/* ═══════════════════════════════════════════════════════
   APHELION — Terminal Amber/Green UI Theme
   ═══════════════════════════════════════════════════════ */

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

:root {
    /* ── Amber/Green terminal palette ── */
    --amber: #ffb300;
    --amber-glow: #ffd54f;
    --amber-dim: rgba(255, 179, 0, 0.18);
    --green: #00e676;
    --green-dim: rgba(0, 230, 118, 0.18);
    --red-warn: #ff4444;
    --bg-dark: #050400;
    --text: #ffd54f;
    --text-muted: #7a6a30;
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-hud: 'Orbitron', 'Share Tech Mono', monospace;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: var(--font-mono);
    color: var(--text);
}

/* ── Canvas ── */
#game-canvas {
    position: fixed;
    inset: 0;
    display: block;
}

/* ═══════════════════════════════════════
   NASA MISSION BRIEFING (click-to-start)
   ═══════════════════════════════════════ */
#nasa-intro {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.7s ease;
}

#nasa-intro.hidden {
    opacity: 0;
    pointer-events: none;
}

#nasa-intro-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    max-width: 660px;
    padding: 48px 28px;
    text-align: center;
    font-family: var(--font-mono);
}

#nasa-logo-line {
    font-size: 12px;
    letter-spacing: 0.42em;
    color: var(--amber);
    text-shadow: 0 0 14px var(--amber), 0 0 32px rgba(255, 179, 0, 0.35);
    text-transform: uppercase;
    animation: nasa-blink 2.4s step-end infinite;
}

@keyframes nasa-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

#nasa-briefing-text {
    font-size: clamp(14px, 2.2vw, 19px);
    line-height: 2;
    color: var(--amber-glow);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(255, 213, 79, 0.45);
    animation: text-glow 5s ease-in-out infinite;
}

@keyframes text-glow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(255, 213, 79, 0.4);
    }

    50% {
        text-shadow: 0 0 22px rgba(255, 213, 79, 0.85), 0 0 50px rgba(255, 179, 0, 0.3);
    }
}

#nasa-click-prompt {
    font-size: 12px;
    letter-spacing: 0.38em;
    color: var(--amber);
    text-transform: uppercase;
    animation: prompt-blink 1s step-end infinite;
    border: 1px solid rgba(255, 179, 0, 0.35);
    padding: 10px 28px;
    margin-top: 8px;
}

@keyframes prompt-blink {

    0%,
    100% {
        opacity: 1;
        border-color: rgba(255, 179, 0, 0.35);
    }

    50% {
        opacity: 0;
        border-color: transparent;
    }
}

/* ═══════════════════════════════════════
   MAIN HUD
   ═══════════════════════════════════════ */
#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

/* Title — top center */
#hud-title {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-hud);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.45em;
    text-transform: uppercase;
}

.title-glow {
    color: var(--amber-glow);
    text-shadow: 0 0 12px var(--amber), 0 0 30px rgba(255, 179, 0, 0.5);
}

/* Velocity — bottom-left */
#speed-meter {
    position: absolute;
    bottom: 36px;
    left: 36px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meter-label {
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: var(--font-mono);
}

#speed-bar-track {
    width: 140px;
    height: 3px;
    background: rgba(255, 179, 0, 0.12);
    border-radius: 2px;
    overflow: hidden;
}

#speed-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--amber), #ffee58);
    border-radius: 2px;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px var(--amber);
}

#speed-value {
    font-size: 11px;
    color: var(--amber-glow);
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

/* Coordinates — bottom-right */
#coords {
    position: absolute;
    bottom: 36px;
    right: 36px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
}

/* Beacon counter — bottom-center */
#beacon-display {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#beacon-value {
    font-family: var(--font-hud);
    font-size: 30px;
    font-weight: 700;
    color: var(--green);
    text-shadow: 0 0 12px var(--green), 0 0 32px rgba(0, 230, 118, 0.45);
    letter-spacing: 0.08em;
    font-variant-numeric: tabular-nums;
    animation: beacon-pulse 2s ease-in-out infinite;
}

@keyframes beacon-pulse {

    0%,
    100% {
        text-shadow: 0 0 12px var(--green), 0 0 32px rgba(0, 230, 118, 0.45);
    }

    50% {
        text-shadow: 0 0 24px var(--green), 0 0 60px rgba(0, 230, 118, 0.8), 0 0 100px rgba(0, 200, 80, 0.3);
    }
}

/* ═══════════════════════════════════════
   RADIATION METER
   ═══════════════════════════════════════ */
#radiation-meter {
    position: absolute;
    bottom: 80px;
    left: 36px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#radiation-bar-track {
    width: 140px;
    height: 6px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(0, 255, 136, 0.2);
}

#radiation-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff88, #ffff00, #ff3300);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.5s ease;
    box-shadow: 0 0 8px #00ff88;
}

#radiation-value {
    font-size: 11px;
    color: #00ff88;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

/* ═══════════════════════════════════════
   INVENTORY HUD (beacons collected)
   ═══════════════════════════════════════ */
#inventory-hud {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 31;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #00ff88;
    text-shadow: 0 0 8px #00ff88;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 255, 136, 0.22);
    padding: 5px 18px;
    border-radius: 3px;
    pointer-events: none;
    display: none;
    white-space: nowrap;
}

#inventory-hud.visible {
    display: block;
}

#inv-collected {
    color: #ffb300;
    text-shadow: 0 0 10px #ffb300;
    font-weight: bold;
}

/* Radiation damage full-screen overlay */
#radiation-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 88;
    background: radial-gradient(ellipse at center, rgba(0, 255, 100, 0.0), transparent);
    transition: background 0.2s;
}

#radiation-flash.rad-pulse {
    animation: rad-flare 0.6s ease forwards;
}

@keyframes rad-flare {
    0% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 100, 0.28) 0%, transparent 70%);
    }

    100% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 100, 0.0) 0%, transparent 70%);
    }
}

/* Power-up collected notification */
#powerup-notify {
    position: fixed;
    top: 26%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 65;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #ffb300;
    text-shadow: 0 0 18px #ffb300;
    opacity: 0;
    display: none;
}

#powerup-notify.pop {
    display: block;
    animation: powerup-pop 2s ease forwards;
}

@keyframes powerup-pop {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(6px);
    }

    15% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    75% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ═══════════════════════════════════════
   OBJECTIVE HUD
   ═══════════════════════════════════════ */
#objective-hud {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--green);
    text-shadow: 0 0 8px var(--green), 0 0 20px rgba(0, 230, 118, 0.35);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 230, 118, 0.22);
    padding: 6px 20px;
    border-radius: 3px;
    pointer-events: none;
    display: none;
    white-space: nowrap;
}

#objective-hud.visible {
    display: block;
    animation: obj-in 1s ease forwards;
}

@keyframes obj-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ═══════════════════════════════════════
   HULL INTEGRITY (hearts)
   ═══════════════════════════════════════ */
#health-bar {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#hearts-row {
    display: flex;
    gap: 4px;
}

.heart {
    font-size: 18px;
    color: var(--amber);
    text-shadow: 0 0 8px var(--amber), 0 0 18px rgba(255, 179, 0, 0.4);
    transition: color 0.2s, text-shadow 0.2s;
}

.heart.lost {
    color: rgba(100, 60, 0, 0.35);
    text-shadow: none;
}

@keyframes heart-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }
}

.heart.damage-pulse {
    animation: heart-pulse 0.25s ease;
}

/* ═══════════════════════════════════════
   DAMAGE FLASH
   ═══════════════════════════════════════ */
#damage-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 90;
}

#damage-flash.flash {
    animation: dmg-flash 0.4s ease forwards;
}

#damage-flash.boss-flash {
    animation: boss-flash 0.6s ease forwards;
}

@keyframes dmg-flash {
    0% {
        background: rgba(255, 100, 0, 0.35);
    }

    100% {
        background: transparent;
    }
}

@keyframes boss-flash {
    0% {
        background: rgba(255, 0, 0, 0.55);
    }

    100% {
        background: transparent;
    }
}

/* ═══════════════════════════════════════
   HULL BREACH DEATH SCREEN
   ═══════════════════════════════════════ */
#hull-breach {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#hull-breach.active {
    opacity: 1;
}

#hull-breach-inner {
    text-align: center;
}

#hull-breach-title {
    font-family: var(--font-hud);
    font-size: clamp(40px, 7vw, 80px);
    font-weight: 700;
    color: var(--red-warn);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    text-shadow: 0 0 30px var(--red-warn), 0 0 80px rgba(255, 60, 60, 0.5);
    animation: breach-flicker 0.15s step-end infinite;
}

#hull-breach-sub {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.4em;
    color: rgba(255, 100, 50, 0.7);
    margin-top: 16px;
    text-transform: uppercase;
}

@keyframes breach-flicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ═══════════════════════════════════════
   WARNINGS & ALERTS
   ═══════════════════════════════════════ */
/* Anomaly detected (waking) */
#waking-alert {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
    display: none;
    text-align: center;
}

#waking-alert.visible {
    display: block;
    animation: alert-pulse 1.4s ease-in-out infinite;
}

#waking-alert-text {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--amber);
    text-shadow: 0 0 14px var(--amber), 0 0 36px rgba(255, 179, 0, 0.5);
}

@keyframes alert-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Solar proximity */
#sanctuary-overlay {
    position: fixed;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
    display: none;
    text-align: center;
}

#sanctuary-overlay.visible {
    display: block;
    animation: alert-pulse 2s ease-in-out infinite;
}

#sanctuary-text {
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #ffdd44;
    text-shadow: 0 0 16px #ffaa00, 0 0 40px rgba(255, 170, 0, 0.45);
}

/* Sector warning flash */
#sector-warning-flash {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    text-align: center;
}

#sector-warning-flash.active {
    animation: sector-warn 3.5s ease forwards;
}

#sector-warning-text {
    font-family: var(--font-hud);
    font-size: clamp(14px, 2.8vw, 24px);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--amber);
    text-shadow: 0 0 20px var(--amber), 0 0 60px rgba(255, 179, 0, 0.4);
}

@keyframes sector-warn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.02);
    }

    75% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
    }
}

/* ═══════════════════════════════════════
   BOOST ACTIVE
   ═══════════════════════════════════════ */
#boost-active {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--green);
    text-shadow: 0 0 16px var(--green);
    text-transform: uppercase;
    opacity: 0;
    display: none;
}

#boost-active.visible {
    display: block;
    opacity: 1;
    animation: boost-flash 0.8s ease-in-out infinite alternate;
}

@keyframes boost-flash {
    from {
        text-shadow: 0 0 12px var(--green), 0 0 30px rgba(0, 230, 118, 0.4);
    }

    to {
        text-shadow: 0 0 24px var(--green), 0 0 70px rgba(0, 230, 118, 0.8);
    }
}

/* ═══════════════════════════════════════
   PORTAL FLASH
   ═══════════════════════════════════════ */
#portal-flash {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at center, rgba(0, 255, 200, 0.7), transparent 70%);
}

#portal-flash.active {
    animation: portal-warp 1.2s ease forwards;
}

@keyframes portal-warp {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ═══════════════════════════════════════
   QUARANTINE WIN OVERLAY
   ═══════════════════════════════════════ */
#quarantine-win {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, rgba(0, 20, 60, 0.93) 0%, rgba(0, 0, 10, 0.98) 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#qwin-title {
    font-family: var(--font-hud);
    font-size: clamp(24px, 4vw, 48px);
    color: var(--green);
    letter-spacing: 0.2em;
    text-shadow: 0 0 40px var(--green), 0 0 90px rgba(0, 230, 118, 0.4);
    margin-bottom: 1rem;
}

#qwin-sub {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: rgba(0, 230, 118, 0.75);
    letter-spacing: 0.14em;
}

#qwin-hint {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: rgba(0, 180, 80, 0.5);
    margin-top: 1rem;
    letter-spacing: 0.1em;
}

/* ═══════════════════════════════════════
   RADAR
   ═══════════════════════════════════════ */
#radar-canvas {
    position: fixed;
    bottom: 36px;
    right: 130px;
    width: 120px;
    height: 120px;
    z-index: 20;
    border-radius: 50%;
    border: 1px solid rgba(255, 179, 0, 0.2);
    opacity: 0.85;
}

/* ═══════════════════════════════════════
   CONTROLS HINT
   ═══════════════════════════════════════ */
#controls-hint {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
}

.hint-row {
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--amber);
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.3);
    border-radius: 3px;
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════
   ENCOUNTER MESSAGE (center screen horror)
   ═══════════════════════════════════════ */
#encounter-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 75;
    pointer-events: none;
    text-align: center;
    display: none;
}

#encounter-message.visible {
    display: block;
    animation: encounter-appear 6s ease forwards;
}

#encounter-text {
    font-family: var(--font-hud);
    font-size: clamp(14px, 2.5vw, 22px);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #ff2244;
    text-shadow: 0 0 20px #ff2244, 0 0 60px rgba(255, 20, 60, 0.6);
}

@keyframes encounter-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }

    12% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.04);
    }

    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
    }
}

/* Old beacon display — hidden */
#beacon-display {
    display: none !important;
}

/* ═══════════════════════════════════════
   FRAG COLLECT (kept as no-op, hidden)
   ═══════════════════════════════════════ */
#frag-collect {
    display: none !important;
}

/* ═══════════════════════════════════════
   STUB HIDDEN ELEMENTS
   ═══════════════════════════════════════ */
#portal-warning,
#aggro-warning,
#intro-overlay,
#player-name,
#vibe-level-value,
#score-value,
#username-input,
#returning-info,
#start-btn {
    display: none !important;
}