/* ============================================================
   IDLE CRUISE - Main Stylesheet
   Pixel art game with modern UI chrome
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --pixel-font: 'Press Start 2P', monospace;
    --ui-font: 'Fredoka', sans-serif;
    --gold: #FFD84A;
    --gold-dark: #C8A830;
    --blue: #4A90D9;
    --blue-dark: #2E5A8A;
    --red: #D94A4A;
    --green: #4AD94A;
    --bg-dark: #1a1a2e;
    --bg-panel: rgba(20, 20, 40, 0.92);
    --bg-button: rgba(255, 255, 255, 0.12);
    --text: #f0f0f0;
    --text-dim: #a0a0b0;
    --bar-height: 52px;
    --bottom-height: 64px;
    --ad-height: 90px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a1a;
    color: var(--text);
    font-family: var(--ui-font);
    image-rendering: pixelated;
    -webkit-user-select: none;
    user-select: none;
}

/* --- Game Canvas --- */
#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    z-index: 1;
}

/* --- Top Bar --- */
#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--bar-height);
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 10;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

#top-left {
    display: flex;
    gap: 16px;
    align-items: center;
}

#coin-display, #distance-display {
    font-family: var(--pixel-font);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
}

#coin-display { color: var(--gold); }
#distance-display { color: var(--text-dim); }

#unit-toggle {
    cursor: pointer;
    border-bottom: 1px dashed rgba(255,255,255,0.3);
    transition: color 0.15s;
}
#unit-toggle:hover { color: var(--gold); }

#top-center {
    text-align: center;
}

#game-title {
    font-family: var(--pixel-font);
    font-size: 14px;
    color: var(--gold);
    letter-spacing: 3px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

#zone-name {
    font-family: var(--pixel-font);
    font-size: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#top-right {
    display: flex;
    gap: 8px;
}

/* --- Buttons --- */
.top-btn, .bottom-btn {
    font-family: var(--pixel-font);
    font-size: 9px;
    background: var(--bg-button);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.top-btn:hover, .bottom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.top-btn:active, .bottom-btn:active {
    transform: translateY(0);
}

/* --- Bottom Panel --- */
#bottom-panel {
    position: fixed;
    bottom: var(--ad-height);
    left: 0;
    right: 0;
    height: var(--bottom-height);
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 10;
    border-top: 2px solid rgba(255, 255, 255, 0.08);
}

#bottom-left {
    display: flex;
    gap: 8px;
}

#bottom-center {
    display: flex;
    align-items: center;
    gap: 12px;
}

#vehicle-preview {
    image-rendering: pixelated;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

#speed-display {
    font-family: var(--pixel-font);
    font-size: 10px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 4px;
}

#bottom-right {
    text-align: right;
}

#quick-stats {
    font-family: var(--pixel-font);
    font-size: 8px;
    color: var(--text-dim);
    line-height: 1.6;
}

/* --- Ad Banner --- */
#ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--ad-height);
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* --- Icons --- */
.icon {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    vertical-align: middle;
}

/* --- Modal Overlay --- */
#modal-container {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
}

#modal-container.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-container .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

#modal-container .modal-content {
    position: relative;
    background: var(--bg-dark);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
}

#modal-container .modal-title {
    font-family: var(--pixel-font);
    font-size: 14px;
    color: var(--gold);
    margin-bottom: 16px;
    text-align: center;
}

#modal-container .modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 20px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
}

/* --- Toast --- */
#toast-container {
    position: fixed;
    top: calc(var(--bar-height) + 8px);
    right: 12px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    font-family: var(--ui-font);
    font-size: 13px;
    background: var(--bg-panel);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text);
    animation: toast-in 0.25s ease-out;
    max-width: 280px;
}

.toast.toast-out {
    animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(40px); }
}

/* --- Responsive --- */
@media (max-width: 719px) {
    :root {
        --bar-height: 44px;
        --bottom-height: 56px;
        --ad-height: 50px;
    }

    #game-title { font-size: 10px; letter-spacing: 1px; }
    #zone-name { font-size: 7px; }
    #coin-display, #distance-display { font-size: 9px; }
    .top-btn, .bottom-btn { font-size: 7px; padding: 6px 8px; }
    #top-left { gap: 10px; }
    #top-right { gap: 4px; }
    #quick-stats { font-size: 7px; }
    #speed-display { font-size: 8px; }

    #modal-container .modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    #game-title { font-size: 8px; }
    #top-right { flex-wrap: wrap; }
}

/* Portrait phone */
@media (max-width: 480px) and (orientation: portrait) {
    :root {
        --ad-height: 50px;
    }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --bar-height: 36px;
        --bottom-height: 44px;
        --ad-height: 50px;
    }
    #game-title { font-size: 9px; }
    .top-btn, .bottom-btn { padding: 4px 8px; }
}
