/* Self-hosted Anton (latin subset) — no external Google Fonts dependency.
   Works offline / in the packaged native app and avoids remote-resource fragility. */
@font-face {
    font-family: 'Anton';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('assets/fonts/anton-v27.woff2') format('woff2');
}

:root { --main-color: #0f0; --dim-color: rgba(0, 50, 0, 0.3); --bg-color: #000; --danger-color: #f00; }

body { background-color: var(--bg-color); color: var(--main-color); font-family: 'Courier New', Courier, monospace; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100dvh; margin: 0; overflow: hidden; user-select: none; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
* { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); box-sizing: border-box; background: #000; }
#screen-shooter, #screen-escape, #screen-intro { padding: 0; }
.screen.active { display: flex; }

/* INTRO SCREEN */
#screen-intro { background: #000; z-index: 2000; }
#intro-player { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); }
#intro-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #000; z-index: 2010; cursor: pointer; }
.blink-text { color: #0f8; font-size: 1.8rem; animation: blink 1s infinite; text-shadow: 0 0 10px rgba(0,255,120,0.5); font-family: 'Courier New', monospace; letter-spacing: 3px; }
#skip-intro-btn { position: absolute; bottom: 30px; right: 30px; z-index: 2020; background: rgba(5,12,8,0.8); border: 1px solid rgba(0,255,120,0.3); color: rgba(0,255,120,0.7); padding: 8px 18px; cursor: pointer; display: none; font-family: 'Courier New', monospace; font-weight: bold; letter-spacing: 1px; }
/* BITTEN OVERLAY */
#bitten-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 3000; display: none; align-items: center; justify-content: center; flex-direction: column; }
#bitten-overlay h1 { color: #f44; font-size: 2.5rem; text-shadow: 0 0 15px rgba(255,0,0,0.5); animation: blink 0.1s infinite; margin: 0; text-transform: uppercase; border: 1px solid rgba(255,60,60,0.5); padding: 20px 30px; transform: none; background: rgba(40,0,0,0.8); text-align: center; max-width: 90%; font-family: 'Courier New', monospace; letter-spacing: 3px; }

/* WARNING SCREEN */
#screen-warning { background-color: #000; background-image: url('assets/warning_icon.webp'); background-size: cover; background-position: center; z-index: 3000; }
#screen-warning .warning-content { max-width: 600px; text-align: center; padding: 20px; }
#screen-warning h1 { color: #f44; font-family: 'Courier New', monospace; text-transform: uppercase; margin-bottom: 20px; font-size: 2.2rem; letter-spacing: 4px; text-shadow: 0 0 15px rgba(255,0,0,0.4), 2px 2px 0 #000; }
#screen-warning p { color: rgba(0,255,120,0.7); font-family: 'Courier New', monospace; font-size: 1.1rem; line-height: 1.6; margin-bottom: 40px; text-shadow: 0 0 5px rgba(0,0,0,0.8); font-weight: bold; }

/* ALARM OVERLAY (EMERGENCY MODE) */
#alarm-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1; /* Debajo de .game-ui (z-index: 2) */
    opacity: 0; transition: opacity 0.5s;
    background-image: radial-gradient(circle, transparent 40%, rgba(100, 0, 0, 0.9)); /* Viñeta fija */
    background-color: rgba(255, 0, 0, 0);
}
#alarm-overlay.alarm-active { opacity: 1; animation: alarm-pulse 0.8s infinite alternate; }
@keyframes alarm-pulse { from { background-color: rgba(255, 0, 0, 0.1); } to { background-color: rgba(255, 0, 0, 0.4); } }

/* ====== MENÚ PRINCIPAL - TERMINAL RETRO-FUTURISTA ====== */
#screen-menu {
    position: relative;
    background: #000;
    padding-top: calc(95px + env(safe-area-inset-top, 0px));
    justify-content: flex-start;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}
#screen-menu::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('assets/INTRO.webp');
    background-size: cover;
    background-position: center top;
    filter: blur(4px) brightness(0.35);
    z-index: 0;
}
#screen-menu::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,20,10,0.4) 0%, rgba(0,0,0,0.6) 50%, rgba(0,10,5,0.5) 100%);
    z-index: 0;
    pointer-events: none;
}

/* SCANLINES OVERLAY */
.menu-scanlines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    z-index: 1;
    pointer-events: none;
}

/* PANEL PRINCIPAL */
.menu-panel {
    position: relative;
    background: rgba(5, 12, 8, 0.92);
    border: 1px solid rgba(0, 255, 120, 0.25);
    padding: 30px 25px 25px;
    width: 90%; max-width: 360px; text-align: center;
    touch-action: pan-y;
    box-shadow:
        0 0 15px rgba(0, 255, 100, 0.08),
        0 0 60px rgba(0, 0, 0, 0.8),
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(0, 255, 120, 0.1);
    z-index: 2;
    animation: menu-panel-glow 4s ease-in-out infinite alternate;
}
@keyframes menu-panel-glow {
    0% { border-color: rgba(0, 255, 120, 0.2); box-shadow: 0 0 15px rgba(0, 255, 100, 0.06), 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.6); }
    100% { border-color: rgba(0, 255, 120, 0.35); box-shadow: 0 0 20px rgba(0, 255, 100, 0.12), 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.6); }
}

/* GAME MODAL (replaces native alert/confirm) */
#game-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 9999; display: none; align-items: center; justify-content: center; }
#game-modal { background: rgba(5, 12, 8, 0.95); border: 1px solid rgba(0, 255, 120, 0.3); padding: 25px 20px 20px; width: 85%; max-width: 340px; text-align: center; box-shadow: 0 0 20px rgba(0,255,100,0.1), 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.6); font-family: 'Courier New', monospace; }
#game-modal-msg { color: #0f8; font-size: 0.9rem; line-height: 1.5; white-space: pre-line; margin-bottom: 20px; }
#game-modal-btns { display: flex; gap: 10px; justify-content: center; }
#game-modal-btns .opt-btn { min-width: 90px; font-size: 0.85rem; padding: 8px 16px; }
#game-modal-cancel { border-color: #f44 !important; color: #f44 !important; }

/* ESQUINAS DECORATIVAS */
.menu-corner {
    position: absolute;
    width: 14px; height: 14px;
    border-color: rgba(0, 255, 120, 0.5);
    border-style: solid;
    border-width: 0;
    pointer-events: none;
}
.menu-corner.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.menu-corner.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.menu-corner.bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.menu-corner.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

/* BARRA DE ESTADO */
.menu-status-bar {
    position: absolute;
    top: 8px; left: 12px; right: 12px;
    font-size: 0.6rem;
    color: rgba(0, 255, 120, 0.45);
    text-align: left;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}
.status-dot {
    display: inline-block;
    width: 5px; height: 5px;
    background: #0f8;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    animation: status-blink 2s ease-in-out infinite;
    box-shadow: 0 0 4px #0f8;
}
@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.status-sep { color: rgba(0, 255, 120, 0.2); margin: 0 3px; }

/* TÍTULO */
.title {
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
    color: #0f8;
    background: none;
    padding: 12px 10px;
    border: none;
    border-top: 1px solid rgba(0, 255, 120, 0.2);
    border-bottom: 1px solid rgba(0, 255, 120, 0.2);
    text-shadow: 0 0 10px rgba(0, 255, 120, 0.6), 0 0 30px rgba(0, 255, 100, 0.2);
    margin-bottom: 5px;
    margin-top: 10px;
    box-shadow: none;
    font-size: 1.7rem;
    letter-spacing: 4px;
    animation: titleRGBGlitch 10s ease-in-out infinite;
    position: relative;
}

/* SUBTÍTULO */
#menu-subtitle {
    color: rgba(0, 255, 120, 0.35);
    font-size: 0.7rem;
    letter-spacing: 3px;
}

/* MONEDA GLOBAL */
#global-currency {
    position: absolute;
    top: calc(18px + env(safe-area-inset-top, 0px)); left: 18px;
    color: #0f8;
    font-weight: bold; font-size: 0.95rem;
    text-shadow: 0 0 8px rgba(0,255,120,0.4);
    z-index: 50;
    background: rgba(0, 15, 8, 0.7);
    border: 1px solid rgba(0, 255, 120, 0.2);
    padding: 5px 10px;
    letter-spacing: 1px;
}
.currency-icon {
    color: #fa0;
    text-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
}

/* BOTONES DEL MENÚ PRINCIPAL */
#main-menu-btns button, #survival-options button {
    background: rgba(0, 20, 10, 0.8) !important;
    color: rgba(0, 255, 120, 0.85) !important;
    border: 1px solid rgba(0, 255, 120, 0.15) !important;
    border-left: 3px solid rgba(0, 255, 120, 0.5) !important;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    text-shadow: 0 0 5px rgba(0, 255, 120, 0.3);
    box-shadow: none;
    margin-top: 8px; width: 100%; padding: 11px 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    transform: none;
    position: relative;
}
#main-menu-btns button::before, #survival-options button::before {
    content: '>';
    margin-right: 8px;
    color: rgba(0, 255, 120, 0.3);
    transition: color 0.15s;
}
#main-menu-btns button:hover, #survival-options button:hover {
    background: rgba(0, 255, 120, 0.1) !important;
    border-left-color: #0f8 !important;
    color: #fff !important;
    text-shadow: 0 0 8px rgba(0, 255, 120, 0.5);
    transform: none;
}
#main-menu-btns button:hover::before, #survival-options button:hover::before {
    color: #0f8;
}
#main-menu-btns button:active, #survival-options button:active {
    background: rgba(0, 255, 120, 0.2) !important;
    transform: scale(0.98);
}

/* BOTÓN DANGER (Reset, Horde) */
#main-menu-btns .menu-btn-danger, #survival-options .menu-btn-danger {
    border-left-color: rgba(255, 60, 60, 0.6) !important;
    color: rgba(255, 80, 80, 0.85) !important;
    text-shadow: 0 0 5px rgba(255, 60, 60, 0.3);
    margin-top: 18px;
    font-size: 0.75rem;
}
#main-menu-btns .menu-btn-danger::before, #survival-options .menu-btn-danger::before {
    color: rgba(255, 60, 60, 0.3);
}
#main-menu-btns .menu-btn-danger:hover, #survival-options .menu-btn-danger:hover {
    background: rgba(255, 40, 40, 0.12) !important;
    border-left-color: #f44 !important;
    color: #f88 !important;
}
#main-menu-btns .menu-btn-danger:hover::before, #survival-options .menu-btn-danger:hover::before {
    color: #f44;
}

/* BOTÓN START CAMPAIGN (Destacado) */
#main-menu-btns #start-btn {
    border-left-width: 4px !important;
    border-left-color: #0f8 !important;
    font-size: 0.95rem;
    padding: 13px 15px;
    color: #0f8 !important;
}

/* PANTALLA TITLE INTRO (Estilo RE) */
#screen-title-intro {
    background: #000;
    z-index: 5000;
}
#title-intro-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2.8rem;
    color: #fff;
    letter-spacing: 8px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255,255,255,0.5), 0 0 60px rgba(0,180,255,0.3);
    opacity: 0;
    text-align: center;
    padding: 0 20px;
}

/* CHAR SELECT */
/* CHAR SELECT - TERMINAL STYLE */
#screen-char { background: #000; overflow: hidden; }
#char-display-area { position: absolute; top:0; left:0; width: 100%; height: 100%; z-index: 1; }
#char-img-display { width: 100%; height: 100%; display: block; opacity: 0.55; mask-image: linear-gradient(to bottom, black 55%, transparent 100%); -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%); }
.char-overlay { position: absolute; bottom: 0; left: 0; width: 100%; padding: 20px 20px 60px 20px; background: rgba(5, 12, 8, 0.95); border-top: 1px solid rgba(0, 255, 120, 0.3); display: flex; flex-direction: column; align-items: center; text-align: center; z-index: 5; box-sizing: border-box; }
.char-overlay h2 { font-size: 2.2rem; margin: 0; color: #0f8; text-shadow: 0 0 15px rgba(0,255,120,0.5); text-transform: uppercase; letter-spacing: 3px; font-family: 'Courier New', monospace; }
.char-overlay p { font-size: 0.85rem; color: rgba(0, 255, 120, 0.7); margin-bottom: 20px; font-weight: bold; white-space: pre-wrap; line-height: 1.4; max-width: 700px; text-align: left; display: inline-block; }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: rgba(0, 255, 120, 0.4); font-size: 4rem; cursor: pointer; z-index: 10; text-shadow: 0 0 10px rgba(0,255,120,0.3); }
.nav-arrow:hover { color: rgba(0, 255, 120, 0.8); }
.back-btn-corner { position: absolute; top: calc(20px + env(safe-area-inset-top, 0px)); left: calc(20px + env(safe-area-inset-left, 0px)); background: rgba(0,15,8,0.7); border: 1px solid rgba(0,255,120,0.3); color: rgba(0,255,120,0.7); font-size: 1.5rem; z-index: 20; cursor: pointer; padding: 5px 10px; font-family: 'Courier New', monospace; }
.left { left: 10px; } .right { right: 10px; }

/* SHOOTER */
/* Safe-area offsets for elements on full-bleed screens (shooter, escape) */
#btn-escape-pause { top: calc(20px + env(safe-area-inset-top, 0px)) !important; left: calc(20px + env(safe-area-inset-left, 0px)) !important; }
#btn-dev-back { top: calc(20px + env(safe-area-inset-top, 0px)) !important; right: calc(20px + env(safe-area-inset-right, 0px)) !important; }

#screen-shooter { background: #000; }
#shooter-canvas { position: absolute; top:0; left:0; width:100%; height:100%; z-index:20; }
#muzzle-flash { position: fixed; bottom: 0; left: 0; width: 100%; height: 40%; background: radial-gradient(circle at bottom center, rgba(255, 200, 50, 0.35) 0%, transparent 70%); opacity: 0; pointer-events: none; z-index: 50; transition: opacity 0.04s; }
/* Combat status panel: THREATS + infection bar + protection bar. Top-LEFT so it never
   collides with #combat-score (top-right). Lives inside #screen-shooter and its visibility is
   managed in JS (shown at wave start, hidden in Escape Run), so it only appears during combat —
   no overlap with the puzzle/shop headers. Replaces the old top-right csh icons during combat. */
#breach-info {
    display: none;
    position: absolute;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
    z-index: 30;
    width: 146px;
    padding: 8px 10px;
    background: rgba(5, 12, 8, 0.5);
    border: 1px solid rgba(0,255,120,0.22);
    border-left: 3px solid rgba(0,255,120,0.55);
    border-radius: 4px;
    color: #0f8;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    pointer-events: none;
    text-shadow: 1px 1px 0 #000;
    box-sizing: border-box;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
#bi-threats { font-weight: bold; font-size: 0.72rem; letter-spacing: 1px; opacity: 0.9; margin-bottom: 7px; }
#ammo-panel { position:absolute; bottom:calc(30px + env(safe-area-inset-bottom, 0px)); width:100%; text-align:center; z-index:40; pointer-events:none; }
#ammo-counter { font-size: 2rem; color: #0f8; font-weight: bold; text-shadow: 0 0 8px rgba(0,255,120,0.4), 2px 2px 0 #000; font-family: 'Courier New', monospace; }
#reload-btn { pointer-events: auto; z-index: 1000; position: relative; background: rgba(5,12,8,0.9); border: 1px solid rgba(0,255,120,0.4); color: #0f8; padding: 10px 40px; font-size: 1.3rem; margin-top:10px; transition: 0.15s; font-family: 'Courier New', monospace; letter-spacing: 2px; text-shadow: 0 0 5px rgba(0,255,120,0.3); }
#reload-btn:hover { background: rgba(0,255,120,0.1); border-color: #0f8; }
#reload-btn.jammed { background: #500; border-color: #f00; color: #f00; animation: shake 0.2s infinite; }

#btn-switch-weapon {
    pointer-events: auto; z-index: 1000; position: absolute;
    right: 20px; bottom: 5px;
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(5,12,8,0.85); border: 2px solid #fa0; color: #fa0;
    font-size: 2rem; cursor: pointer; display: none;
    align-items: center; justify-content: center;
    box-shadow: 0 0 8px rgba(255,170,0,0.3);
}
#btn-switch-weapon:active { transform: scale(0.95); background: #fa0; color: #000; }

.alert-msg { color: #f44; font-size: 2.5rem; text-align: center; z-index: 30; pointer-events:none; margin:0; animation: blink 0.2s infinite; position:relative; top:20%; text-shadow: 0 0 15px rgba(255,0,0,0.5); font-family: 'Courier New', monospace; }
#combat-score { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(20px + env(safe-area-inset-right, 0px)); color: #fa0; font-size: 1.1rem; font-weight: bold; text-shadow: 0 0 6px rgba(255,170,0,0.4), 2px 2px 0 #000; z-index: 30; pointer-events: none; font-family: 'Courier New', monospace; letter-spacing: 1px; text-align: right; }

/* SPECIAL ATTACK WIDGET */
.special-widget {
    position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%);
    width: 50px; height: 50px;
    background: rgba(0,0,0,0.6); border: 2px solid #0ff; border-radius: 50%;
    display: none; justify-content: center; align-items: center;
    color: #0ff; font-size: 1.5rem; font-weight: bold;
    overflow: hidden; box-shadow: 0 0 10px #0ff;
    z-index: 40; pointer-events: none;
}
.special-widget.cooldown { border-color: #555; color: #555; box-shadow: none; background: rgba(0,0,0,0.8); }
#special-fill { position: absolute; bottom: 0; left: 0; width: 100%; height: 0%; background: rgba(0, 255, 255, 0.2); z-index: 0; transition: height 0.1s linear; }
#special-icon { z-index: 1; text-shadow: 0 0 5px #0ff; }
#special-timer { position: absolute; z-index: 2; font-size: 1rem; color: #fff; text-shadow: 0 0 2px #000; font-family: monospace; }

/* COMBO SYSTEM — persistent counter (large screens only) */
#combo-container { position: absolute; bottom: 8px; right: 12px; z-index: 35; pointer-events: none; display: none; text-align: right; }
#combo-val { font-family: 'Anton', 'Impact', sans-serif; font-size: 2.2rem; font-weight: 900; text-shadow: 3px 3px 0 #000; transition: color 0.2s; font-style: italic; }

/* Colores Dinámicos */
.combo-low { color: #ffeb3b; -webkit-text-stroke: 1px #000; }
.combo-med { color: #ff9800; -webkit-text-stroke: 1px #000; }
.combo-high { color: #f44336; -webkit-text-stroke: 1px #000; text-shadow: 0 0 8px rgba(255,0,0,0.5); }

/* Animaciones */
.combo-pulse { animation: comboPulse 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes comboPulse { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }

.combo-blinking { animation: comboBlink 0.3s steps(2, start) infinite; }
@keyframes comboBlink { to { visibility: hidden; } }

.combo-shake { animation: comboShake 0.15s infinite; }
@keyframes comboShake { 0% { transform: translate(0,0); } 25% { transform: translate(-1px, 1px); } 50% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 0); } 100% { transform: translate(0,0); } }

/* Enhanced Combo Tiers — glow reservado para legendario+ */
.combo-epic { color: #bf40ff; -webkit-text-stroke: 1px #000; text-shadow: 0 0 10px rgba(191,64,255,0.5); font-size: 2.4rem !important; }
.combo-legendary { color: #ffd700; -webkit-text-stroke: 1px #000; text-shadow: 0 0 12px rgba(255,215,0,0.6), 0 0 30px rgba(255,100,0,0.2); font-size: 2.8rem !important; }
.combo-mythic { color: #fff; -webkit-text-stroke: 1px rgba(0,200,255,0.6); text-shadow: 0 0 15px rgba(255,255,255,0.6), 0 0 35px rgba(0,200,255,0.3); font-size: 3.2rem !important; }
.combo-godlike { color: #fff; -webkit-text-stroke: 2px #f0f; text-shadow: 0 0 20px #f0f, 0 0 40px rgba(0,255,255,0.3); font-size: 3.5rem !important; animation: comboGodlike 0.3s infinite alternate !important; }
@keyframes comboGodlike { 0% { filter: hue-rotate(0deg); transform: scale(1.02); } 100% { filter: hue-rotate(40deg); transform: scale(1); } }

/* Small/narrow screens: hide persistent counter, floating popups are the display */
@media (max-width: 767px) {
    #combo-container { display: none !important; }
}
/* Large screens (tablet+): persistent counter center-right, big & flashy */
@media (min-width: 768px) {
    #combo-container { bottom: auto; right: 12px; top: 40%; text-align: center; }
    #combo-val { font-size: 3.2rem; }
    .combo-epic { font-size: 3.4rem !important; }
    .combo-legendary { font-size: 3.8rem !important; }
    .combo-mythic { font-size: 4.2rem !important; }
    .combo-godlike { font-size: 4.5rem !important; }
}

/* === COMBO FLOATING POPUP (spawns at kill position) === */
.combo-popup {
    position: absolute; z-index: 36; pointer-events: none;
    font-family: 'Anton', 'Impact', sans-serif; font-weight: 900; font-style: italic;
    font-size: 2.6rem; white-space: nowrap;
    -webkit-text-stroke: 2px #000;
    animation: comboPopFloat 1.6s ease-out forwards;
}
.cp-low { color: #ffeb3b; text-shadow: 2px 2px 0 #000, 0 0 12px rgba(255,235,59,0.7); }
.cp-med { color: #ff9800; text-shadow: 2px 2px 0 #000, 0 0 14px rgba(255,152,0,0.8); }
.cp-high { color: #f44336; text-shadow: 2px 2px 0 #000, 0 0 16px rgba(255,0,0,0.8), 0 0 30px rgba(255,0,0,0.3); }
.cp-epic { color: #bf40ff; text-shadow: 2px 2px 0 #000, 0 0 18px rgba(191,64,255,0.9), 0 0 35px rgba(191,64,255,0.3); font-size: 3rem; }
.cp-legendary { color: #ffd700; text-shadow: 2px 2px 0 #000, 0 0 20px rgba(255,215,0,0.9), 0 0 40px rgba(255,100,0,0.4); font-size: 3.4rem; }
.cp-mythic { color: #fff; text-shadow: 2px 2px 0 #000, 0 0 20px cyan, 0 0 40px rgba(0,200,255,0.6); font-size: 3.8rem; }
.cp-godlike { color: #fff; text-shadow: 2px 2px 0 #000, 0 0 25px #f0f, 0 0 45px cyan; font-size: 4.2rem; }
@keyframes comboPopFloat {
    0% { opacity: 1; transform: scale(0.3); }
    12% { opacity: 1; transform: scale(1.6); }
    30% { opacity: 1; transform: scale(1.15) translateY(-8px); }
    70% { opacity: 0.8; transform: scale(1.05) translateY(-30px); }
    100% { opacity: 0; transform: translateY(-55px) scale(0.8); }
}
/* Large screens: bigger floating popups */
@media (min-width: 768px) {
    .combo-popup { font-size: 3.4rem; }
    .cp-epic { font-size: 3.8rem; }
    .cp-legendary { font-size: 4.2rem; }
    .cp-mythic { font-size: 4.8rem; }
    .cp-godlike { font-size: 5.2rem; }
}

.combo-streak-flash {
    position: fixed; top: 30%; left: 50%; transform: translate(-50%,-50%);
    font-family: 'Anton', 'Impact', sans-serif; font-size: 2rem; font-weight: 900; color: #ffd700;
    text-shadow: 0 0 15px rgba(255,215,0,0.8), 3px 3px 0 #000; z-index: 200; pointer-events: none;
    animation: streakFlash 1s ease-out forwards; white-space: nowrap;
}
@keyframes streakFlash { 0% { opacity: 1; transform: translate(-50%,-50%) scale(0.5); } 30% { opacity: 1; transform: translate(-50%,-50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1) translateY(-40px); } }

.headshot-streak-flash {
    position: fixed; top: 38%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Anton', 'Impact', sans-serif; font-size: 1.6rem; font-weight: 900; color: #ff4444;
    text-shadow: 0 0 12px rgba(255,68,68,0.8), 2px 2px 0 #000; z-index: 200; pointer-events: none;
    white-space: nowrap; transition: opacity 0.3s, transform 0.1s;
}

/* COIN DROP SYSTEM */
.coin-drop {
    position: absolute; font-size: 1.8rem; z-index: 45; pointer-events: auto; cursor: pointer;
    animation: coinBounce 0.6s ease-out forwards;
    filter: drop-shadow(0 0 6px rgba(255,200,0,0.6));
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.coin-drop.coin-fly {
    transition: left 0.4s ease-in, top 0.4s ease-in, opacity 0.3s ease, transform 0.4s ease-in;
    opacity: 0.5; transform: scale(0.3); pointer-events: none;
}
@keyframes coinBounce {
    0% { transform: scale(0) translateY(0); opacity: 0; }
    40% { transform: scale(1.3) translateY(-25px); opacity: 1; }
    70% { transform: scale(0.9) translateY(-5px); opacity: 1; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
.coin-idle { animation: coinIdle 1.5s ease-in-out infinite; }
@keyframes coinIdle {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* PERK SELECTION OVERLAY */
#perk-selection {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 9000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.4s ease;
}
#perk-selection.perk-active { opacity: 1; }
.perk-title {
    font-family: 'Courier New', monospace; font-size: 1.5rem; color: #ffd700;
    letter-spacing: 4px; margin-bottom: 30px; text-shadow: 0 0 10px rgba(255,215,0,0.5);
    text-transform: uppercase; font-weight: bold;
}
#perk-cards { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; padding: 0 10px; }
.perk-card {
    background: rgba(10,25,15,0.95); border: 2px solid rgba(0,255,120,0.3);
    padding: 20px 15px; width: 130px; text-align: center; cursor: pointer;
    transition: all 0.3s ease; position: relative; overflow: hidden;
    animation: perkCardIn 0.4s ease-out both;
}
@keyframes perkCardIn { 0% { opacity: 0; transform: translateY(40px) scale(0.8); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.perk-card:hover { border-color: #ffd700; background: rgba(255,215,0,0.08); transform: translateY(-5px); box-shadow: 0 0 20px rgba(255,215,0,0.2); }
.perk-card:active { transform: scale(0.95); }
.perk-icon { font-size: 2.5rem; margin-bottom: 10px; }
/* Twemoji: size emoji <img> to match surrounding text, like native emoji */
img.emoji { height: 1em; width: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.1em; display: inline; }
.perk-name { font-family: 'Courier New', monospace; font-size: 0.85rem; color: #ffd700; font-weight: bold; margin-bottom: 8px; letter-spacing: 1px; }
.perk-desc { font-family: 'Courier New', monospace; font-size: 0.65rem; color: rgba(255,255,255,0.6); line-height: 1.3; }
.perk-selected { border-color: #ffd700 !important; box-shadow: 0 0 30px rgba(255,215,0,0.5); transform: scale(1.15) !important; z-index: 2; }
.perk-rejected { opacity: 0.2; transform: scale(0.85); pointer-events: none; }

/* MODIFIER ANNOUNCEMENT */
#modifier-announcement {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 10001;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
}
#modifier-announcement.mod-enter { opacity: 1; animation: modZoomIn 0.4s ease-out; pointer-events: auto; }
#modifier-announcement.mod-exit { opacity: 0; transition: opacity 0.4s ease; }
@keyframes modZoomIn { 0% { opacity: 0; transform: scale(2); } 100% { opacity: 1; transform: scale(1); } }
.mod-icon-big { font-size: 4rem; margin-bottom: 15px; animation: modIconPulse 0.6s ease-in-out infinite alternate; }
@keyframes modIconPulse { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }
.mod-name-big { font-family: 'Anton', 'Impact', sans-serif; font-size: 3rem; color: #fff; letter-spacing: 6px; text-shadow: 0 0 20px rgba(255,255,255,0.5), 0 0 40px rgba(255,0,0,0.3); text-transform: uppercase; max-width: 320px; text-align: center; word-break: break-word; }
.mod-desc-text { font-family: 'Courier New', monospace; font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-top: 10px; letter-spacing: 2px; max-width: 300px; text-align: center; }


/* EARTHQUAKE modifier shake */
.eq-shake { animation: eqShake 0.5s ease-in-out; }
.eq-shake-constant { animation: eqShake 0.3s ease-in-out infinite; }
@keyframes eqShake {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-8px, 5px); }
    20% { transform: translate(7px, -6px); }
    30% { transform: translate(-6px, 3px); }
    40% { transform: translate(5px, -4px); }
    50% { transform: translate(-4px, 6px); }
    60% { transform: translate(6px, -3px); }
    70% { transform: translate(-3px, 4px); }
    80% { transform: translate(4px, -5px); }
    90% { transform: translate(-5px, 2px); }
}

/* GAME UI (PUZZLE) - FIX LINEA GRIS */
#screen-game {
    background-image: url('assets/mesa.webp');
    background-size: cover;
    background-position: center;
    /* display is controlled by .screen and .screen.active */
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
}
/* Animated fullscreen puzzle background — tubes & purification */
#screen-game.has-puzzle-bg { background-image: none; }
#screen-game.has-puzzle-bg .game-ui {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; max-width: none;
    background-color: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    border: none; box-shadow: none;
    padding: 0; gap: 0; display: block;
}
#screen-game.has-puzzle-bg .game-ui .header {
    position: absolute; top: 0; left: 0; z-index: 15;
    background: rgba(0,10,5,0.75); box-sizing: border-box;
    cursor: grab; touch-action: none;
    min-width: 120px; overflow: hidden;
}
/* Purification: strip header down to EXIT button only */
#screen-game.pur-puzzle .game-ui .header {
    background: transparent; border: none; box-shadow: none;
    cursor: default; touch-action: auto;
    min-width: 0; padding: 4px; width: auto; overflow: visible;
}
#screen-game.pur-puzzle .game-ui .header > *:not(#exit-game-btn) { display: none; }

#screen-game.has-puzzle-bg #puzzle-module {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block;
}
#screen-game.has-puzzle-bg .puzzle-terminal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block;
}
#screen-game.has-puzzle-bg .puzzle-terminal > div {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block;
}
/* Zone-positioned elements get dark panel style */
#screen-game.has-puzzle-bg .tube-row {
    height: 100%; background: rgba(0,5,3,0.82);
}
#screen-game.has-puzzle-bg .row-container {
    height: 100%; display: flex; flex-direction: column; margin: 0;
}
/* tube-frame must flex-grow so tube-row's height:100% has a real parent height to reference */
#screen-game.has-puzzle-bg .tube-frame {
    flex: 1; min-height: 0; overflow: hidden;
}
#screen-game.has-puzzle-bg .lbl { width: auto; flex-shrink: 0; }
#screen-game.has-puzzle-bg #pur-hud {
    background: rgba(0,8,5,0.70); border-radius: 3px; padding: 4px 8px;
}
/* Zone editor overlay boxes */
#zones-editor [data-zone-key] { transition: none; }
.game-ui {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background-color: rgba(5, 12, 8, 0.92);
    border: 1px solid rgba(0, 255, 120, 0.2);
    box-shadow: 0 0 15px rgba(0,255,100,0.06), 0 10px 30px rgba(0,0,0,0.8), inset 0 0 25px rgba(0,0,0,0.6);
    border-radius: 0;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-sizing: border-box;
    margin: 0 auto;
}
#puzzle-module {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: rgba(0, 15, 8, 0.8);
    padding: 10px;
    color: #0f8;
    font-weight: bold;
    border: 1px solid rgba(0, 255, 120, 0.15);
    border-left: 3px solid rgba(0, 255, 120, 0.4);
    text-shadow: 0 0 5px rgba(0,255,120,0.4);
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}
.row-container { display: flex; flex-direction: column; gap: 5px; margin-bottom: 5px; width: 100%; position: relative; }
.lbl {
    font-size: 0.7rem; font-weight: 700; display:flex; justify-content:space-between;
    background: rgba(0,15,8,0.6); color: rgba(0,255,120,0.6); padding: 2px 6px; font-family: 'Courier New', monospace; text-shadow: none; border-left: 2px solid rgba(0,255,120,0.3); width: fit-content; margin-bottom: 2px; transform: none; letter-spacing: 1px; text-transform: uppercase;
}
.tube-row {
    display: flex; gap: 4px; align-items: flex-end; height: 55px;
    background: rgba(0,5,3,0.9); padding: 5px; border: 1px solid rgba(0,255,120,0.1); width: 100%; box-sizing: border-box; box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
}
.tube-container { flex: 1; height: 100%; background: rgba(0,20,10,0.4); border: 1px solid rgba(0,255,120,0.1); border-radius: 0; position: relative; overflow: hidden; }
.tube-liquid { 
    position: absolute; bottom: 0; left: 0; width: 100%; 
    background-color: transparent; background-image: repeating-linear-gradient(to top, var(--main-color) 0px, var(--main-color) 4px, #000 4px, #000 5px);
    transition: height 0.2s; opacity: 1; box-shadow: none; 
}
/* CUSTOM CHANNEL COLORS */
#target-row .tube-liquid { background-image: repeating-linear-gradient(to top, #0ff 0px, #0ff 4px, #000 4px, #000 5px); box-shadow: 0 0 8px #0ff; }
#row-a .tube-liquid { background-image: repeating-linear-gradient(to top, #ff4444 0px, #ff4444 4px, #000 4px, #000 5px); }
#row-b .tube-liquid { background-image: repeating-linear-gradient(to top, #44ff44 0px, #44ff44 4px, #000 4px, #000 5px); }
#row-c .tube-liquid { background-image: repeating-linear-gradient(to top, #4488ff 0px, #4488ff 4px, #000 4px, #000 5px); }
.tube-frame.swipeable { cursor: grab; touch-action: none; user-select: none; overflow: hidden; }
.status-panel { margin-top: 10px; background: rgba(0,10,5,0.8); padding: 15px; border: 1px solid rgba(0,255,120,0.15); box-shadow: inset 0 0 15px rgba(0,0,0,0.6); display: flex; flex-direction: column; align-items: center; width: 100%; box-sizing: border-box; }
.bar-bg { background: rgba(0,5,3,0.9); height: 15px; width: 100%; margin-bottom: 10px; border: 1px solid rgba(0,255,120,0.2); }
.bar-fill { background-image: repeating-linear-gradient(to right, #0f0 0px, #0f0 4px, #000 4px, #000 5px); height: 100%; width: 0%; transition: width 0.3s; }
#synth-btn { width: 100%; background: rgba(0,15,8,0.8); color: #0f8; border: 1px solid rgba(0,255,120,0.3); padding: 12px; font-size: 1rem; font-weight: bold; cursor: pointer; text-shadow: 0 0 5px rgba(0,255,120,0.4); box-shadow: none; text-align: center; font-family: 'Courier New', monospace; letter-spacing: 2px; }
#synth-btn:active { background: rgba(0,255,120,0.1); }
#synth-btn.ready { background: rgba(0,255,120,0.15); color: #0f8; border-color: #0f8; box-shadow: 0 0 15px rgba(0,255,120,0.3); animation: pulse-green 1s infinite; }
@keyframes pulse-green { 0% { box-shadow: 0 0 15px rgba(0,255,120,0.3); } 50% { box-shadow: 0 0 25px rgba(0,255,120,0.5); } 100% { box-shadow: 0 0 15px rgba(0,255,120,0.3); } }
.overdrive-btn { width: 100%; background: rgba(40,0,0,0.8); color: #f44; border: 1px solid rgba(255,60,60,0.4); padding: 10px; font-size: 1rem; font-weight: bold; cursor: pointer; margin-top: 8px; transition: 0.15s; box-shadow: 0 0 8px rgba(255,0,0,0.2); text-shadow: 0 0 5px rgba(255,60,60,0.4); text-align: center; font-family: 'Courier New', monospace; letter-spacing: 1px; } .overdrive-btn:active { background: rgba(255,60,60,0.2); transform: scale(0.98); }

/* === COLOR-CODED PUZZLE TERMINAL === */
.puzzle-terminal { position: relative; width: 100%; }
.terminal-header {
    font-family: 'Courier New', monospace; font-size: 0.55rem; color: rgba(0,255,120,0.2);
    text-align: center; letter-spacing: 2px; padding: 2px 0 6px 0; text-transform: uppercase;
}
.puzzle-hint {
    font-size: 0.6rem; opacity: 0.4; text-align: center;
    font-family: 'Courier New', monospace; color: rgba(0,255,120,0.6);
    padding: 2px 0 0 0; letter-spacing: 0.5px;
}
.puzzle-separator { width: 100%; height: 1px; background: rgba(0,255,120,0.08); margin: 6px 0; }

/* Tube glass effect */
.tube-glass {
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 0%, transparent 25%, transparent 75%, rgba(255,255,255,0.02) 100%) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}
/* Color liquid fill */
.tube-liquid-color {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
    border-top: 2px solid rgba(255,255,255,0.2);
    transition: background 0.15s;
}
/* Multi-color stack */
.tube-color-stack {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column;
}
.tube-stripe {
    border-top: 1px solid rgba(255,255,255,0.15);
    min-height: 0;
}
/* MIX row match indicators */
.tube-match { box-shadow: 0 0 5px rgba(0,255,100,0.4); border-color: rgba(0,255,100,0.35) !important; }
.tube-mismatch { border-color: rgba(255,60,60,0.15) !important; }

/* Match percentage */
.match-indicator {
    font-family: 'Courier New', monospace; font-size: 0.7rem;
    text-align: center; padding: 4px 0; letter-spacing: 2px; font-weight: bold;
}
.match-low { color: #ff4444; }
.match-50 { color: #ffaa00; }
.match-100 { color: #44ff44; animation: pulse-green 1s infinite; }

/* Channel label colors */
.lbl-red { color: #ff4444 !important; border-left-color: #ff4444 !important; }
.lbl-green { color: #44ff44 !important; border-left-color: #44ff44 !important; }
.lbl-blue { color: #4488ff !important; border-left-color: #4488ff !important; }

/* FIX: Ensure Status Panel in Game UI is full width and centered */
.game-ui .status-panel { width: 100%; max-width: none; align-items: center; }

/* SHOPS (GLASS EFFECT) */
#screen-shop, #screen-global-shop, #screen-survival-shop, #screen-survival-summary { background-image: url('assets/shop_bg.webp'); background-size: cover; background-position: center; }
.shop-ui {
    width: 95%; max-width: 600px; height: 90%;
    background: rgba(5, 12, 8, 0.93);
    border: 1px solid rgba(0, 255, 120, 0.2);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    padding: 20px; display: flex; flex-direction: column;
    box-shadow: 0 0 15px rgba(0,255,100,0.06), 0 10px 40px rgba(0,0,0,0.8), inset 0 0 25px rgba(0,0,0,0.5);
    touch-action: pan-y;
}
.shop-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(0,255,120,0.2); margin-bottom: 20px; padding-bottom: 10px; color: #0f8; font-family: 'Courier New', monospace; letter-spacing: 1px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; overflow-y: auto; flex: 1; min-height: 0; padding-bottom: 10px; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.shop-card { background: rgba(0, 20, 10, 0.5); border: 1px solid rgba(0, 255, 120, 0.1); border-left: 3px solid rgba(0, 255, 120, 0.3); padding: 12px 10px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: 0.15s; color: rgba(0,255,120,0.7); font-family: 'Courier New', monospace; min-height: 155px; overflow: hidden; box-sizing: border-box; }
.shop-card .icon { font-size: 1.7em; flex-shrink: 0; }
.shop-card .info { width: 100%; overflow: hidden; }
.shop-card .info h4 { font-size: 0.82em; margin: 4px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-card .info small { font-size: 0.7em; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.shop-card:hover { background: rgba(0, 255, 120, 0.08); border-left-color: #0f8; }
.shop-card:active { background: rgba(0, 255, 120, 0.15); color: #fff; }
.shop-card .cost { font-size: 0.75em; flex-shrink: 0; margin-top: auto; font-weight: bold; color: #fa0; border: 1px solid rgba(255,170,0,0.4); padding: 6px 8px 2px; border-radius: 0; text-shadow: 0 0 5px rgba(255,170,0,0.3); }
.shop-card.disabled { opacity: 0.6; filter: grayscale(80%); pointer-events: none; cursor: default; background: rgba(30,30,30,0.6); border-color: rgba(100,100,100,0.3); color: rgba(150,150,150,0.5); position: relative; overflow: hidden; }
.shop-card.disabled .cost { color: rgba(150,150,150,0.5); border-color: rgba(150,150,150,0.3); text-shadow: none; }
@media (max-width: 400px) {
    .shop-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
    .shop-card { padding: 8px 6px; min-height: 135px; }
    .shop-card .icon { font-size: 1.4em; }
    .shop-card .info h4 { font-size: 0.72em; }
    .shop-card .info small { font-size: 0.62em; -webkit-line-clamp: 3; }
    .shop-card .cost { font-size: 0.65em; }
}
@media (min-width: 768px) {
    .shop-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
    .shop-card .info small { -webkit-line-clamp: 5; }
}

/* PANTALLAS SECUNDARIAS */
#screen-tutorial { background: #000; position: relative; overflow: hidden; }
#screen-tutorial::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: url('assets/tutorial.webp'); background-size: cover; background-position: center; filter: blur(4px) brightness(0.3); -webkit-filter: blur(4px) brightness(0.3); transform: scale(1.05); z-index: 0; }
#screen-tutorial .menu-panel { position: relative; z-index: 1; }
#screen-leaderboard { position: relative; }
#screen-leaderboard::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('assets/highscore_bg.webp');
    background-size: cover; background-position: center top;
    filter: blur(5px) brightness(0.35);
    z-index: -1;
}
#screen-cinematic { background-image: url('assets/cinematic_bg.webp'); background-size: cover; background-position: center; }
#screen-lore { background-image: url('assets/lore_bg.webp'); background-size: cover; background-position: center; }
#screen-victory { background-image: url('assets/victory_bg.webp'); background-size: cover; background-position: center; }
#screen-surv-victory { background-image: url('assets/surv_victory_bg.webp'); background-size: cover; background-position: center; }
#screen-win { background-image: url('assets/win_bg.webp'); background-size: cover; background-position: center; }
#screen-fail { background-color: #000; background-size: cover; background-position: center; }

/* Censored text block */
.censored-block { background: #111; color: transparent; padding: 0 2px; border-radius: 2px; user-select: none; }

/* LORE CARDS & READER */
#screen-lore .menu-panel { display: flex; flex-direction: column; max-height: 85vh; }
#lore-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; width: 100%; overflow-y: auto; padding: 10px; box-sizing: border-box; flex: 1; min-height: 0; }
.lore-card { background: rgba(0, 20, 10, 0.6); border: 1px solid rgba(255, 170, 0, 0.3); border-radius: 0; aspect-ratio: 3/4; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; padding: 5px; }
.lore-card:active { transform: scale(0.95); }
.lore-card.unlocked:hover { transform: scale(1.03); background: rgba(255, 170, 0, 0.12); border-color: #fa0; }
.lore-card.locked { border-color: rgba(0,255,120,0.1); opacity: 0.5; cursor: default; background: rgba(0,5,3,0.8); }
.lore-card .icon { font-size: 2.5rem; margin-bottom: 5px; }
.lore-card .icon.thorne-icon { filter: grayscale(1) brightness(0.15); }
.lore-card .label { font-size: 0.7rem; color: rgba(255,255,255,0.8); text-align: center; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; font-weight: bold; font-family: 'Courier New', monospace; }

#screen-lore-reader { background-image: url('assets/lore_bg.webp'); background-size: cover; background-position: center; }
.reader-panel {
    background: rgba(5, 12, 8, 0.93);
    border: 1px solid rgba(0, 255, 120, 0.2);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    padding: 20px; width: 90%; max-width: 600px; max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 0 15px rgba(0,255,100,0.06), 0 10px 40px rgba(0,0,0,0.8), inset 0 0 25px rgba(0,0,0,0.5);
    overflow: hidden; position: relative;
}
#lore-read-content { flex: 1; overflow-y: auto; margin: 20px 0; font-family: 'Courier New', Courier, monospace; font-size: 1.0rem; line-height: 1.6; color: rgba(0,255,120,0.75); white-space: pre-wrap; text-align: left; padding-right: 10px; }

/* =========================================
   STORY SCREEN - DIARY OVERLAY
   ========================================= */
#screen-story { background: #000; position: relative; overflow: hidden; padding: 0; justify-content: center; align-items: center; }
#story-bg-blur { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; filter: blur(10px) brightness(0.3); -webkit-filter: blur(10px) brightness(0.3); transform: scale(1.1); z-index: 0; }

.story-layout {
    position: relative; z-index: 1;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
}

/* Frame: imagen + texto superpuesto */
.story-frame {
    position: relative;
    max-width: 70vw; max-height: 90vh;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(0,255,120,0.15);
    box-shadow: 0 0 25px rgba(0,0,0,0.9), 0 0 8px rgba(0,255,120,0.06);
    overflow: hidden;
}
.story-frame img {
    display: block;
    width: 100%; height: 100%;
    object-fit: contain;
}

/* Texto superpuesto en el tercio superior */
.story-content {
    position: absolute; top: 0; left: 0; width: 100%;
    max-height: 38%;
    background: linear-gradient(180deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.7) 60%, transparent 100%);
    padding: 20px 25px 30px;
    box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center;
    overflow: hidden;
}
#day-title {
    color: #0f8; font-family: 'Courier New', monospace;
    font-size: 1.3rem; letter-spacing: 3px; text-transform: uppercase;
    margin: 0 0 8px 0;
    text-shadow: 0 0 10px rgba(0,255,120,0.5);
    border-bottom: 1px solid rgba(0,255,120,0.2);
    padding-bottom: 6px; width: 100%; text-align: center;
}
.story-scroll {
    max-height: 130px; overflow-y: auto; width: 100%;
    text-align: justify; padding-right: 8px;
    font-size: 0.9rem; line-height: 1.55; letter-spacing: 0.3px;
    color: rgba(255,255,255,0.85);
    font-family: 'Courier New', monospace;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}
.story-scroll::-webkit-scrollbar { width: 3px; }
.story-scroll::-webkit-scrollbar-track { background: transparent; }
.story-scroll::-webkit-scrollbar-thumb { background: rgba(0,255,120,0.3); }

/* Botón en la parte inferior del frame */
#next-day-btn {
    position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%);
    width: auto; min-width: 200px; padding: 10px 25px;
    font-size: 1rem;
    background: rgba(0,0,0,0.75); border: 1px solid rgba(0,255,120,0.5);
    border-left: 4px solid #0f8;
    font-weight: bold; cursor: pointer; color: #0f8;
    font-family: 'Courier New', monospace; letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(0,255,120,0.3);
    transition: all 0.15s; z-index: 5;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
#next-day-btn:hover { background: rgba(0,255,120,0.15); color: #fff; }

/* --- PORTRAIT (Móviles) --- */
@media (orientation: portrait) {
    .story-layout { padding: 15px; }
    .story-frame { max-width: 92vw; max-height: 85vh; }
    .story-content { max-height: 35%; padding: 15px 15px 25px; }
    #day-title { font-size: 1.1rem; letter-spacing: 2px; margin-bottom: 6px; padding-bottom: 5px; }
    .story-scroll { max-height: 110px; font-size: 0.85rem; line-height: 1.5; }
    #next-day-btn { bottom: 10px; min-width: 170px; padding: 9px 20px; font-size: 0.9rem; }
}

/* --- LANDSCAPE (Tablets, PC) --- */
@media (orientation: landscape) {
    .story-frame { max-width: 65vw; max-height: 92vh; }
    .story-content { max-height: 33%; padding: 18px 25px 28px; }
    .story-scroll { max-height: 140px; }
}

/* --- Landscape corto (Nest Hub <=700px altura) --- */
@media (orientation: landscape) and (max-height: 700px) {
    .story-layout { padding: 8px; }
    .story-frame { max-width: 72vw; max-height: 94vh; }
    .story-content { max-height: 36%; padding: 12px 18px 22px; }
    #day-title { font-size: 1rem; margin-bottom: 4px; }
    .story-scroll { max-height: 100px; font-size: 0.82rem; }
    #next-day-btn { bottom: 8px; padding: 7px 16px; font-size: 0.85rem; min-width: 150px; }
}

/* --- Pantallas grandes (iPad+) - texto 15% mayor --- */
@media (min-width: 768px) and (min-height: 700px) {
    #day-title { font-size: 1.5rem; }
    .story-scroll { font-size: 1.035rem; line-height: 1.65; max-height: 160px; }
    #next-day-btn { font-size: 1.15rem; padding: 12px 30px; min-width: 230px; }
}

/* --- Pantallas muy anchas (ultrawide, >16:9) --- */
@media (min-aspect-ratio: 16/9) {
    .story-frame { max-width: 55vw; }
}
@media (min-aspect-ratio: 2/1) {
    .story-frame { max-width: 45vw; }
}

.cinematic-text-container {
    background: rgba(5, 12, 8, 0.85);
    border-top: 1px solid rgba(0, 255, 120, 0.3);
    border-bottom: 1px solid rgba(0, 255, 120, 0.3);
    border-left: none; border-right: none;
    padding: 20px;
    width: 85%;
    max-height: 50vh;
    overflow-y: auto;
    text-align: center;
    border-radius: 0;
    margin-bottom: 20px;
}
#cinematic-text { color: rgba(0, 255, 120, 0.8); font-size: 1.05rem; line-height: 1.6; text-shadow: 0 0 5px rgba(0,255,120,0.2); font-family: 'Courier New', monospace; }
.lang-selector { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 100; display:flex; gap:4px; }
.lang-btn { background: rgba(0,15,8,0.8); border: 1px solid rgba(0,255,120,0.25); color: rgba(0,255,120,0.7); padding: 4px 9px; cursor: pointer; font-family:'Courier New', monospace; font-weight:bold; font-size: 0.75rem; letter-spacing: 1px; transition: all 0.15s; }
.lang-btn:hover { background: rgba(0,255,120,0.1); color: #0f8; border-color: rgba(0,255,120,0.5); }
.audio-controls { position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 100; display:flex; gap:4px; flex-wrap: wrap; max-width: 160px; justify-content: flex-end; }
#score-list { list-style: none; padding: 0; margin: 20px 0; text-align: left; width: 100%;}
#score-list li { display: flex; justify-content: space-between; padding: 8px; border-bottom: 1px solid rgba(0,255,120,0.1); color: rgba(0,255,120,0.7); font-size: 1rem; font-family: 'Courier New', monospace; }

/* UTILS */
#start-btn, #select-btn { width: 100%; padding: 13px; font-size: 1.1rem; background: rgba(0,255,120,0.12); border: 1px solid rgba(0,255,120,0.5); border-left: 4px solid #0f8; font-weight: bold; cursor: pointer; margin-top:15px; color:#0f8; font-family: 'Courier New', monospace; letter-spacing: 2px; text-shadow: 0 0 5px rgba(0,255,120,0.3); transition: all 0.15s; }
#start-btn:hover, #select-btn:hover { background: rgba(0,255,120,0.2); color: #fff; }
.restart-btn { margin-top: 20px; padding: 15px 30px; background: rgba(5,12,8,0.9); border: 1px solid rgba(0,255,120,0.3); color: #0f8; font-size: 1.1rem; cursor: pointer; pointer-events: auto; z-index: 100; font-family: 'Courier New', monospace; letter-spacing: 2px; }
.restart-btn:hover { background: rgba(0,255,120,0.1); border-color: #0f8; }
.opt-btn { background: rgba(0,15,8,0.8); border: 1px solid rgba(0,255,120,0.15); border-left: 3px solid rgba(0,255,120,0.4); color: rgba(0,255,120,0.7); padding: 10px; cursor: pointer; z-index: 50; position: relative; font-family: 'Courier New', monospace; letter-spacing: 1px; transition: all 0.15s; }
.opt-btn:hover { background: rgba(0,255,120,0.08); color: #0f8; border-left-color: #0f8; }
#player-name, #player-name-fail { background: rgba(0,5,3,0.9); border: 1px solid rgba(0,255,120,0.3); color: #0f8; padding: 10px; font-size: 1.5rem; text-align: center; width: 150px; margin-bottom: 10px; font-family: 'Courier New', monospace; text-transform: uppercase; text-shadow: 0 0 5px rgba(0,255,120,0.3); }
/* Floating combat power-ups — bright pulsing aura + halo so they stand out against the busy
   battlefield. Per-type color via the --pu-glow / --pu-color custom props (set by .pu-* below). */
.powerup {
    --pu-glow: 0,255,255; --pu-color: #0ff;
    position: absolute; width: 46px; height: 46px;
    background: rgba(5,12,8,0.9);
    border: 2px solid var(--pu-color); border-radius: 50%;
    color: var(--pu-color); font-weight: bold; font-size: 1.05rem;
    display: flex; justify-content: center; align-items: center;
    z-index: 80; cursor: pointer;
    text-shadow: 0 0 6px var(--pu-color);
    box-shadow: 0 0 16px rgba(var(--pu-glow),0.85), 0 0 34px rgba(var(--pu-glow),0.4);
    animation: float 2s infinite ease-in-out, powerup-aura 0.85s infinite alternate;
}
.powerup::before {
    content: ''; position: absolute; inset: -12px; border-radius: 50%; z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle, rgba(var(--pu-glow),0.4) 0%, transparent 70%);
    animation: powerup-halo 0.85s infinite alternate;
}
@keyframes powerup-aura {
    from { box-shadow: 0 0 14px rgba(var(--pu-glow),0.6), 0 0 28px rgba(var(--pu-glow),0.3); }
    to   { box-shadow: 0 0 28px rgba(var(--pu-glow),1),   0 0 58px rgba(var(--pu-glow),0.55); }
}
@keyframes powerup-halo {
    from { opacity: 0.55; transform: scale(0.92); }
    to   { opacity: 1;    transform: scale(1.15); }
}
/* Per-type colors (classes pu-ammo / pu-kill / pu-net / pu-time set in spawnPowerUp) */
.powerup.pu-ammo { --pu-glow: 170,255,0;  --pu-color: #aaff00; }  /* ∞ infinite ammo — green */
.powerup.pu-kill { --pu-glow: 255,70,70;  --pu-color: #ff5555; }  /* 2X damage — red */
.powerup.pu-net  { --pu-glow: 120,180,255; --pu-color: #88bbff; } /* 🕸 web slow — blue */
.powerup.pu-time { --pu-glow: 0,230,255;  --pu-color: #00e6ff; }  /* ❄ freeze — cyan */
.low-end .powerup::before { animation: none; }
.lore-drop { position: absolute; width: 54px; height: 54px; background: url('assets/lore_item.webp') no-repeat center center; background-size: contain; z-index: 90; cursor: pointer; animation: float 2s infinite ease-in-out, lore-glow 1.2s infinite alternate; filter: drop-shadow(0 0 12px #fa0) drop-shadow(0 0 4px rgba(255,255,255,0.5)); }
@keyframes lore-glow { from { filter: drop-shadow(0 0 10px #fa0) drop-shadow(0 0 2px rgba(255,255,255,0.3)); } to { filter: drop-shadow(0 0 22px #ffb300) drop-shadow(0 0 8px rgba(255,255,255,0.6)) brightness(1.15); } }
.ammo-drop { position: absolute; width: 46px; height: 46px; background: radial-gradient(circle, rgba(0,40,0,0.95), rgba(0,20,0,0.98)); border: 2px solid #aaff00; border-radius: 8px; color: #aaff00; font-weight: bold; font-size: 0.82rem; letter-spacing: -0.5px; display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1.1; z-index: 85; cursor: pointer; animation: float 2s infinite ease-in-out, ammo-pulse 0.9s infinite alternate; box-shadow: 0 0 14px rgba(170,255,0,0.7), 0 0 28px rgba(170,255,0,0.25); pointer-events: auto; user-select: none; }
@keyframes ammo-pulse { from { box-shadow: 0 0 10px rgba(170,255,0,0.55); border-color: #aaff00; } to { box-shadow: 0 0 22px rgba(170,255,0,0.9), 0 0 44px rgba(170,255,0,0.35); border-color: #ccff44; } }
#powerup-active {
    position: absolute; bottom: 155px; left: 50%; transform: translateX(-50%);
    z-index: 101; pointer-events: none;
    gap: 6px; justify-content: center;
}
.pu-indicator {
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,10,5,0.9); border: 1px solid rgba(0,255,255,0.4);
    padding: 3px 8px; font-family: 'Courier New', monospace;
    font-size: 0.75rem; font-weight: bold; color: #0ff;
    box-shadow: 0 0 10px rgba(0,255,255,0.2);
}
.pu-indicator .pu-icon { font-size: 0.9rem; }
.pu-indicator .pu-timer { color: #fff; min-width: 24px; text-align: right; }
.pu-indicator.pu-ind-ammo { border-color: rgba(0,255,120,0.5); color: #0f8; box-shadow: 0 0 10px rgba(0,255,120,0.2); }
.pu-indicator.pu-ind-kill { border-color: rgba(255,60,60,0.5); color: #f44; box-shadow: 0 0 10px rgba(255,60,60,0.2); }
.pu-indicator.pu-ind-time { border-color: rgba(100,180,255,0.5); color: #6bf; box-shadow: 0 0 10px rgba(100,180,255,0.2); }
.pu-indicator.pu-expiring { animation: puBlink 0.4s infinite; }
@keyframes puBlink { 0%,100%{opacity:1} 50%{opacity:0.4} }
#ar-container { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); width: 300px; z-index: 100; display: none; }
#ar-bar { width: 100%; height: 20px; background: rgba(0,5,3,0.9); border: 1px solid rgba(0,255,120,0.3); position: relative; overflow: hidden; border-radius: 0; }
#ar-zone { position: absolute; top: 0; height: 100%; width: 20%; left: 60%; background: rgba(0,255,120,0.5); }
#ar-marker { position: absolute; top: 0; left: 0; height: 100%; width: 4px; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.6); }
#ar-label { text-align: center; color: #0f8; font-weight: bold; margin-top: 5px; text-shadow: 0 0 5px rgba(0,0,0,0.8); font-family: 'Courier New', monospace; font-size: 0.85rem; letter-spacing: 1px; }

/* EFECTOS */
.ar-anim { animation: moveMarker 1.0s linear infinite; }
.shake-anim { animation: shakeScreen 0.3s cubic-bezier(.36,.07,.19,.97) both; }
.emergency-mode::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(rgba(255, 0, 0, 0.2), rgba(50, 0, 0, 0.6)); z-index: 5; pointer-events: none; animation: alarmPulse 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
#screen-crack {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/screen_crack.webp');
    background-size: cover;
    background-position: center; /* <-- ESTA ES LA CLAVE */
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.5s;
}
/* Survival Perks HUD - shows active perk icons (vertical, bottom-left) */
#survival-perks-hud {
    position: fixed; bottom: 160px; left: 8px; z-index: 9999;
    display: flex; flex-direction: column; gap: 3px;
    pointer-events: none; max-width: 50px;
}
.sph-perk {
    font-size: 0.9rem; background: rgba(0,0,0,0.6);
    padding: 2px 4px; border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.15);
    line-height: 1; cursor: default;
}
.sph-perk.sph-temp { border-color: rgba(255,170,0,0.3); }

/* Campaign Status HUD - always visible during campaign */
#campaign-status-hud {
    position: fixed; top: 36px; right: 8px; z-index: 9999;
    display: flex; flex-direction: column; gap: 3px;
    pointer-events: none; font-family: 'Courier New', monospace;
}
.csh-icon {
    font-size: 0.65rem; color: #aaa; background: rgba(0,0,0,0.6);
    padding: 2px 6px; border-radius: 3px; white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.1);
}
#csh-infection.csh-danger { color: #f44; border-color: rgba(255,0,0,0.4); }
#csh-infection.csh-warning { color: #fa0; border-color: rgba(255,170,0,0.3); }
#csh-infection.csh-safe { color: #0f8; }

#damage-fx {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 0, 0, 0.6) 0%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 101;
}

@keyframes moveMarker { 0% { left: 0%; } 100% { left: 100%; } }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes shakeScreen { 10%, 90% { transform: translate3d(-2px, 0, 0); } 20%, 80% { transform: translate3d(4px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-6px, 0, 0); } 40%, 60% { transform: translate3d(6px, 0, 0); } }
@keyframes alarmPulse { 0%{opacity:0.5} 50%{opacity:1} 100%{opacity:0.5} }
@keyframes glitchShake { 0%{transform:translate(1px, 1px)} 50%{transform:translate(-1px, -1px)} 100%{transform:translate(1px, -1px)} }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 100% { transform: translateX(0); } }
.tube-row.glitched { filter: grayscale(100%) contrast(1.5); border-color: #aaa; animation: glitchShake 0.2s infinite; position: relative; }
.tube-row.glitched::after { content: attr(data-glitch-text); position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: red; font-weight: bold; background: #000; padding: 2px 5px; z-index: 10; font-size: 0.8rem; white-space: nowrap; }

/* OVERDRIVE CONFIRMATION */
#screen-overdrive-confirm {
    background: rgba(0,0,0,0.8);
    z-index: 150;
}

/* LOCKED PUZZLE ROW */
.row-container.locked {
    pointer-events: none; /* Disable clicks on buttons */
    opacity: 0.6;
    position: relative;
}
.row-container.locked::after {
    content: '🔒';
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; color: #fa0; text-shadow: 0 0 10px #000; z-index: 10;
}
/* PUZZLE MASTER: pre-aligned channel */
.row-container.pm-locked {
    pointer-events: none;
    position: relative;
    border: 1px solid rgba(170,0,255,0.4);
    box-shadow: 0 0 8px rgba(170,0,255,0.3);
}
.row-container.pm-locked::after {
    content: '🧩';
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    font-size: 1.2rem; opacity: 0.7; z-index: 10;
}

/* PERK REROLL BUTTON */
.perk-reroll-btn {
    background: transparent; border: 1px solid #0ff; color: #0ff;
    font-family: 'Courier New', monospace; font-size: 0.8rem;
    padding: 6px 18px; cursor: pointer; letter-spacing: 2px;
    margin-bottom: 15px; transition: all 0.2s;
}
.perk-reroll-btn:hover { background: rgba(0,255,255,0.15); box-shadow: 0 0 10px rgba(0,255,255,0.3); }

/* SURVIVAL STATUS SCREEN */
#screen-survival-status { background-color: #000; background-size: cover; background-position: center; }
#screen-survival-status .status-panel {
    background: rgba(5, 12, 8, 0.93);
    border: 1px solid rgba(0, 255, 120, 0.2);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    padding: 20px; border-radius: 0; width: 90%; max-width: 400px; text-align: center; gap: 15px;
    box-shadow: 0 0 15px rgba(0,255,100,0.06), 0 10px 40px rgba(0,0,0,0.8), inset 0 0 25px rgba(0,0,0,0.5);
}
.stat-row { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(0,255,120,0.1); padding: 5px 0; color: rgba(0,255,120,0.7); font-size: 1rem; font-family: 'Courier New', monospace; }
.stat-val { font-weight: bold; color: #0f8; }
.stat-val.penalty { color: #f44; } .stat-val.gained { color: #0f8; }
.inf-bar-container { width: 100%; height: 20px; background: rgba(0,5,3,0.9); border: 1px solid rgba(0,255,120,0.2); margin-top: 5px; position: relative; }
.inf-bar-fill { height: 100%; background: #d0f; width: 0%; transition: width 0.5s; }
.inf-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; text-align: center; line-height: 20px; font-size: 0.8rem; color: #fff; text-shadow: 1px 1px 0 #000; font-weight: bold; font-family: 'Courier New', monospace; }
.quit-btn { background: rgba(40,0,0,0.8); border: 1px solid rgba(255,60,60,0.4); color: #f44; margin-top: 10px; width: 100%; padding: 10px; cursor: pointer; font-weight: bold; font-family: 'Courier New', monospace; letter-spacing: 1px; }
.quit-btn:hover { background: rgba(255,60,60,0.15); color: #f88; border-color: #f44; }

#throwables-container { position: absolute; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; align-items: flex-start; }
.throw-btn { width: 60px; height: 60px; border-radius: 50%; border: 1px solid rgba(0,255,120,0.3); background: rgba(5,12,8,0.85); color: #0f8; font-size: 1.5rem; cursor: pointer; display: flex; justify-content: center; align-items: center; position: relative; transition: 0.15s; }
.throw-btn.active { background: rgba(255,170,0,0.2); border-color: #fa0; color: #fa0; transform: scale(1.1); box-shadow: 0 0 12px rgba(255,170,0,0.3); }
.throw-count { position: absolute; top: -5px; right: -5px; background: rgba(255,60,60,0.9); color: #fff; font-size: 0.75rem; padding: 2px 6px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.3); font-weight: bold; font-family: 'Courier New', monospace; }

/* RESPONSIVE FIXES FOR LARGE SCREENS (iPad Pro, Tablets, Desktops) */
@media (min-width: 768px) and (min-height: 800px) {
    #screen-menu {
        padding-top: env(safe-area-inset-top, 0px);
        justify-content: center;
    }
    .menu-panel {
        max-width: 480px;
        padding: 40px 35px 35px;
    }
    .title {
        font-size: 2.2rem;
        letter-spacing: 6px;
    }
    #menu-subtitle {
        font-size: 0.85rem;
    }
    #main-menu-btns button, #survival-options button {
        font-size: 1rem;
        padding: 14px 18px;
        margin-top: 10px;
    }
    #main-menu-btns #start-btn {
        font-size: 1.1rem;
        padding: 16px 18px;
    }
    .menu-status-bar {
        font-size: 0.7rem;
    }
    #global-currency {
        font-size: 1.1rem;
        padding: 8px 14px;
    }
    .lang-btn {
        font-size: 0.85rem !important;
        padding: 6px 12px !important;
    }
}

/* RESPONSIVE FIX: Center menu on narrow/tall screens (iPhones) */
@media (max-width: 430px) and (min-height: 700px) {
    #screen-menu {
        padding-top: env(safe-area-inset-top, 0px);
        justify-content: center;
    }
}

/* RESPONSIVE FIX: Squarish / wide-but-short screens (Surface Duo, small tablets) */
@media (min-width: 431px) and (max-width: 767px) and (max-height: 800px) {
    #screen-menu {
        padding-top: calc(70px + env(safe-area-inset-top, 0px));
        padding-bottom: 10px;
        justify-content: center;
    }
    #screen-menu .menu-panel {
        max-width: 380px;
        padding: 14px 18px;
    }
    #screen-menu .title {
        font-size: 1.5rem !important;
        margin-bottom: 5px !important;
    }
    #screen-menu #menu-subtitle {
        margin-bottom: 8px !important;
        font-size: 0.68rem !important;
    }
    #main-menu-btns button {
        padding: 7px 10px;
        margin-top: 5px;
        font-size: 0.85rem;
    }
    #main-menu-btns #start-btn {
        padding: 9px 12px;
        font-size: 0.9rem;
    }
    #main-menu-btns .menu-btn-danger {
        margin-top: 10px;
        font-size: 0.72rem;
    }
}

/* RESPONSIVE FIXES FOR IPHONE SE / SMALL SCREENS */
@media (max-height: 700px) {
    .game-ui { padding: 10px; gap: 5px; }
    .tube-row { height: 40px; }
    .row-container { gap: 2px; margin-bottom: 2px; }
    .lbl { font-size: 0.65rem; padding: 1px 4px; }
    .header { padding: 5px; font-size: 0.9rem; }
    .status-panel { padding: 10px; }
    #synth-btn, .overdrive-btn { padding: 8px; font-size: 0.9rem; }
    .bar-bg { height: 10px; margin-bottom: 5px; }
    #screen-menu {
        padding-top: calc(70px + env(safe-area-inset-top, 0px));
        padding-bottom: 10px;
        justify-content: center;
    }
    #screen-menu .menu-panel {
        padding: 10px 12px;
        display: flex;
        flex-direction: column;
    }
    #screen-menu .title {
        font-size: 1.2rem !important;
        margin-bottom: 4px !important;
        padding: 3px;
    }
    #screen-menu #menu-subtitle {
        margin-bottom: 6px !important;
        font-size: 0.65rem !important;
    }
    #screen-menu .menu-status-bar {
        font-size: 0.5rem;
        padding: 2px 8px;
        margin-bottom: 2px;
    }
    #main-menu-btns button {
        padding: 6px 8px;
        margin-top: 4px;
        font-size: 0.8rem;
    }
    #main-menu-btns #start-btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    #main-menu-btns .menu-btn-danger {
        margin-top: 8px;
        font-size: 0.7rem;
    }
    .lang-selector { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; }
    .lang-btn { padding: 3px 6px !important; font-size: 0.65rem !important; }
    .audio-controls { top: calc(38px + env(safe-area-inset-top, 0px)); right: 10px; gap: 3px; }
    #global-currency { top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; font-size: 0.8rem; }
    #rank-badge { font-size: 0.65rem; }

    /* Story & Cinematic Fixes for Small Screens (iPhone SE) */
    #screen-story { padding: 0; }
    .story-layout { padding: 8px; }
    .story-frame { max-width: 96vw; max-height: 88vh; }
    .story-content { max-height: 38%; padding: 10px 10px 20px; }
    #day-title { font-size: 0.95rem; letter-spacing: 1.5px; margin-bottom: 4px; padding-bottom: 4px; }
    .story-scroll { max-height: 80px; font-size: 0.78rem; line-height: 1.4; }
    #next-day-btn { bottom: 6px; min-width: 140px; padding: 7px 14px; font-size: 0.8rem; letter-spacing: 1px; }
    .cinematic-text-container { max-height: 40vh; padding: 10px; width: 90%; }
    #cinematic-text { font-size: 0.95rem; }

    /* Character Select Fixes for Small Screens */
    .char-overlay { padding: 10px 15px 30px 15px; }
    .char-overlay h2 { font-size: 1.5rem; margin-bottom: 5px; }
    .char-overlay p { font-size: 0.75rem; margin-bottom: 10px; line-height: 1.3; }
    #select-btn { padding: 8px; font-size: 1rem; margin-top: 5px; }
}

/* GENERAL LANDSCAPE OPTIMIZATIONS (Nest Hub, iPad, Tablets, Phones) */
@media (orientation: landscape) {
    /* Reducir arma drásticamente en horizontal para que no tape */
    #weapon-container { width: 30% !important; max-width: 350px; bottom: -5px; }

    /* Escalar UI para ganar espacio visual */
    #breach-info { transform: scale(0.85); transform-origin: top left; }
    #combat-score { transform: scale(0.85); transform-origin: top right; right: 10px; top: 8px; }
    #ammo-panel { bottom: 5px; transform: scale(0.85); transform-origin: bottom center; }
    .alert-msg { font-size: 2rem; top: 15%; }

    /* Personaje de cuerpo entero en landscape */
    #char-img-display {
        opacity: 0.8 !important;
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }
    .char-overlay {
        background: linear-gradient(to top, rgba(0,0,0,0.95) 60%, transparent 100%) !important;
        padding-bottom: 20px !important;
    }
}

/* PUZZLE GAME UI - General responsive fixes */
@media (max-height: 600px) {
    .game-ui {
        padding: 8px;
        gap: 8px;
        max-height: 95vh;
        overflow-y: auto;
    }
    .game-ui .header {
        padding: 8px 10px;
        font-size: 0.8rem;
        gap: 10px;
    }
}

/* Header spacing fix for narrow + short screens */
@media (max-width: 450px) and (max-height: 700px) {
    .game-ui .header {
        padding: 8px;
        gap: 8px;
        font-size: 0.8rem;
    }
    .game-ui .header > * {
        flex-shrink: 1;
        min-width: 0;
    }
}

/* Very small screens (iPhone SE and similar) */
@media (max-height: 568px) {
    .game-ui {
        padding: 5px;
        gap: 5px;
    }
    .infection-ui { gap: 4px; }
    .inf-grid { max-width: 240px; padding: 3px; }
    .inf-header { padding: 4px 8px; font-size: 0.75rem; }
    .inf-legend, .inf-hint { font-size: 0.6rem !important; margin: 2px 0 !important; }
    .infection-ui button { padding: 6px !important; font-size: 0.75rem !important; }
    .overdrive-btn { padding: 6px !important; font-size: 0.75rem !important; }
}

/* Medium phones (iPhone 14 Pro Max ~430px, etc) */
@media (min-width: 400px) and (max-width: 500px) {
    #screen-game { padding: 10px; }
    .game-ui {
        max-width: calc(100% - 20px);
        padding: 15px;
        margin: 0 auto;
    }
    .header {
        gap: 10px;
        font-size: 0.85rem;
    }
    .bd-ui {
        max-width: calc(100% - 20px);
        margin: 0 auto;
    }
}

/* Narrow screens (phones portrait <400px) */
@media (max-width: 400px) {
    #screen-game { padding: 5px; }
    .game-ui {
        max-width: calc(100% - 10px);
        padding: 10px;
        margin: 0 auto;
    }
    .header {
        padding: 6px 8px;
        gap: 5px;
        font-size: 0.75rem;
    }
    #puzzle-module { align-items: center; }
    .infection-ui {
        max-width: 100%;
        margin: 0 auto;
    }
    .inf-grid { max-width: 280px; margin: 0 auto; }
    .bd-ui {
        max-width: calc(100% - 10px);
        margin: 0 auto;
        padding: 10px;
        box-sizing: border-box;
    }
    .bd-lock-container { width: 200px; height: 200px; }
    .bd-ring-0 { width: 180px; height: 180px; }
    .bd-ring-1 { width: 148px; height: 148px; }
    .bd-ring-2 { width: 116px; height: 116px; }
    .bd-ring-3 { width: 84px; height: 84px; }
    .bd-ring-4 { width: 52px; height: 52px; }
    .bd-center-icon { width: 40px; height: 40px; font-size: 1.4rem; }
}

/* DAMAGE NUMBERS (RPG ACTION STYLE) */
.damage-number {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-family: 'Anton', 'Impact', 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    color: #ffffaa; /* Amarillo pálido */
    -webkit-text-stroke: 1.5px black;
    text-shadow: 3px 3px 0 #000;
    animation: damagePop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; /* Efecto elástico */
    text-align: center;
    line-height: 0.9;
}
.damage-number.crit {
    color: #ff4400; /* Naranja fuego intenso */
    font-size: 4rem; /* 1.5x más grande */
    -webkit-text-stroke: 2.5px black;
    text-shadow: 5px 5px 0 #000;
    z-index: 10000;
}
@keyframes damagePop {
    0% { transform: scale(0) translate(0, 0); opacity: 0; }
    20% { transform: scale(1.5) translate(0, -20px); opacity: 1; } /* Explosión inicial */
    40% { transform: scale(1.0) translate(0, -30px); } /* Rebote */
    100% { transform: scale(1.0) translate(0, -100px); opacity: 0; } /* Flotar y desvanecer */
}

/* WEAPON VIEWMODEL & RECOIL */
#weapon-container {
    position: absolute; bottom: 0; right: 0;
    width: 50%; max-width: 600px; /* Ajustable según preferencia */
    z-index: 25; /* Encima del canvas (20), debajo del HUD (30+) */
    pointer-events: none;
    display: flex; justify-content: flex-end; align-items: flex-end;
}
#current-weapon-view { width: 100%; height: auto; display: block; transform-origin: bottom right; }
.shooting-anim { animation: weapon-recoil 0.2s ease-out; }
@keyframes weapon-recoil {
    0% { transform: none; }
    20% { transform: translateY(30px) rotateZ(-5deg) scale(1.05); }
    100% { transform: none; }
}

/* Left-handed viewmodel (Shotgun) */
#weapon-container.left-handed {
    right: auto;
    left: 0;
    justify-content: flex-start;
}
#weapon-container.left-handed #current-weapon-view {
    transform-origin: bottom left;
}
#weapon-container.left-handed .shooting-anim {
    animation-name: weapon-recoil-left;
}
@keyframes weapon-recoil-left {
    0% { transform: none; }
    20% { transform: translateY(30px) rotateZ(5deg) scale(1.05); }
    100% { transform: none; }
}

/* Centered viewmodel (Sentinel electron cannon) */
#weapon-container.centered-weapon {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
}
#weapon-container.centered-weapon #current-weapon-view {
    transform-origin: bottom center;
}
#weapon-container.centered-weapon .shooting-anim {
    animation-name: weapon-recoil-center;
}
@keyframes weapon-recoil-center {
    0% { transform: none; }
    20% { transform: translateY(30px) scale(1.05); }
    100% { transform: none; }
}

/* =========================================
   SKIN DIGITAL (LEGACY OS v1.0)
   ========================================= */
/* SKIN DIGITAL: Ya integrado en el tema base (retro-futurista) */

/* DEV MODE */
#dev-mode-toggle.active { border-color: #0f0 !important; color: #0f0 !important; background: rgba(0, 20, 0, 0.8) !important; box-shadow: 0 0 10px #0f0; }

/* =========================================
   PUZZLE: INFECTION (BIOHAZARD NETWORK)
   ========================================= */
.infection-ui {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin: 0 auto;
}
.inf-header {
    width: 100%;
    display: flex;
    justify-content: center;
    color: #0f8;
    font-weight: bold;
    font-size: 0.85rem;
    text-shadow: 0 0 5px rgba(0,255,120,0.4);
    background: rgba(5,15,5,0.9);
    padding: 8px 15px;
    border: 1px solid rgba(0,200,80,0.2);
    border-left: 3px solid rgba(0,255,120,0.5);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}
.inf-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    background: rgba(5,15,5,0.95);
    padding: 8px;
    border: 1px solid rgba(0,200,80,0.2);
    border-radius: 0;
    box-shadow: inset 0 0 25px rgba(0,0,0,0.9), 0 0 12px rgba(0,200,80,0.08);
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
}
.inf-cell {
    background: rgba(8,20,8,0.9);
    border: 1px solid rgba(0,200,80,0.15);
    border-radius: 0;
    position: relative;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.inf-cell:hover { background: rgba(15,35,15,0.9); box-shadow: inset 0 0 10px rgba(0,255,120,0.15); }
.inf-cell:active { transform: scale(0.95); background: rgba(20,45,20,0.9); }
.inf-cell.locked { cursor: default; border-color: rgba(255,0,0,0.5); box-shadow: 0 0 5px rgba(255,0,0,0.3); }
/* Noise cells look identical to path cells (distraction/difficulty) */

/* PIPES (CSS SHAPES) */
.inf-pipe { position: absolute; background: #4a7a5a; transition: background 0.3s; z-index: 2; border-radius: 2px; }

/* EXTENDED PIPES (To remove visual gaps) */
.pipe-straight { width: 30%; height: 120%; top: -10%; }
.pipe-elbow-v { width: 30%; height: 70%; top: -10%; }
.pipe-elbow-h { height: 30%; width: 70%; right: -10%; }
.pipe-cross-v { width: 30%; height: 120%; top: -10%; }
.pipe-cross-h { height: 30%; width: 120%; left: -10%; }

/* Nucleus Marker */
.inf-nucleus { width: 35%; height: 35%; background: #0f8; border: 2px solid #000; border-radius: 50%; z-index: 10; box-shadow: 0 0 8px rgba(0,255,120,0.8); animation: pulse-nuc 2s infinite; }
.inf-start { width: 45%; height: 45%; background: radial-gradient(circle, #ff4444, #aa0000); border-radius: 50%; z-index: 10; box-shadow: 0 0 15px #f00; border: 2px solid #fff; }
.inf-end { width: 45%; height: 45%; background: radial-gradient(circle, #44ff44, #00aa00); border-radius: 50%; z-index: 10; box-shadow: 0 0 15px #0f0; border: 2px solid #fff; }

/* Direction arrows on start/end cells */
.inf-dir-arrow { position: absolute; width: 0; height: 0; z-index: 11; }
/* Up (dir 0) */
.inf-dir-arrow-0 { top: 2px; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid #fff; }
/* Right (dir 1) */
.inf-dir-arrow-1 { right: 2px; top: 50%; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid #fff; }
/* Down (dir 2) */
.inf-dir-arrow-2 { bottom: 2px; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid #fff; }
/* Left (dir 3) */
.inf-dir-arrow-3 { left: 2px; top: 50%; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 8px solid #fff; }

/* INFECTED STATE */
.inf-cell.infected .inf-pipe { background: #ff3333 !important; box-shadow: 0 0 10px #ff0000; animation: pulse-blood 1.5s infinite; }
.inf-cell.infected { background: rgba(50,0,0,0.9); border-color: #880000; }
.inf-cell.infected .inf-nucleus { background: #f00; border-color: #000; box-shadow: 0 0 10px #f00; }

/* INFECTION PUZZLE - Responsive */
@media (max-width: 400px), (max-height: 600px) {
    .infection-ui { max-width: 100%; gap: 6px; }
    .inf-grid { max-width: 280px; padding: 5px; }
    .inf-header { font-size: 0.8rem; padding: 5px 10px; }
    .infection-ui button { padding: 8px; font-size: 0.85rem; }
}

/* Wide screens (Nest Hub, tablets landscape) */
@media (min-aspect-ratio: 16/10) {
    .infection-ui { max-width: 350px; }
    .inf-grid { max-width: 280px; }
}

/* Defeat/victory screen on landscape/Nest Hub */
@media (orientation: landscape) and (max-height: 700px) {
    #escape-fail-overlay {
        background-position: center bottom !important;
    }
    #screen-victory {
        background-position: center 20% !important;
    }
    #screen-win {
        background-position: center 20% !important;
    }
}

/* Very wide screens (Nest Hub) */
@media (min-aspect-ratio: 16/9) and (max-height: 600px) {
    .game-ui { max-width: 500px; padding: 10px; }
    .infection-ui { max-width: 300px; gap: 5px; }
    .inf-grid { max-width: 220px; padding: 4px; border-width: 2px; }
    .inf-header { font-size: 0.75rem; padding: 4px 8px; }
    .infection-ui button { padding: 6px; font-size: 0.8rem; }
}

/* Surface Duo and foldables */
@media (min-width: 500px) and (max-width: 750px) and (min-height: 700px) {
    .infection-ui { max-width: 380px; }
    .inf-grid { max-width: 300px; }
}

/* FADE TRANSITION OVERLAY */
#fade-transition {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 10000; pointer-events: none;
    opacity: 0; transition: opacity 0.25s ease-in-out;
}
#fade-transition.active { opacity: 1; pointer-events: all; }

/* =========================================
   PUZZLE: BLAST DOOR (THORNE DAY 7)
   REDESIGNED - Clear visual feedback
   ========================================= */
/* ============================================
   BLAST DOOR PUZZLE - VISUAL REDESIGN
   ============================================ */
.bd-ui {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: rgba(5, 12, 8, 0.95);
    border: 1px solid rgba(0, 255, 120, 0.15);
    padding: 15px;
    border-radius: 0;
    box-shadow: 0 0 15px rgba(0,255,100,0.05), inset 0 0 25px rgba(0,0,0,0.6);
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* ARMORED DOOR BACKGROUND */
.bd-door-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    z-index: 0;
    pointer-events: none;
}
.bd-door-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 6px;
    color: rgba(80, 80, 80, 0.15);
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    background: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 40%, #111 60%, #0a0a0a 100%);
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 0 solid #333;
}
.bd-door-left {
    border-right: 3px solid #2a2a2a;
    writing-mode: vertical-lr;
}
.bd-door-right {
    border-left: 3px solid #2a2a2a;
    writing-mode: vertical-lr;
}
/* Door open animation */
.bd-ui.door-open .bd-door-left { transform: translateX(-110%); }
.bd-ui.door-open .bd-door-right { transform: translateX(110%); }
.bd-ui.door-open .bd-door-half { border-color: #0f8; }

/* All content above the door */
.bd-header, .bd-hint, .bd-progress, .bd-lock-container,
.bd-ring-labels, .bd-sentinel-float, .bd-moves,
.bd-ui > button, .bd-ui > .restart-btn, .bd-ui > .overdrive-btn, .bd-ui > .opt-btn {
    position: relative;
    z-index: 2;
}

/* CRACK EFFECTS — green light leaking through door */
.bd-ui::before, .bd-ui::after { content: ''; position: absolute; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.8s; }
.bd-ui.crack-1::before {
    opacity: 1;
    top: 15%; left: 48%; width: 2px; height: 30%;
    background: linear-gradient(180deg, transparent, #0f8, transparent);
    box-shadow: 0 0 8px #0f8, 0 0 15px rgba(0,255,136,0.3);
    transform: rotate(-5deg);
}
.bd-ui.crack-2::after {
    opacity: 1;
    top: 10%; left: 52%; width: 2px; height: 25%;
    background: linear-gradient(180deg, transparent, #0f8, transparent);
    box-shadow: 0 0 8px #0f8, 0 0 15px rgba(0,255,136,0.3);
    transform: rotate(8deg);
}
.bd-ui.crack-3 { box-shadow: 0 0 15px rgba(0,255,100,0.05), inset 0 0 25px rgba(0,0,0,0.6), inset 0 0 30px rgba(0,255,136,0.05); }
.bd-ui.crack-4 { box-shadow: 0 0 15px rgba(0,255,100,0.05), inset 0 0 25px rgba(0,0,0,0.6), inset 0 0 40px rgba(0,255,136,0.1); }
.bd-ui.crack-5 {
    box-shadow: 0 0 25px rgba(0,255,136,0.2), inset 0 0 25px rgba(0,0,0,0.6), inset 0 0 50px rgba(0,255,136,0.15);
    border-color: rgba(0,255,136,0.3);
}

.bd-header {
    width: 100%;
    text-align: center;
    background: transparent;
    padding: 8px;
    border-bottom: 1px solid rgba(0,255,120,0.1);
}
.bd-header h2 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    color: rgba(0,255,120,0.5);
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}
.bd-status {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 0;
    display: inline-block;
}
.bd-status.locked {
    color: #ff6600;
    background: rgba(255, 100, 0, 0.15);
    border: 1px solid #ff6600;
    text-shadow: 0 0 5px #ff6600;
}
.bd-status.unlocked {
    color: #00ffaa;
    background: rgba(0, 255, 170, 0.15);
    border: 1px solid #00ffaa;
    text-shadow: 0 0 10px #00ffaa;
    animation: pulse-green 1s infinite;
}

/* Instruction hint */
.bd-hint {
    font-size: 0.75rem;
    color: rgba(0,255,120,0.4);
    text-align: center;
    padding: 5px;
    background: rgba(0,5,3,0.6);
    border-radius: 0;
    width: 100%;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}
.bd-hint span { color: #fa0; }

.bd-lock-container {
    position: relative;
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #1a1a1a 0%, #080808 60%, #000 100%);
    border-radius: 50%;
    border: 4px solid #333;
    box-shadow: 0 0 30px rgba(0,0,0,0.9), inset 0 0 40px rgba(0,0,0,0.8);
    margin-top: 5px;
}

/* POWER SOURCE — fixed indicator at top of container */
.bd-power-source {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    z-index: 20;
    filter: drop-shadow(0 0 8px #ff0) drop-shadow(0 0 15px rgba(255,255,0,0.6));
    animation: power-pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes power-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px #ff0) drop-shadow(0 0 12px rgba(255,255,0,0.4)); }
    50% { filter: drop-shadow(0 0 12px #ff0) drop-shadow(0 0 25px rgba(255,255,0,0.7)); }
}

/* RINGS — Each with distinct color */
.bd-ring {
    position: absolute;
    border-radius: 50%;
    border: 6px solid;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 8px rgba(0,0,0,0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bd-ring:hover { box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 15px rgba(255,150,0,0.4); }

/* Ring sizes and INDIVIDUAL COLORS */
.bd-ring-0 { width: 220px; height: 220px; z-index: 1; background: transparent; border-color: #e33; }
.bd-ring-1 { width: 180px; height: 180px; z-index: 2; background: rgba(10,10,10,0.9); border-color: #f80; }
.bd-ring-2 { width: 140px; height: 140px; z-index: 3; background: rgba(12,12,12,0.9); border-color: #ee0; }
.bd-ring-3 { width: 100px; height: 100px; z-index: 4; background: rgba(14,14,14,0.9); border-color: #0dd; }
.bd-ring-4 { width: 60px; height: 60px; z-index: 5; background: rgba(16,16,16,0.9); border-color: #eee; }

/* MARKERS — Entry (green ▼) and Exit (cyan ▲) */
.bd-marker {
    position: absolute;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
    transition: box-shadow 0.3s;
}
.bd-marker-entry {
    background: radial-gradient(circle, #0f8, #0a5);
    color: #fff;
    border: 2px solid #0f8;
    box-shadow: 0 0 10px #0f8, 0 0 20px rgba(0,255,136,0.4);
    text-shadow: 0 0 4px #fff;
}
.bd-marker-exit {
    background: radial-gradient(circle, #0ff, #066);
    color: #fff;
    border: 2px solid #0ff;
    box-shadow: 0 0 10px #0ff, 0 0 20px rgba(0,255,255,0.4);
    text-shadow: 0 0 4px #fff;
}

/* Smaller markers for inner rings */
.bd-ring-3 .bd-marker, .bd-ring-4 .bd-marker { width: 14px; height: 14px; font-size: 0.55rem; }

/* RING STATES */
/* Completed — green border with energy flowing */
.bd-ring.ring-aligned {
    border-color: #0f8 !important;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 12px rgba(0,255,136,0.5) !important;
    cursor: default;
}
.bd-ring.ring-aligned .bd-marker-entry {
    background: radial-gradient(circle, #0f8, #0a5);
    box-shadow: 0 0 12px #0f8, 0 0 25px rgba(0,255,136,0.6) !important;
}
.bd-ring.ring-aligned .bd-marker-exit {
    background: radial-gradient(circle, #0ff, #066);
    box-shadow: 0 0 12px #0ff, 0 0 25px rgba(0,255,255,0.6) !important;
}

/* Energized — staggered illumination during win sequence */
.bd-ring.ring-energized {
    border-color: #0f8 !important;
    box-shadow: inset 0 0 15px rgba(0,255,136,0.2), 0 0 25px rgba(0,255,136,0.7), 0 0 50px rgba(0,255,136,0.3) !important;
    animation: ring-energize-flash 0.6s ease-out !important;
}
@keyframes ring-energize-flash {
    0% { box-shadow: inset 0 0 30px rgba(0,255,136,0.8), 0 0 50px #0f8, 0 0 80px rgba(0,255,136,0.6); }
    100% { box-shadow: inset 0 0 15px rgba(0,255,136,0.2), 0 0 25px rgba(0,255,136,0.7), 0 0 50px rgba(0,255,136,0.3); }
}

/* Active — pulsing glow */
.bd-ring.ring-active {
    animation: ring-active-pulse 1s ease-in-out infinite !important;
    cursor: pointer;
}
@keyframes ring-active-pulse {
    0%, 100% { box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 15px rgba(255,170,0,0.6); }
    50% { box-shadow: inset 0 0 15px rgba(0,0,0,0.8), 0 0 30px rgba(255,170,0,0.9), 0 0 50px rgba(255,100,0,0.4); }
}
.bd-ring.ring-active .bd-marker {
    animation: marker-glow 1s ease-in-out infinite;
}
@keyframes marker-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
}

/* Locked — dim */
.bd-ring.ring-locked {
    border-color: #333 !important;
    opacity: 0.4;
    cursor: not-allowed;
}
.bd-ring.ring-locked .bd-marker {
    opacity: 0.4;
    box-shadow: none !important;
}

/* CENTER EYE ICON */
.bd-center-icon {
    font-size: 1.8rem;
    z-index: 10;
    pointer-events: none;
    transition: all 0.5s;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, #1a1a1a, #000);
    border-radius: 50%;
    border: 3px solid #f44;
    color: #f44;
    text-shadow: 0 0 15px #f00;
    animation: eye-pulse 2s ease-in-out infinite;
}
@keyframes eye-pulse {
    0%, 100% { text-shadow: 0 0 10px #f00; transform: scale(1); }
    50% { text-shadow: 0 0 25px #f00, 0 0 40px rgba(255,0,0,0.4); transform: scale(1.08); }
}
/* Eye blink on ring completion */
.bd-center-icon.blink {
    animation: eye-blink 0.4s ease !important;
}
@keyframes eye-blink {
    0% { opacity: 1; transform: scaleY(1); }
    40% { opacity: 0.2; transform: scaleY(0.1); }
    100% { opacity: 1; transform: scaleY(1); }
}
/* Eye unlocked — green */
.bd-center-icon.unlocked {
    color: #0f8 !important;
    text-shadow: 0 0 20px #0f8, 0 0 40px rgba(0,255,136,0.5) !important;
    border-color: #0f8 !important;
    animation: none !important;
}

/* FIREWALL LABELS */
.bd-ring-labels {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    width: 100%;
    margin-top: 4px;
}
.bd-rlabel {
    font-family: 'Courier New', monospace;
    font-size: 0.55rem;
    color: rgba(0,255,120,0.25);
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border: 1px solid rgba(0,255,120,0.08);
    background: rgba(0,5,3,0.4);
    transition: all 0.3s;
}
/* Highlight active ring's label */
.bd-rlabel.active {
    color: #fa0;
    border-color: rgba(255,170,0,0.3);
    background: rgba(30,20,0,0.5);
    text-shadow: 0 0 5px rgba(255,170,0,0.3);
}
/* Bypassed label */
.bd-rlabel.bypassed {
    color: #0f8 !important;
    border-color: rgba(0,255,136,0.3) !important;
    background: rgba(0,15,8,0.5) !important;
    text-shadow: 0 0 5px rgba(0,255,136,0.3);
}

/* SENTINEL FLOATING MESSAGE */
.bd-sentinel-float {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #0f8;
    text-shadow: 0 0 10px #0f8;
    text-align: center;
    padding: 6px 12px;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none;
    min-height: 1.2em;
    letter-spacing: 1px;
}
.bd-sentinel-float.show {
    opacity: 1;
    transform: translateY(0);
}

/* Progress indicator */
.bd-progress {
    font-size: 0.9rem;
    font-weight: bold;
    color: rgba(0,255,120,0.8);
    text-align: center;
    padding: 8px 15px;
    background: rgba(0,10,5,0.7);
    border: 1px solid rgba(0,255,120,0.2);
    border-radius: 0;
    margin-bottom: 2px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

/* ALL ALIGNED STATE */
.bd-ui.aligned .bd-ring { border-color: #0f8 !important; }
.bd-ui.aligned .bd-marker-entry {
    background: radial-gradient(circle, #0f8, #0a5) !important;
    box-shadow: 0 0 15px #0f8, 0 0 30px rgba(0,255,136,0.6) !important;
}
.bd-ui.aligned .bd-marker-exit {
    background: radial-gradient(circle, #0ff, #066) !important;
    box-shadow: 0 0 15px #0ff, 0 0 30px rgba(0,255,255,0.6) !important;
}
.bd-ui.aligned .bd-lock-container {
    box-shadow: 0 0 40px rgba(0,255,136,0.4), inset 0 0 40px rgba(0,0,0,0.8);
}

/* MOVE COUNTER */
.bd-moves {
    font-size: 0.7rem;
    color: rgba(0,255,120,0.4);
    text-align: center;
    margin-top: 2px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}
.bd-moves span { color: #0ff; font-weight: bold; }

/* Responsive Blast Door — Small phones (iPhone SE: 375x667) */
@media (max-width: 400px) {
    .bd-ui { padding: 10px; gap: 6px; max-width: 340px; }
    .bd-header h2 { font-size: 0.85rem; letter-spacing: 1px; }
    .bd-status { font-size: 0.7rem; padding: 3px 8px; }
    .bd-hint { font-size: 0.65rem; }
    .bd-lock-container { width: 200px; height: 200px; }
    .bd-ring-0 { width: 180px; height: 180px; }
    .bd-ring-1 { width: 148px; height: 148px; }
    .bd-ring-2 { width: 116px; height: 116px; }
    .bd-ring-3 { width: 84px; height: 84px; }
    .bd-ring-4 { width: 52px; height: 52px; }
    .bd-marker { width: 14px; height: 14px; font-size: 0.55rem; }
    .bd-ring-3 .bd-marker, .bd-ring-4 .bd-marker { width: 12px; height: 12px; font-size: 0.5rem; }
    .bd-center-icon { width: 40px; height: 40px; font-size: 1.3rem; }
    .bd-rlabel { font-size: 0.5rem; padding: 1px 4px; }
    .bd-sentinel-float { font-size: 0.65rem; }
    .bd-door-half { font-size: 1.5rem; }
    .bd-progress { font-size: 0.8rem; padding: 5px 10px; }
    .bd-moves { font-size: 0.65rem; }
    .bd-power-source { font-size: 1.1rem; top: -12px; }
}

/* Very narrow phones (< 350px like Galaxy Z Fold inner) */
@media (max-width: 350px) {
    .bd-ui { padding: 8px; gap: 4px; max-width: 300px; }
    .bd-header h2 { font-size: 0.75rem; }
    .bd-lock-container { width: 170px; height: 170px; }
    .bd-ring-0 { width: 155px; height: 155px; }
    .bd-ring-1 { width: 128px; height: 128px; }
    .bd-ring-2 { width: 100px; height: 100px; }
    .bd-ring-3 { width: 72px; height: 72px; }
    .bd-ring-4 { width: 45px; height: 45px; }
    .bd-marker { width: 12px; height: 12px; font-size: 0.45rem; }
    .bd-ring-3 .bd-marker, .bd-ring-4 .bd-marker { width: 10px; height: 10px; font-size: 0.4rem; }
    .bd-center-icon { width: 35px; height: 35px; font-size: 1.1rem; }
    .bd-door-half { font-size: 1.2rem; }
    .bd-power-source { font-size: 1rem; top: -10px; }
}

/* Square-ish screens (Surface Duo ~540x720, aspect ~0.75) */
@media (min-width: 500px) and (max-width: 650px) and (min-aspect-ratio: 7/10) and (max-aspect-ratio: 9/10) {
    .bd-ui { max-width: 420px; padding: 14px; }
    .bd-lock-container { width: 230px; height: 230px; }
    .bd-ring-0 { width: 210px; height: 210px; }
    .bd-ring-1 { width: 174px; height: 174px; }
    .bd-ring-2 { width: 136px; height: 136px; }
    .bd-ring-3 { width: 98px; height: 98px; }
    .bd-ring-4 { width: 58px; height: 58px; }
    .bd-center-icon { width: 48px; height: 48px; font-size: 1.6rem; }
}

/* Short/landscape screens (general) */
@media (max-height: 600px) and (min-width: 400px) {
    .bd-ui { padding: 8px; gap: 4px; }
    .bd-lock-container { width: 170px; height: 170px; margin-top: 2px; }
    .bd-ring-0 { width: 155px; height: 155px; }
    .bd-ring-1 { width: 128px; height: 128px; }
    .bd-ring-2 { width: 100px; height: 100px; }
    .bd-ring-3 { width: 72px; height: 72px; }
    .bd-ring-4 { width: 45px; height: 45px; }
    .bd-marker { width: 12px; height: 12px; font-size: 0.45rem; }
    .bd-center-icon { width: 36px; height: 36px; font-size: 1.2rem; }
    .bd-door-half { font-size: 1.2rem; }
    .bd-rlabel { font-size: 0.5rem; padding: 1px 4px; }
    .bd-sentinel-float { font-size: 0.65rem; min-height: 0; padding: 3px 8px; }
    .bd-progress { font-size: 0.8rem; padding: 4px 10px; }
    .bd-header { padding: 4px; }
    .bd-header h2 { font-size: 0.85rem; margin-bottom: 2px; }
    .bd-power-source { font-size: 1rem; top: -10px; }
}

/* Wide screens — Nest Hub (1024x600, aspect ~16/9) */
@media (min-aspect-ratio: 16/9) and (max-height: 650px) {
    .game-ui {
        max-width: 700px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
    }
    .game-ui .header {
        width: 100%;
        flex-shrink: 0;
    }
    .bd-ui {
        max-width: 550px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 6px;
        padding: 8px 15px;
    }
    .bd-header { width: 100%; order: 1; padding: 4px; }
    .bd-header h2 { font-size: 0.85rem; margin-bottom: 2px; }
    .bd-hint { width: 100%; order: 2; font-size: 0.65rem; }
    .bd-lock-container {
        width: 175px; height: 175px;
        order: 3; flex-shrink: 0; margin-top: 0;
    }
    .bd-ring-0 { width: 158px; height: 158px; }
    .bd-ring-1 { width: 130px; height: 130px; }
    .bd-ring-2 { width: 102px; height: 102px; }
    .bd-ring-3 { width: 74px; height: 74px; }
    .bd-ring-4 { width: 46px; height: 46px; }
    .bd-ui > button, .bd-ui > .restart-btn {
        order: 4; width: auto; min-width: 160px; flex-grow: 0;
    }
    .bd-center-icon { width: 36px; height: 36px; font-size: 1.2rem; }
    .bd-ring-labels { order: 5; }
    .bd-sentinel-float { order: 6; width: 100%; font-size: 0.65rem; min-height: 0; padding: 3px 8px; }
    .bd-door-half { font-size: 1.2rem; }
    .bd-progress { font-size: 0.8rem; padding: 4px 10px; order: 7; }
    .bd-moves { order: 8; }
}

/* Very wide screens (Nest Hub Max, ultrawide) */
@media (min-aspect-ratio: 2/1) and (max-height: 600px) {
    .game-ui { max-width: 750px; }
    .bd-ui { max-width: 600px; gap: 8px; }
    .bd-lock-container { width: 180px; height: 180px; }
    .bd-ring-0 { width: 164px; height: 164px; }
    .bd-ring-1 { width: 136px; height: 136px; }
    .bd-ring-2 { width: 108px; height: 108px; }
    .bd-ring-3 { width: 78px; height: 78px; }
    .bd-ring-4 { width: 50px; height: 50px; }
}

@keyframes pulse-nuc { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.7; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse-blood { 0% { box-shadow: 0 0 5px #f00; } 50% { box-shadow: 0 0 15px #f00; } 100% { box-shadow: 0 0 5px #f00; } }

/* =========================================
   ESCAPE RUN HUD
   ========================================= */
@keyframes escape-combo-glow {
    0% { box-shadow: 0 0 10px rgba(255,100,0,0.5), inset 0 0 10px rgba(255,100,0,0.2); }
    100% { box-shadow: 0 0 20px rgba(255,100,0,0.8), inset 0 0 15px rgba(255,100,0,0.4); }
}
@keyframes escape-combo-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
#escape-combo.active {
    animation: escape-combo-pulse 0.6s ease-out forwards;
}
#escape-combo-panel.combo-high {
    border-color: #ff0 !important;
    background: linear-gradient(180deg, rgba(255,200,0,0.3) 0%, rgba(255,100,0,0.4) 100%) !important;
}
#escape-combo-panel.combo-high #escape-combo-value {
    color: #ff0 !important;
    text-shadow: 0 0 15px #ff0, 0 0 30px #fa0, 3px 3px 0 #000 !important;
}
#escape-combo-panel.combo-max {
    border-color: #f00 !important;
    background: linear-gradient(180deg, rgba(255,50,50,0.4) 0%, rgba(200,0,0,0.5) 100%) !important;
    animation: escape-combo-glow 0.2s infinite alternate !important;
}
#escape-combo-panel.combo-max #escape-combo-value {
    color: #fff !important;
    text-shadow: 0 0 15px #f00, 0 0 30px #f00, 3px 3px 0 #000 !important;
    animation: comboShake 0.1s infinite;
}

/* INSUFFICIENT FUNDS FLOATING MSG */
.float-msg {
    position: fixed;
    top: 18%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(40, 0, 0, 0.92);
    color: #f44;
    padding: 15px 20px;
    border: 1px solid rgba(255,60,60,0.5);
    border-left: 3px solid #f44;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 20000;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(255,0,0,0.4);
    animation: fadeUp 1.0s forwards;
    text-align: center;
    max-width: 90vw;
    box-sizing: border-box;
    overflow: hidden;
    word-break: break-word;
}
@keyframes fadeUp {
    0% { opacity: 1; transform: translate(-50%, 0%); }
    100% { opacity: 0; transform: translate(-50%, -80%); }
}

/* =========================================
   PUZZLE CONDENSATION FOG OVERLAY
   ========================================= */
#puzzle-fog-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 15;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(180,200,210,var(--fog-opacity,0.05)) 100%);
}

/* =========================================
   SHOOTER CORRIDOR LIGHT FLICKER
   ========================================= */
#corridor-flicker {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; opacity: 0; pointer-events: none; z-index: 19;
}

/* =========================================
   WEAPON SMOKE EFFECT
   ========================================= */
#weapon-smoke {
    position: absolute; bottom: 35%; right: 15%;
    width: 40px; height: 60px;
    pointer-events: none; z-index: 26;
    opacity: 0; transition: opacity 0.3s;
}
#weapon-smoke.active { opacity: 1; }
#weapon-smoke .smoke-wisp {
    position: absolute; width: 6px; height: 6px;
    background: rgba(200,200,200,0.4); border-radius: 50%;
    animation: smokeRise 1.5s ease-out infinite;
}
#weapon-smoke .smoke-wisp:nth-child(2) { left: 12px; animation-delay: 0.3s; }
#weapon-smoke .smoke-wisp:nth-child(3) { left: 6px; animation-delay: 0.6s; }
@keyframes smokeRise {
    0% { transform: translateY(0) scale(1); opacity: 0.5; }
    100% { transform: translateY(-50px) scale(2.5); opacity: 0; }
}
#weapon-container.left-handed ~ #weapon-smoke {
    right: auto; left: 15%;
}

/* =========================================
   VIEWMODEL BREATHING SWAY
   ========================================= */
@keyframes weaponBreathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}
#current-weapon-view.breathing { animation: weaponBreathe 2.5s ease-in-out infinite; }
#current-weapon-view.breathing.shooting-anim { animation: weapon-recoil 0.2s ease-out; }

/* =========================================
   THORNE CLASSIFIED WATERMARK
   ========================================= */
.classified-watermark {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 4rem; font-weight: bold; letter-spacing: 8px;
    color: rgba(255, 60, 60, 0.08);
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    pointer-events: none; z-index: 1;
    white-space: nowrap;
    user-select: none;
}

/* =========================================
   SHOP NEON FLICKER TITLE
   ========================================= */
@keyframes neonFlicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { text-shadow: 0 0 7px currentColor, 0 0 15px currentColor, 0 0 30px currentColor; opacity: 1; }
    20%, 24%, 55% { text-shadow: none; opacity: 0.6; }
}
.shop-header h2 { animation: neonFlicker 3s infinite; }

/* =========================================
   SHOP SOLD OUT TAPE
   ========================================= */
.shop-card.disabled::after {
    content: 'SOLD OUT';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    background: repeating-linear-gradient(90deg, #000 0px, #000 8px, #fc0 8px, #fc0 16px);
    color: #000; font-weight: bold; font-size: 0.75rem; letter-spacing: 2px;
    padding: 3px 30px; white-space: nowrap;
    font-family: 'Courier New', monospace;
    border: 2px solid #000;
    z-index: 5;
    text-shadow: none;
}

/* =========================================
   PUZZLE OVERDRIVE VIBRATION
   ========================================= */
@keyframes overdriveShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px) translateY(1px); }
    30% { transform: translateX(2px) translateY(-1px); }
    50% { transform: translateX(-1px) translateY(1px); }
    70% { transform: translateX(1px) translateY(-1px); }
    90% { transform: translateX(-2px); }
}
#puzzle-module.overdrive-shake { animation: overdriveShake 0.15s linear infinite; }

/* =========================================
   PUZZLE LIGHT REFLECTION SWEEP
   ========================================= */
#puzzle-light-sweep {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 16; overflow: hidden;
}
#puzzle-light-sweep::after {
    content: '';
    position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.04) 45%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 55%, transparent 60%);
    animation: lightSweep var(--sweep-duration, 18s) linear infinite;
}
@keyframes lightSweep {
    0% { left: -100%; }
    90%, 100% { left: 200%; }
}

/* =========================================
   SHOOTER DYNAMIC VIGNETTE
   ========================================= */
#shooter-vignette {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 18;
    background: radial-gradient(ellipse at center, transparent 50%, #000 100%);
    opacity: 0;
    transition: opacity 0.5s;
}

/* =========================================
   SHOP PURCHASE ANIMATION
   ========================================= */
@keyframes purchaseStamp {
    0% { transform: scale(1); border-color: rgba(0,255,120,0.3); }
    30% { transform: scale(0.93); }
    60% { transform: scale(1.02); border-color: #0f8; box-shadow: 0 0 15px rgba(0,255,120,0.5); }
    100% { transform: scale(1); border-color: rgba(0,255,120,0.3); box-shadow: none; }
}
.shop-card.purchase-flash { animation: purchaseStamp 0.4s ease-out; }

/* =========================================
   MENU TITLE RGB GLITCH (Enhanced)
   ========================================= */
@keyframes titleRGBGlitch {
    0%, 89%, 100% { text-shadow: 0 0 10px rgba(0,255,120,0.6), 0 0 30px rgba(0,255,100,0.2); transform: none; }
    90% { text-shadow: 2px 0 #f00, -2px 0 #0ff, 0 0 10px rgba(0,255,120,0.6); transform: translateX(-1px); }
    91% { text-shadow: -2px 0 #f00, 2px 0 #0ff, 0 0 10px rgba(0,255,120,0.6); transform: translateX(2px); }
    92% { text-shadow: 1px 1px #f00, -1px -1px #0ff; transform: translateX(-1px) skewX(1deg); }
    93% { text-shadow: -1px 0 #f00, 1px 0 #0ff; transform: none; }
}

/* =========================================
   MATRIX RAIN CANVAS
   ========================================= */
#matrix-rain {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; opacity: 0.25;
}

/* =========================================
   MENU BUTTONS SEQUENTIAL LOAD
   ========================================= */
@keyframes btnLoad {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}
#main-menu-btns button, #main-menu-btns .opt-btn {
    opacity: 0;
    animation: btnLoad 0.3s ease-out forwards;
}

/* =========================================
   SCANLINE TRANSITION OVERLAY
   ========================================= */
#fade-transition.active::after {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px, transparent 2px,
        rgba(0,255,120,0.03) 2px, rgba(0,255,120,0.03) 4px
    );
    animation: scanSwipe 0.25s linear;
    pointer-events: none;
}
@keyframes scanSwipe {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(0); }
}

/* =========================================
   TYPING FLOAT MESSAGE
   ========================================= */
/* .float-msg merged into base rule above */

/* =========================================
   TAP RIPPLE FEEDBACK
   ========================================= */
.tap-ripple {
    position: fixed;
    width: 10px; height: 10px;
    border: 1.5px solid rgba(0, 255, 120, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    animation: tapRippleExpand 200ms ease-out forwards;
    display: none;
}
@keyframes tapRippleExpand {
    0%   { width: 10px; height: 10px; opacity: 1; }
    100% { width: 30px; height: 30px; opacity: 0; }
}

/* =========================================
   TITLE GLITCH INTERFERENCE (clip-path)
   ========================================= */
.title-glitch-interference {
    animation: titleInterference 0.15s steps(2) forwards !important;
}
@keyframes titleInterference {
    0%   { clip-path: polygon(0 0, 100% 0, 100% 20%, 0 20%); transform: translateX(1px); }
    12%  { clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%); transform: translateX(-1px); }
    25%  { clip-path: polygon(0 40%, 100% 40%, 100% 60%, 0 60%); transform: translateX(1px); }
    37%  { clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); transform: translateX(-1px); }
    50%  { clip-path: polygon(0 80%, 100% 80%, 100% 100%, 0 100%); transform: translateX(1px); }
    62%  { clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%); transform: translateX(-1px); }
    75%  { clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%); transform: translateX(1px); }
    100% { clip-path: none; transform: none; }
}

/* =========================================
   PUZZLE DISINTEGRATION EFFECT
   ========================================= */
/* =========================================
   PERK DURATION BADGE
   ========================================= */
.perk-duration {
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-family: 'Courier New', monospace;
    color: #fa0;
    border: 1px solid rgba(255, 170, 0, 0.4);
    border-radius: 4px;
    background: rgba(255, 170, 0, 0.1);
    letter-spacing: 1px;
}

/* =========================================
   COUNTDOWN MODIFIER TIMER
   ========================================= */
#countdown-timer {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    font-size: 3rem;
    color: #ff0;
    font-weight: bold;
    text-shadow: 0 0 15px #f50, 0 0 30px rgba(255,80,0,0.4);
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
}

/* =========================================
   WAVE REACTION OVERLAY
   ========================================= */
#wave-reaction {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.80);
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
#reaction-text {
    max-width: 500px;
    text-align: center;
    color: rgba(0, 255, 120, 0.9);
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 255, 120, 0.3);
    letter-spacing: 1px;
}

/* =========================================
   SENTINEL MESSAGE
   ========================================= */
#sentinel-msg {
    display: none;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(0, 5, 3, 0.9);
    border: 1px solid rgba(0, 255, 120, 0.3);
    border-left: 3px solid rgba(0, 255, 120, 0.5);
    padding: 8px 15px;
    max-width: 90%;
    font-size: 0.75rem;
    color: rgba(0, 255, 120, 0.7);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.5s;
}

/* =========================================
   SKIN: CRIMSON PROTOCOL
   Blood red theme - replaces ALL greens
   Primary: #c22  Accent: #f44  Dim: #811
   ========================================= */
body.skin-crimson {
    --main-color: #f44;
    --dim-color: rgba(50, 0, 0, 0.3);
    --bg-color: #0a0000;
    --danger-color: #ff0;
}
/* --- Screens & Backgrounds --- */
body.skin-crimson .screen { background-color: #0a0000; }
body.skin-crimson #screen-menu { background: radial-gradient(ellipse at center, #1a0000 0%, #0a0000 70%, #000 100%); }
body.skin-crimson #screen-menu::after { background: linear-gradient(180deg, rgba(30,0,0,0.4) 0%, rgba(0,0,0,0.6) 50%, rgba(20,0,0,0.5) 100%); }
/* --- Panels --- */
body.skin-crimson .menu-panel,
body.skin-crimson .shop-ui,
body.skin-crimson .status-panel {
    border-color: rgba(255, 68, 68, 0.4) !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.1), inset 0 0 25px rgba(0, 0, 0, 0.6);
    background: rgba(10, 0, 0, 0.95);
    animation: crimson-panel-glow 4s ease-in-out infinite;
}
@keyframes crimson-panel-glow {
    0%, 100% { border-color: rgba(255, 68, 68, 0.25); }
    50% { border-color: rgba(255, 68, 68, 0.45); }
}
/* --- Headings --- */
body.skin-crimson h1, body.skin-crimson h2, body.skin-crimson h3 {
    color: #f44 !important;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5) !important;
}
/* --- Buttons --- */
body.skin-crimson .opt-btn {
    border-color: rgba(255, 68, 68, 0.5) !important;
    color: #f44 !important;
}
body.skin-crimson .opt-btn:active { background: rgba(255, 68, 68, 0.2); }
body.skin-crimson #main-menu-btns button {
    border-left-color: rgba(180, 30, 30, 0.4) !important;
    color: rgba(255, 68, 68, 0.7) !important;
}
body.skin-crimson #main-menu-btns button:hover {
    border-left-color: #f44 !important;
    color: #f44 !important;
}
body.skin-crimson #main-menu-btns button:hover::before { color: #f44 !important; }
body.skin-crimson #main-menu-btns #start-btn {
    border-left-color: #f44 !important;
    color: #f44 !important;
}
body.skin-crimson #start-btn, body.skin-crimson #select-btn {
    border-left-color: #f44 !important;
    color: #f44 !important;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3) !important;
}
body.skin-crimson .restart-btn {
    color: #f44 !important;
    border-color: rgba(255, 68, 68, 0.3) !important;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3) !important;
}
body.skin-crimson #next-day-btn {
    border-left-color: #f44 !important;
    color: #f44 !important;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3) !important;
}
/* --- Intro & Blink --- */
body.skin-crimson .blink-text {
    color: #f44 !important;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5) !important;
}
body.skin-crimson #skip-intro-btn {
    border-color: rgba(255, 68, 68, 0.3) !important;
    color: rgba(255, 68, 68, 0.7) !important;
    background: rgba(10, 0, 0, 0.8) !important;
}
/* --- Title & Currency --- */
body.skin-crimson .title { color: #f44 !important; text-shadow: 0 0 15px rgba(255,0,0,0.5) !important; }
body.skin-crimson #global-currency { color: #f44 !important; text-shadow: 0 0 8px rgba(255,0,0,0.4) !important; }
body.skin-crimson .status-dot { background: #f44 !important; box-shadow: 0 0 4px #f44 !important; }
body.skin-crimson .menu-status-bar { color: rgba(255, 68, 68, 0.5) !important; }
/* --- Character Select --- */
body.skin-crimson .char-overlay h2 { color: #f44 !important; text-shadow: 0 0 15px rgba(255,0,0,0.5) !important; }
body.skin-crimson .char-overlay p { color: rgba(255, 68, 68, 0.7) !important; }
body.skin-crimson .nav-arrow { color: rgba(255, 68, 68, 0.4) !important; text-shadow: 0 0 10px rgba(255,0,0,0.3) !important; }
/* --- Shooter HUD --- */
body.skin-crimson #breach-info { color: #f44 !important; }
body.skin-crimson #ammo-counter { color: #f44 !important; text-shadow: 0 0 8px rgba(255,0,0,0.4), 2px 2px 0 #000 !important; }
body.skin-crimson #reload-btn {
    border-color: rgba(255, 68, 68, 0.4) !important;
    color: #f44 !important;
    text-shadow: 0 0 5px rgba(255,0,0,0.3) !important;
}
body.skin-crimson #reload-btn:hover { background: rgba(255,68,68,0.1) !important; border-color: #f44 !important; }
body.skin-crimson #combat-score { color: #f44 !important; }
body.skin-crimson .alert-msg { text-shadow: 0 0 15px rgba(255,0,0,0.5) !important; }
/* --- Puzzle / Game UI --- */
body.skin-crimson .header {
    color: #f44 !important;
    border-left-color: rgba(255, 68, 68, 0.4) !important;
    text-shadow: 0 0 5px rgba(255,0,0,0.4) !important;
}
body.skin-crimson .game-ui { background: rgba(10, 0, 0, 0.95) !important; }
body.skin-crimson .bar-fill {
    background-image: repeating-linear-gradient(to right, #c22 0px, #c22 4px, #000 4px, #000 5px) !important;
}
body.skin-crimson #synth-btn {
    color: #f44 !important;
    border-color: rgba(255, 68, 68, 0.3) !important;
    text-shadow: 0 0 5px rgba(255,0,0,0.4) !important;
}
body.skin-crimson #synth-btn.ready {
    background: rgba(255, 68, 68, 0.15) !important;
    color: #f44 !important;
    border-color: #f44 !important;
    box-shadow: 0 0 15px rgba(255,0,0,0.3) !important;
    animation: crimson-pulse 1s infinite !important;
}
@keyframes crimson-pulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255,0,0,0.3); }
    50% { box-shadow: 0 0 25px rgba(255,0,0,0.5); }
}
body.skin-crimson .overdrive-btn {
    color: #f44 !important;
    border-color: rgba(255,68,68,0.3) !important;
}
/* --- Shop --- */
body.skin-crimson .shop-header { color: #f44 !important; border-bottom-color: rgba(255,68,68,0.2) !important; }
body.skin-crimson .shop-card {
    border-color: rgba(255, 68, 68, 0.3) !important;
    background: rgba(20, 0, 0, 0.6);
}
body.skin-crimson .shop-card:hover { border-left-color: #f44 !important; }
/* --- Story --- */
body.skin-crimson #day-title { color: #f44 !important; text-shadow: 0 0 10px rgba(255,0,0,0.5) !important; }
body.skin-crimson .story-content { border-color: rgba(255,68,68,0.2) !important; }
/* --- Player Name Input --- */
body.skin-crimson #player-name, body.skin-crimson #player-name-fail {
    color: #f44 !important;
    border-color: rgba(255, 68, 68, 0.3) !important;
    text-shadow: 0 0 5px rgba(255,0,0,0.3) !important;
}
/* --- Score/Stats --- */
body.skin-crimson .stat-val { color: #f44 !important; }
body.skin-crimson #ar-label { color: #f44 !important; }
body.skin-crimson .throw-btn { color: #f44 !important; border-color: rgba(255,68,68,0.3) !important; }
/* --- Infection Puzzle --- */
body.skin-crimson .inf-nucleus { background: #f44 !important; box-shadow: 0 0 8px rgba(255,68,68,0.8) !important; }
body.skin-crimson .inf-end { background: radial-gradient(circle, #ff4444, #aa0000) !important; box-shadow: 0 0 15px #f44 !important; }
/* --- Sentinel & Reactions --- */
body.skin-crimson #sentinel-msg {
    border-color: rgba(255, 68, 68, 0.3) !important;
    border-left-color: rgba(255, 68, 68, 0.5) !important;
    color: rgba(255, 68, 68, 0.7) !important;
}
body.skin-crimson #reaction-text { color: rgba(255, 100, 100, 0.9) !important; text-shadow: 0 0 10px rgba(255,0,0,0.3) !important; }
/* --- Escape Run HUD (inline style overrides) --- */
body.skin-crimson #btn-escape-pause {
    color: #f44 !important;
    border-color: rgba(255, 68, 68, 0.4) !important;
    background: rgba(10, 0, 0, 0.8) !important;
}
body.skin-crimson #escape-pause-overlay h1 { color: #f44 !important; text-shadow: 0 0 15px rgba(255,0,0,0.5) !important; }
body.skin-crimson #escape-score-panel {
    background: rgba(10, 0, 0, 0.92) !important;
    border-color: rgba(255, 68, 68, 0.25) !important;
    border-left-color: rgba(255, 68, 68, 0.5) !important;
}
body.skin-crimson #escape-score-value {
    color: #f44 !important;
    text-shadow: 0 0 10px rgba(255,0,0,0.5), 0 0 20px rgba(255,0,0,0.3) !important;
}
body.skin-crimson #escape-score-panel > div:last-child { color: rgba(255,68,68,0.4) !important; }
/* --- Leaderboard & High Scores --- */
body.skin-crimson .hs-entry { border-color: rgba(255,68,68,0.15) !important; }
/* --- Perk Cards --- */
body.skin-crimson .perk-card { border-color: rgba(255,68,68,0.3) !important; background: rgba(10,0,0,0.9) !important; }
body.skin-crimson .perk-title { color: #f44 !important; }
body.skin-crimson .perk-desc { color: rgba(255,150,150,0.8) !important; }
body.skin-crimson .perk-duration { background: rgba(180,30,30,0.3) !important; color: #f44 !important; border-color: rgba(255,68,68,0.3) !important; }
/* --- Countdown Timer --- */
body.skin-crimson #countdown-timer { color: #f44 !important; text-shadow: 0 0 15px rgba(255,0,0,0.6) !important; }
/* --- Dev Mode --- */
body.skin-crimson #dev-mode-toggle.active { border-color: #f44 !important; color: #f44 !important; }
/* --- Bitten Overlay --- */
body.skin-crimson #bitten-overlay h1 { color: #f44 !important; }
/* --- Wave Reaction --- */
body.skin-crimson #wave-reaction { background: rgba(10,0,0,0.85) !important; }
/* --- Lang Buttons --- */
body.skin-crimson .lang-btn { color: rgba(255,68,68,0.6) !important; border-color: rgba(255,68,68,0.2) !important; }
/* --- Rank Badge --- */
body.skin-crimson #rank-badge { color: rgba(255,68,68,0.6) !important; border-color: rgba(255,68,68,0.2) !important; background: rgba(10,0,0,0.7) !important; }
/* --- Force Update Button --- */
body.skin-crimson #btn-force-update { color: rgba(255,68,68,0.45) !important; border-color: rgba(255,68,68,0.2) !important; background: rgba(10,0,0,0.7) !important; }
/* --- Menu Scanlines tint --- */
body.skin-crimson .menu-scanlines { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,0,0,0.015) 2px, rgba(255,0,0,0.015) 4px) !important; }

/* =========================================
   SKIN: LEGACY OS (Digital Corruption)
   Muted brownish-green "demacrado" theme
   Primary: #9b8a45  Accent: #b8a455  Dim: #6b5e30
   ========================================= */
body.skin-digital {
    --main-color: #9b8a45;
    --dim-color: rgba(60, 50, 20, 0.3);
    --bg-color: #0a0800;
}
/* --- Screens --- */
body.skin-digital .screen { background-color: #0a0800; }
body.skin-digital #screen-menu { background: radial-gradient(ellipse at center, #12100a 0%, #0a0800 70%, #000 100%); }
body.skin-digital #screen-menu::after { background: linear-gradient(180deg, rgba(20,18,5,0.4) 0%, rgba(0,0,0,0.6) 50%, rgba(15,12,5,0.5) 100%); }
/* --- Panels --- */
body.skin-digital .menu-panel,
body.skin-digital .shop-ui,
body.skin-digital .status-panel {
    animation: digital-panel-shake 4s infinite;
    border-color: rgba(155, 138, 69, 0.4) !important;
    box-shadow: 0 0 12px rgba(155, 138, 69, 0.08), inset 0 0 20px rgba(0, 0, 0, 0.5);
    background: rgba(10, 8, 0, 0.95);
}
body.skin-digital h1, body.skin-digital h2, body.skin-digital h3, body.skin-digital .perk-title {
    color: #b8a455 !important;
    text-shadow: 0 0 8px rgba(155, 138, 69, 0.4) !important;
    animation: digital-text-glitch 3s infinite;
}
@keyframes digital-panel-shake {
    0%, 96% { transform: translate(0); }
    96.5% { transform: translate(-2px, 1px); }
    97% { transform: translate(3px, -1px); }
    97.5% { transform: translate(-1px, 2px); }
    98% { transform: translate(0); }
    100% { transform: translate(0); }
}
@keyframes digital-text-glitch {
    0%, 93% { text-shadow: 0 0 8px rgba(155, 138, 69, 0.4); transform: none; }
    93.5% { text-shadow: -3px 0 #a08040, 3px 0 #706030; transform: skewX(-2deg); }
    94% { text-shadow: 3px 0 #a08040, -3px 0 #706030; transform: skewX(1deg); }
    94.5% { text-shadow: 0 0 8px rgba(155, 138, 69, 0.4); transform: none; }
    100% { text-shadow: 0 0 8px rgba(155, 138, 69, 0.4); transform: none; }
}
body.skin-digital::after {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(155, 138, 69, 0.025) 2px,
        rgba(155, 138, 69, 0.025) 4px
    );
    pointer-events: none;
    z-index: 9000;
    animation: digital-static 0.15s infinite;
}
@keyframes digital-static {
    0% { opacity: 0.6; }
    50% { opacity: 0.4; }
    100% { opacity: 0.6; }
}
/* --- Buttons --- */
body.skin-digital .opt-btn {
    border-color: rgba(155, 138, 69, 0.4) !important;
    color: #9b8a45 !important;
}
body.skin-digital .opt-btn:active { background: rgba(155, 138, 69, 0.15); }
body.skin-digital #main-menu-btns button {
    border-left-color: rgba(107, 94, 48, 0.4) !important;
    color: rgba(155, 138, 69, 0.7) !important;
}
body.skin-digital #main-menu-btns button:hover { border-left-color: #b8a455 !important; color: #b8a455 !important; }
body.skin-digital #main-menu-btns button:hover::before { color: #b8a455 !important; }
body.skin-digital #main-menu-btns #start-btn { border-left-color: #9b8a45 !important; color: #9b8a45 !important; }
body.skin-digital #start-btn, body.skin-digital #select-btn {
    border-left-color: #9b8a45 !important; color: #9b8a45 !important;
    text-shadow: 0 0 5px rgba(155, 138, 69, 0.3) !important;
}
body.skin-digital .restart-btn { color: #9b8a45 !important; border-color: rgba(155, 138, 69, 0.3) !important; }
body.skin-digital #next-day-btn { border-left-color: #9b8a45 !important; color: #9b8a45 !important; }
/* --- Intro & Title --- */
body.skin-digital .blink-text { color: #9b8a45 !important; text-shadow: 0 0 10px rgba(155, 138, 69, 0.5) !important; }
body.skin-digital #skip-intro-btn { border-color: rgba(155, 138, 69, 0.3) !important; color: rgba(155, 138, 69, 0.7) !important; background: rgba(10,8,0,0.8) !important; }
body.skin-digital .title { color: #b8a455 !important; }
body.skin-digital #global-currency { color: #9b8a45 !important; text-shadow: 0 0 8px rgba(155,138,69,0.4) !important; }
body.skin-digital .status-dot { background: #9b8a45 !important; box-shadow: 0 0 4px #9b8a45 !important; }
body.skin-digital .menu-status-bar { color: rgba(155, 138, 69, 0.5) !important; }
/* --- Character Select --- */
body.skin-digital .char-overlay h2 { color: #b8a455 !important; text-shadow: 0 0 15px rgba(155,138,69,0.5) !important; }
body.skin-digital .char-overlay p { color: rgba(155, 138, 69, 0.7) !important; }
body.skin-digital .nav-arrow { color: rgba(155, 138, 69, 0.4) !important; }
/* --- Shooter HUD --- */
body.skin-digital #breach-info { color: #9b8a45 !important; }
body.skin-digital #ammo-counter { color: #9b8a45 !important; text-shadow: 0 0 8px rgba(155,138,69,0.4), 2px 2px 0 #000 !important; }
body.skin-digital #reload-btn { border-color: rgba(155, 138, 69, 0.4) !important; color: #9b8a45 !important; }
body.skin-digital #combat-score { color: #9b8a45 !important; }
/* --- Puzzle / Game UI --- */
body.skin-digital .header { color: #9b8a45 !important; border-left-color: rgba(155,138,69,0.4) !important; text-shadow: 0 0 5px rgba(155,138,69,0.4) !important; }
body.skin-digital .game-ui { background: rgba(10, 8, 0, 0.95) !important; }
body.skin-digital .bar-fill { background-image: repeating-linear-gradient(to right, #9b8a45 0px, #9b8a45 4px, #000 4px, #000 5px) !important; }
body.skin-digital #synth-btn { color: #9b8a45 !important; border-color: rgba(155,138,69,0.3) !important; }
body.skin-digital #synth-btn.ready { background: rgba(155,138,69,0.15) !important; color: #b8a455 !important; border-color: #9b8a45 !important; box-shadow: 0 0 15px rgba(155,138,69,0.3) !important; }
body.skin-digital .overdrive-btn { color: #9b8a45 !important; border-color: rgba(155,138,69,0.3) !important; }
/* --- Shop --- */
body.skin-digital .shop-header { color: #9b8a45 !important; border-bottom-color: rgba(155,138,69,0.2) !important; }
body.skin-digital .shop-card { border-color: rgba(155,138,69,0.3) !important; background: rgba(15,12,0,0.6); }
body.skin-digital .shop-card:hover { border-left-color: #b8a455 !important; }
/* --- Story --- */
body.skin-digital #day-title { color: #b8a455 !important; text-shadow: 0 0 10px rgba(155,138,69,0.5) !important; }
/* --- Player Input --- */
body.skin-digital #player-name, body.skin-digital #player-name-fail { color: #9b8a45 !important; border-color: rgba(155,138,69,0.3) !important; }
/* --- Stats --- */
body.skin-digital .stat-val { color: #9b8a45 !important; }
body.skin-digital #ar-label { color: #9b8a45 !important; }
body.skin-digital .throw-btn { color: #9b8a45 !important; border-color: rgba(155,138,69,0.3) !important; }
/* --- Infection Puzzle --- */
body.skin-digital .inf-nucleus { background: #9b8a45 !important; box-shadow: 0 0 8px rgba(155,138,69,0.8) !important; }
body.skin-digital .inf-end { background: radial-gradient(circle, #b8a455, #6b5e30) !important; box-shadow: 0 0 15px #9b8a45 !important; }
/* --- Sentinel & Reactions --- */
body.skin-digital #sentinel-msg { border-color: rgba(155,138,69,0.3) !important; border-left-color: rgba(155,138,69,0.5) !important; color: rgba(155,138,69,0.7) !important; }
body.skin-digital #reaction-text { color: rgba(180, 160, 80, 0.9) !important; text-shadow: 0 0 10px rgba(155,138,69,0.3) !important; }
/* --- Escape Run HUD --- */
body.skin-digital #btn-escape-pause { color: #9b8a45 !important; border-color: rgba(155,138,69,0.4) !important; background: rgba(10,8,0,0.8) !important; }
body.skin-digital #escape-pause-overlay h1 { color: #9b8a45 !important; text-shadow: 0 0 15px rgba(155,138,69,0.5) !important; }
body.skin-digital #escape-score-panel { background: rgba(10,8,0,0.92) !important; border-color: rgba(155,138,69,0.25) !important; border-left-color: rgba(155,138,69,0.5) !important; }
body.skin-digital #escape-score-value { color: #9b8a45 !important; text-shadow: 0 0 10px rgba(155,138,69,0.5) !important; }
body.skin-digital #escape-score-panel > div:last-child { color: rgba(155,138,69,0.4) !important; }
/* --- Perks --- */
body.skin-digital .perk-card { border-color: rgba(155,138,69,0.3) !important; background: rgba(10,8,0,0.9) !important; }
body.skin-digital .perk-desc { color: rgba(180,160,80,0.8) !important; }
body.skin-digital .perk-duration { background: rgba(107,94,48,0.3) !important; color: #9b8a45 !important; border-color: rgba(155,138,69,0.3) !important; }
/* --- Countdown & Dev --- */
body.skin-digital #countdown-timer { color: #b8a455 !important; text-shadow: 0 0 15px rgba(155,138,69,0.6) !important; }
body.skin-digital #dev-mode-toggle.active { border-color: #9b8a45 !important; color: #9b8a45 !important; }
/* --- Lang Buttons --- */
body.skin-digital .lang-btn { color: rgba(155,138,69,0.6) !important; border-color: rgba(155,138,69,0.2) !important; }
/* --- Menu scanlines --- */
body.skin-digital .menu-scanlines { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(155,138,69,0.015) 2px, rgba(155,138,69,0.015) 4px) !important; }

/* =========================================
   SKIN: WHITEOUT
   Full black & white inversion, high contrast
   Primary: #111  Accent: #444  BG: #f0f0f0
   ========================================= */
body.skin-whiteout {
    --main-color: #222;
    --dim-color: rgba(200, 200, 200, 0.3);
    --bg-color: #f0f0f0;
    --danger-color: #c00;
}
/* --- Screens & Backgrounds --- */
body.skin-whiteout .screen { background: #f0f0f0; color: #222; }
body.skin-whiteout #screen-menu { background: radial-gradient(ellipse at center, #fff 0%, #e8e8e8 70%, #ddd 100%); }
body.skin-whiteout #screen-menu::before { filter: blur(4px) brightness(0.35) grayscale(1) !important; }
body.skin-whiteout #screen-menu::after { background: linear-gradient(180deg, rgba(220,220,220,0.4) 0%, rgba(200,200,200,0.5) 50%, rgba(210,210,210,0.4) 100%); }
/* --- Panels --- */
body.skin-whiteout .menu-panel,
body.skin-whiteout .shop-ui,
body.skin-whiteout .status-panel {
    background: rgba(240, 240, 240, 0.95);
    border-color: #999 !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.05), inset 0 0 25px rgba(200, 200, 200, 0.3);
}
/* --- Headings --- */
body.skin-whiteout h1, body.skin-whiteout h2, body.skin-whiteout h3 {
    color: #111 !important;
    text-shadow: none !important;
}
/* --- Buttons --- */
body.skin-whiteout .opt-btn {
    border-color: #999 !important;
    color: #333 !important;
    background: rgba(255, 255, 255, 0.8);
}
body.skin-whiteout .opt-btn:active { background: rgba(0, 0, 0, 0.1); }
body.skin-whiteout #main-menu-btns button {
    border-left-color: #bbb !important;
    color: #444 !important;
    background: rgba(255,255,255,0.5) !important;
}
body.skin-whiteout #main-menu-btns button:hover {
    border-left-color: #333 !important;
    color: #111 !important;
    background: rgba(0,0,0,0.05) !important;
}
body.skin-whiteout #main-menu-btns button:hover::before { color: #333 !important; }
body.skin-whiteout #main-menu-btns #start-btn {
    border-left-color: #333 !important;
    color: #111 !important;
}
body.skin-whiteout #start-btn, body.skin-whiteout #select-btn {
    border-left-color: #333 !important;
    color: #111 !important;
    text-shadow: none !important;
}
body.skin-whiteout .restart-btn {
    color: #333 !important;
    border-color: #999 !important;
    text-shadow: none !important;
    background: rgba(255,255,255,0.8) !important;
}
body.skin-whiteout #next-day-btn {
    border-left-color: #333 !important;
    color: #111 !important;
    text-shadow: none !important;
}
/* --- Intro & Blink --- */
body.skin-whiteout .blink-text {
    color: #222 !important;
    text-shadow: none !important;
}
body.skin-whiteout #skip-intro-btn {
    border-color: #999 !important;
    color: #444 !important;
    background: rgba(240,240,240,0.9) !important;
}
/* --- Title & Currency --- */
body.skin-whiteout .title { color: #111 !important; text-shadow: none !important; }
body.skin-whiteout #global-currency { color: #333 !important; text-shadow: none !important; }
body.skin-whiteout .status-dot { background: #333 !important; box-shadow: 0 0 4px rgba(0,0,0,0.3) !important; }
body.skin-whiteout .menu-status-bar { color: #888 !important; }
/* --- Character Select --- */
body.skin-whiteout .char-overlay h2 { color: #111 !important; text-shadow: none !important; }
body.skin-whiteout .char-overlay p { color: #555 !important; }
body.skin-whiteout .nav-arrow { color: #999 !important; text-shadow: none !important; }
body.skin-whiteout .char-overlay { background: linear-gradient(to top, rgba(240,240,240,0.95) 0%, rgba(240,240,240,0.7) 60%, transparent 100%) !important; }
/* --- Shooter HUD --- */
body.skin-whiteout #breach-info { color: #333 !important; border-color: rgba(0,0,0,0.3) !important; }
body.skin-whiteout #ammo-counter { color: #222 !important; text-shadow: 1px 1px 0 rgba(255,255,255,0.8) !important; }
body.skin-whiteout #reload-btn {
    border-color: #999 !important;
    color: #333 !important;
    text-shadow: none !important;
    background: rgba(240,240,240,0.8) !important;
}
body.skin-whiteout #reload-btn:hover { background: rgba(0,0,0,0.1) !important; border-color: #666 !important; }
body.skin-whiteout #combat-score { color: #222 !important; }
body.skin-whiteout .alert-msg { color: #111 !important; text-shadow: 1px 1px 0 rgba(255,255,255,0.5) !important; }
/* --- Puzzle / Game UI --- */
body.skin-whiteout .header {
    color: #222 !important;
    border-left-color: #999 !important;
    text-shadow: none !important;
    background: rgba(240,240,240,0.8) !important;
}
body.skin-whiteout .game-ui { background: rgba(240, 240, 240, 0.95) !important; border-color: #ccc !important; }
body.skin-whiteout .bar-fill {
    background-image: repeating-linear-gradient(to right, #333 0px, #333 4px, #ddd 4px, #ddd 5px) !important;
}
body.skin-whiteout .bar-bg { background: #ddd !important; border-color: #aaa !important; }
body.skin-whiteout #synth-btn {
    color: #333 !important;
    border-color: #999 !important;
    text-shadow: none !important;
    background: rgba(255,255,255,0.8) !important;
}
body.skin-whiteout #synth-btn.ready {
    background: #111 !important;
    color: #fff !important;
    border-color: #000 !important;
    box-shadow: 0 0 12px rgba(0,0,0,0.4) !important;
    text-shadow: 0 0 5px rgba(255,255,255,0.5) !important;
    animation: whiteout-pulse 1s infinite !important;
}
@keyframes whiteout-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0,0,0,0.1); }
    50% { box-shadow: 0 0 20px rgba(0,0,0,0.2); }
}
body.skin-whiteout .overdrive-btn { color: #333 !important; border-color: #999 !important; background: rgba(255,255,255,0.8) !important; }
/* --- Shop --- */
body.skin-whiteout .shop-header { color: #222 !important; border-bottom-color: #ccc !important; }
body.skin-whiteout .shop-card {
    border-color: #bbb !important;
    background: rgba(255, 255, 255, 0.8);
    color: #222;
}
body.skin-whiteout .shop-card .icon { filter: grayscale(0.5); }
body.skin-whiteout .shop-card:hover { border-left-color: #444 !important; }
/* --- Story --- */
body.skin-whiteout #day-title { color: #111 !important; text-shadow: none !important; }
body.skin-whiteout .story-content { color: #333 !important; background: rgba(240,240,240,0.95) !important; border-color: #ccc !important; }
body.skin-whiteout .story-scroll { color: #444 !important; }
/* --- Player Name Input --- */
body.skin-whiteout #player-name, body.skin-whiteout #player-name-fail {
    color: #222 !important;
    border-color: #999 !important;
    text-shadow: none !important;
    background: rgba(255,255,255,0.9) !important;
}
/* --- Score/Stats --- */
body.skin-whiteout .stat-val { color: #222 !important; }
body.skin-whiteout #ar-label { color: #222 !important; }
body.skin-whiteout .throw-btn { color: #333 !important; border-color: #999 !important; background: rgba(255,255,255,0.8) !important; }
/* --- Infection Puzzle --- */
body.skin-whiteout .inf-nucleus { background: #333 !important; box-shadow: 0 0 8px rgba(0,0,0,0.5) !important; }
body.skin-whiteout .inf-end { background: radial-gradient(circle, #666, #333) !important; box-shadow: 0 0 15px rgba(0,0,0,0.4) !important; }
body.skin-whiteout .inf-cell { background: rgba(255,255,255,0.9) !important; border-color: #ccc !important; }
body.skin-whiteout .inf-cell.infected { background: #555 !important; }
body.skin-whiteout .inf-grid { border-color: #aaa !important; background: rgba(230,230,230,0.5) !important; }
body.skin-whiteout .inf-header { color: #222 !important; background: rgba(240,240,240,0.9) !important; border-color: #aaa !important; }
/* --- Sentinel & Reactions --- */
body.skin-whiteout #sentinel-msg {
    background: rgba(240, 240, 240, 0.9) !important;
    border-color: #aaa !important;
    border-left-color: #666 !important;
    color: #444 !important;
}
body.skin-whiteout #reaction-text { color: #222 !important; text-shadow: none !important; }
/* --- Escape Run HUD --- */
body.skin-whiteout #btn-escape-pause {
    color: #333 !important;
    border-color: #999 !important;
    background: rgba(240,240,240,0.9) !important;
}
body.skin-whiteout #escape-pause-overlay { background: rgba(240,240,240,0.9) !important; }
body.skin-whiteout #escape-pause-overlay h1 { color: #222 !important; text-shadow: none !important; }
body.skin-whiteout #escape-score-panel {
    background: rgba(240,240,240,0.92) !important;
    border-color: #999 !important;
    border-left-color: #555 !important;
    box-shadow: 0 0 10px rgba(0,0,0,0.05) !important;
}
body.skin-whiteout #escape-score-value {
    color: #222 !important;
    text-shadow: none !important;
}
body.skin-whiteout #escape-score-panel > div:last-child { color: #999 !important; }
body.skin-whiteout #escape-combo-panel {
    background: rgba(230,230,230,0.9) !important;
    border-color: #999 !important;
    border-left-color: #555 !important;
}
/* --- Leaderboard --- */
body.skin-whiteout .hs-entry { border-color: #ddd !important; color: #333 !important; }
/* --- Perks --- */
body.skin-whiteout .perk-card { border-color: #bbb !important; background: rgba(245,245,245,0.95) !important; color: #222 !important; }
body.skin-whiteout .perk-title { color: #111 !important; }
body.skin-whiteout .perk-desc { color: #555 !important; }
body.skin-whiteout .perk-duration { background: rgba(0,0,0,0.05) !important; color: #444 !important; border-color: #bbb !important; }
/* --- Countdown --- */
body.skin-whiteout #countdown-timer { color: #222 !important; text-shadow: 0 0 10px rgba(0,0,0,0.2) !important; }
/* --- Dev Mode --- */
body.skin-whiteout #dev-mode-toggle { background: rgba(240,240,240,0.7) !important; border-color: #ccc !important; color: #999 !important; }
body.skin-whiteout #dev-mode-toggle.active { border-color: #333 !important; color: #333 !important; }
/* --- Bitten Overlay --- */
body.skin-whiteout #bitten-overlay { background: rgba(240,240,240,0.95) !important; }
body.skin-whiteout #bitten-overlay h1 { color: #c00 !important; background: rgba(255,255,255,0.9) !important; border-color: #c00 !important; }
/* --- Wave Reaction --- */
body.skin-whiteout #wave-reaction { background: rgba(240,240,240,0.85) !important; }
/* --- KIA (fail screen) --- */
body.skin-whiteout #screen-fail .menu-panel { border-color: #999 !important; box-shadow: 0 0 15px rgba(0,0,0,0.05) !important; }
body.skin-whiteout #fail-title { color: #c00 !important; text-shadow: none !important; }
body.skin-whiteout #btn-save-restart { border-color: #999 !important; color: #333 !important; border-left-color: #555 !important; }
/* --- Victory/Win --- */
body.skin-whiteout #screen-victory, body.skin-whiteout #screen-win { color: #222 !important; }
/* --- Lang Buttons --- */
body.skin-whiteout .lang-btn { color: #666 !important; border-color: #ccc !important; background: rgba(255,255,255,0.7) !important; }
/* --- Rank Badge --- */
body.skin-whiteout #rank-badge { color: #555 !important; border-color: #bbb !important; background: rgba(255,255,255,0.85) !important; }
/* --- Force Update Button --- */
body.skin-whiteout #btn-force-update { color: #666 !important; border-color: #bbb !important; background: rgba(255,255,255,0.7) !important; }
/* --- Shop card .info text (hardcoded inline whites would be invisible) --- */
body.skin-whiteout .shop-card .info h4 { color: #222 !important; }
body.skin-whiteout .shop-card .info small { color: #666 !important; }
body.skin-whiteout .shop-card .cost { color: #222 !important; border-color: #bbb !important; }
body.skin-whiteout .shop-card.disabled { opacity: 0.55; }
/* --- Menu Scanlines --- */
body.skin-whiteout .menu-scanlines { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.01) 2px, rgba(0,0,0,0.01) 4px) !important; }
/* --- Tubes puzzle --- */
body.skin-whiteout .tube-row { border-color: #ccc !important; }
body.skin-whiteout .lbl { color: #444 !important; }

/* ====== RANK BADGE (Menu) ====== */
#rank-badge {
    position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 200;
    font-family: 'Courier New', monospace; font-size: 0.6rem; letter-spacing: 2px;
    color: rgba(0,255,120,0.6); border: 1px solid rgba(0,255,120,0.2);
    padding: 2px 8px; text-transform: uppercase; background: rgba(0,5,3,0.7);
    display: none;
}

/* ====== AFTER ACTION REPORT (merged into fail screen) ====== */
.aar-stat-row {
    display: flex; justify-content: space-between; padding: 4px 8px;
    font-family: 'Courier New', monospace; font-size: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.05); opacity: 0;
    animation: aar-reveal 0.3s ease-out forwards;
}
.aar-stat-row .aar-label { color: rgba(255,255,255,0.5); }
.aar-stat-row .aar-value { font-weight: bold; }
@keyframes aar-reveal { from { opacity:0; transform:translateX(-10px); } to { opacity:1; transform:translateX(0); } }

.aar-medal {
    display: inline-flex; align-items: center; gap: 6px; margin: 5px 4px;
    padding: 5px 10px; background: rgba(40,30,0,0.6); border: 1px solid rgba(255,200,0,0.3);
    border-radius: 3px; font-family: 'Courier New', monospace; font-size: 0.7rem;
    opacity: 0; transform: scale(0.5); position: relative; overflow: hidden;
    animation: medal-pop 0.4s ease-out forwards;
}
.aar-medal .medal-icon { font-size: 1.2rem; }
.aar-medal .medal-name { color: #fa0; font-weight: bold; letter-spacing: 1px; }
.aar-medal .medal-sub { color: rgba(255,200,0,0.5); font-size: 0.55rem; display: block; }
@keyframes medal-pop { from { opacity:0; transform:scale(0.5); } to { opacity:1; transform:scale(1); } }
.aar-medal::after {
    content: ''; position: absolute; top: 0; left: -50%; width: 30%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,200,0,0.15), transparent);
    animation: medal-shimmer 3s infinite;
}
@keyframes medal-shimmer { 0% { left: -50%; } 100% { left: 150%; } }

.aar-perks-row { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.aar-perk-icon {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    background: rgba(0,20,10,0.6); border: 1px solid rgba(0,255,120,0.2);
    border-radius: 3px; font-size: 1rem;
}

.aar-rankup {
    text-align: center; padding: 8px; margin: 5px 0;
    background: rgba(40,30,0,0.4); border: 1px solid rgba(255,200,0,0.3);
    font-family: 'Courier New', monospace; animation: rankup-glow 1s infinite alternate;
}
.aar-rankup .rankup-label { color: #fa0; font-size: 0.9rem; font-weight: bold; letter-spacing: 2px; }
.aar-rankup .rankup-detail { color: rgba(255,200,0,0.7); font-size: 0.7rem; margin-top: 3px; }
@keyframes rankup-glow { from { box-shadow: 0 0 5px rgba(255,200,0,0.2); } to { box-shadow: 0 0 20px rgba(255,200,0,0.5); } }

/* ====== ACHIEVEMENT TOAST ====== */
#achievement-toast {
    position: fixed; top: 15px; left: 50%; transform: translateX(-50%) translateY(-100px);
    z-index: 10000; font-family: 'Courier New', monospace;
    background: rgba(5,12,8,0.95); border: 1px solid rgba(255,200,0,0.5);
    border-left: 3px solid #fa0; padding: 10px 20px;
    box-shadow: 0 0 25px rgba(255,170,0,0.3); min-width: 250px; max-width: 350px;
    transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
#achievement-toast.show { transform: translateX(-50%) translateY(0); }
#achievement-toast .ach-toast-icon { font-size: 1.5rem; float: left; margin-right: 10px; }
#achievement-toast .ach-toast-label { color: rgba(255,200,0,0.5); font-size: 0.5rem; letter-spacing: 3px; }
#achievement-toast .ach-toast-name { color: #fa0; font-size: 0.85rem; font-weight: bold; letter-spacing: 1px; }
#achievement-toast .ach-toast-reward { color: rgba(0,255,120,0.7); font-size: 0.65rem; margin-top: 3px; }

/* ====== ACHIEVEMENTS SCREEN ====== */
#achievements-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding:5px; }
.ach-card { position:relative; cursor:pointer; border:2px solid rgba(0,255,120,0.15); border-radius:6px; overflow:hidden; aspect-ratio:1; transition:transform 0.2s,border-color 0.2s; }
.ach-card:active { transform:scale(0.95); }
.ach-card.unlocked { border-color:#fa0; }
.ach-card.locked .ach-card-img { filter:blur(8px) brightness(0.4); }
.ach-card-img { width:100%; height:100%; object-fit:cover; display:block; }
.ach-card-check { position:absolute; top:4px; right:4px; color:#fa0; font-size:1.1rem; font-weight:bold; text-shadow:0 0 6px rgba(0,0,0,0.8); }
.ach-card-lock { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); font-size:1.5rem; opacity:0.7; }
/* Achievement detail modal */
#ach-detail-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.85); z-index:9999; display:flex; align-items:center; justify-content:center; }
#ach-detail-card { background:rgba(0,15,8,0.95); border:2px solid rgba(0,255,120,0.3); border-radius:10px; padding:20px; max-width:320px; width:85%; text-align:center; font-family:'Courier New',monospace; }
#ach-detail-img { width:80%; max-width:200px; border-radius:6px; margin-bottom:12px; }
#ach-detail-card.unlocked { border-color:#fa0; }
#ach-detail-card.locked #ach-detail-img { filter:blur(8px) brightness(0.4); }
#ach-detail-name { color:#0f8; font-weight:bold; font-size:1rem; margin-bottom:6px; }
#ach-detail-card.unlocked #ach-detail-name { color:#fa0; }
#ach-detail-desc { color:rgba(0,255,120,0.6); font-size:0.75rem; margin-bottom:6px; }
#ach-detail-reward { color:rgba(0,255,120,0.5); font-size:0.7rem; margin-bottom:8px; }
#ach-detail-status { font-size:0.75rem; }
#ach-detail-status.done { color:#fa0; }
#ach-detail-status.pending { color:rgba(0,255,120,0.4); }

/* ====== LEADERBOARD RANKS/BADGES ====== */
.rank-tier { display:flex; justify-content:space-between; padding:8px; margin:4px 0; border:1px solid rgba(0,255,120,0.1); font-family:'Courier New',monospace; font-size:0.8rem; color:rgba(0,255,120,0.6); }
.rank-tier.current { border-color:#fa0; color:#fa0; background:rgba(40,30,0,0.3); }
.rank-tier .rank-pts { color:rgba(0,255,120,0.4); font-size:0.7rem; }
.badge-item { display:flex; align-items:center; gap:10px; padding:8px; margin:4px 0; background:rgba(0,15,8,0.4); border:1px solid rgba(0,255,120,0.1); font-family:'Courier New',monospace; }
.badge-item-icon { font-size:1.3rem; min-width:30px; text-align:center; }
.badge-item-name { color:#fa0; font-weight:bold; font-size:0.75rem; }
.badge-item-desc { color:rgba(0,255,120,0.5); font-size:0.6rem; }

/* ====== LOW-END DEVICE OPTIMIZATIONS ====== */
/* Only applied when body has .low-end class (old phones ≤2GB RAM) */

/* Kill all animations globally, then whitelist essentials */
.low-end *, .low-end *::before, .low-end *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0.05s !important;
}
/* Re-enable essential gameplay animations */
.low-end .combo-streak-flash { animation-duration: 1s !important; }
.low-end .coin-drop { animation-duration: 0.6s !important; }
.low-end .perk-card { animation-duration: 0.3s !important; }
.low-end .weapon-recoil, .low-end .weapon-recoil-left { animation-duration: 0.2s !important; }

/* Kill all backdrop-filter blur (very GPU-heavy) */
.low-end .shop-ui,
.low-end .reader-panel,
.low-end #screen-survival-status .status-panel,
.low-end #next-day-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.low-end #menu-panel { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: 0 5px 20px rgba(0,0,0,0.8) !important; }

/* Simplify filter blur on backgrounds */
.low-end #screen-menu::before { filter: brightness(0.35) !important; }
.low-end #screen-tutorial::before { filter: brightness(0.3) !important; }
.low-end #story-bg-blur { filter: brightness(0.3) !important; }
.low-end #screen-chars::before { filter: brightness(0.35) !important; }

/* Kill expensive combo tier effects */
.low-end .combo-godlike { filter: none !important; text-shadow: 0 0 8px #f0f !important; }
.low-end .combo-mythic { text-shadow: 0 0 5px #0cf !important; }
.low-end .combo-legendary { text-shadow: 0 0 5px #ffd700 !important; }
.low-end .combo-epic { text-shadow: 0 0 4px #f80 !important; }

/* Kill menu decorative effects */
.low-end #matrix-bg { display: none !important; }

/* Simplify box-shadows everywhere */
.low-end .shop-card { box-shadow: none !important; }
.low-end .opt-btn, .low-end .restart-btn { text-shadow: none !important; }

/* =========================================
   GHOST TUTORIAL OVERLAY
   ========================================= */
#ghost-tutorial-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none; /* Allow interaction with game underneath */
}
#ghost-tutorial-overlay.visible { opacity: 1; }
#ghost-tutorial-overlay.hiding { opacity: 0; }

.ghost-tut-content {
    display: flex; flex-direction: column; align-items: center; gap: 20px;
}

.ghost-tut-text {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem; font-weight: bold;
    color: #0f8; letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0,255,136,0.6), 0 0 20px rgba(0,255,136,0.3);
    text-align: center;
    animation: ghostTextPulse 2s ease-in-out infinite;
}
@keyframes ghostTextPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Hand element — uses CSS pseudo for the hand icon */
.ghost-tut-hand {
    width: 60px; height: 60px;
    font-size: 50px; line-height: 60px; text-align: center;
    filter: drop-shadow(0 0 12px rgba(0,255,136,0.5));
    opacity: 0.85;
}
.ghost-tut-hand::before {
    content: '\1F91A'; /* raised hand emoji */
    display: block;
}
/* When icon is inlined directly (custom-icon), suppress ::before */
.ghost-tut-hand.custom-icon::before { display: none; }

/* TAP animation: hand presses down and bounces */
.ghost-anim-tap {
    animation: ghostTap 1.5s ease-in-out infinite;
}
@keyframes ghostTap {
    0%   { transform: scale(1) translateY(0); opacity: 0.85; }
    15%  { transform: scale(0.85) translateY(8px); opacity: 1; }
    30%  { transform: scale(1) translateY(0); opacity: 0.85; }
    100% { transform: scale(1) translateY(0); opacity: 0.85; }
}

/* SWIPE animation: hand slides left to right */
.ghost-anim-swipe {
    animation: ghostSwipe 2s ease-in-out infinite;
}
.ghost-anim-swipe::before {
    content: '\1F449'; /* pointing right hand emoji */
}
@keyframes ghostSwipe {
    0%   { transform: translateX(-50px); opacity: 0.4; }
    20%  { opacity: 0.9; }
    50%  { transform: translateX(50px); opacity: 0.9; }
    70%  { opacity: 0.4; }
    100% { transform: translateX(-50px); opacity: 0.4; }
}

/* HOLD animation: hand presses and holds, then releases */
.ghost-anim-hold {
    animation: ghostHold 2.5s ease-in-out infinite;
}
.ghost-anim-hold::before {
    content: '\1F91A'; /* raised hand emoji */
}
@keyframes ghostHold {
    0%   { transform: scale(1) translateY(0); opacity: 0.6; }
    10%  { transform: scale(0.8) translateY(10px); opacity: 1; }
    60%  { transform: scale(0.8) translateY(10px); opacity: 1; }
    75%  { transform: scale(1.1) translateY(-5px); opacity: 0.9; }
    100% { transform: scale(1) translateY(0); opacity: 0.6; }
}

/* === PURIFICATION GHOST TUTORIAL === */
.pur-ghost-hand {
    font-size: 48px; line-height: 56px; text-align: center;
    filter: drop-shadow(0 0 12px rgba(0,255,136,0.5));
    opacity: 0.9;
    animation: purGhostDrag 2.5s ease-in-out infinite;
}
.pur-ghost-hand.pur-ghost-point {
    filter: drop-shadow(0 0 12px rgba(160,80,255,0.5));
    animation: purGhostPoint 1.5s ease-in-out infinite;
}
.pur-ghost-text {
    font-family: 'Courier New', monospace;
    font-size: 1rem; font-weight: bold;
    color: #0f8; letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0,255,136,0.6), 0 0 20px rgba(0,255,136,0.3);
    text-align: center;
    animation: ghostTextPulse 2s ease-in-out infinite;
    margin-top: 10px;
}
@keyframes purGhostDrag {
    0%   { transform: translateY(0); opacity: 0.5; }
    15%  { transform: translateY(0) scale(0.85); opacity: 1; }
    50%  { transform: translateY(60px) scale(0.85); opacity: 1; }
    65%  { transform: translateY(60px) scale(1); opacity: 0.7; }
    100% { transform: translateY(0); opacity: 0.5; }
}
@keyframes purGhostPoint {
    0%   { transform: translateX(0) scale(1); opacity: 0.6; }
    30%  { transform: translateX(20px) scale(1.1); opacity: 1; }
    60%  { transform: translateX(20px) scale(0.9); opacity: 1; }
    100% { transform: translateX(0) scale(1); opacity: 0.6; }
}
@keyframes purGhostPointDown {
    0%   { transform: translateY(0) scale(1); opacity: 0.6; }
    30%  { transform: translateY(14px) scale(1.1); opacity: 1; }
    60%  { transform: translateY(14px) scale(0.9); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 0.6; }
}

/* ==========================================
   JUKEBOX
   ========================================== */
#screen-jukebox { background: #050510; }

@keyframes vinylSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
#jukebox-vinyl.playing {
    animation: vinylSpin 3s linear infinite;
    border-color: #0ff;
    box-shadow: 0 0 30px rgba(0,255,255,0.3), inset 0 0 20px rgba(0,255,255,0.05);
}

.viz-bar {
    width: 4px;
    background: #0ff;
    border-radius: 2px;
    height: 4px;
    transition: height 0.15s ease;
    box-shadow: 0 0 4px rgba(0,255,255,0.4);
}
.viz-bar.active {
    animation: vizBounce 0.4s ease infinite alternate;
}
@keyframes vizBounce {
    0%   { height: 4px; opacity: 0.4; }
    100% { height: 28px; opacity: 1; }
}
/* Stagger delay per bar */
.viz-bar:nth-child(1).active  { animation-delay: 0.00s; }
.viz-bar:nth-child(2).active  { animation-delay: 0.05s; }
.viz-bar:nth-child(3).active  { animation-delay: 0.10s; }
.viz-bar:nth-child(4).active  { animation-delay: 0.15s; }
.viz-bar:nth-child(5).active  { animation-delay: 0.03s; }
.viz-bar:nth-child(6).active  { animation-delay: 0.08s; }
.viz-bar:nth-child(7).active  { animation-delay: 0.13s; }
.viz-bar:nth-child(8).active  { animation-delay: 0.02s; }
.viz-bar:nth-child(9).active  { animation-delay: 0.07s; }
.viz-bar:nth-child(10).active { animation-delay: 0.12s; }
.viz-bar:nth-child(11).active { animation-delay: 0.04s; }
.viz-bar:nth-child(12).active { animation-delay: 0.09s; }
.viz-bar:nth-child(13).active { animation-delay: 0.14s; }
.viz-bar:nth-child(14).active { animation-delay: 0.01s; }
.viz-bar:nth-child(15).active { animation-delay: 0.06s; }
.viz-bar:nth-child(16).active { animation-delay: 0.11s; }

.jukebox-ctrl {
    background: none;
    border: 2px solid rgba(0,255,255,0.3);
    color: #0ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-shadow: 0 0 6px rgba(0,255,255,0.4);
}
.jukebox-ctrl:active {
    background: rgba(0,255,255,0.15);
    transform: scale(0.9);
}

.jukebox-track {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border: 1px solid rgba(0,255,255,0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0,255,255,0.02);
}
.jukebox-track:hover { background: rgba(0,255,255,0.06); }
.jukebox-track.active {
    border-color: #0ff;
    background: rgba(0,255,255,0.08);
    box-shadow: 0 0 8px rgba(0,255,255,0.15);
}
.jukebox-track.locked {
    opacity: 0.35;
    cursor: default;
}
.jukebox-track .jt-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.jukebox-track .jt-info {
    flex: 1;
    min-width: 0;
}
.jukebox-track .jt-info h4 {
    color: #0ff;
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 1px;
}
.jukebox-track .jt-info small {
    color: rgba(0,255,255,0.4);
    font-size: 0.6rem;
}
.jukebox-track .jt-status {
    font-size: 0.65rem;
    color: rgba(0,255,255,0.4);
    flex-shrink: 0;
    letter-spacing: 1px;
}
.jukebox-track.active .jt-status {
    color: #0ff;
}
@keyframes jukeboxPulse {
    0%   { text-shadow: 0 0 5px rgba(0,255,255,0.3); }
    50%  { text-shadow: 0 0 15px rgba(0,255,255,0.8); }
    100% { text-shadow: 0 0 5px rgba(0,255,255,0.3); }
}
.jukebox-track.active .jt-icon {
    animation: jukeboxPulse 1.5s ease infinite;
}

/* ── ROTATE DEVICE OVERLAY ─────────────────────────────────────────────────── */
/* Shown only when a mobile phone is in landscape (JS adds class to body).      */
#rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000e07;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    pointer-events: all;
    user-select: none;
}
body.show-rotate #rotate-overlay { display: flex; }

#rotate-icon {
    font-size: 4rem;
    animation: rotatePulse 1.4s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(0,255,120,0.5));
}
@keyframes rotatePulse {
    0%   { transform: rotate(0deg) scale(1);    }
    30%  { transform: rotate(90deg) scale(1.05); }
    60%  { transform: rotate(90deg) scale(1);   }
    100% { transform: rotate(0deg) scale(1);    }
}

#rotate-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    text-align: center;
}
#rotate-text span {
    display: block;
    color: #0f8;
    text-shadow: 0 0 10px rgba(0,255,120,0.4);
}
.rot-en { font-size: 1.1rem; font-weight: bold; }
.rot-es { font-size: 0.85rem; opacity: 0.65; }
.rot-pt { font-size: 0.85rem; opacity: 0.65; }
