/**
 * ============================================================================
 *  STYLE.CSS — Retro Arcade Terminal Stylesheet
 * ============================================================================
 *
 *  CRT-styled visual theme for the Retro Arcade Terminal.
 *
 *  Architecture:
 *    • Design tokens via CSS custom properties (:root)
 *    • Single retro font: "Press Start 2P" (Google Fonts)
 *    • CRT scanline overlay via body::after pseudo-element
 *    • Screen system: .screen elements toggled with .active class
 *    • All game content rendered into <pre> elements (.game-arena)
 *
 *  Sections:
 *    1. Design Tokens     — Colors, typography, spacing, effects
 *    2. Reset             — Box model normalization
 *    3. Base              — Body layout (dark background, centered flex)
 *    4. CRT Scanline      — Fixed overlay simulating CRT monitor lines
 *    5. Screens           — Screen container layout and visibility
 *    6. Boot Screen       — IBM POST and splash screen styles
 *    7. Global ESC Hint   — Fixed bottom navigation hint
 *    8. Blink Animation   — Cursor blink keyframes
 *    9. Green Highlight   — Accent color for interactive elements
 *   10. ASCII Panels      — Menu and scoreboard pre-formatted text
 *   11. Game Screens      — Game container padding
 *   12. Game Arenas       — Pre-formatted game rendering area
 *   13. Responsive        — Phone, landscape, very small breakpoints
 *   14. Accessibility     — Reduced motion preferences
 *
 *  Color palette:
 *    Background:  #09090b (near-black)
 *    Text:        #e0e0e0 (light gray)
 *    Bright:      #ffffff (pure white for emphasis)
 *    Accent:      #33ff33 / #00ff00 (terminal green)
 *    Border:      #444444 (subtle gray)
 * ============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');


/* ═══════════════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS — Colors, typography, spacing, effects
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Palette */
    --bg:            #09090b;
    --bg-arena:      #09090b;
    --text:          #e0e0e0;
    --text-bright:   #ffffff;
    --text-dim:      #888888;
    --text-muted:    #777777;
    --border:        #444444;
    --border-dim:    #333333;
    --accent:        #33ff33;

    /* Typography — use min(vw, vh) so grids fit both axes */
    --font:          'Press Start 2P', monospace;
    --fs-arena:      clamp(0.3rem, min(1.35vw, 2.1vh), 0.75rem);
    --fs-panel:      clamp(0.32rem, min(1.4vw, 2.2vh), 0.65rem);
    --fs-boot:       clamp(0.38rem, min(1.2vw, 1.9vh), 0.65rem);
    --fs-prompt:     clamp(0.5rem, min(1.5vw, 2.4vh), 0.75rem);
    --fs-hint:       clamp(0.3rem, min(0.8vw, 1.3vh), 0.45rem);

    /* Spacing (4px base grid) */
    --sp-1:  4px;
    --sp-2:  8px;
    --sp-3:  12px;
    --sp-4:  16px;
    --sp-5:  20px;
    --sp-6:  24px;
    --sp-8:  32px;
    --sp-10: 40px;

    /* Text glow effects */
    --glow:        0 0 4px rgba(224, 224, 224, 0.3);
    --glow-soft:   0 0 3px rgba(224, 224, 224, 0.2);
    --glow-bright: 0 0 8px rgba(255, 255, 255, 0.4);
    --scanline:    rgba(0, 0, 0, 0.15);

    /* Touch target minimum */
    --touch-min:   44px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   2. RESET — Box model normalization
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* Inherit font on replaced elements so tokens cascade */
pre, button, input { font-family: inherit; }


/* ═══════════════════════════════════════════════════════════════════════════
   3. BASE — Body layout (dark background, centered flex column)
   ═══════════════════════════════════════════════════════════════════════════ */

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}


/* ═══════════════════════════════════════════════════════════════════════════
   4. CRT SCANLINE OVERLAY — Simulates horizontal CRT monitor lines
   ═══════════════════════════════════════════════════════════════════════════ */

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 1px,
        var(--scanline) 1px,
        var(--scanline) 2px
    );
    z-index: 9999;
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. SCREENS — Container layout and visibility toggling
   ═══════════════════════════════════════════════════════════════════════════ */

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--sp-5);
}

.screen.active { display: flex; }
.hidden { display: none !important; }


/* ═══════════════════════════════════════════════════════════════════════════
   6. BOOT SCREEN — IBM POST phase, splash phase, name entry
   ═══════════════════════════════════════════════════════════════════════════ */

#screen-boot {
    justify-content: center;
    padding: var(--sp-10) var(--sp-5);
}

/* Boot output text (POST messages, splash text) */
#boot-output {
    font-size: var(--fs-boot);
    color: var(--text);
    line-height: 1.6;
    max-width: 90vw;
    white-space: pre;
    text-shadow: var(--glow);
    text-align: left;
    user-select: none;
    -webkit-user-select: none;
}

/* "PRESS ENTER TO START" prompt */
#boot-prompt {
    font-size: var(--fs-boot);
    color: var(--text-bright);
    margin-top: var(--sp-4);
    text-align: center;
    text-shadow: var(--glow-bright);
}

/* ── IBM POST phase ─────────────────────────────────────────────────────── */
#screen-boot.ibm-phase {
    background: var(--bg);
    padding-bottom: 6vh;
}

#screen-boot.ibm-phase #boot-output {
    color: var(--text);
    text-align: center;
    margin-top: clamp(4px, 1vh, 10px);
    line-height: 1.8;
    text-shadow: var(--glow-soft);
}

#screen-boot.ibm-phase #boot-prompt {
    margin-top: clamp(40px, 8vh, 80px);
}

/* IBM logo image */
#ibm-logo-img {
    max-width: 82vw;
    max-height: 44vh;
    image-rendering: pixelated;
    user-select: none;
    -webkit-user-select: none;
}

/* IBM text hierarchy classes */
.ibm-title {
    color: var(--text-bright);
    text-shadow: var(--glow-bright);
}

.ibm-dim {
    color: var(--text);
}

/* ── Splash screen phase ────────────────────────────────────────────────── */
#screen-boot.splash-phase {
    background: var(--bg);
    justify-content: center;
    gap: 0;
    padding-bottom: 6vh;
}

/* Splash ASCII art image */
#splash-img {
    max-width: 66vw;
    max-height: 36vh;
    image-rendering: pixelated;
    user-select: none;
    -webkit-user-select: none;
}

#screen-boot.splash-phase #boot-output {
    color: var(--text);
    text-align: center;
    margin-top: clamp(28px, 5vh, 48px);
    line-height: 1.6;
    text-shadow: var(--glow-soft);
}

/* Splash decorative horizontal rules */
.splash-rule {
    color: var(--text);
}

/* Splash hero title line */
.splash-title {
    color: var(--text-bright);
    text-shadow: var(--glow-bright);
    letter-spacing: 0.02em;
}

/* Splash version/copyright footer */
.splash-footer {
    color: var(--text);
}

/* "Press ENTER" prompt spacing */
#screen-boot.splash-phase #boot-prompt {
    margin-top: clamp(40px, 8vh, 80px);
}




/* ═══════════════════════════════════════════════════════════════════════════
   8. BLINK ANIMATION — Cursor blink for prompts
   ═══════════════════════════════════════════════════════════════════════════ */

.blink { animation: blink-anim 1s step-end infinite; }

@keyframes blink-anim {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   9. GREEN HIGHLIGHT — Terminal green accent for interactive elements
   ═══════════════════════════════════════════════════════════════════════════ */

.green {
    color: #00ff00;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
}


/* ═══════════════════════════════════════════════════════════════════════════
   10. ASCII PANELS — Pre-formatted text blocks (menu, scoreboard)
   ═══════════════════════════════════════════════════════════════════════════ */

.ascii-panel {
    font-size: var(--fs-panel);
    line-height: 1.6;
    color: var(--text);
    white-space: pre;
    text-shadow: var(--glow-soft);
    max-width: 98vw;
    user-select: none;
    -webkit-user-select: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   11. GAME SCREENS — Container padding for game views
   ═══════════════════════════════════════════════════════════════════════════ */

.game-screen {
    padding-bottom: var(--sp-3);
}


/* ═══════════════════════════════════════════════════════════════════════════
   12. GAME ARENAS — Pre-formatted game rendering area
   ═══════════════════════════════════════════════════════════════════════════ */

.game-arena {
    font-size: var(--fs-arena);
    line-height: 1.35;
    color: var(--text);
    background: var(--bg-arena);
    border: none;
    padding: var(--sp-3);
    white-space: pre;
    overflow-x: auto;
    text-shadow: var(--glow);
    max-width: 98vw;
    user-select: none;
    -webkit-user-select: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   13. RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Phones (width ≤ 540px) ─────────────────────────────────────────────── */
@media (max-width: 540px) {
    .screen { padding: var(--sp-3) var(--sp-2); }

    .game-screen {
        padding-bottom: var(--sp-2);
    }

    .game-arena {
        padding: var(--sp-2) var(--sp-1);
        background: transparent;
    }
}

/* ── Landscape (height ≤ 500px) ─────────────────────────────────────────── */
@media (max-height: 500px) {
    .game-arena {
        font-size: clamp(0.22rem, 2.2vh, 0.55rem);
        padding: var(--sp-1) var(--sp-2);
        line-height: 1.3;
    }

    .game-screen {
        padding-bottom: var(--sp-1);
    }
}

/* ── Very small screens (width ≤ 360px) ─────────────────────────────────── */
@media (max-width: 360px) {
    .game-arena { padding: var(--sp-1); }
}


/* ═══════════════════════════════════════════════════════════════════════════
   14. MOBILE WALL — "Smartphones didn't exist in 1981" overlay
   ═══════════════════════════════════════════════════════════════════════════ */

.mobile-wall {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.mobile-wall-box {
    text-align: center;
    max-width: 340px;
}

.mobile-wall-art {
    font-family: var(--font);
    font-size: clamp(0.38rem, 2.8vw, 0.65rem);
    color: var(--text-bright);
    text-shadow: var(--glow-bright);
    line-height: 1.6;
    white-space: pre;
    margin-bottom: 32px;
}

.mobile-wall-text {
    font-family: var(--font);
    font-size: clamp(0.4rem, 2.5vw, 0.6rem);
    color: var(--text);
    text-shadow: var(--glow-soft);
    line-height: 2;
    margin-bottom: 24px;
}

.mobile-wall-sub {
    font-family: var(--font);
    font-size: clamp(0.35rem, 2vw, 0.5rem);
    color: var(--text-dim);
    line-height: 1.8;
}


/* ═══════════════════════════════════════════════════════════════════════════
   15. ACCESSIBILITY — Reduced motion preferences
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .blink { animation: none; opacity: 1; }
    body::after { display: none; }
    * { transition-duration: 0.01ms !important; }
}
