/* ============================================================
   style.css - Inflation Race pixel art game styles
   ============================================================ */

/* Font loaded via <link> in index.html for non-blocking render */

:root {
    --bg-dark: #000000;
    --text-primary: #FFF1E8;
    --text-glow: #FFEC27;
    --accent: #FF004D;
    --surface: #1D2B53;
    --accent-shadow: #7E2553;
    --text-warm: #FFA300;
    --text-link: #29ADFF;
    --text-muted: #C2C3C7;
    --text-dim: #5F574F;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    font-family: 'Press Start 2P', monospace;
}

#game-container {
    position: relative;
    width: 1536px;
    height: 864px;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 16 / 9;
}

#game-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

/* HUD overlay - positioned on top of canvas */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

/* Menu screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10;
    color: var(--text-primary);
}

.screen.hidden {
    display: none;
}

#title-screen h1 {
    font-size: 28px;
    color: var(--accent);
    text-shadow: 3px 3px 0 var(--accent-shadow);
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.4;
}

#title-screen .subtitle {
    font-size: 10px;
    color: var(--text-warm);
    margin-bottom: 40px;
}

.menu-item {
    font-size: 12px;
    color: var(--text-primary);
    margin: 8px 0;
    cursor: pointer;
    pointer-events: all;
    padding: 4px 12px;
    transition: color 0.1s;
}

.menu-item:hover, .menu-item.selected {
    color: var(--text-glow);
}

.start-prompt {
    font-size: 10px;
    color: var(--text-link);
    margin-top: 40px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Game over screen */
#gameover-screen {
    background: rgba(0, 0, 0, 0.9);
}

#gameover-screen h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.grade-display {
    font-size: 48px;
    margin: 10px 0;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.5);
}

.score-breakdown {
    font-size: 8px;
    line-height: 2;
    text-align: left;
    margin: 16px 0;
    color: var(--text-muted);
}

.score-breakdown .value {
    color: var(--text-primary);
}

.final-score {
    font-size: 16px;
    color: var(--text-glow);
    margin: 12px 0;
}

/* Pause overlay */
#pause-screen {
    background: rgba(0, 0, 0, 0.7);
}

#pause-screen h2 {
    font-size: 20px;
    animation: blink 1s step-end infinite;
}

/* Controls help */
.controls-help {
    font-size: 7px;
    color: var(--text-dim);
    margin-top: 24px;
    line-height: 2.2;
    text-align: center;
}

.controls-help span {
    color: var(--text-muted);
}

/* High scores */
.high-scores {
    font-size: 8px;
    margin-top: 20px;
    color: var(--text-muted);
}

.high-scores h3 {
    font-size: 10px;
    color: var(--text-warm);
    margin-bottom: 8px;
}

.high-scores li {
    list-style: none;
    margin: 4px 0;
}

/* Era Selection Cards */
.era-cards {
    display: flex;
    gap: 16px;
    margin: 20px 0 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.era-card {
    width: 200px;
    padding: 16px 12px;
    border: 2px solid var(--text-dim);
    background: rgba(29, 43, 83, 0.6);
    cursor: pointer;
    pointer-events: all;
    text-align: center;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.era-card:hover,
.era-card:focus-visible {
    border-color: var(--text-glow);
    background: rgba(29, 43, 83, 0.9);
    transform: scale(1.04);
    outline: none;
}

.era-card:focus-visible {
    box-shadow: 0 0 0 2px var(--text-glow);
}

.era-card[data-era="great_depression"] { border-color: #D4A55C; }
.era-card[data-era="great_depression"]:hover { background: rgba(43, 27, 14, 0.85); border-color: #E8D5B7; }

.era-card[data-era="stagflation"] { border-color: #DAA520; }
.era-card[data-era="stagflation"]:hover { background: rgba(61, 43, 31, 0.85); border-color: #FF8C00; }

.era-card[data-era="helicopter_money"] { border-color: #00E436; }
.era-card[data-era="helicopter_money"]:hover { background: rgba(13, 17, 23, 0.85); border-color: #58A6FF; }

.era-year {
    font-size: 7px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.era-name {
    font-size: 10px;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.era-hook {
    font-size: 7px;
    color: var(--text-warm);
    margin-bottom: 8px;
    line-height: 1.6;
}

.era-stats {
    font-size: 6px;
    color: var(--text-dim);
}

.era-random-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--text-link);
    cursor: pointer;
    pointer-events: all;
    min-height: 44px;
    padding: 14px 24px;
    border: 1px solid var(--text-link);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.era-random-btn:hover,
.era-random-btn:focus-visible {
    background: var(--text-link);
    color: var(--bg-dark);
    outline: none;
}

.era-random-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--text-glow);
}

/* Game Over - Era info */
.gameover-era-name {
    font-size: 8px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.purchasing-power {
    font-size: 8px;
    color: var(--text-warm);
    margin: 6px 0 4px;
}

.gameover-era-stats {
    font-size: 7px;
    color: var(--text-dim);
    margin: 8px 0;
    line-height: 2;
}

.gameover-buttons {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    justify-content: center;
}

.gameover-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: var(--text-link);
    cursor: pointer;
    pointer-events: all;
    min-height: 44px;
    padding: 14px 20px;
    border: 1px solid var(--text-link);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s, color 0.15s;
}

.gameover-btn:hover,
.gameover-btn:focus-visible {
    background: var(--text-link);
    color: var(--bg-dark);
    outline: none;
}

.gameover-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--text-glow);
}

/* Era Event Banner */
.era-event-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.era-event-banner.visible {
    opacity: 1;
}

.era-event-banner .event-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.8);
    margin-bottom: 4px;
}

.era-event-banner .event-flavor {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--text-muted);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
}

/* Responsive scaling */
@media (max-width: 1536px) {
    #game-container {
        width: 100vw;
        height: calc(100vw * 9 / 16);
    }
}

@media (max-height: 864px) {
    #game-container {
        height: 100vh;
        width: calc(100vh * 16 / 9);
    }
}

/* Mobile: stack era cards vertically, scale text */
@media (max-width: 680px) {
    .era-cards {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 12px 0 10px;
    }

    .era-card {
        width: 90%;
        max-width: 280px;
        padding: 12px 10px;
    }

    #title-screen h1 {
        font-size: 18px;
    }

    #title-screen .subtitle {
        font-size: 8px;
        margin-bottom: 16px;
    }

    .controls-help {
        font-size: 6px;
        margin-top: 12px;
    }

    .gameover-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .gameover-btn {
        width: 80%;
        max-width: 260px;
        justify-content: center;
    }
}
