/* Time Mission: Magma Mayhem - Game CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #0a0a1a;
    font-family: 'Orbitron', sans-serif;
    /* Ensure safe area padding on iOS */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD Overlay */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 100;
}

#hud > div {
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #00ffff;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 0 10px #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

/* HUD Logo */
#hud-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px !important;
    border: 2px solid #00ffff !important;
    gap: 0;
}

.hud-logo-time {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #00ffff;
    letter-spacing: 2px;
    text-shadow: 0 0 8px #00ffff;
    line-height: 1.2;
}

.hud-logo-mission {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #ffffff;
    letter-spacing: 1px;
    line-height: 1.2;
}

#level-display {
    color: #00ffff;
}

#score-display {
    color: #ffcc00;
    border-color: #ffcc00 !important;
    text-shadow: 0 0 10px #ffcc00 !important;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.3), inset 0 0 20px rgba(255, 204, 0, 0.1) !important;
}

#lives-display {
    font-size: 18px;
    letter-spacing: 5px;
    border-color: #ff3366 !important;
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.3), inset 0 0 20px rgba(255, 51, 102, 0.1) !important;
}

.heart {
    filter: drop-shadow(0 0 5px #ff0000);
    transition: all 0.3s ease;
}

.heart.lost {
    opacity: 0.2;
    filter: grayscale(100%);
}

/* Timer Bar */
#timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.8) !important;
    padding: 10px 16px !important;
    border: 2px solid #00ccff !important;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 204, 255, 0.3), inset 0 0 20px rgba(0, 204, 255, 0.1) !important;
}

#potential-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
    min-width: 45px;
}

#timer-bar {
    width: 120px;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00ccff;
    border-radius: 4px;
    overflow: hidden;
}

#timer-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00ff88, #00ffcc);
    transition: width 0.1s linear, background 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

#timer-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #00ccff;
    text-shadow: 0 0 5px #00ccff;
}

/* Vintage Arcade Start Screen */
.vintage-start {
    text-align: center;
    padding: 30px 50px;
    background: #000;
    border: 4px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.vintage-title {
    margin-bottom: 5px;
}

.title-time {
    font-family: 'Press Start 2P', monospace;
    font-size: 32px;
    color: #00ffff;
    display: block;
    letter-spacing: 8px;
    text-shadow: 0 0 10px #00ffff;
}

.title-mission {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    color: #ffffff;
    display: block;
    letter-spacing: 6px;
    margin-top: 5px;
}

.vintage-subtitle {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #ff6600;
    margin: 20px 0;
    letter-spacing: 4px;
    text-shadow: 0 0 10px #ff3300;
    animation: colorPulse 2s ease-in-out infinite;
}

@keyframes colorPulse {
    0%, 100% { color: #ff6600; text-shadow: 0 0 10px #ff3300; }
    50% { color: #ff3300; text-shadow: 0 0 20px #ff0000; }
}

.vintage-instructions {
    margin: 25px 0;
    padding: 10px;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
}

.vintage-instructions p {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #88ff88;
    letter-spacing: 2px;
}

.vintage-characters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
    pointer-events: auto;
}

.char-option {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #666;
    padding: 10px 15px;
    border: 2px solid #333;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 80px;
}

.char-option:hover {
    color: #ffcc00;
    border-color: #ffcc00;
    background: rgba(255, 204, 0, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
}

.char-option.selected {
    color: #00ffff;
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), inset 0 0 10px rgba(0, 255, 255, 0.1);
}

.char-option.selected:hover {
    color: #00ffff;
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.6), inset 0 0 10px rgba(0, 255, 255, 0.15);
}

.char-option span {
    display: block;
}

/* Character Preview Icons - CROSSY ROAD BLOCKY STYLE */
.char-preview-icon {
    width: 50px;
    height: 60px;
    position: relative;
}

/* CHICKEN - Blocky voxel style */
.chicken-icon .chicken-body {
    position: absolute;
    width: 28px;
    height: 26px;
    background: #ffdd33;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.chicken-icon .chicken-head {
    position: absolute;
    width: 24px;
    height: 20px;
    background: #ffdd33;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
}

.chicken-icon .chicken-comb {
    position: absolute;
    width: 4px;
    height: 8px;
    background: #ff2222;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: -4px 2px 0 #ff2222, 4px 4px 0 #ff2222;
}

.chicken-icon .chicken-beak {
    position: absolute;
    width: 10px;
    height: 6px;
    background: #ff6622;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%);
}

.chicken-icon .chicken-eye {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #111;
    bottom: 40px;
}

.chicken-icon .chicken-eye.left { left: 16px; }
.chicken-icon .chicken-eye.right { right: 16px; }

/* BANANA MAN - Blocky voxel style */
.banana-icon .banana-body {
    position: absolute;
    width: 22px;
    height: 42px;
    background: #ffe135;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0;
}

.banana-icon .banana-stem {
    position: absolute;
    width: 8px;
    height: 10px;
    background: #8b4513;
    bottom: 46px;
    left: 50%;
    transform: translateX(-50%);
}

.banana-icon .banana-face {
    position: absolute;
    width: 14px;
    height: 12px;
    background: #ffeecc;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.banana-icon .banana-eye {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #111;
    bottom: 32px;
    z-index: 3;
}

.banana-icon .banana-eye.left { left: 19px; }
.banana-icon .banana-eye.right { right: 19px; }

.banana-icon .banana-smile {
    position: absolute;
    width: 8px;
    height: 3px;
    background: #222;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.banana-icon .banana-arm {
    position: absolute;
    width: 6px;
    height: 12px;
    background: #ffeecc;
    bottom: 18px;
}

.banana-icon .banana-arm.left { left: 10px; transform: rotate(20deg); }
.banana-icon .banana-arm.right { right: 10px; transform: rotate(-20deg); }

/* SKIER - Blocky voxel style */
.skier-icon .skier-body {
    position: absolute;
    width: 24px;
    height: 22px;
    background: #2255cc;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.skier-icon .skier-head {
    position: absolute;
    width: 20px;
    height: 18px;
    background: #ffeecc;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
}

.skier-icon .skier-hat {
    position: absolute;
    width: 22px;
    height: 8px;
    background: #ff4444;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
}

.skier-icon .skier-pompom {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffffff;
    bottom: 54px;
    left: 50%;
    transform: translateX(-50%);
}

.skier-icon .skier-goggles {
    position: absolute;
    width: 18px;
    height: 6px;
    background: #ff4444;
    bottom: 38px;
    left: 50%;
    transform: translateX(-50%);
}

.skier-icon .skier-ski {
    position: absolute;
    width: 6px;
    height: 28px;
    background: #2255cc;
    bottom: 0;
}

.skier-icon .skier-ski.left { left: 14px; }
.skier-icon .skier-ski.right { right: 14px; }

/* TURTLE - Blocky voxel style */
.turtle-icon .turtle-shell {
    position: absolute;
    width: 38px;
    height: 10px;
    background: #2d8659;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 -8px 0 0 #2d8659, 0 -14px 0 -2px #2d8659;
}

.turtle-icon .turtle-pattern {
    position: absolute;
    width: 10px;
    height: 6px;
    background: #1a5c3a;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.turtle-icon .turtle-head {
    position: absolute;
    width: 14px;
    height: 12px;
    background: #3cb371;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    z-index: 2;
}

.turtle-icon .turtle-eye {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #111;
    bottom: 24px;
    z-index: 3;
}

.turtle-icon .turtle-eye.left { left: 20px; }
.turtle-icon .turtle-eye.right { right: 20px; }

.turtle-icon .turtle-leg {
    position: absolute;
    width: 8px;
    height: 6px;
    background: #3cb371;
}

.turtle-icon .turtle-leg.fl { bottom: 10px; left: 6px; }
.turtle-icon .turtle-leg.fr { bottom: 10px; right: 6px; }
.turtle-icon .turtle-leg.bl { bottom: 4px; left: 10px; }
.turtle-icon .turtle-leg.br { bottom: 4px; right: 10px; }

/* DELOREAN - Back to the Future car */
.delorean-icon .delorean-body {
    position: absolute;
    width: 44px;
    height: 14px;
    background: linear-gradient(180deg, #d0d0d0 0%, #a0a0a0 100%);
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

.delorean-icon .delorean-cabin {
    position: absolute;
    width: 26px;
    height: 12px;
    background: linear-gradient(180deg, #c0c0c0 0%, #909090 100%);
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px 2px 0 0;
}

.delorean-icon .delorean-window {
    position: absolute;
    width: 20px;
    height: 8px;
    background: #1a1a2e;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
}

.delorean-icon .delorean-wheel {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #222;
    border-radius: 50%;
}

.delorean-icon .delorean-wheel.fl { bottom: 8px; left: 8px; }
.delorean-icon .delorean-wheel.fr { bottom: 8px; right: 8px; }
.delorean-icon .delorean-wheel.bl { bottom: 8px; left: 14px; }
.delorean-icon .delorean-wheel.br { bottom: 8px; right: 14px; }

.delorean-icon .delorean-glow {
    position: absolute;
    width: 40px;
    height: 3px;
    background: #00ffff;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px #00ffff, 0 0 12px #00ffff;
    animation: deloreanGlow 1.5s ease-in-out infinite;
}

@keyframes deloreanGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Start Button */
.start-btn {
    font-family: 'Press Start 2P', monospace !important;
    font-size: 14px !important;
    padding: 20px 50px !important;
    margin: 25px 0 10px !important;
    background: linear-gradient(180deg, #00ff88 0%, #00aa55 100%) !important;
    color: #001a00 !important;
    border: 3px solid #00ff88 !important;
    box-shadow: 0 6px 0 #006633, 0 0 40px rgba(0, 255, 136, 0.5) !important;
    animation: startPulse 1.5s ease-in-out infinite;
}

.start-btn:hover {
    background: linear-gradient(180deg, #44ffaa 0%, #00cc66 100%) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 0 #006633, 0 0 60px rgba(0, 255, 136, 0.7) !important;
}

.start-btn:active {
    transform: translateY(4px) !important;
    box-shadow: 0 2px 0 #006633, 0 0 20px rgba(0, 255, 136, 0.4) !important;
}

@keyframes startPulse {
    0%, 100% { box-shadow: 0 6px 0 #006633, 0 0 40px rgba(0, 255, 136, 0.5); }
    50% { box-shadow: 0 6px 0 #006633, 0 0 60px rgba(0, 255, 136, 0.8); }
}

.vintage-start-prompt {
    margin: 10px 0 20px;
    pointer-events: none;
}

.vintage-start-prompt span {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #666;
    pointer-events: none;
}

.blink {
    animation: blinkText 1s step-start infinite;
}

@keyframes blinkText {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.vintage-controls {
    margin-top: 20px;
}

.vintage-controls p {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #555;
    letter-spacing: 1px;
    margin: 4px 0;
}

/* Show desktop controls on desktop, mobile controls on mobile */
.vintage-controls .mobile-controls {
    display: none;
}

@media (max-width: 768px), (pointer: coarse) {
    .vintage-controls .desktop-controls {
        display: none;
    }
    .vintage-controls .mobile-controls {
        display: block;
    }
}

.vintage-copyright {
    margin-top: 20px;
}

.vintage-copyright p {
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #333;
}

/* Keep original logo for other screens */
.time-mission-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-mission-logo.small {
    transform: scale(0.6);
    margin-bottom: 5px;
}

.logo-time {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: #00ffff;
    letter-spacing: 10px;
    text-shadow: 0 0 10px #00ffff;
}

.logo-mission {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 12px;
    text-shadow: 0 0 5px #ffffff;
    margin-top: -2px;
}

.game-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(180deg, #ff6600 0%, #ff3300 50%, #cc0000 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 10px #ff3300) drop-shadow(0 0 20px #ff0000);
    margin-top: 10px;
    letter-spacing: 8px;
    animation: magmaPulse 2s ease-in-out infinite;
}

@keyframes magmaPulse {
    0%, 100% { filter: drop-shadow(0 0 10px #ff3300) drop-shadow(0 0 20px #ff0000); }
    50% { filter: drop-shadow(0 0 20px #ff6600) drop-shadow(0 0 40px #ff3300); }
}

/* Overlay Screens */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(8px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: #fff;
    padding: 40px 60px;
    background: linear-gradient(180deg, #1a1a3a 0%, #0a0a1a 100%);
    border: 3px solid #00ffff;
    border-radius: 20px;
    box-shadow:
        0 0 50px rgba(0, 255, 255, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    max-width: 600px;
}

.start-content {
    max-width: 700px;
}

.overlay-content h1 {
    font-size: 28px;
    margin-bottom: 25px;
    color: #00ffff;
    text-shadow: 0 0 20px #00ffff;
    letter-spacing: 3px;
}

.overlay-content p {
    font-size: 14px;
    margin-bottom: 12px;
    color: #aaccff;
    line-height: 1.6;
}


/* Character Selection */
.character-select {
    margin: 25px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    border: 2px solid #444;
}

.character-select h3 {
    font-size: 14px;
    color: #00ffff;
    margin-bottom: 15px;
    letter-spacing: 3px;
}

.character-options {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.character-option {
    width: 90px;
    padding: 12px;
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.character-option:hover {
    border-color: #00ffff;
    transform: translateY(-3px);
}

.character-option.selected {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.char-preview {
    width: 50px;
    height: 50px;
    margin: 0 auto 8px;
    border-radius: 8px;
}

.chicken-preview {
    background: linear-gradient(180deg, #ffdd33 60%, #ff6622 100%);
}

.robot-preview {
    background: linear-gradient(180deg, #88aacc 60%, #445566 100%);
}

.alien-preview {
    background: linear-gradient(180deg, #44ff88 60%, #228844 100%);
}

.ninja-preview {
    background: linear-gradient(180deg, #333344 60%, #111122 100%);
}

.character-option span {
    font-size: 10px;
    color: #aaa;
    display: block;
}

.character-option.selected span {
    color: #00ffff;
}

/* Game Buttons */
.game-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 18px 50px;
    margin-top: 20px;
    background: linear-gradient(180deg, #00ffff 0%, #0088aa 100%);
    color: #001122;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 5px 0 #006688, 0 0 30px rgba(0, 255, 255, 0.4);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 #006688, 0 0 50px rgba(0, 255, 255, 0.6);
    background: linear-gradient(180deg, #66ffff 0%, #00aacc 100%);
}

.game-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #006688, 0 0 20px rgba(0, 255, 255, 0.3);
}

/* Countdown Display */
#countdown-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.countdown-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 200px;
    font-weight: 900;
    color: #00ffff;
    text-shadow:
        0 0 20px #00ffff,
        0 0 40px #00ffff,
        0 0 80px #00ffff;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* GO text */
.countdown-number.go {
    color: #44ff44;
    text-shadow:
        0 0 20px #44ff44,
        0 0 40px #44ff44,
        0 0 80px #44ff44;
}

/* Pause Indicator */
#pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 900;
    color: #00ffff;
    text-shadow: 0 0 30px #00ffff;
    z-index: 150;
    animation: pulse 1s infinite;
    letter-spacing: 10px;
}

#pause-indicator.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Music Toggle Button */
.music-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ffff;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
}

.music-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.1);
}

.music-btn.muted {
    border-color: #666;
    opacity: 0.5;
}

/* Score popup animation */
.score-popup {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    pointer-events: none;
    animation: scoreFloat 1s ease-out forwards;
    z-index: 300;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.5);
    }
}

/* Damage flash effect */
.damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.5);
    pointer-events: none;
    z-index: 50;
    animation: damageFlash 0.3s ease-out;
}

@keyframes damageFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* Level transition */
.level-transition {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    color: #00ffff;
    text-shadow: 0 0 30px #00ffff;
    z-index: 250;
    animation: levelPop 1.5s ease-out forwards;
    letter-spacing: 5px;
}

@keyframes levelPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Tutorial Popup */
#tutorial-popup {
    background: rgba(0, 0, 0, 0.95);
}

.tutorial-content {
    text-align: center;
    color: #fff;
    padding: 30px 50px;
    background: linear-gradient(180deg, #1a1a3a 0%, #0a0a1a 100%);
    border: 3px solid #00ffff;
    border-radius: 16px;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.4);
    max-width: 400px;
    pointer-events: auto;
}

.tutorial-content h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #00ffff;
    margin-bottom: 20px;
    letter-spacing: 2px;
    text-shadow: 0 0 15px #00ffff;
}

.tutorial-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.tutorial-main {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 15px;
    line-height: 1.5;
}

.tutorial-detail {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: #aaccff;
    margin-bottom: 10px;
    line-height: 1.4;
}

.tutorial-content .blue-text {
    color: #00ccff;
    font-weight: 700;
    text-shadow: 0 0 8px #00ccff;
}

.tutorial-content .green-text {
    color: #00ff88;
    font-weight: 700;
    text-shadow: 0 0 8px #00ff88;
}

.tutorial-score-example {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
}

.tutorial-score-example .score-high {
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
}

.tutorial-score-example .score-low {
    color: #ff4444;
    text-shadow: 0 0 10px #ff4444;
}

.tutorial-content .game-btn {
    margin-top: 15px;
    padding: 12px 40px;
    font-size: 14px;
    pointer-events: auto;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    /* Mobile HUD - Single row compact layout with safe area */
    #hud {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        gap: 4px;
        padding: 12px 8px 6px 8px;
        padding-top: calc(12px + env(safe-area-inset-top));
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
        background: rgba(0, 0, 0, 0.85);
        min-height: 40px;
    }

    #hud > div {
        font-size: 8px;
        padding: 4px 8px;
        border-width: 1px;
        white-space: nowrap;
    }

    #hud-logo {
        display: none; /* Hide logo on mobile to save space */
    }

    .hud-logo-time, .hud-logo-mission {
        font-size: 8px;
    }

    #level-display {
        order: 1;
        flex: 0 0 auto;
        text-align: center;
    }

    #score-display {
        order: 2;
        flex: 0 0 auto;
        text-align: center;
    }

    #lives-display {
        order: 3;
        font-size: 12px;
        letter-spacing: 1px;
        padding: 4px 6px;
    }

    /* Hide timer container in top HUD on mobile - show separately */
    #timer-container {
        position: fixed;
        top: auto;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        order: 4;
        width: auto;
        justify-content: center;
        padding: 8px 16px !important;
        margin-top: 0;
        z-index: 100;
        background: rgba(0, 0, 0, 0.85) !important;
        border-radius: 8px;
    }

    #potential-score {
        font-size: 16px;
        min-width: 35px;
    }

    #timer-bar {
        width: 80px;
        height: 10px;
    }

    #timer-label {
        font-size: 7px;
    }

    /* Mobile overlay content */
    .overlay-content {
        padding: 20px 20px;
        margin: 10px;
        max-width: 95vw;
    }

    .overlay-content h1 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .overlay-content p {
        font-size: 11px;
    }

    .game-btn {
        font-size: 11px;
        padding: 14px 28px;
    }

    /* Mobile start screen */
    .vintage-start {
        padding: 20px 15px;
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    .title-time {
        font-size: 22px;
        letter-spacing: 4px;
    }

    .title-mission {
        font-size: 14px;
        letter-spacing: 3px;
    }

    .vintage-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
        margin: 12px 0;
    }

    .vintage-instructions {
        margin: 15px 0;
        padding: 8px;
    }

    .vintage-instructions p {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .vintage-characters {
        gap: 6px;
        margin: 15px 0;
    }

    .char-option {
        padding: 8px 10px;
        min-width: 65px;
        font-size: 6px;
    }

    .char-preview-icon {
        width: 40px;
        height: 48px;
        transform: scale(0.8);
    }

    .start-btn {
        font-size: 11px !important;
        padding: 16px 35px !important;
        margin: 18px 0 8px !important;
    }

    .vintage-start-prompt span {
        font-size: 8px;
    }

    .vintage-controls p {
        font-size: 7px;
    }

    .vintage-copyright p {
        font-size: 6px;
    }

    /* Mobile tutorial */
    .tutorial-content {
        padding: 20px 25px;
        max-width: 90vw;
    }

    .tutorial-content h2 {
        font-size: 14px;
    }

    .tutorial-icon {
        font-size: 36px;
        margin-bottom: 15px;
    }

    .tutorial-main {
        font-size: 13px;
    }

    .tutorial-detail {
        font-size: 11px;
    }

    .tutorial-score-example {
        font-size: 16px;
        padding: 12px;
    }

    /* Mobile countdown */
    .countdown-number {
        font-size: 100px;
    }

    /* Mobile level transition */
    .level-transition {
        font-size: 28px;
    }

    /* Mobile pause indicator */
    #pause-indicator {
        font-size: 32px;
        letter-spacing: 6px;
    }

    /* Mobile music button */
    .music-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        bottom: 15px;
        right: 15px;
    }
}

/* Extra small screens */
@media (max-width: 400px) {
    #hud > div {
        font-size: 8px;
        padding: 5px 8px;
    }

    #lives-display {
        font-size: 12px;
    }

    .title-time {
        font-size: 18px;
    }

    .title-mission {
        font-size: 12px;
    }

    .vintage-subtitle {
        font-size: 10px;
    }

    .char-option {
        min-width: 55px;
        padding: 6px 8px;
    }

    .start-btn {
        font-size: 10px !important;
        padding: 14px 28px !important;
    }
}

/* Touch device hint */
.touch-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: #666;
    text-align: center;
    pointer-events: none;
    z-index: 50;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Swipe indicator arrows */
.swipe-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    pointer-events: none;
    opacity: 0.4;
    z-index: 50;
}

.swipe-arrow {
    width: 40px;
    height: 40px;
    border: 2px solid #00ffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #00ffff;
}

/* Book Visit Link - Desktop (bottom of screen) */
#book-visit-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #ffcc00;
    text-decoration: none;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #ffcc00;
    border-radius: 8px;
    z-index: 100;
    transition: all 0.2s ease;
    text-shadow: 0 0 8px #ffcc00;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
    letter-spacing: 1px;
    white-space: nowrap;
}

#book-visit-link:hover {
    background: rgba(255, 204, 0, 0.2);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 0 25px rgba(255, 204, 0, 0.5);
}

/* Win Screen Discount Banner */
.discount-banner {
    display: block;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #00ff88;
    text-decoration: none;
    padding: 20px 30px;
    margin: 25px 0;
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.2) 0%, rgba(0, 136, 68, 0.2) 100%);
    border: 3px solid #00ff88;
    border-radius: 12px;
    text-shadow: 0 0 15px #00ff88;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.4), inset 0 0 20px rgba(0, 255, 136, 0.1);
    animation: discountPulse 1.5s ease-in-out infinite;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.discount-banner:hover {
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.35) 0%, rgba(0, 136, 68, 0.35) 100%);
    transform: scale(1.03);
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.6), inset 0 0 30px rgba(0, 255, 136, 0.2);
}

@keyframes discountPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.4), inset 0 0 20px rgba(0, 255, 136, 0.1); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 136, 0.7), inset 0 0 30px rgba(0, 255, 136, 0.2); }
}

.win-content {
    max-width: 650px;
}

/* Mobile: Book visit link under score */
@media (max-width: 768px) {
    #book-visit-link {
        position: fixed;
        bottom: auto;
        top: calc(55px + env(safe-area-inset-top));
        left: 50%;
        transform: translateX(-50%);
        font-size: 7px;
        padding: 8px 14px;
        letter-spacing: 0.5px;
    }

    .discount-banner {
        font-size: 9px;
        padding: 14px 18px;
        margin: 18px 0;
        line-height: 1.5;
    }

    .win-content {
        max-width: 95vw;
    }
}

@media (max-width: 400px) {
    #book-visit-link {
        font-size: 6px;
        padding: 6px 10px;
    }

    .discount-banner {
        font-size: 7px;
        padding: 12px 14px;
    }
}

/* ============================================
   LEADERBOARD STYLES
   ============================================ */

/* Leaderboard Button on Home Screen */
.leaderboard-btn {
    font-family: 'Press Start 2P', monospace !important;
    font-size: 10px !important;
    padding: 14px 30px !important;
    margin: 10px 0 !important;
    background: linear-gradient(180deg, #ffcc00 0%, #cc9900 100%) !important;
    color: #1a1a00 !important;
    border: 2px solid #ffcc00 !important;
    box-shadow: 0 4px 0 #996600, 0 0 20px rgba(255, 204, 0, 0.4) !important;
}

.leaderboard-btn:hover {
    background: linear-gradient(180deg, #ffdd44 0%, #ddaa00 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #996600, 0 0 30px rgba(255, 204, 0, 0.6) !important;
}

/* Score Submit Section */
.score-submit-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    border: 2px solid #00ffff;
}

.submit-prompt {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #00ffff;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.name-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.player-name-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #00ffff;
    border-radius: 6px;
    color: #ffffff;
    text-transform: uppercase;
    width: 180px;
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
}

.player-name-input:focus {
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.player-name-input::placeholder {
    color: #666;
}

.submit-btn {
    font-family: 'Press Start 2P', monospace !important;
    font-size: 10px !important;
    padding: 12px 20px !important;
    margin: 0 !important;
}

.submit-status {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    margin-top: 10px;
    min-height: 16px;
    transition: all 0.2s ease;
}

.submit-status.success {
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
}

.submit-status.error {
    color: #ff4444;
    text-shadow: 0 0 10px #ff4444;
}

/* Leaderboard Container */
.leaderboard-container {
    margin: 15px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid #ffcc00;
    max-height: 280px;
    overflow-y: auto;
}

.leaderboard-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.leaderboard-main-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    color: #ffcc00;
    text-shadow: 0 0 15px #ffcc00;
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(30, 30, 50, 0.8);
    border-radius: 6px;
    border: 1px solid #333;
    transition: all 0.2s ease;
}

.leaderboard-entry.top-three {
    border-color: #ffcc00;
    background: rgba(255, 204, 0, 0.1);
}

.leaderboard-entry.highlighted {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
    animation: highlightPulse 1.5s ease-in-out infinite;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 136, 0.6); }
}

.entry-rank {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #ffcc00;
    min-width: 40px;
    text-align: center;
}

.entry-char {
    font-size: 18px;
    min-width: 30px;
    text-align: center;
}

.entry-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    flex: 1;
    text-align: left;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-score {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #00ffff;
    text-shadow: 0 0 8px #00ffff;
    min-width: 40px;
    text-align: right;
}

.no-scores {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: #666;
    text-align: center;
    padding: 20px;
}

/* Leaderboard Overlay Content */
.leaderboard-overlay-content {
    min-width: 350px;
    max-width: 500px;
}

.leaderboard-overlay-content .leaderboard-list {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Game Over Content - Adjust for leaderboard */
.game-over-content {
    max-width: 450px;
}

/* Mobile Leaderboard Styles */
@media (max-width: 768px) {
    .leaderboard-btn {
        font-size: 8px !important;
        padding: 10px 20px !important;
    }

    .score-submit-section {
        padding: 12px;
        margin: 15px 0;
    }

    .submit-prompt {
        font-size: 8px;
    }

    .player-name-input {
        font-size: 10px;
        padding: 10px 12px;
        width: 140px;
    }

    .submit-btn {
        font-size: 8px !important;
        padding: 10px 14px !important;
    }

    .submit-status {
        font-size: 7px;
    }

    .leaderboard-container {
        padding: 10px;
        max-height: 200px;
    }

    .leaderboard-title {
        font-size: 11px;
    }

    .leaderboard-main-title {
        font-size: 14px;
    }

    .leaderboard-entry {
        padding: 8px 10px;
    }

    .entry-rank {
        font-size: 10px;
        min-width: 32px;
    }

    .entry-char {
        font-size: 14px;
        min-width: 24px;
    }

    .entry-name {
        font-size: 10px;
    }

    .entry-score {
        font-size: 10px;
        min-width: 32px;
    }

    .leaderboard-overlay-content {
        min-width: 280px;
        max-width: 95vw;
    }

    .leaderboard-overlay-content .leaderboard-list {
        max-height: 280px;
    }

    .game-over-content {
        max-width: 95vw;
    }
}

@media (max-width: 400px) {
    .player-name-input {
        width: 120px;
        font-size: 9px;
    }

    .name-input-container {
        gap: 6px;
    }

    .leaderboard-container {
        max-height: 160px;
    }

    .entry-rank {
        font-size: 9px;
        min-width: 28px;
    }

    .entry-name {
        font-size: 9px;
    }

    .entry-score {
        font-size: 9px;
    }
}
