html {
    width: 100%;
    min-height: 100%;
}

:root {
    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --android-board-size: min(52vw, 72dvh);
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center; 
    align-items: center;    
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #1a2a3a 0%, #0f172a 100%);
    font-family: 'Press Start 2P', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, cursive;
    overflow: hidden;
    color: #ecf0f1;
}

/* Background Canvas */
#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    padding: calc(var(--sat) + 8px) 14px calc(var(--sab) + 8px);
    height: 100%;
    overflow-y: auto;
    z-index: -1;
    background: linear-gradient(135deg, #1a2a3a 0%, #0f172a 100%);
}
/* Animated background */
@keyframes animatedBackground {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Game Layout */
.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100vw;
    height: 100dvh;
    position: relative;
    z-index: 1;
    padding: env(safe-area-inset-top, 6px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 6px) env(safe-area-inset-left, 10px);
    box-sizing: border-box;
    gap: 0;
}

.game-stage {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 6px 0;
    box-sizing: border-box;
    /* Size container so children can use cqw/cqh/cqmin */
    container-type: size;
    container-name: game-stage;
}

/* Boost gauge — compact strip inside action-cluster, below buttons */
#boost-gauge-strip {
    width: 100%;
    padding: 6px 4px 0;
    box-sizing: border-box;
}

#boost-gauge-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: visible;
}

#boost-gauge-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, #0077cc, #00e5ff);
    transition: width 0.12s ease;
}

#boost-gauge-fill.is-full {
    background: linear-gradient(90deg, #00aaff, #00e5ff);
    box-shadow: 0 0 5px rgba(0, 229, 255, 0.9), 0 0 10px rgba(0, 180, 255, 0.5);
    animation: boost-full-pulse 1.2s ease-in-out infinite;
}

@keyframes boost-full-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 229, 255, 0.9), 0 0 10px rgba(0, 180, 255, 0.5); }
    50%       { box-shadow: 0 0 8px rgba(0, 229, 255, 1.0), 0 0 16px rgba(0, 200, 255, 0.8); }
}

/* â”€â”€â”€ HUD Top Bar â”€â”€â”€ */
#game-hud {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    z-index: 5;
}

.hud-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}

.hud-left {
    justify-content: flex-start;
}

.hud-center {
    justify-content: center;
    flex-shrink: 1;
}

.hud-right {
    justify-content: flex-end;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1.5px solid rgba(74, 104, 217, 0.4);
    background: rgba(10, 18, 32, 0.85);
    box-shadow: 0 0 8px rgba(74, 104, 217, 0.1), inset 0 0 6px rgba(74, 104, 217, 0.05);
    min-width: 0;
    font-size: 0.72em;
    transition: box-shadow 0.3s ease;
    flex-shrink: 1;
    white-space: nowrap;
}

.hud-label {
    font-size: 0.55em;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(236, 240, 241, 0.45);
    margin-bottom: 3px;
}

/* Score â€” prominent, golden glow */
.hud-score {
    border-color: rgba(241, 196, 15, 0.5);
    box-shadow: 0 0 14px rgba(241, 196, 15, 0.12), inset 0 0 8px rgba(241, 196, 15, 0.04);
    padding: 6px 18px;
}
.hud-score #score {
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.7), 0 0 20px rgba(241, 196, 15, 0.3);
    font-size: 1.5em;
}
.hud-score .hud-label { color: rgba(241, 196, 15, 0.55); }

/* Power â€” green accent */
.hud-power { border-color: rgba(46, 204, 113, 0.35); box-shadow: 0 0 8px rgba(46, 204, 113, 0.08); }
.hud-power-content { display: flex; flex-direction: column; align-items: center; gap: 1px; }
#power-up { color: #2ecc71; font-size: 0.85em; text-shadow: 0 0 6px rgba(46, 204, 113, 0.5); white-space: nowrap; }
#power-up-timer { color: #e74c3c; font-size: 0.8em; display: none; animation: pulseText 1.5s infinite alternate; }

/* Bombs â€” orange accent */
.hud-bombs { border-color: rgba(230, 126, 34, 0.4); box-shadow: 0 0 8px rgba(230, 126, 34, 0.1); }
.hud-bombs #bombs { color: #e67e22; text-shadow: 0 0 8px rgba(230, 126, 34, 0.6); font-size: 1.1em; }

/* Best â€” cyan accent */
.hud-best {
    border-color: rgba(139, 233, 253, 0.4);
    box-shadow: 0 0 10px rgba(139, 233, 253, 0.1), inset 0 0 6px rgba(139, 233, 253, 0.03);
    padding: 6px 18px;
}
.hud-best #high-score { color: #8be9fd; text-shadow: 0 0 8px rgba(139, 233, 253, 0.6); font-size: 1.2em; }
.hud-best .hud-label { color: rgba(139, 233, 253, 0.45); }

/* Boss health â€” red, appears inline in center group */
.hud-boss { border-color: rgba(231, 76, 60, 0.5); box-shadow: 0 0 10px rgba(231, 76, 60, 0.15); color: #e74c3c; font-size: 0.7em; }
.hud-wave { border-color: rgba(155, 89, 182, 0.5); box-shadow: 0 0 10px rgba(155, 89, 182, 0.15); }
.hud-wave #wave-number { color: #a855f7; text-shadow: 0 0 8px rgba(168, 85, 247, 0.8); font-size: 1.1em; }

/* Controller status â€” hidden from HUD by default, shown only as a small indicator */
#controller-status {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(139, 233, 253, 0.6) !important;
    border: none;
    background: transparent;
    box-shadow: none;
    font-size: 0.5em;
    padding: 2px 8px;
    pointer-events: none;
}

@keyframes pulseText {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f1c40f !important;
    font-size: 2em;
    z-index: 6;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.8);
    animation: countdownPulse 1s infinite alternate;
}

@keyframes countdownPulse {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(1.15); }
}

/* â”€â”€â”€ Virtual Joystick â”€â”€â”€ */
#joystick-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    z-index: 10;
}

.joystick-base {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 35, 60, 0.55) 0%, rgba(10, 18, 36, 0.7) 100%);
    border: 2px solid rgba(74, 104, 217, 0.45);
    box-shadow: 0 0 20px rgba(74, 104, 217, 0.2), inset 0 0 15px rgba(74, 104, 217, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-base.active {
    border-color: rgba(74, 104, 217, 0.8);
    box-shadow: 0 0 30px rgba(74, 104, 217, 0.4), inset 0 0 20px rgba(74, 104, 217, 0.15);
}

.joystick-thumb {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(120, 150, 230, 0.7), rgba(74, 104, 217, 0.5));
    border: 2px solid rgba(140, 170, 255, 0.6);
    box-shadow: 0 0 14px rgba(74, 104, 217, 0.5);
    will-change: transform;
    pointer-events: none;
}

/* â”€â”€â”€ D-Pad Zone â”€â”€â”€ */
#dpad-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    flex-shrink: 0;
    z-index: 10;
}

.dpad {
    display: grid;
    grid-template-columns: 44px 44px 44px;
    grid-template-rows: 44px 44px 44px;
    gap: 3px;
}

.dpad-btn {
    border: none;
    background: rgba(74, 104, 217, 0.35);
    border: 2px solid rgba(74, 104, 217, 0.5);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    transition: background 0.08s, transform 0.08s;
}

.dpad-btn:active,
.dpad-btn.pressed {
    background: rgba(74, 104, 217, 0.7);
    transform: scale(0.92);
    box-shadow: 0 0 12px rgba(74, 104, 217, 0.6);
}

.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-center{ grid-column: 2; grid-row: 2; background: rgba(30, 40, 60, 0.5); border-color: rgba(60, 80, 140, 0.3); pointer-events: none; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }

/* â”€â”€â”€ Action Cluster (right side) â”€â”€â”€ */
#action-cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    flex-shrink: 0;
    z-index: 10;
}

.action-btn {
    border: none;
    font-family: 'Press Start 2P', cursive;
    color: white;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.action-btn.pressed,
.action-btn:active {
    transform: scale(0.9);
}

/* Action main cluster â€” 2-row Ã— 2-col grid:
   col1: [pwr] [bomb]
   col2: [shoot spans both rows] */
.action-main {
    display: grid;
    grid-template-columns: 56px 56px;
    grid-template-rows: 56px 56px;
    gap: 8px;
    align-items: center;
    justify-items: center;
}

/* Pause button â€” sits in HUD right group beside high score */
.pause-btn {
    width: 46px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e67e22, #d35400);
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(230, 126, 34, 0.4), 0 3px 8px rgba(0,0,0,0.4);
    flex-shrink: 0;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    cursor: pointer;
    border: none;
    color: white;
}

.pause-btn.pressed,
.pause-btn:active {
    box-shadow: 0 0 22px rgba(230, 126, 34, 0.6);
}

/* Power button â€” top-left */
.power-btn {
    grid-column: 1;
    grid-row: 1;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #b06dd4, #9b59b6);
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(155, 89, 182, 0.4), 0 4px 10px rgba(0,0,0,0.3);
}

.power-btn.pressed,
.power-btn:active {
    box-shadow: 0 0 28px rgba(155, 89, 182, 0.7);
}

/* Bomb button â€” bottom-left */
.bomb-btn {
    grid-column: 1;
    grid-row: 2;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f0913a, #e67e22);
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(230, 126, 34, 0.4), 0 4px 10px rgba(0,0,0,0.3);
}

.bomb-btn.pressed,
.bomb-btn:active {
    box-shadow: 0 0 28px rgba(230, 126, 34, 0.7);
}

/* Shoot button â€” right column, spans both rows */
.shoot-btn {
    grid-column: 2;
    grid-row: 1;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #3ddc84, #27ae60);
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(46, 204, 113, 0.45), 0 4px 10px rgba(0,0,0,0.3);
}

.shoot-btn.pressed,
.shoot-btn:active {
    box-shadow: 0 0 28px rgba(46, 204, 113, 0.7);
}

/* Boost button -- bottom-right */
.boost-btn {
    grid-column: 2;
    grid-row: 2;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #00e5ff, #0099bb);
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(0, 200, 255, 0.45), 0 4px 10px rgba(0,0,0,0.3);
}

.boost-btn.pressed,
.boost-btn:active {
    box-shadow: 0 0 28px rgba(0, 229, 255, 0.8);
}

#game-container {
    position: relative;
    box-sizing: border-box;
    aspect-ratio: 1;
    /* cqmin = smaller of container width/height â€” always fits game-stage */
    width: min(90cqmin, 600px);
    height: min(90cqmin, 600px);
    max-width: 100%;
    max-height: 100%;
    background: rgba(8, 14, 28, 0.9);
    border: 2px solid rgba(74, 104, 217, 0.6);
    border-radius: 12px;
    box-shadow: 
        0 0 20px rgba(74, 104, 217, 0.25),
        0 0 60px rgba(74, 104, 217, 0.08),
        inset 0 0 30px rgba(74, 104, 217, 0.06);
    margin: 0;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    flex-shrink: 1;
}

#boost-status {
    position: relative;
    z-index: 8;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    width: min(72%, 360px);
    min-width: 180px;
    margin: 0 auto max(8px, env(safe-area-inset-bottom, 0px));
    padding: 6px 8px;
    box-sizing: border-box;
    border: 1px solid rgba(0, 200, 255, 0.42);
    border-radius: 9px;
    background: rgba(5, 14, 31, 0.78);
    box-shadow: 0 3px 18px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(5px);
}

#btn-boost-desktop {
    flex: 0 0 auto;
    min-height: 27px;
    padding: 0 8px;
    border: 1px solid rgba(0, 229, 255, 0.65);
    border-radius: 5px;
    color: #dffaff;
    background: rgba(0, 123, 185, 0.55);
    font: 0.5em 'Press Start 2P', cursive;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.7);
}

#btn-boost-desktop:hover,
#btn-boost-desktop:focus-visible {
    background: rgba(0, 182, 255, 0.75);
    outline: none;
}

#btn-boost-desktop kbd {
    display: inline-block;
    margin-left: 5px;
    color: rgba(255, 255, 255, 0.68);
    font: inherit;
    font-size: 0.78em;
}

#boost-status #boost-gauge-track {
    flex: 1 1 auto;
    min-width: 40px;
    height: 7px;
}

@media (max-width: 520px) {
    #boost-status {
        width: calc(100% - 24px);
        margin-bottom: max(6px, env(safe-area-inset-bottom, 0px));
        gap: 6px;
        padding: 5px 6px;
    }

    #btn-boost-desktop {
        min-height: 24px;
        padding: 0 6px;
        font-size: 0.42em;
    }

    #btn-boost-desktop kbd { display: none; }
    #boost-status #boost-gauge-track { height: 6px; }
}

#game-container:hover {
    box-shadow: 
        0 0 25px rgba(74, 104, 217, 0.35),
        0 0 80px rgba(74, 104, 217, 0.12),
        inset 0 0 30px rgba(74, 104, 217, 0.08);
}

#game-board {
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(74, 104, 217, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 104, 217, 0.04) 1px, transparent 1px);
    background-size: 20px 20px;
}

#power-up-notification {
    position: absolute;
    bottom: -35px;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9em;
    text-align: center;
    z-index: 2;
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: slideUp 0.5s forwards;
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.game-over,
#game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(12px);
    animation: fadeInOverlay 0.4s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-card {
    background: rgba(20, 30, 48, 0.95);
    border: 3px solid #e74c3c;
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(231, 76, 60, 0.4),
        inset 0 0 15px rgba(231, 76, 60, 0.1);
    padding: 35px 45px;
    text-align: center;
    animation: scaleIn 0.4s ease;
    min-width: 220px;
}

.fade-in {
    animation: simpleFadeIn 0.3s ease forwards;
}

@keyframes simpleFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.fade-in-menu {
    animation: simpleFadeInMenu 0.3s ease forwards;
}

@keyframes simpleFadeInMenu {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.fade-out {
    animation: simpleFadeOut 0.2s ease forwards;
}

@keyframes simpleFadeOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-card h2,
.game-over h2 {
    font-size: 2em;
    color: #e74c3c;
    text-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
    margin-bottom: 20px;
    animation: pulsateText 1.5s infinite alternate;
}

@keyframes pulsateText {
    from { text-shadow: 0 0 15px rgba(231, 76, 60, 0.5); }
    to { text-shadow: 0 0 25px rgba(231, 76, 60, 0.9); }
}

.game-over-card p,
.game-over p {
    font-size: 1.5em;
    color: #ecf0f1;
    margin-bottom: 20px;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.game-over-card button,
.game-over button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-over-card button:hover,
.game-over button:hover {
    background: linear-gradient(135deg, #27ae60, #219653);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

#name-entry-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(12px);
    animation: fadeInOverlay 0.4s ease;
}

#name-entry-modal .modal-content {
    background: rgba(20, 30, 48, 0.9);
    border: 3px solid #4a68d9;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(74, 104, 217, 0.5);
    padding: 35px;
    text-align: center;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes scaleInCentered {
    from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#name-entry-modal h2 {
    font-size: 2em;
    color: #4a68d9;
    text-shadow: 0 0 10px rgba(74, 104, 217, 0.7);
    margin-bottom: 20px;
}

#name-entry-modal input[type="text"] {
    padding: 12px;
    font-size: 1.2em;
    border: 2px solid #4a68d9;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    background: rgba(15, 25, 40, 0.6);
    color: #ecf0f1;
    transition: all 0.3s ease;
}

#name-entry-modal input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(74, 104, 217, 0.5);
    border-color: #4a68d9;
}

#name-entry-modal button {
    padding: 15px 30px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#name-entry-modal button:hover {
    background: linear-gradient(135deg, #3653b3, #263c8f);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

/* â”€â”€â”€ First-Run Guide â”€â”€â”€ */
#first-run-guide {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 20, 0.92);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 16px;
    box-sizing: border-box;
    animation: fadeInOverlay 0.4s ease;
}

.guide-card {
    background: rgba(14, 22, 42, 0.97);
    border: 2px solid rgba(74, 104, 217, 0.5);
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(74, 104, 217, 0.25), inset 0 0 30px rgba(74, 104, 217, 0.04);
    padding: 28px 24px 20px;
    width: min(520px, 100%);
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: scaleIn 0.35s ease;
    box-sizing: border-box;
}

.guide-slides-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    /* custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(74,104,217,0.5) transparent;
}

.guide-slides-wrap::-webkit-scrollbar {
    width: 4px;
}
.guide-slides-wrap::-webkit-scrollbar-thumb {
    background: rgba(74,104,217,0.5);
    border-radius: 4px;
}
.guide-slides-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.guide-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding-bottom: 8px;
}

.guide-slide.active {
    display: flex;
}

.guide-icon {
    font-size: 3em;
    line-height: 1;
    filter: drop-shadow(0 0 12px rgba(74,104,217,0.6));
}

.guide-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.75em, 2.5vw, 1em);
    color: #4a68d9;
    text-shadow: 0 0 14px rgba(74,104,217,0.7);
    line-height: 1.5;
    margin: 0;
}

.guide-subtitle {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.45em, 1.5vw, 0.6em);
    color: rgba(241,196,15,0.85);
    margin: 0 0 4px;
    line-height: 1.6;
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-list li {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42em, 1.4vw, 0.58em);
    color: rgba(236, 240, 241, 0.88);
    line-height: 1.7;
    padding: 8px 12px;
    background: rgba(74, 104, 217, 0.08);
    border-left: 3px solid rgba(74, 104, 217, 0.5);
    border-radius: 0 6px 6px 0;
}

.guide-list li strong {
    color: #f1c40f;
}

.guide-powerup-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    text-align: left;
}

.guide-pu-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    background: rgba(74, 104, 217, 0.08);
    border-left: 3px solid rgba(74, 104, 217, 0.4);
    border-radius: 0 6px 6px 0;
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.4em, 1.3vw, 0.54em);
    color: rgba(236, 240, 241, 0.88);
    line-height: 1.7;
}

.guide-pu-row span:first-child {
    font-size: 1.5em;
    flex-shrink: 0;
}

.guide-pu-row strong {
    color: #f1c40f;
}

/* Slide 5 (controller) special highlight */
.guide-slide:last-child .guide-icon {
    filter: drop-shadow(0 0 16px rgba(46,204,113,0.7));
}

.guide-slide:last-child .guide-title {
    color: #2ecc71;
    text-shadow: 0 0 14px rgba(46,204,113,0.6);
}

/* Dot indicators */
.guide-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.guide-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(74, 104, 217, 0.25);
    border: 1.5px solid rgba(74, 104, 217, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-dot.active {
    background: #4a68d9;
    box-shadow: 0 0 8px rgba(74, 104, 217, 0.7);
    transform: scale(1.25);
}

/* Navigation buttons */
.guide-nav-btns {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.guide-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.45em, 1.5vw, 0.6em);
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    white-space: nowrap;
}

.guide-btn-primary {
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: #fff;
    box-shadow: 0 4px 14px rgba(74,104,217,0.35);
}

.guide-btn-primary:hover { background: linear-gradient(135deg, #5574e8, #4060cc); transform: translateY(-2px); }

.guide-btn-secondary {
    background: rgba(74, 104, 217, 0.15);
    color: rgba(200,210,255,0.8);
    border: 1.5px solid rgba(74,104,217,0.3);
}

.guide-btn-secondary:hover { background: rgba(74, 104, 217, 0.25); transform: translateY(-2px); }

.guide-btn-skip {
    background: transparent;
    color: rgba(200, 200, 200, 0.45);
    font-size: clamp(0.38em, 1.2vw, 0.5em);
}

.guide-btn-skip:hover { color: rgba(200, 200, 200, 0.75); }

/* Last slide: swap Next for a big "Let's Play!" */
.guide-btn-done {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    box-shadow: 0 4px 14px rgba(46,204,113,0.4);
    padding: 12px 20px;
}

.guide-btn-done:hover { background: linear-gradient(135deg, #3ddc84, #2ecc71); transform: translateY(-2px); }

#instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 30, 48, 0.9);
    border: 3px solid #4a68d9;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(74, 104, 217, 0.5);
    padding: 25px;
    text-align: center;
    display: none;
    z-index: 11;
    overflow-y: hidden;
    width: 90vw;
    max-width: 600px;
    max-height: 80vh;
    animation: scaleInCentered 0.4s ease forwards;
    backdrop-filter: blur(8px);
}

#instructions h2 {
    font-size: 1.8em;
    color: #4a68d9;
    text-shadow: 0 0 10px rgba(74, 104, 217, 0.7);
    margin-bottom: 15px;
}

#instructions p, #instructions li {
    font-size: 1.1em;
    color: #ecf0f1;
    line-height: 1.6;
    margin-bottom: 10px;
}

#instructions b {
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

#instructions ul {
    list-style-type: none;
    padding-left: 20px;
}

#instructions ul li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
}

#instructions ul li::before {
    content: '\2192';
    position: absolute;
    left: 0;
    color: #4a68d9;
}

#instruction-categories {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.category-button {
    margin: 0;
    padding: 10px 20px;
    font-size: 0.9em;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.category-button:hover {
    background: linear-gradient(135deg, #3653b3, #263c8f);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.category-button.active {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: #2c3e50;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
}

.instruction-category {
    display: none;
    background: rgba(15, 25, 40, 0.5);
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
    max-height: 50vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4a68d9 rgba(15, 25, 40, 0.2);
}

.instruction-category.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.instruction-category h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #f1c40f;
    text-shadow: 0 0 8px rgba(241, 196, 15, 0.5);
}

.instruction-category::-webkit-scrollbar {
    width: 8px;
}

.instruction-category::-webkit-scrollbar-track {
    background: rgba(15, 25, 40, 0.2);
    border-radius: 10px;
}

.instruction-category::-webkit-scrollbar-thumb {
    background-color: #4a68d9;
    border-radius: 10px;
}

.android-only {
    display: none;
}

@media (max-width: 600px) {
    #instruction-categories {
        flex-direction: column;
        align-items: center;
    }
    
    .category-button {
        width: 80%;
        margin: 5px 0;
    }
}

#boss-warning {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.9), rgba(192, 57, 43, 0.9));
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.2em;
    z-index: 9999; /* Ensure it's above everything including modals */
    display: none;
    animation: bossWarningPulse 0.6s infinite alternate, slideDown 0.5s forwards;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.7);
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

@keyframes bossWarningPulse {
    from { transform: translateX(-50%) scale(1); }
    to { transform: translateX(-50%) scale(1.05); }
}

@keyframes slideDown {
    from { top: -50px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

/* ════════════════════════════════════════════════════════════
   MAIN MENU — Sci-Fi Retro Arcade
════════════════════════════════════════════════════════════ */

#main-menu {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at 30% 35%, rgba(22, 38, 62, 0.98) 0%, rgba(8, 14, 28, 1) 70%);
    z-index: 100;
    overflow: hidden;
}

/* ── Background: rotating geometry ── */
.geometric-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.07;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.geometric-pattern::before,
.geometric-pattern::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1.5px solid rgba(74, 104, 217, 0.5);
    animation: rotatePattern 40s linear infinite;
    will-change: transform;
}

.geometric-pattern::before {
    width: 900px;
    height: 900px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}

.geometric-pattern::after {
    width: 640px;
    height: 640px;
    border-radius: 60% 40% 40% 60% / 60% 30% 70% 40%;
    animation-duration: 22s;
    animation-direction: reverse;
    border-color: rgba(46, 204, 113, 0.25);
}

.hexagon-grid {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='40' viewBox='0 0 28.87 50' preserveAspectRatio='xMidYMid slice'%3E%3Cpath d='M0,25V0H28.87V50Z' fill='none' stroke='rgba(74, 104, 217, 0.15)' stroke-miterlimit='10'/%3E%3Cpath d='M14.44,12.5,0,25,14.44,37.5,28.87,25Z' fill='none' stroke='rgba(74, 104, 217, 0.15)' stroke-miterlimit='10'/%3E%3C/svg%3E");
    background-size: 80px 80px;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* CRT scanlines */
.menu-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.12) 3px,
        rgba(0, 0, 0, 0.12) 4px
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

/* Dot grid overlay */
#main-menu::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(74, 104, 217, 0.06) 1px, transparent 1px),
        radial-gradient(circle, rgba(241, 196, 15, 0.03) 1px, transparent 1px);
    background-size: 28px 28px, 18px 18px;
    background-position: 0 0, 14px 14px;
    opacity: 0.7;
    z-index: 0;
}

@keyframes rotatePattern {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Ambient light blobs ── */
.light-source {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(70px);
    z-index: 0;
}

.light-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(74, 104, 217, 0.5) 0%, transparent 70%);
    top: -200px;
    left: -80px;
    animation: lightFade 9s infinite alternate;
    will-change: opacity;
}

.light-2 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(46, 204, 113, 0.3) 0%, transparent 70%);
    bottom: -140px;
    right: -60px;
    animation: lightFade 11s infinite alternate-reverse;
    will-change: opacity;
}

.light-3 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(241, 196, 15, 0.2) 0%, transparent 70%);
    bottom: -80px;
    left: 25%;
    animation: lightFade 7s 1s infinite alternate;
    will-change: opacity;
}

@keyframes lightFade {
    0%   { opacity: 0.2; }
    100% { opacity: 0.5; }
}

/* ── Menu container card ── */
.menu-container {
    position: relative;
    z-index: 2;
    width: min(520px, 90vw);
    padding: 36px 48px 32px;
    background: linear-gradient(
        155deg,
        rgba(20, 32, 54, 0.88) 0%,
        rgba(12, 20, 38, 0.94) 60%,
        rgba(8, 14, 28, 0.97) 100%
    );
    border-radius: 20px;
    border: 1.5px solid rgba(74, 104, 217, 0.55);
    box-shadow:
        0 0 0 1px rgba(74, 104, 217, 0.1),
        0 0 45px rgba(74, 104, 217, 0.22),
        0 0 90px rgba(74, 104, 217, 0.08),
        0 32px 64px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 0 24px rgba(74, 104, 217, 0.07);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: menuEntrance 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes menuEntrance {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Inner highlight overlays */
.menu-container::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 19px;
    background: linear-gradient(
        135deg,
        rgba(74, 104, 217, 0.1) 0%,
        transparent 50%,
        rgba(46, 204, 113, 0.04) 100%
    );
    pointer-events: none;
}

.menu-container::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 19px;
    background: linear-gradient(-45deg, rgba(241, 196, 15, 0.05) 0%, transparent 55%);
    pointer-events: none;
}

/* ── Corner HUD accents ── */
.corner-decoration {
    position: absolute;
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.top-left {
    top: 14px;
    left: 14px;
    border-top: 2px solid rgba(74, 104, 217, 0.75);
    border-left: 2px solid rgba(74, 104, 217, 0.75);
    border-top-left-radius: 6px;
}

.top-right {
    top: 14px;
    right: 14px;
    border-top: 2px solid rgba(74, 104, 217, 0.75);
    border-right: 2px solid rgba(74, 104, 217, 0.75);
    border-top-right-radius: 6px;
}

.bottom-left {
    bottom: 14px;
    left: 14px;
    border-bottom: 2px solid rgba(74, 104, 217, 0.75);
    border-left: 2px solid rgba(74, 104, 217, 0.75);
    border-bottom-left-radius: 6px;
}

.bottom-right {
    bottom: 14px;
    right: 14px;
    border-bottom: 2px solid rgba(74, 104, 217, 0.75);
    border-right: 2px solid rgba(74, 104, 217, 0.75);
    border-bottom-right-radius: 6px;
}

/* ── Pixel snake logo ── */
.menu-snake-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    animation: fadeSlideDown 0.4s 0.05s ease both;
    will-change: transform, opacity;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.snake-svg {
    width: 116px;
    height: 70px;
    overflow: visible;
    filter:
        drop-shadow(0 0 6px rgba(46, 204, 113, 0.85))
        drop-shadow(0 0 16px rgba(46, 204, 113, 0.4));
    animation: snakeBreathe 3.5s ease-in-out infinite;
    will-change: opacity;
}

@keyframes snakeBreathe {
    0%, 100% { opacity: 0.9; }
    50%       { opacity: 1; }
}

/* Hide legacy inline snake icons */
.snake-icon {
    display: none;
}

/* ── Game title ── */
.game-title {
    position: relative;
    margin-bottom: 26px;
    text-align: center;
    animation: fadeSlideDown 0.4s 0.12s ease both;
    will-change: transform, opacity;
}

.game-title h1 {
    font-size: clamp(1.3rem, 4vw, 2.4rem);
    color: #f1c40f;
    text-shadow:
        0 0 10px rgba(241, 196, 15, 0.9),
        0 0 28px rgba(241, 196, 15, 0.45),
        0 0 55px rgba(241, 196, 15, 0.18);
    margin: 0 0 10px;
    padding: 0;
    line-height: 1.2;
    letter-spacing: 1px;
    position: relative;
}

/* Glow shimmer via pseudo element — opacity only, GPU composited */
.game-title h1::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 60%, rgba(241, 196, 15, 0.22) 0%, transparent 70%);
    animation: titleGlowFade 2.8s ease-in-out infinite alternate;
    will-change: opacity;
    pointer-events: none;
    border-radius: 8px;
}

@keyframes titleGlowFade {
    from { opacity: 0.3; }
    to   { opacity: 1; }
}

.game-tagline {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42rem, 1.2vw, 0.62rem);
    color: rgba(139, 233, 253, 0.75);
    letter-spacing: 3px;
    margin: 0 0 14px;
    opacity: 0.85;
}

.title-decoration {
    position: relative;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(74, 104, 217, 0.7) 20%,
        rgba(241, 196, 15, 1) 50%,
        rgba(74, 104, 217, 0.7) 80%,
        transparent 100%
    );
    margin: 0 -8px;
}

.title-decoration::before,
.title-decoration::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #f1c40f;
    top: -2.5px;
    box-shadow: 0 0 10px #f1c40f, 0 0 22px rgba(241, 196, 15, 0.6);
    animation: decorPulse 2.5s ease-in-out infinite alternate;
    will-change: opacity;
}

.title-decoration::before { left: 22%; }
.title-decoration::after  { right: 22%; }

@keyframes decorPulse {
    0%   { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ── Navigation buttons ── */
.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 11px;
    width: 100%;
}

.button-container::before,
.button-container::after {
    display: none;
}

#main-menu button {
    width: 100%;
    max-width: 360px;
    margin: 0;
    padding: 13px 20px;
    font-size: clamp(0.6rem, 1.4vw, 0.8rem);
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, rgba(74, 104, 217, 0.85) 0%, rgba(54, 83, 179, 0.92) 100%);
    color: #fff;
    border: 1px solid rgba(74, 104, 217, 0.45);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    position: relative;
    overflow: hidden;
    text-align: center;
    letter-spacing: 1px;
    animation: btnEntrance 0.35s ease both;
    will-change: transform, opacity;
}

/* Shimmer sweep on hover */
#main-menu button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.14) 50%,
        transparent 60%
    );
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

#main-menu button:hover::before {
    transform: translateX(100%);
}

#main-menu button:hover {
    transform: translateY(-3px) scale(1.02);
    opacity: 0.95;
}

#main-menu button:active {
    transform: translateY(-1px) scale(1.01);
}

/* Focus ring (keyboard / gamepad) */
button.controller-focus,
button:focus-visible {
    outline: 2px solid #f1c40f;
    outline-offset: 3px;
    box-shadow:
        0 0 0 4px rgba(241, 196, 15, 0.2),
        0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Staggered entrance delays */
#main-menu #start-button        { animation-delay: 0.20s; }
#main-menu #leaderboard-button  { animation-delay: 0.27s; }
#main-menu #instructions-button { animation-delay: 0.34s; }
#main-menu #about-button        { animation-delay: 0.41s; }
#main-menu #settings-button     { animation-delay: 0.48s; }

@keyframes btnEntrance {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Start Game — primary CTA */
#main-menu #start-button {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.95) 0%, rgba(39, 174, 96, 1) 100%);
    border-color: rgba(46, 204, 113, 0.55);
    padding: 18px 20px;
    font-size: clamp(0.68rem, 1.7vw, 0.95rem);
    letter-spacing: 2px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 22px rgba(46, 204, 113, 0.22);
    animation: btnEntrance 0.35s ease both;
}

#main-menu #start-button::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 13px;
    border: 1.5px solid rgba(46, 204, 113, 0.55);
    animation: startRing 3s ease-in-out infinite;
    pointer-events: none;
    will-change: opacity;
}

@keyframes startRing {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.75; }
}

#main-menu #start-button:hover {
    background: linear-gradient(135deg, rgba(52, 224, 125, 1) 0%, rgba(46, 204, 113, 1) 100%);
    transform: translateY(-3px) scale(1.02);
    opacity: 0.95;
}

/* Version badge */
.menu-version {
    position: absolute;
    bottom: 16px;
    right: 18px;
    font-size: 0.55em;
    color: rgba(74, 104, 217, 0.45);
    letter-spacing: 1px;
}

/* ── Responsive command-deck menu refresh ─────────────────── */
#main-menu {
    padding: clamp(16px, 3vw, 44px);
    align-items: stretch;
}

#main-menu .menu-container {
    width: min(1080px, 100%);
    min-height: min(640px, calc(100dvh - 32px));
    margin: auto;
    padding: clamp(30px, 5vw, 72px);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(290px, 0.85fr);
    grid-template-areas:
        "logo actions"
        "title actions"
        "version actions";
    column-gap: clamp(44px, 9vw, 120px);
    align-items: center;
    border-radius: 28px;
    overflow: hidden;
}

#main-menu .menu-container::before {
    background:
        linear-gradient(90deg, rgba(16, 34, 63, 0.5), transparent 55%),
        radial-gradient(circle at 15% 25%, rgba(46, 204, 113, 0.16), transparent 28%),
        radial-gradient(circle at 82% 68%, rgba(241, 196, 15, 0.12), transparent 31%);
}

#main-menu .menu-snake-logo {
    grid-area: logo;
    justify-content: flex-start;
    margin: 0 0 18px;
}

#main-menu .snake-svg {
    width: 148px;
    height: auto;
}

#main-menu .game-title {
    grid-area: title;
    margin: 0;
    text-align: left;
    align-self: start;
}

#main-menu .game-title h1 {
    font-size: clamp(2.5rem, 5.5vw, 5.6rem);
    line-height: 0.98;
    letter-spacing: -1px;
    margin-bottom: 20px;
}

#main-menu .game-tagline {
    font-size: clamp(0.48rem, 0.85vw, 0.7rem);
    letter-spacing: 4px;
}

#main-menu .title-decoration {
    margin: 22px 0 0;
    max-width: 390px;
}

#main-menu .button-container {
    grid-area: actions;
    gap: 12px;
    padding: 22px;
    border: 1px solid rgba(112, 151, 255, 0.22);
    border-radius: 20px;
    background: rgba(5, 12, 27, 0.38);
    box-shadow: inset 0 1px rgba(255,255,255,0.05), 0 24px 48px rgba(0,0,0,0.24);
}

#main-menu .button-container::before {
    content: 'SELECT MODE';
    display: block;
    width: 100%;
    color: rgba(139, 233, 253, 0.7);
    font: 0.52rem 'Press Start 2P', cursive;
    letter-spacing: 2px;
    text-align: left;
    margin: 0 0 8px 4px;
}

#main-menu button {
    max-width: none;
    min-height: 58px;
    padding: 16px 20px;
    text-align: left;
    border-radius: 12px;
    font-size: clamp(0.62rem, 0.9vw, 0.78rem);
}

#main-menu #start-button {
    min-height: 74px;
    font-size: clamp(0.72rem, 1.1vw, 0.92rem);
}

#main-menu .menu-version {
    grid-area: version;
    position: static;
    align-self: end;
    margin-top: 26px;
}

@media (max-width: 720px), (max-height: 700px) {
    #main-menu { padding: 10px; overflow-y: auto; }
    #main-menu .menu-container {
        width: min(100%, 520px);
        min-height: auto;
        padding: 26px 18px 20px;
        grid-template-columns: 1fr;
        grid-template-areas: "logo" "title" "actions" "version";
        row-gap: 0;
        border-radius: 20px;
    }
    #main-menu .menu-snake-logo { justify-content: center; margin-bottom: 12px; }
    #main-menu .snake-svg { width: 104px; }
    #main-menu .game-title { text-align: center; margin-bottom: 22px; }
    #main-menu .game-title h1 { font-size: clamp(2.15rem, 12vw, 3.5rem); line-height: 1; margin-bottom: 14px; }
    #main-menu .game-tagline { letter-spacing: 2px; }
    #main-menu .title-decoration { margin: 18px auto 0; }
    #main-menu .button-container { padding: 14px; gap: 9px; border-radius: 16px; }
    #main-menu button { min-height: 53px; padding: 13px 16px; text-align: center; font-size: clamp(0.56rem, 2.8vw, 0.7rem); }
    #main-menu #start-button { min-height: 64px; font-size: clamp(0.65rem, 3.2vw, 0.8rem); }
    #main-menu .menu-version { margin-top: 16px; text-align: center; }
}

/* Responsive secondary screens: never exceed the visible device area. */
#leaderboard,
#instructions,
#settings-panel,
#about-panel {
    box-sizing: border-box;
    width: min(760px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overscroll-behavior: contain;
}

@media (max-width: 720px), (max-height: 700px) {
    #leaderboard,
    #instructions,
    #settings-panel,
    #about-panel {
        top: calc(50% + env(safe-area-inset-top, 0px) / 2);
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: 18px 14px;
        border-width: 1px;
        border-radius: 14px;
    }
    #leaderboard h2,
    #instructions h2,
    #settings-panel h2,
    #about-panel h2 { font-size: clamp(1rem, 5vw, 1.35rem); margin-bottom: 16px; }
    #leaderboard th,
    #leaderboard td { padding: 8px 5px; font-size: clamp(0.42rem, 2.4vw, 0.58rem); }
    #instructions p,
    #instructions li { font-size: clamp(0.72rem, 3.5vw, 0.92rem); line-height: 1.45; }
    .settings-option { min-width: min(140px, 100%); }
}

@media (max-width: 380px), (max-height: 600px) {
    #main-menu .menu-snake-logo { display: none; }
    #main-menu .menu-container { padding-top: 20px; }
    #main-menu .game-title h1 { font-size: 2rem; }
    #main-menu .game-title { margin-bottom: 14px; }
    #main-menu .button-container { padding: 10px; gap: 7px; }
    #main-menu button { min-height: 46px; padding: 10px; }
    #main-menu #start-button { min-height: 56px; }
}

#leaderboard {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 30, 48, 0.9);
    border: 3px solid #4a68d9;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(74, 104, 217, 0.5);
    padding: 35px;
    text-align: center;
    display: none;
    z-index: 11;
    max-width: 600px;
    width: 90vw;
    animation: scaleInCentered 0.4s ease forwards;
    backdrop-filter: blur(8px);
}

#leaderboard h2 {
    font-size: 2em;
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.7);
    margin-bottom: 30px;
}

#leaderboard table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background: rgba(15, 25, 40, 0.5);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

#leaderboard th, #leaderboard td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(74, 104, 217, 0.2);
}

#leaderboard th {
    background: rgba(74, 104, 217, 0.3);
    color: #f1c40f;
}

#leaderboard tbody tr:hover {
    background: rgba(74, 104, 217, 0.1);
}

#leaderboard tbody tr:nth-child(1) {
    background: linear-gradient(90deg, rgba(241, 196, 15, 0.2), rgba(15, 25, 40, 0.5));
}

#leaderboard tbody tr:nth-child(2) {
    background: linear-gradient(90deg, rgba(189, 195, 199, 0.2), rgba(15, 25, 40, 0.5));
}

#leaderboard tbody tr:nth-child(3) {
    background: linear-gradient(90deg, rgba(211, 84, 0, 0.2), rgba(15, 25, 40, 0.5));
}

#back-to-menu-button,
#back-to-menu-button-from-instructions {
    padding: 12px 25px;
    font-size: 1em;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

#back-to-menu-button:hover,
#back-to-menu-button-from-instructions:hover {
    background: linear-gradient(135deg, #3653b3, #263c8f);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

#exit-confirm-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(12px);
    z-index: 200;
}

.exit-confirm-card {
    width: min(88vw, 380px);
    padding: 30px 28px;
    border-radius: 22px;
    border: 2px solid rgba(74, 104, 217, 0.5);
    background: rgba(20, 30, 48, 0.94);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.exit-confirm-card h2 {
    margin: 0 0 16px;
    color: #f1c40f;
    font-size: 1.5em;
}

.exit-confirm-card p {
    margin: 0;
    font-family: sans-serif;
    font-size: 0.92em;
    line-height: 1.6;
    color: rgba(236, 240, 241, 0.86);
}

.exit-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.exit-confirm-actions button {
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.82em;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

#cancel-exit-button {
    background: linear-gradient(135deg, #4a68d9, #3653b3);
}

#confirm-exit-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

#pause-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(12px);
    animation: fadeInOverlay 0.3s ease;
}

.pause-card {
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid rgba(74, 104, 217, 0.5);
    border-radius: 20px;
    padding: 35px 45px;
    text-align: center;
    box-shadow: 
        0 0 40px rgba(74, 104, 217, 0.3),
        inset 0 0 15px rgba(74, 104, 217, 0.1);
    animation: scaleIn 0.4s ease;
    min-width: 220px;
}

.pause-icon {
    font-size: 3em;
    margin-bottom: 10px;
    opacity: 0.8;
    animation: pausePulse 1.5s infinite alternate;
}

#pause-screen h2 {
    font-size: 2em;
    color: #f1c40f;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.7);
    margin: 0 0 8px 0;
}

.pause-hint {
    font-family: sans-serif;
    font-size: 0.75em;
    color: rgba(236, 240, 241, 0.4);
    margin: 0 0 25px 0;
    letter-spacing: 1px;
}

@keyframes pausePulse {
    from { transform: scale(1); opacity: 0.6; }
    to { transform: scale(1.08); opacity: 1; }
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

#pause-screen button {
    width: 220px;
    margin: 0;
    padding: 14px 0;
    font-size: 1em;
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

#pause-screen button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: all 0.5s;
}

#pause-screen button:hover::before {
    left: 100%;
}

#resume-button {
    background: linear-gradient(135deg, #2ecc71, #27ae60) !important;
}

#resume-button:hover {
    background: linear-gradient(135deg, #27ae60, #219653) !important;
}

#quit-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

#quit-button:hover {
    background: linear-gradient(135deg, #c0392b, #922b21) !important;
}

#pause-screen button:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

@media (max-width: 800px) {
    #game-hud {
        gap: 6px;
        padding: 6px 10px;
    }

    .hud-item {
        padding: 4px 8px;
        font-size: 0.6em;
    }

    .hud-score {
        padding: 4px 12px;
    }
    .hud-score #score { font-size: 1.3em; }

    .hud-best {
        padding: 4px 12px;
    }

    #game-container {
        margin-top: 0;
    }
}

/* â”€â”€â”€ About Panel â”€â”€â”€ */

#about-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at top left, rgba(74, 104, 217, 0.2), transparent 32%),
        radial-gradient(circle at bottom right, rgba(241, 196, 15, 0.14), transparent 28%),
        linear-gradient(180deg, rgba(20, 30, 48, 0.97), rgba(10, 15, 30, 0.98));
    border: 2.5px solid #4a68d9;
    border-radius: 26px;
    box-shadow:
        0 0 34px rgba(74, 104, 217, 0.35),
        0 0 80px rgba(10, 15, 30, 0.55),
        inset 0 0 18px rgba(74, 104, 217, 0.12);
    z-index: 110;
    width: min(92vw, 880px);
    max-height: min(88vh, 760px);
    overflow: hidden;
    animation: scaleInCentered 0.4s ease forwards;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    text-align: left;
    isolation: isolate;
}

#about-panel::before,
#about-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#about-panel::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.04));
    opacity: 0.8;
}

#about-panel::after {
    inset: 1px;
    border-radius: 24px;
    border: 1px solid rgba(139, 233, 253, 0.1);
}

#about-panel h2 {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.35em;
    color: #f1c40f;
    text-shadow: 0 0 12px rgba(241, 196, 15, 0.35);
}

.about-header-fixed,
.about-footer-fixed {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.about-header-fixed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 16px;
    background: linear-gradient(180deg, rgba(16, 25, 42, 0.96), rgba(12, 18, 31, 0.82));
    border-bottom: 1px solid rgba(74, 104, 217, 0.28);
}

.about-header-copy,
.about-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.about-header-copy {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.about-kicker,
.about-section-kicker,
.about-eyebrow {
    margin: 0;
    color: rgba(139, 233, 253, 0.78);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.about-kicker {
    font-size: 0.5em;
}

.about-version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(139, 233, 253, 0.22);
    background: rgba(139, 233, 253, 0.08);
    color: #8be9fd;
    font-size: 0.52em;
    box-shadow: inset 0 0 10px rgba(139, 233, 253, 0.07);
}

.about-close-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(241, 196, 15, 0.3);
    border-radius: 12px;
    background: rgba(241, 196, 15, 0.08);
    color: #f1c40f;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8em;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    box-shadow: inset 0 0 12px rgba(241, 196, 15, 0.08);
}

.about-close-btn:hover {
    transform: translateY(-2px);
    background: rgba(241, 196, 15, 0.16);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.about-content {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.about-card {
    position: relative;
    border-radius: 20px;
    border: 1px solid rgba(74, 104, 217, 0.18);
    background: linear-gradient(180deg, rgba(15, 24, 39, 0.92), rgba(12, 19, 31, 0.92));
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.14);
    overflow: clip;
}

.about-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 38%);
    pointer-events: none;
}

.about-intro {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding: 18px;
    position: relative;
    z-index: 1;
}

.about-intro-art {
    box-sizing: border-box;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 18px;
    border: 1px solid rgba(74, 104, 217, 0.2);
    background:
        radial-gradient(circle at 50% 35%, rgba(74, 104, 217, 0.18), transparent 60%),
        linear-gradient(180deg, rgba(19, 31, 53, 0.92), rgba(11, 18, 30, 0.94));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-shadow: inset 0 0 14px rgba(74, 104, 217, 0.08);
}

.about-app-icon {
    width: min(100%, 76px);
    height: auto;
    border-radius: 18px;
    box-shadow:
        0 8px 18px rgba(74, 104, 217, 0.22),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

.about-intro-copy {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
}

.about-intro-kicker {
    margin: 0 0 8px;
    color: rgba(139, 233, 253, 0.72);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.48em;
}

.about-game-title {
    font-size: clamp(0.96em, 1.55vw, 1.24em);
    color: #ecf0f1;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.18);
    margin: 0 0 8px;
    max-width: 13ch;
    line-height: 1.08;
    text-wrap: balance;
}

.about-lead {
    margin: 0;
    color: rgba(236, 240, 241, 0.8);
    font-size: 0.56em;
    line-height: 1.62;
    max-width: 40ch;
}

.about-meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.about-meta-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(74, 104, 217, 0.2);
    background: rgba(9, 15, 28, 0.56);
    color: rgba(236, 240, 241, 0.72);
    font-size: 0.45em;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1;
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.9fr);
    grid-template-areas:
        'story creator'
        'features features';
    gap: 18px;
}

.about-story,
.about-features,
.about-creator {
    padding: 18px;
}

.about-story {
    grid-area: story;
}

.about-features {
    grid-area: features;
}

.about-creator {
    grid-area: creator;
}

.about-section-heading {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.about-section-kicker {
    font-size: 0.48em;
}

.about-section-heading h4 {
    margin: 0;
    color: #ecf0f1;
    font-size: 0.76em;
    line-height: 1.45;
}

.about-description {
    font-size: 0.6em;
    color: rgba(236, 240, 241, 0.78);
    line-height: 1.72;
    margin-bottom: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}

.about-description p {
    margin: 0;
}

.about-description p + p {
    margin-top: 12px;
}

.about-feature-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    position: relative;
    z-index: 1;
}

.about-feature-item {
    min-height: 0;
    padding: 14px 15px;
    border-radius: 16px;
    border: 1px solid rgba(74, 104, 217, 0.16);
    background: rgba(9, 15, 28, 0.46);
    box-shadow: inset 0 0 16px rgba(74, 104, 217, 0.05);
}

.about-feature-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.about-feature-tag {
    color: rgba(139, 233, 253, 0.72);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 0.42em;
}

.about-feature-copy strong {
    color: #ecf0f1;
    font-size: 0.58em;
    font-weight: normal;
    line-height: 1.4;
}

.about-feature-copy span {
    color: rgba(236, 240, 241, 0.66);
    font-size: 0.5em;
    line-height: 1.6;
}

.creator-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(9, 15, 28, 0.3);
    border: 1px solid rgba(74, 104, 217, 0.12);
    border-radius: 16px;
    padding: 14px;
    position: relative;
    z-index: 1;
}

.creator-photo {
    width: 78px;
    height: 78px;
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid rgba(46, 204, 113, 0.6);
    box-shadow: 0 0 18px rgba(46, 204, 113, 0.18);
    flex-shrink: 0;
}

.creator-info {
    text-align: left;
}

.creator-name {
    font-size: 0.72em;
    color: #ecf0f1;
    margin: 0 0 6px;
}

.creator-role {
    margin: 0 0 10px;
    font-size: 0.47em;
    color: rgba(236, 240, 241, 0.58);
    line-height: 1.6;
}

.creator-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.creator-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.5em;
    padding: 8px 11px;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.25s ease;
    font-family: 'Press Start 2P', cursive;
}

.creator-link svg {
    flex-shrink: 0;
}

.github-link {
    color: #ecf0f1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.github-link:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.34);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
}

.linkedin-link {
    color: #58abff;
    background: rgba(10, 102, 194, 0.12);
    border: 1px solid rgba(10, 102, 194, 0.24);
}

.linkedin-link:hover {
    background: rgba(10, 102, 194, 0.2);
    border-color: rgba(88, 171, 255, 0.42);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(10, 102, 194, 0.18);
}

.about-footer-fixed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px 16px;
    background: linear-gradient(180deg, rgba(12, 18, 31, 0.74), rgba(9, 15, 28, 0.96));
    border-top: 1px solid rgba(74, 104, 217, 0.24);
}

.about-footer-note {
    margin: 0;
    max-width: 56%;
    color: rgba(236, 240, 241, 0.52);
    font-size: 0.46em;
    line-height: 1.55;
}

#back-from-about {
    min-width: 200px;
    padding: 11px 18px;
    font-size: 0.72em;
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

#back-from-about:hover {
    background: linear-gradient(135deg, #3653b3, #263c8f);
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.34);
}

@media (max-width: 760px) {
    #about-panel {
        width: min(94vw, 640px);
        max-height: 90vh;
    }

    .about-header-fixed,
    .about-footer-fixed {
        padding: 16px;
    }

    .about-content {
        padding: 14px;
        gap: 12px;
    }

    .about-intro {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
        padding: 16px;
    }

    .about-intro-art {
        width: 92px;
        height: 92px;
    }

    .about-intro-copy {
        text-align: center;
        align-items: center;
    }

    .about-game-title {
        max-width: 11ch;
    }

    .about-lead {
        max-width: none;
    }

    .about-meta-chips {
        justify-content: center;
    }

    .about-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            'story'
            'features'
            'creator';
    }

    .about-footer-fixed {
        flex-direction: column;
        align-items: stretch;
    }

    .about-footer-note {
        max-width: none;
        text-align: center;
    }

    #back-from-about {
        width: 100%;
        min-width: 0;
    }
}

/* â”€â”€â”€ Settings Panel â”€â”€â”€ */

#settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 30, 48, 0.95);
    border: 3px solid #4a68d9;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(74, 104, 217, 0.5);
    padding: 35px 40px;
    text-align: center;
    z-index: 110;
    width: 90vw;
    max-width: 500px;
    animation: scaleInCentered 0.4s ease forwards;
    backdrop-filter: blur(10px);
}

#settings-panel h2 {
    font-size: 1.8em;
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.7);
    margin-bottom: 25px;
    margin-top: 0;
}

.settings-label {
    font-size: 0.9em;
    color: #ecf0f1;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
}

.settings-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.settings-option {
    cursor: pointer;
    flex: 1;
    min-width: 180px;
    max-width: 220px;
}

.settings-option input[type="radio"] {
    display: none;
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    border: 2px solid rgba(74, 104, 217, 0.3);
    border-radius: 12px;
    background: rgba(15, 25, 40, 0.6);
    transition: all 0.3s ease;
}

.option-card:hover {
    border-color: rgba(74, 104, 217, 0.6);
    background: rgba(15, 25, 40, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.settings-option.controller-focus .option-card {
    border-color: #f1c40f;
    box-shadow:
        0 0 0 4px rgba(241, 196, 15, 0.18),
        0 10px 25px rgba(0, 0, 0, 0.4);
    transform: translateY(-3px);
}

.settings-option input[type="radio"]:checked + .option-card {
    border-color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.2), inset 0 0 10px rgba(241, 196, 15, 0.05);
}

.option-icon {
    font-size: 2em;
    line-height: 1;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, sans-serif;
}

.option-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8em;
    color: #ecf0f1;
}

.settings-option input[type="radio"]:checked + .option-card .option-title {
    color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

.option-desc {
    font-family: sans-serif;
    font-size: 0.7em;
    color: rgba(236, 240, 241, 0.6);
    line-height: 1.4;
}

#back-from-settings {
    padding: 12px 25px;
    font-size: 0.85em;
    font-family: 'Press Start 2P', cursive;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-top: 20px;
}

#back-from-settings:hover {
    background: linear-gradient(135deg, #3653b3, #263c8f);
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
}

/* â”€â”€â”€ Settings Hub â”€â”€â”€ */
#settings-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.settings-hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 24px;
}

.settings-hub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(74, 104, 217, 0.35);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Press Start 2P', cursive;
}

.settings-hub-card:hover, .settings-hub-card:active {
    background: rgba(74, 104, 217, 0.2);
    border-color: #4a68d9;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 104, 217, 0.35);
}

.hub-icon { font-size: 1.8em; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, sans-serif; }
.hub-title { font-size: 0.55em; color: #ecf0f1; }
.hub-desc { font-size: 0.45em; color: rgba(236,240,241,0.5); text-align: center; line-height: 1.4; }

/* â”€â”€â”€ Settings sub-panels â”€â”€â”€ */
.settings-subpanel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.settings-subpanel h2 {
    font-size: 1.3em;
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241,196,15,0.7);
    margin: 10px 0 20px;
}

.settings-back-btn {
    align-self: flex-start;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6em;
    padding: 8px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: rgba(236,240,241,0.8);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.settings-back-btn:hover, .settings-back-btn:active {
    background: rgba(74,104,217,0.25);
    border-color: #4a68d9;
    color: #fff;
}

/* non-android-only: inverse of android-only / mobile-device */
.non-android-only { display: none; }
body:not(.android-device):not(.mobile-device) .non-android-only { display: block; }
body:not(.android-device):not(.mobile-device) .android-only { display: none; }


.settings-sublabel {
    font-size: 0.65em;
    color: rgba(236,240,241,0.6);
    margin: 2px 0 10px;
    font-family: 'Press Start 2P', cursive;
}
.vbtn-remap-grid {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}
.vbtn-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.vbtn-slot-label {
    font-size: 0.55em;
    color: rgba(236,240,241,0.5);
    font-family: 'Press Start 2P', cursive;
}
.vbtn-slot-action {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7em;
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #ecf0f1;
    transition: all 0.2s;
}
.vbtn-slot.selected .vbtn-slot-action {
    border-color: #f1c40f;
    background: rgba(241,196,15,0.18);
    box-shadow: 0 0 12px rgba(241,196,15,0.5);
    color: #f1c40f;
}

/* â”€â”€â”€ Controller remap rows â”€â”€â”€ */
.remap-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-family: 'Press Start 2P', cursive;
}
.remap-action {
    font-size: 0.65em;
    min-width: 90px;
}
.remap-current-label {
    flex: 1;
    font-size: 0.55em;
    color: rgba(236,240,241,0.6);
    text-align: center;
}
.remap-assign-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    padding: 6px 10px;
    background: rgba(52,152,219,0.2);
    border: 1px solid rgba(52,152,219,0.4);
    border-radius: 6px;
    color: #3498db;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.remap-assign-btn:hover, .remap-assign-btn:active {
    background: rgba(52,152,219,0.4);
    color: #fff;
}
.remap-assign-btn.listening {
    background: rgba(241,196,15,0.25);
    border-color: #f1c40f;
    color: #f1c40f;
    animation: pulse-border 0.6s infinite alternate;
}
@keyframes pulse-border {
    from { box-shadow: 0 0 4px rgba(241,196,15,0.4); }
    to   { box-shadow: 0 0 12px rgba(241,196,15,0.9); }
}

/* â”€â”€â”€ Keyboard remap button (reuses remap-row layout, own colour) â”€â”€â”€ */
.kb-assign-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    padding: 6px 10px;
    background: rgba(155,89,182,0.2);
    border: 1px solid rgba(155,89,182,0.4);
    border-radius: 6px;
    color: #9b59b6;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.kb-assign-btn:hover, .kb-assign-btn:active {
    background: rgba(155,89,182,0.4);
    color: #fff;
}
.kb-assign-btn.listening {
    background: rgba(241,196,15,0.25);
    border-color: #f1c40f;
    color: #f1c40f;
    animation: pulse-border 0.6s infinite alternate;
}

/* â”€â”€â”€ Controls tutorial overlay â”€â”€â”€ */
#controls-tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,12,25,0.92);
    z-index: 8500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}
.cto-card {
    background: linear-gradient(160deg, rgba(20,28,58,0.98) 0%, rgba(10,16,36,0.98) 100%);
    border: 1px solid rgba(74,104,217,0.4);
    border-radius: 16px;
    padding: 24px 20px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 0 40px rgba(74,104,217,0.25);
}
.cto-header {
    text-align: center;
}
.cto-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1em;
    color: #7ba7ff;
    margin: 0 0 8px;
}
.cto-subtitle {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    color: rgba(236,240,241,0.55);
    margin: 0;
}
.cto-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.cto-tab {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45em;
    padding: 7px 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(236,240,241,0.55);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.cto-tab.active {
    background: rgba(74,104,217,0.3);
    border-color: rgba(74,104,217,0.7);
    color: #7ba7ff;
}
.cto-panel {}
.cto-controls-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cto-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
}
.cto-key {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    color: #f1c40f;
    min-width: 110px;
    text-align: center;
    padding: 4px 6px;
    background: rgba(241,196,15,0.1);
    border: 1px solid rgba(241,196,15,0.3);
    border-radius: 5px;
    white-space: nowrap;
}
.cto-desc {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    color: rgba(236,240,241,0.75);
    flex: 1;
}
.cto-settings-hint {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45em;
    color: rgba(236,240,241,0.45);
    text-align: center;
    line-height: 1.6;
    margin: 0;
}
.cto-settings-hint strong {
    color: #7ba7ff;
}
.cto-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65em;
    padding: 14px;
    background: linear-gradient(135deg, rgba(74,104,217,0.5), rgba(52,152,219,0.4));
    border: 2px solid rgba(74,104,217,0.6);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}
.cto-btn:hover, .cto-btn:active {
    background: linear-gradient(135deg, rgba(74,104,217,0.8), rgba(52,152,219,0.6));
    box-shadow: 0 0 16px rgba(74,104,217,0.5);
}

/* â”€â”€â”€ Settings action button (opens an editor overlay) â”€â”€â”€ */
.settings-action-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65em;
    padding: 14px 20px;
    background: rgba(74, 104, 217, 0.2);
    border: 2px solid rgba(74, 104, 217, 0.5);
    border-radius: 10px;
    color: #7ba7ff;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 6px;
}

.settings-action-btn:hover, .settings-action-btn:active {
    background: rgba(74, 104, 217, 0.4);
    border-color: #4a68d9;
    color: #fff;
    box-shadow: 0 0 14px rgba(74, 104, 217, 0.5);
}

/* â”€â”€ Audio settings â”€â”€ */
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: #4a68d9;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.volume-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.volume-icon {
    font-size: 1.1em;
    flex-shrink: 0;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, sans-serif;
}

/* Emoji font utility — use on any inline emoji span */
.emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', emoji, sans-serif;
    font-style: normal;
}
.volume-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    color: rgba(255,255,255,0.7);
    min-width: 36px;
    text-align: right;
}
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.12);
    outline: none;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #4a68d9;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.3);
}
.volume-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #4a68d9;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.3);
}


#settings-button {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
}

#settings-button:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98) !important;
}

@media (max-width: 500px) {
    .settings-options {
        flex-direction: column;
        align-items: center;
    }
    
    .settings-option {
        max-width: 100%;
        width: 100%;
    }
    
    #settings-panel {
        padding: 25px 20px;
    }
}

body.android-device {
    align-items: center;
    justify-content: center;
}

body.android-device .android-only {
    display: block;
}

body.android-device .game-layout {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100dvh;
    padding: env(safe-area-inset-top, 5px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 5px) env(safe-area-inset-left, 10px);
    box-sizing: border-box;
    align-items: center;
    justify-content: flex-start;
}

body.android-device #game-hud {
    flex-shrink: 0;
    gap: 4px;
    padding: 4px 8px;
}

body.android-device .hud-group {
    gap: 4px;
}

body.android-device .hud-item {
    padding: 3px 8px;
    font-size: clamp(7px, 1.5vw, 11px);
    border-radius: 6px;
}

body.android-device .hud-score {
    padding: 4px 10px;
}

body.android-device .hud-best {
    padding: 4px 10px;
}

body.android-device .hud-label {
    font-size: 0.5em;
    letter-spacing: 1.5px;
}

body.android-device .game-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    width: 100%;
    min-height: 0;
    padding: 6px 8px;
    box-sizing: border-box;
    container-type: size;
    container-name: game-stage;
}

/* Canvas sits in center column â€” always geometrically centered */
body.android-device #game-container {
    grid-column: 2;
    width: var(--android-board-size, min(55vw, 80dvh));
    height: var(--android-board-size, min(55vw, 80dvh));
    aspect-ratio: 1;
    max-width: none;
    max-height: 100%;
    margin: 0;
    border-width: 2px;
    flex-shrink: 0;
}

/* Left control â€” last item in first column, push to the right edge of that column */
body.android-device #joystick-zone,
body.android-device #dpad-zone {
    grid-column: 1;
    justify-self: center;
}

/* Right control â€” first item in third column */
body.android-device #action-cluster {
    grid-column: 3;
    justify-self: center;
    width: auto;
}

body.android-device #game-board,
body.android-device #game-container {
    touch-action: none;
}

/* Controller connected â€” hide virtual controls, expand board */
body.controller-connected .game-layout {
    gap: 8px;
}

body.android-device.controller-connected #joystick-zone,
body.android-device.controller-connected #dpad-zone,
body.android-device.controller-connected #action-cluster {
    display: none !important;
}

body.android-device.controller-connected #game-container {
    /* cqmin = min(game-stage width, game-stage height) â€” guaranteed never to overflow */
    width: min(90cqmin, 600px);
    height: min(90cqmin, 600px);
    grid-column: 1 / 4;
}

/* Joystick sizing on Android */
body.android-device #joystick-zone {
    width: clamp(100px, 18vw, 150px);
    height: clamp(100px, 18vw, 150px);
}

body.android-device .joystick-base {
    width: clamp(88px, 16vw, 130px);
    height: clamp(88px, 16vw, 130px);
}

body.android-device .joystick-thumb {
    width: clamp(36px, 6vw, 48px);
    height: clamp(36px, 6vw, 48px);
}

/* Action cluster sizing on Android */
body.android-device .action-main {
    grid-template-columns: clamp(44px, 7.5vw, 56px) clamp(44px, 7.5vw, 56px);
    grid-template-rows: clamp(44px, 7.5vw, 56px) clamp(44px, 7.5vw, 56px);
    gap: clamp(5px, 1vw, 8px);
}

body.android-device .power-btn,
body.android-device .bomb-btn,
body.android-device .shoot-btn,
body.android-device .boost-btn {
    width: clamp(44px, 7.5vw, 56px);
    height: clamp(44px, 7.5vw, 56px);
    font-size: clamp(18px, 3.5vw, 24px);
}

body.android-device .pause-btn {
    width: clamp(36px, 6vw, 46px);
    height: clamp(32px, 5vw, 40px);
    font-size: clamp(16px, 3vw, 20px);
}

/* Menu styles */
body.android-device #main-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100dvh;
    padding: calc(var(--sat) + 8px) 14px calc(var(--sab) + 8px);
    box-sizing: border-box;
    overflow: hidden;
}

body.android-device .menu-container {
    width: min(100%, 560px);
    margin: 0 auto;
    padding: 20px 22px 20px;
    animation: none;
    opacity: 1;
}

body.android-device .corner-decoration,
body.android-device .light-source,
body.android-device .menu-scanlines {
    display: none;
}

body.android-device .menu-snake-logo {
    margin-bottom: 10px;
}

body.android-device .snake-svg {
    width: 88px;
    height: 53px;
    animation: snakeBreathe 3.5s ease-in-out infinite;
}

body.android-device .game-title {
    margin-bottom: 12px;
}

body.android-device .game-title h1 {
    font-size: clamp(1.2rem, 4vw, 1.9rem);
    line-height: 1.2;
    letter-spacing: 1px;
}

body.android-device .game-tagline {
    font-size: clamp(0.38rem, 1.1vw, 0.55rem);
}

body.android-device #main-menu button {
    width: min(100%, 320px);
    padding: 10px 16px;
    font-size: clamp(10px, 2vw, 14px);
}

body.android-device #main-menu #start-button {
    padding: 14px 16px;
    font-size: clamp(11px, 2.2vw, 15px);
}

body.android-device .button-container {
    gap: 9px;
}

body.android-device .title-decoration {
    bottom: -8px;
}

body.android-device .menu-version {
    display: none;
}

@media (max-width: 900px) and (orientation: landscape) {
    body.android-device .game-layout {
        gap: 3px;
    }

    body.android-device .menu-container {
        width: min(100%, 560px);
    }

    body.android-device .menu-snake-logo {
        display: none;
    }

    body.android-device .game-tagline {
        display: none;
    }

    body.android-device .game-title h1 {
        font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    }
}

body.android-device #boss-warning {
    top: calc(var(--sat) + 12px);
    width: calc(100vw - 32px);
    max-width: 360px;
    font-size: 0.9em;
    text-align: center;
}

body.android-device #instructions,
body.android-device #leaderboard,
body.android-device #settings-panel {
    position: fixed;
    inset: calc(var(--sat) + 12px) 12px calc(var(--sab) + 12px) 12px;
    width: auto;
    max-width: none;
    max-height: none;
    transform: none !important;
    animation: none !important;
    overflow-y: auto;
    padding: 24px 18px;
}
body.android-device #about-panel {
    position: fixed;
    inset: calc(var(--sat) + 12px) 12px calc(var(--sab) + 12px) 12px;
    width: auto;
    max-width: none;
    max-height: none;
    transform: none !important;
    animation: none !important;
    overflow: hidden;
    padding: 0;
}

body.android-device #instructions p,
body.android-device #instructions li,
body.android-device #leaderboard td,
body.android-device #leaderboard th,
body.android-device .option-desc,
body.android-device .pause-hint {
    font-size: 0.82em;
}

body.android-device .pause-card {
    width: min(88vw, 360px);
    padding: 28px 20px;
}

body.android-device #pause-screen button,
body.android-device .exit-confirm-actions button {
    min-height: 54px;
}

/* â”€â”€â”€ End of styles â”€â”€â”€ */

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   AUTH SCREEN â€” login / register
   Matches game theme: Press Start 2P, dark navy, blue/gold glows
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

#auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 40%, rgba(15, 25, 40, 0.97) 0%, rgba(10, 15, 30, 0.99) 100%);
    z-index: 12000;
    overflow: hidden;
    padding: env(safe-area-inset-top, 12px) 16px env(safe-area-inset-bottom, 12px);
    box-sizing: border-box;
}

/* Ambient glow blobs (like main menu light sources) */
.auth-bg-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(80px);
    z-index: 0;
}
.auth-glow-1 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(74, 104, 217, 0.25) 0%, transparent 70%);
    top: -120px;
    left: -100px;
    animation: authGlowPulse 9s ease-in-out infinite alternate;
}
.auth-glow-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(241, 196, 15, 0.18) 0%, transparent 70%);
    bottom: -100px;
    right: -80px;
    animation: authGlowPulse 11s ease-in-out infinite alternate-reverse;
}
@keyframes authGlowPulse {
    from { opacity: 0.5; transform: scale(0.9); }
    to   { opacity: 1;   transform: scale(1.15); }
}

/* â”€â”€â”€ Auth card â”€â”€â”€ */
.auth-card {
    position: relative;
    z-index: 1;
    background: rgba(20, 30, 48, 0.88);
    border: 2.5px solid #4a68d9;
    border-radius: 20px;
    box-shadow:
        0 0 40px rgba(74, 104, 217, 0.3),
        0 0 80px rgba(10, 15, 30, 0.5),
        inset 0 0 18px rgba(74, 104, 217, 0.08);
    backdrop-filter: blur(8px);
    padding: 24px 28px 20px;
    width: min(420px, 100%);
    max-height: 100dvh;
    overflow: hidden;
    box-sizing: border-box;
    animation: authCardIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes authCardIn {
    from { opacity: 0; transform: scale(0.88) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* â”€â”€â”€ Logo / title block â”€â”€â”€ */
.auth-logo {
    text-align: center;
    margin-bottom: 12px;
}
.auth-snake-emoji {
    display: block;
    font-size: 2.8em;
    line-height: 1;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 10px rgba(241, 196, 15, 0.6));
    animation: authSnakeWiggle 3s ease-in-out infinite;
}
@keyframes authSnakeWiggle {
    0%, 100% { transform: rotate(-6deg); }
    50%       { transform: rotate(6deg); }
}
.auth-game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.72em, 2.8vw, 0.98em);
    color: #f1c40f;
    text-shadow:
        0 0 14px rgba(241, 196, 15, 0.7),
        0 0 30px rgba(241, 196, 15, 0.3);
    line-height: 1.55;
    margin: 0 0 10px;
    animation: authTitlePulse 2.5s ease-in-out infinite alternate;
}
@keyframes authTitlePulse {
    from { text-shadow: 0 0 12px rgba(241,196,15,0.5), 0 0 24px rgba(241,196,15,0.25); }
    to   { text-shadow: 0 0 22px rgba(241,196,15,0.85), 0 0 45px rgba(241,196,15,0.4); }
}
.auth-title-bar {
    width: 70%;
    height: 2px;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent, rgba(241,196,15,0.7), transparent);
}

/* â”€â”€â”€ Tab switcher â”€â”€â”€ */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border: 2px solid rgba(74,104,217,0.35);
    border-radius: 10px;
    overflow: hidden;
}
.auth-tab {
    flex: 1;
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.5em, 1.8vw, 0.65em);
    padding: 10px 6px;
    background: transparent;
    border: none;
    color: rgba(236,240,241,0.5);
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.5px;
}
.auth-tab.active {
    background: rgba(74,104,217,0.3);
    color: #ecf0f1;
    text-shadow: 0 0 8px rgba(74,104,217,0.8);
    box-shadow: inset 0 0 10px rgba(74,104,217,0.15);
}
.auth-tab:first-child { border-right: 1px solid rgba(74,104,217,0.25); }
.auth-tab:hover:not(.active) { background: rgba(74,104,217,0.1); color: rgba(236,240,241,0.8); }

/* â”€â”€â”€ Forms â”€â”€â”€ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.auth-field label {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42em, 1.4vw, 0.55em);
    color: rgba(236,240,241,0.55);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.auth-field input {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.52em, 1.6vw, 0.65em);
    padding: 10px 12px;
    background: rgba(10, 18, 32, 0.7);
    border: 2px solid rgba(74,104,217,0.35);
    border-radius: 8px;
    color: #ecf0f1;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.auth-field input::placeholder {
    color: rgba(236,240,241,0.22);
}
.auth-field input:focus {
    border-color: #4a68d9;
    box-shadow: 0 0 12px rgba(74,104,217,0.35), inset 0 0 5px rgba(74,104,217,0.1);
}
.auth-field input:focus::placeholder { color: rgba(236,240,241,0.12); }

/* â”€â”€â”€ Error / success messages â”€â”€â”€ */
.auth-error {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.38em, 1.2vw, 0.5em);
    color: #e74c3c;
    text-shadow: 0 0 6px rgba(231,76,60,0.5);
    text-align: center;
    line-height: 1.6;
    padding: 8px 10px;
    background: rgba(231,76,60,0.08);
    border: 1px solid rgba(231,76,60,0.25);
    border-radius: 6px;
    animation: authShake 0.4s ease;
}
@keyframes authShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-3px); }
    80%     { transform: translateX(3px); }
}
.auth-success {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.38em, 1.2vw, 0.5em);
    color: #2ecc71;
    text-shadow: 0 0 6px rgba(46,204,113,0.4);
    text-align: center;
    line-height: 1.6;
    padding: 8px 10px;
    background: rgba(46,204,113,0.08);
    border: 1px solid rgba(46,204,113,0.25);
    border-radius: 6px;
}

/* â”€â”€â”€ Submit button â”€â”€â”€ */
.auth-submit-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.5em, 1.8vw, 0.65em);
    padding: 12px 10px;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 5px 18px rgba(74,104,217,0.3), 0 2px 6px rgba(0,0,0,0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}
.auth-submit-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}
.auth-submit-btn:hover::before { left: 100%; }
.auth-submit-btn:hover {
    background: linear-gradient(135deg, #5574e8, #4060cc);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(74,104,217,0.45);
}
.auth-submit-btn:active { transform: translateY(0); }
.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
/* Register button: gold accent */
#auth-register-form .auth-submit-btn {
    background: linear-gradient(135deg, #d4a017, #b8860b);
    box-shadow: 0 5px 18px rgba(212,160,23,0.3);
}
#auth-register-form .auth-submit-btn:hover {
    background: linear-gradient(135deg, #e5b020, #c89010);
    box-shadow: 0 8px 24px rgba(212,160,23,0.45);
}

/* â”€â”€â”€ Auto-login resuming splash â”€â”€â”€ */
#auth-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* â”€â”€â”€ Version watermark â”€â”€â”€ */
.auth-version {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    color: rgba(236,240,241,0.2);
    text-align: center;
    margin: 14px 0 0;
}

/* â”€â”€â”€ Logged-in user chip (floating badge in top-right of main menu) â”€â”€â”€ */
#auth-user-chip {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(20, 30, 48, 0.88);
    border: 1.5px solid rgba(74,104,217,0.4);
    border-radius: 24px;
    padding: 6px 10px 6px 12px;
    z-index: 150;
    backdrop-filter: blur(6px);
    box-shadow: 0 0 14px rgba(74,104,217,0.15);
    animation: authCardIn 0.3s ease;
}
/* Offline tint */
#auth-user-chip[data-mode="offline"] {
    border-color: rgba(231, 76, 60, 0.45);
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.15);
}
#auth-user-chip[data-mode="offline"] #auth-user-name {
    color: #e74c3c;
}
#auth-user-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    color: #8be9fd;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#auth-signout-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    background: rgba(231,76,60,0.15);
    border: 1px solid rgba(231,76,60,0.3);
    border-radius: 14px;
    color: #e74c3c;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}
#auth-signout-btn:hover {
    background: rgba(231,76,60,0.3);
    border-color: #e74c3c;
    color: #fff;
}

/* â”€â”€â”€ Status dot inside the auth chip â”€â”€â”€ */
.auth-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-online {
    background: #2ecc71;
    box-shadow: 0 0 6px rgba(46,204,113,0.8);
    animation: connPulse 2.5s ease-in-out infinite;
}
.dot-offline {
    background: #e74c3c;
    box-shadow: 0 0 6px rgba(231,76,60,0.8);
}
@keyframes connPulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Android tweaks for auth screen */
body.android-device #auth-screen {
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px
             calc(env(safe-area-inset-bottom, 0px) + 12px);
}
body.android-device .auth-card {
    padding: 18px 16px 14px;
}
body.android-device .auth-game-title {
    font-size: clamp(0.6em, 3vw, 0.85em);
}
body.android-device .auth-logo {
    margin-bottom: 8px;
}
body.android-device .auth-form {
    gap: 8px;
}
body.android-device .auth-field input {
    padding: 8px 10px;
}
body.android-device .auth-submit-btn {
    padding: 10px 12px;
}
body.android-device .auth-offline-row {
    margin-top: 6px;
    gap: 5px;
}

/* â”€â”€ Forgot password link â”€â”€ */
.auth-forgot-link {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.36em, 1.1vw, 0.46em);
    color: rgba(139, 233, 253, 0.55);
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
    margin-top: 2px;
    padding: 4px 0;
    transition: color 0.2s;
    text-decoration: underline;
    text-decoration-color: rgba(139,233,253,0.2);
    align-self: center;
}
.auth-forgot-link:hover { color: rgba(139,233,253,0.9); }

.auth-forgot-desc {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.38em, 1.2vw, 0.5em);
    color: rgba(236,240,241,0.5);
    text-align: center;
    line-height: 1.7;
    margin: 0 0 10px;
}

/* â”€â”€ Offline mode row â”€â”€ */
.auth-offline-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.auth-offline-divider {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.42em;
    color: rgba(236,240,241,0.2);
    letter-spacing: 3px;
}
.auth-offline-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42em, 1.4vw, 0.54em);
    padding: 10px 18px;
    background: rgba(231,76,60,0.08);
    border: 1.5px solid rgba(231,76,60,0.3);
    border-radius: 10px;
    color: rgba(231,76,60,0.75);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.auth-offline-btn:hover {
    background: rgba(231,76,60,0.18);
    border-color: rgba(231,76,60,0.6);
    color: #e74c3c;
    transform: translateY(-1px);
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   TOAST NOTIFICATION
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

#game-toast {
    display: none;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    left: 50%;
    transform: translateX(-50%) translateY(-70px);
    background: rgba(14, 22, 40, 0.97);
    border: 2px solid rgba(46, 204, 113, 0.5);
    border-radius: 12px;
    padding: 11px 22px;
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.44em, 1.5vw, 0.56em);
    color: #2ecc71;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
    box-shadow: 0 4px 24px rgba(46, 204, 113, 0.18), 0 8px 28px rgba(0,0,0,0.45);
    z-index: 20000;
    white-space: nowrap;
    max-width: 88vw;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}
#game-toast.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
#game-toast.toast-error {
    border-color: rgba(231, 76, 60, 0.5);
    color: #e74c3c;
    text-shadow: 0 0 8px rgba(231, 76, 60, 0.5);
    box-shadow: 0 4px 24px rgba(231, 76, 60, 0.18), 0 8px 28px rgba(0,0,0,0.45);
}
#game-toast.toast-info {
    border-color: rgba(74, 104, 217, 0.5);
    color: #8be9fd;
    text-shadow: 0 0 8px rgba(139, 233, 253, 0.5);
    box-shadow: 0 4px 24px rgba(74, 104, 217, 0.18), 0 8px 28px rgba(0,0,0,0.45);
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   VERIFICATION NOTICE (shown after register)
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.auth-verify-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 8px 0;
    animation: authCardIn 0.35s ease;
}
.auth-verify-icon {
    font-size: 3em;
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(74, 104, 217, 0.7));
    animation: authSnakeWiggle 2.5s ease-in-out infinite;
}
.auth-verify-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7em, 2.5vw, 0.9em);
    color: #4a68d9;
    text-shadow: 0 0 14px rgba(74, 104, 217, 0.6);
    margin: 0;
}
.auth-verify-text {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.4em, 1.3vw, 0.53em);
    color: rgba(236, 240, 241, 0.6);
    margin: 0;
    line-height: 1.7;
}
.auth-verify-email-display {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42em, 1.4vw, 0.56em);
    color: #f1c40f;
    text-shadow: 0 0 8px rgba(241, 196, 15, 0.5);
    background: rgba(241, 196, 15, 0.08);
    border: 1.5px solid rgba(241, 196, 15, 0.3);
    border-radius: 8px;
    padding: 8px 14px;
    word-break: break-all;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}
.auth-verify-hint {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.36em, 1.2vw, 0.48em);
    color: rgba(236, 240, 241, 0.45);
    margin: 0;
    line-height: 1.8;
}
.auth-verify-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}
.auth-resend-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.46em, 1.6vw, 0.6em);
    padding: 12px 10px;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(74, 104, 217, 0.25);
}
.auth-resend-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5574e8, #4060cc);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 104, 217, 0.4);
}
.auth-resend-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.auth-back-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.4em, 1.3vw, 0.53em);
    padding: 10px;
    background: transparent;
    border: 1.5px solid rgba(74, 104, 217, 0.3);
    border-radius: 8px;
    color: rgba(236, 240, 241, 0.55);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}
.auth-back-btn:hover {
    border-color: rgba(74, 104, 217, 0.6);
    color: #ecf0f1;
    background: rgba(74, 104, 217, 0.08);
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   ACCOUNT SETTINGS PANEL
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

.account-info-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(74, 104, 217, 0.07);
    border: 1.5px solid rgba(74, 104, 217, 0.22);
    border-radius: 12px;
    padding: 14px 16px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 22px;
}
.account-avatar {
    font-size: 2.4em;
    filter: drop-shadow(0 0 8px rgba(241, 196, 15, 0.5));
    flex-shrink: 0;
    line-height: 1;
}
.account-info-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
}
.account-username {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75em;
    color: #f1c40f;
    text-shadow: 0 0 6px rgba(241, 196, 15, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-email {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.44em;
    color: rgba(236, 240, 241, 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.account-form-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
    margin-bottom: 6px;
}
.account-form-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-bottom: 6px;
}
.account-input {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    padding: 10px 12px;
    background: rgba(10, 18, 32, 0.7);
    border: 2px solid rgba(74, 104, 217, 0.3);
    border-radius: 8px;
    color: #ecf0f1;
    outline: none;
    flex: 1;
    min-width: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    width: 100%;
}
.account-input::placeholder { color: rgba(236, 240, 241, 0.22); }
.account-input:focus {
    border-color: #4a68d9;
    box-shadow: 0 0 10px rgba(74, 104, 217, 0.3), inset 0 0 4px rgba(74, 104, 217, 0.08);
}
.account-save-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    padding: 10px 14px;
    background: linear-gradient(135deg, #4a68d9, #3653b3);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-end;
}
.account-save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5574e8, #4060cc);
    transform: translateY(-2px);
}
.account-save-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.account-save-pw-btn { align-self: stretch; }

.account-msg {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.44em;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 14px;
    text-align: center;
    line-height: 1.7;
}
.account-msg.msg-success {
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.25);
}
.account-msg.msg-error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.25);
}
.account-danger-zone {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(231, 76, 60, 0.15);
    width: 100%;
    display: flex;
    justify-content: center;
}
.account-signout-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6em;
    padding: 12px 30px;
    background: rgba(231, 76, 60, 0.12);
    border: 2px solid rgba(231, 76, 60, 0.35);
    border-radius: 10px;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.2s;
}
.account-signout-btn:hover {
    background: rgba(231, 76, 60, 0.28);
    border-color: #e74c3c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.25);
}

/* â”€â”€ Delete Account â”€â”€ */
.account-delete-zone {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.account-delete-hint {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.35em;
    color: #888;
    text-align: center;
    line-height: 1.6;
}
.account-delete-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55em;
    padding: 10px 24px;
    background: rgba(192, 57, 43, 0.15);
    border: 2px solid rgba(192, 57, 43, 0.4);
    border-radius: 10px;
    color: #c0392b;
    cursor: pointer;
    transition: all 0.2s;
}
.account-delete-btn:hover:not(:disabled) {
    background: rgba(192, 57, 43, 0.35);
    border-color: #c0392b;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(192, 57, 43, 0.3);
}
.account-delete-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Delete confirmation modal */
.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}
.delete-modal-content {
    background: #1a1a2e;
    border: 2px solid rgba(192, 57, 43, 0.5);
    border-radius: 16px;
    padding: 24px 28px;
    max-width: 380px;
    width: 90%;
    text-align: center;
}
.delete-modal-content h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7em;
    color: #e74c3c;
    margin-bottom: 12px;
}
.delete-modal-content p {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.38em;
    color: #ccc;
    line-height: 1.8;
    margin-bottom: 10px;
}
.delete-confirm-prompt {
    margin-top: 8px;
}
.delete-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

/* â”€â”€ Username availability hint (register form) â”€â”€ */
.auth-field-hint {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.38em;
    min-height: 1.4em;
    padding: 3px 2px 0;
    line-height: 1.4;
    display: block;
}
.hint-ok      { color: #2ecc71; }
.hint-err     { color: #e74c3c; }
.hint-checking{ color: rgba(236,240,241,0.4); }

/* â”€â”€ Leaderboard tabs â”€â”€ */
.lb-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    border-bottom: 1.5px solid rgba(74,104,217,0.2);
    padding-bottom: 8px;
}
.lb-tab {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.44em, 1.4vw, 0.56em);
    padding: 8px 16px;
    background: rgba(74,104,217,0.08);
    border: 1.5px solid rgba(74,104,217,0.25);
    border-radius: 8px 8px 0 0;
    color: rgba(236,240,241,0.5);
    cursor: pointer;
    transition: all 0.2s;
}
.lb-tab.active {
    background: rgba(74,104,217,0.2);
    border-color: rgba(74,104,217,0.6);
    color: #8be9fd;
}
.lb-tab:hover:not(.active) {
    background: rgba(74,104,217,0.14);
    color: rgba(236,240,241,0.75);
}

/* Rank medals */
.lb-gold   td { color: #f1c40f; }
.lb-silver td { color: #bdc3c7; }
.lb-bronze td { color: #e67e22; }

.lb-msg {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5em;
    color: rgba(236,240,241,0.35);
    text-align: center;
    padding: 18px 0;
    line-height: 1.8;
}

/* Scrollable leaderboard table container */
.lb-table-scroll {
    max-height: 50vh;
    overflow-y: auto;
    border-radius: 10px;
}
.lb-table-scroll::-webkit-scrollbar { width: 6px; }
.lb-table-scroll::-webkit-scrollbar-thumb { background: rgba(74,104,217,0.4); border-radius: 3px; }
.lb-table-scroll::-webkit-scrollbar-track { background: transparent; }

/* Current user's row highlight */
.lb-self td {
    color: #8be9fd !important;
    font-weight: bold;
}
.lb-self {
    background: rgba(139,233,253,0.1) !important;
    border-left: 3px solid #8be9fd;
}

/* User rank line above global table */
.lb-rank-line {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.45em, 1.3vw, 0.55em);
    color: #8be9fd;
    text-align: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(139,233,253,0.08);
    border: 1px solid rgba(139,233,253,0.2);
    border-radius: 8px;
}

/* â”€â”€ About: competitive tagline â”€â”€ */
.about-competitive-tagline {
    margin: 16px 0 0;
    padding: 14px 16px;
    background: linear-gradient(90deg, rgba(74, 104, 217, 0.16), rgba(15, 25, 40, 0.36));
    border: 1px solid rgba(74, 104, 217, 0.2);
    border-left: 3px solid rgba(241, 196, 15, 0.65);
    border-radius: 16px;
    font-size: 0.58em;
    color: rgba(236, 240, 241, 0.72);
    line-height: 1.8;
}

/* â”€â”€ Offline-during-game countdown overlay â”€â”€ */

/* -- Rewind power-up death window overlay -- */
#rewind-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(5px);
}
.rewind-card {
    background: rgba(15, 10, 30, 0.97);
    border: 2px solid rgba(142, 68, 173, 0.7);
    border-radius: 18px;
    padding: 36px 44px;
    text-align: center;
    box-shadow: 0 0 50px rgba(142, 68, 173, 0.35), 0 0 120px rgba(142, 68, 173, 0.1);
    animation: authCardIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.rewind-icon {
    font-size: 2.8em;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 12px rgba(195, 155, 211, 0.8));
}
.rewind-card h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7em, 2vw, 1em);
    color: #e74c3c;
    margin: 0;
    text-shadow: 0 0 12px rgba(231, 76, 60, 0.6);
}
.rewind-card p {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.38em, 1.1vw, 0.5em);
    color: rgba(195, 155, 211, 0.75);
    margin: 0;
    line-height: 1.7;
}
.rewind-countdown {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(2.2em, 9vw, 4em);
    color: #c39bd3;
    text-shadow: 0 0 24px rgba(142, 68, 173, 0.9);
    animation: rewindPulse 1s ease-in-out infinite;
    line-height: 1;
    margin: 4px 0;
}
.rewind-hint {
    color: rgba(241, 196, 15, 0.85) !important;
    font-size: clamp(0.35em, 1vw, 0.46em) !important;
}
.rewind-hint strong {
    color: #f1c40f;
}
@keyframes rewindPulse {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%       { transform: scale(1.12); opacity: 0.75; }
}
#offline-countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
}
.offline-countdown-card {
    background: rgba(15, 23, 42, 0.97);
    border: 2px solid rgba(231, 76, 60, 0.6);
    border-radius: 18px;
    padding: 36px 44px;
    text-align: center;
    box-shadow: 0 0 40px rgba(231, 76, 60, 0.25);
    animation: authCardIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.offline-countdown-icon {
    font-size: 2.4em;
    margin-bottom: 4px;
}
.offline-countdown-card h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7em, 2vw, 1em);
    color: #e74c3c;
    margin: 0;
}
.offline-countdown-card p {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.4em, 1.2vw, 0.54em);
    color: rgba(236,240,241,0.6);
    margin: 0;
    line-height: 1.7;
}
.offline-countdown-num {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(2em, 8vw, 3.5em);
    color: #e74c3c;
    text-shadow: 0 0 20px rgba(231,76,60,0.7);
    animation: connPulse 1s ease-in-out infinite;
    line-height: 1;
}
.offline-countdown-hint {
    color: rgba(46,204,113,0.7) !important;
}

/* â”€â”€ Resign confirm modal (online mode) â”€â”€ */
#resign-modal {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
}
.resign-card {
    background: rgba(15, 23, 42, 0.97);
    border: 2px solid rgba(241,196,15,0.5);
    border-radius: 18px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: 0 0 36px rgba(241,196,15,0.15);
    animation: authCardIn 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 360px;
}
.resign-icon { font-size: 2em; }
.resign-card h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7em, 2vw, 1em);
    color: #f1c40f;
    margin: 0;
}
.resign-card p {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.38em, 1.1vw, 0.5em);
    color: rgba(236,240,241,0.55);
    line-height: 1.9;
    margin: 0;
}
.resign-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    width: 100%;
}
.resign-actions button {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.42em, 1.2vw, 0.54em);
    padding: 10px 0;
    border-radius: 10px;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
    border: 1.5px solid;
}
#resign-cancel-btn {
    background: rgba(74,104,217,0.12);
    border-color: rgba(74,104,217,0.4);
    color: #8be9fd;
}
#resign-cancel-btn:hover {
    background: rgba(74,104,217,0.25);
    border-color: #4a68d9;
}
#resign-confirm-btn {
    background: rgba(231,76,60,0.12);
    border-color: rgba(231,76,60,0.4);
    color: #e74c3c;
}
#resign-confirm-btn:hover {
    background: rgba(231,76,60,0.28);
    border-color: #e74c3c;
    color: #fff;
}


/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   UNIVERSAL RESPONSIVE SYSTEM
   Covers ALL devices: iPhone SE â†’ iPhone 16 Pro Max, all iPads, all Android
   phones & tablets, and desktop from 720p to 4K.
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€â”€ iOS / iPad / any non-Android mobile â€” get the same treatment as android â”€ */
body.mobile-device:not(.android-device) {
    align-items: center;
    justify-content: center;
}

body.mobile-device:not(.android-device) .android-only {
    display: block;
}

body.mobile-device:not(.android-device) .non-android-only {
    display: none;
}

body.mobile-device:not(.android-device) .game-layout {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100dvh;
    padding: var(--sat) var(--sar) var(--sab) var(--sal);
    box-sizing: border-box;
    align-items: center;
    justify-content: flex-start;
}

body.mobile-device:not(.android-device) #game-hud {
    flex-shrink: 0;
    gap: 4px;
    padding: 4px 8px;
}

body.mobile-device:not(.android-device) .hud-group { gap: 4px; }

body.mobile-device:not(.android-device) .hud-item {
    padding: 3px 8px;
    font-size: clamp(7px, 1.5vw, 11px);
    border-radius: 6px;
}

body.mobile-device:not(.android-device) .hud-score { padding: 4px 10px; }
body.mobile-device:not(.android-device) .hud-best  { padding: 4px 10px; }
body.mobile-device:not(.android-device) .hud-label  { font-size: 0.5em; letter-spacing: 1.5px; }

body.mobile-device:not(.android-device) .game-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    width: 100%;
    min-height: 0;
    padding: 6px 8px;
    box-sizing: border-box;
    container-type: size;
    container-name: game-stage;
}

body.mobile-device:not(.android-device) #game-container {
    grid-column: 2;
    width: var(--android-board-size, min(55vw, 80dvh));
    height: var(--android-board-size, min(55vw, 80dvh));
    aspect-ratio: 1;
    max-width: none;
    max-height: 100%;
    margin: 0;
    border-width: 2px;
    flex-shrink: 0;
}

body.mobile-device:not(.android-device) #joystick-zone,
body.mobile-device:not(.android-device) #dpad-zone {
    grid-column: 1;
    justify-self: center;
}

body.mobile-device:not(.android-device) #action-cluster {
    grid-column: 3;
    justify-self: center;
    width: auto;
}

body.mobile-device:not(.android-device) #game-board,
body.mobile-device:not(.android-device) #game-container {
    touch-action: none;
}

body.mobile-device:not(.android-device) #joystick-zone {
    width: clamp(100px, 18vw, 150px);
    height: clamp(100px, 18vw, 150px);
}

body.mobile-device:not(.android-device) .joystick-base {
    width: clamp(88px, 16vw, 130px);
    height: clamp(88px, 16vw, 130px);
}

body.mobile-device:not(.android-device) .joystick-thumb {
    width: clamp(36px, 6vw, 48px);
    height: clamp(36px, 6vw, 48px);
}

body.mobile-device:not(.android-device) .action-main {
    grid-template-columns: clamp(44px, 7.5vw, 56px) clamp(44px, 7.5vw, 56px);
    grid-template-rows: clamp(44px, 7.5vw, 56px) clamp(44px, 7.5vw, 56px);
    gap: clamp(5px, 1vw, 8px);
}

body.mobile-device:not(.android-device) .power-btn,
body.mobile-device:not(.android-device) .bomb-btn,
body.mobile-device:not(.android-device) .shoot-btn,
body.mobile-device:not(.android-device) .boost-btn {
    width: clamp(44px, 7.5vw, 56px);
    height: clamp(44px, 7.5vw, 56px);
    font-size: clamp(18px, 3.5vw, 24px);
}

body.mobile-device:not(.android-device) .pause-btn {
    width: clamp(36px, 6vw, 46px);
    height: clamp(32px, 5vw, 40px);
    font-size: clamp(16px, 3vw, 20px);
}

body.mobile-device:not(.android-device) #main-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100dvh;
    padding: calc(var(--sat) + 8px) 14px calc(var(--sab) + 8px);
    box-sizing: border-box;
    overflow: hidden;
}

body.mobile-device:not(.android-device) .menu-container {
    width: min(100%, 560px);
    margin: 0 auto;
    padding: 20px 22px 20px;
    animation: none;
    opacity: 1;
}

body.mobile-device:not(.android-device) .corner-decoration,
body.mobile-device:not(.android-device) .light-source,
body.mobile-device:not(.android-device) .menu-scanlines {
    display: none;
}

body.mobile-device:not(.android-device) .menu-snake-logo { margin-bottom: 10px; }
body.mobile-device:not(.android-device) .snake-svg { width: 88px; height: 53px; }
body.mobile-device:not(.android-device) .game-title { margin-bottom: 12px; }

body.mobile-device:not(.android-device) .game-title h1 {
    font-size: clamp(1.2rem, 4.5vw, 1.9rem);
    line-height: 1.2;
    letter-spacing: 1px;
}

body.mobile-device:not(.android-device) .game-tagline {
    font-size: clamp(0.38rem, 1.1vw, 0.55rem);
}

body.mobile-device:not(.android-device) #main-menu button {
    width: min(100%, 320px);
    padding: 10px 16px;
    font-size: clamp(10px, 2vw, 14px);
}

body.mobile-device:not(.android-device) #main-menu #start-button {
    padding: 14px 16px;
    font-size: clamp(11px, 2.2vw, 15px);
}

body.mobile-device:not(.android-device) .button-container { gap: 9px; }
body.mobile-device:not(.android-device) .title-decoration { bottom: -8px; }
body.mobile-device:not(.android-device) .menu-version { display: none; }

body.mobile-device:not(.android-device) #boss-warning {
    top: calc(var(--sat) + 12px);
    width: calc(100vw - 32px);
    max-width: 360px;
    font-size: 0.9em;
    text-align: center;
}

body.mobile-device:not(.android-device) #instructions,
body.mobile-device:not(.android-device) #leaderboard,
body.mobile-device:not(.android-device) #settings-panel {
    position: fixed;
    inset: calc(var(--sat) + 12px) 12px calc(var(--sab) + 12px) 12px;
    width: auto;
    max-width: none;
    max-height: none;
    transform: none !important;
    animation: none !important;
    overflow-y: auto;
    padding: 24px 18px;
}
body.mobile-device:not(.android-device) #about-panel {
    position: fixed;
    inset: calc(var(--sat) + 12px) 12px calc(var(--sab) + 12px) 12px;
    width: auto;
    max-width: none;
    max-height: none;
    transform: none !important;
    animation: none !important;
    overflow: hidden;
    padding: 0;
}

body.mobile-device:not(.android-device) #instructions p,
body.mobile-device:not(.android-device) #instructions li,
body.mobile-device:not(.android-device) #leaderboard td,
body.mobile-device:not(.android-device) #leaderboard th,
body.mobile-device:not(.android-device) .option-desc,
body.mobile-device:not(.android-device) .pause-hint {
    font-size: 0.82em;
}

body.mobile-device:not(.android-device) .pause-card {
    width: min(88vw, 360px);
    padding: 28px 20px;
}

body.mobile-device:not(.android-device) #pause-screen button,
body.mobile-device:not(.android-device) .exit-confirm-actions button {
    min-height: 54px;
}

body.mobile-device:not(.android-device).controller-connected #joystick-zone,
body.mobile-device:not(.android-device).controller-connected #dpad-zone,
body.mobile-device:not(.android-device).controller-connected #action-cluster {
    display: none !important;
}

body.mobile-device:not(.android-device).controller-connected #game-container {
    width: min(90cqmin, 600px);
    height: min(90cqmin, 600px);
    grid-column: 1 / 4;
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   SMALL PHONES (width â‰¤ 380px) â€” iPhone SE, Galaxy S series, etc.
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 380px) {
    /* Tighter HUD */
    #game-hud { padding: 2px 4px; gap: 2px; }
    .hud-group { gap: 2px; }
    .hud-item { padding: 2px 5px; font-size: 0.5em; border-radius: 5px; }
    .hud-score, .hud-best { padding: 2px 6px; }
    .hud-score #score { font-size: 1.1em; }
    .hud-best #high-score { font-size: 1em; }
    .hud-label { font-size: 0.45em; letter-spacing: 1px; }

    /* Smaller board + controls on tiny phones */
    .game-stage { padding: 4px 4px; }

    /* Menu */
    .menu-container { padding: 14px 14px; }
    .menu-snake-logo { margin-bottom: 8px !important; }
    .snake-svg { width: 72px !important; height: 43px !important; }
    .game-title h1 { font-size: clamp(0.95rem, 5vw, 1.4rem) !important; }
    .game-title { margin-bottom: 10px !important; }
    .game-tagline { font-size: clamp(0.34rem, 1vw, 0.48rem) !important; }
    #main-menu button {
        width: min(100%, 260px) !important;
        padding: 8px 12px !important;
        font-size: clamp(8px, 2.5vw, 11px) !important;
    }
    #main-menu #start-button {
        padding: 12px 12px !important;
        font-size: clamp(9px, 2.8vw, 12px) !important;
    }
    .button-container { gap: 7px !important; }

    /* Panels */
    #settings-panel,
    #instructions,
    #leaderboard { padding: 16px 12px !important; }
    #settings-panel h2,
    #instructions h2,
    #leaderboard h2,
    #about-panel h2 { font-size: 1.05em; }

    .about-content { padding: 12px; }
    .about-intro,
    .about-story,
    .about-features,
    .about-creator { padding: 14px; }
    .about-meta-chips { gap: 6px; }
    .about-meta-chip { min-height: 28px; padding: 0 10px; font-size: 0.44em; }
    .about-footer-fixed { padding: 12px; }

    .settings-hub-grid { gap: 8px; }
    .settings-hub-card { padding: 12px 6px; }
    .hub-icon { font-size: 1.4em; }
    .hub-title { font-size: 0.48em; }
    .hub-desc { font-size: 0.38em; }

    /* Auth */
    .auth-card { padding: 14px 12px 10px; }
    .auth-snake-emoji { font-size: 2.2em; }

    /* Game Over / Pause / Modals */
    .game-over-card { padding: 22px 18px; }
    .game-over-card h2 { font-size: 1.4em; }
    .game-over-card p { font-size: 1.1em; }
    .game-over-card button { padding: 10px 18px; font-size: 0.9em; }

    .pause-card { padding: 22px 16px; }
    #pause-screen h2 { font-size: 1.4em; }
    #pause-screen button { width: 180px; padding: 10px 0; font-size: 0.8em; }

    .exit-confirm-card { padding: 20px 16px; }
    .exit-confirm-card h2 { font-size: 1.2em; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   PHONES PORTRAIT (width â‰¤ 480px) â€” all iPhones, most androids
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 480px) {
    /* Leaderboard table - compact fonts */
    #leaderboard th, #leaderboard td { padding: 8px 4px; font-size: 0.6em; }
    #leaderboard h2 { font-size: 1.3em; margin-bottom: 16px; }

    /* Instructions â€” all text compact */
    #instructions h2 { font-size: 1.2em; }
    #instructions p, #instructions li { font-size: 0.85em; line-height: 1.5; }
    .category-button { padding: 7px 12px; font-size: 0.65em; }

    /* About */
    #about-panel h2 { font-size: 1.2em; }
    .about-header-fixed,
    .about-footer-fixed { padding: 14px; }
    .about-header-actions { gap: 8px; }
    .about-version-badge { min-height: 30px; padding: 0 10px; font-size: 0.48em; }
    .about-close-btn { width: 36px; height: 36px; }
    .about-content { padding: 14px; gap: 12px; }
    .about-intro,
    .about-story,
    .about-features,
    .about-creator { padding: 16px; }
    .about-description { font-size: 0.62em; }
    .about-feature-grid { grid-template-columns: 1fr; }
    .about-meta-chip { font-size: 0.45em; }
    .creator-card { padding: 14px; gap: 12px; align-items: flex-start; }
    .creator-photo { width: 64px; height: 64px; }
    .creator-name { font-size: 0.7em; }
    .about-footer-note { font-size: 0.48em; }

    /* Guide slides */
    .guide-card { padding: 20px 16px 14px; }
    .guide-icon { font-size: 2.2em; }

    /* Resign modal */
    .resign-card { padding: 22px 18px; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   LANDSCAPE PHONES (short height) â€” iPhone SE/8/X/14/15/16 + Android in landscape
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-height: 500px) and (orientation: landscape) {
    /* Stack everything horizontally, compress vertically */
    #game-hud { padding: 2px 8px; gap: 3px; }
    .hud-item { padding: 2px 6px; font-size: 0.52em; }
    .hud-score, .hud-best { padding: 2px 8px; }
    .hud-label { font-size: 0.4em; }

    .game-stage { padding: 2px 6px; }

    /* Menu in landscape */
    .menu-container { padding: 12px 20px !important; }
    .menu-snake-logo { display: none !important; }
    .game-title { margin-bottom: 6px !important; }
    .game-title h1 { font-size: clamp(1rem, 3vh, 1.4rem) !important; }
    .game-tagline { display: none !important; }
    .button-container { gap: 5px !important; }
    #main-menu button {
        padding: 6px 12px !important;
        font-size: clamp(8px, 1.5vh, 11px) !important;
    }
    #main-menu #start-button {
        padding: 9px 12px !important;
        font-size: clamp(9px, 1.7vh, 12px) !important;
    }

    /* Panels in landscape â€” use near-full screen */
    #settings-panel,
    #instructions,
    #leaderboard {
    inset: calc(var(--sat) + 4px) 8px calc(var(--sab) + 4px) 8px !important;
    padding: 12px 14px !important;
}
#about-panel {
    inset: calc(var(--sat) + 4px) 8px calc(var(--sab) + 4px) 8px !important;
    /* removed padding for about-panel */
}

    .about-content {
        padding: 12px;
        gap: 12px;
    }

    .about-header-fixed,
    .about-footer-fixed {
        padding: 12px 14px;
    }

    .about-intro {
        padding: 16px;
    }

    .about-intro {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 14px;
        justify-items: stretch;
        text-align: left;
    }

    .about-intro-art {
        width: 92px;
        height: 92px;
    }

    .about-intro-copy {
        text-align: left;
        align-items: flex-start;
    }

    .about-game-title {
        max-width: 12ch;
    }

    .about-meta-chips {
        justify-content: flex-start;
    }

    .about-layout {
        grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
        grid-template-areas:
            'story creator'
            'features features';
    }

    .about-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .about-footer-fixed {
        flex-direction: row;
    }

    .about-footer-note {
        max-width: 55%;
        text-align: left;
    }

    /* Auth in landscape */
    .auth-card { max-height: 100dvh; }
    .auth-logo { margin-bottom: 4px; }
    .auth-snake-emoji { font-size: 1.8em; }
    .auth-form { gap: 6px; }

    /* Game over / pause */
    .game-over-card { padding: 16px 24px; }
    .game-over-card h2 { font-size: 1.3em; }
    .pause-card { padding: 14px 20px; }
    .pause-icon { font-size: 1.8em; margin-bottom: 4px; }
    #pause-screen h2 { font-size: 1.3em; margin-bottom: 4px; }
    .pause-hint { margin-bottom: 12px; }
    #pause-screen button { width: 170px; padding: 8px 0; font-size: 0.78em; }

    /* Guide in landscape */
    .guide-card { padding: 14px 16px 10px; max-height: 95dvh; }
    .guide-icon { font-size: 1.8em; }
}

/* Landscape on slightly taller phones (iPhone Pro Max, Pixel) */
@media (min-height: 500px) and (max-height: 650px) and (orientation: landscape) {
    .menu-container { padding: 16px 24px !important; }
    .menu-snake-logo { margin-bottom: 8px !important; }
    .snake-svg { width: 80px !important; height: 48px !important; }
    .game-title h1 { font-size: clamp(1.1rem, 3.5vh, 1.6rem) !important; }
    .game-tagline { font-size: clamp(0.36rem, 1vh, 0.5rem) !important; }
    #main-menu button {
        padding: 8px 12px !important;
        font-size: clamp(9px, 1.8vh, 12px) !important;
    }
    #main-menu #start-button {
        padding: 11px 12px !important;
    }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   TABLETS PORTRAIT (768px â€“ 1024px) â€” iPad Mini, iPad Air, iPad Pro, Galaxy Tab
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    /* Larger game board on tablets */
    #game-container {
        width: min(80cqmin, 560px);
        height: min(80cqmin, 560px);
    }

    /* Menu optimized for tablet */
    .menu-container {
        padding: 36px 48px;
        max-width: 520px;
    }
    .game-title h1 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
    #main-menu button {
        width: min(100%, 340px);
        padding: 14px 20px;
        font-size: clamp(11px, 1.6vw, 15px);
    }
    #main-menu #start-button {
        padding: 18px 20px;
        font-size: clamp(12px, 1.8vw, 16px);
    }

    /* Panels centered nicely */
    #instructions,
    #leaderboard,
    #settings-panel,
    #about-panel {
        width: min(90vw, 600px);
        max-height: 85vh;
    }

    /* HUD more spacious */
    #game-hud { padding: 8px 20px; gap: 10px; }
    .hud-item { padding: 5px 14px; font-size: 0.7em; }
    .hud-score { padding: 6px 20px; }
    .hud-best { padding: 6px 20px; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   TABLETS LANDSCAPE â€” iPad Mini/Air/Pro landscape, Galaxy Tab landscape
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (min-width: 1024px) and (max-width: 1400px) and (orientation: landscape),
       (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    /* Big game board in landscape tablets */
    #game-container {
        width: min(85cqmin, 600px);
        height: min(85cqmin, 600px);
    }

    .menu-container {
        padding: 30px 50px;
        max-width: 560px;
    }
    .game-title h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   STANDARD DESKTOP (1024px â€“ 1440px) â€” Laptops, common monitors
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (min-width: 1024px) and (max-width: 1439px) {
    .menu-container {
        min-width: 520px;
        padding: 44px 70px;
    }
    .game-title h1 { font-size: clamp(2rem, 3vw, 3em); }
    #main-menu button { width: 340px; padding: 18px 0; font-size: 1.2em; }
    .button-container { gap: 16px; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   LARGE DESKTOP (1440px+) â€” More generous sizing
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (min-width: 1440px) {
    #game-container {
        width: min(90cqmin, 700px);
        height: min(90cqmin, 700px);
    }

    .menu-container { min-width: 560px; padding: 50px 80px; }
    .game-title h1 { font-size: 3.5em; }
    #main-menu button { width: 380px; padding: 20px 0; font-size: 1.3em; }
    .button-container { gap: 18px; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   ULTRA-WIDE / 4K  (2560px+) â€” Scale up proportionally
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (min-width: 2560px) {
    #game-container {
        width: min(90cqmin, 900px);
        height: min(90cqmin, 900px);
    }

    .menu-container { min-width: 640px; padding: 60px 100px; max-width: 800px; }
    .game-title h1 { font-size: 4em; }
    #main-menu button { width: 440px; padding: 22px 0; font-size: 1.4em; }
    .button-container { gap: 20px; }
    .hud-item { font-size: 0.85em; }
    .hud-score #score { font-size: 1.8em; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   iOS SAFE AREA â€” iPhones with notch/Dynamic Island
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@supports (padding-top: env(safe-area-inset-top)) {
    body.mobile-device .game-layout {
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    body.mobile-device #main-menu {
        padding: calc(env(safe-area-inset-top, 0px) + 8px)
                 calc(env(safe-area-inset-right, 0px) + 14px)
                 calc(env(safe-area-inset-bottom, 0px) + 8px)
                 calc(env(safe-area-inset-left, 0px) + 14px);
    }

    body.mobile-device #instructions,
    body.mobile-device #leaderboard,
    body.mobile-device #settings-panel,
    body.mobile-device #about-panel {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
        left: calc(env(safe-area-inset-left, 0px) + 12px);
        right: calc(env(safe-area-inset-right, 0px) + 12px);
    }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   ANDROID LANDSCAPE â€” Existing android-device landscape enhancements
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-height: 500px) and (orientation: landscape) {
    body.android-device .game-layout,
    body.mobile-device .game-layout {
        gap: 2px;
    }

    body.android-device .menu-container,
    body.mobile-device .menu-container {
        width: min(100%, 480px);
    }

    body.android-device .game-title h1,
    body.mobile-device .game-title h1 {
        font-size: clamp(1rem, 3.5vh, 1.5rem) !important;
    }

    body.android-device .button-container,
    body.mobile-device .button-container { gap: 5px !important; }

    body.android-device .settings-hub-grid,
    body.mobile-device .settings-hub-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    body.android-device .settings-hub-card,
    body.mobile-device .settings-hub-card {
        padding: 10px 6px;
    }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   UNIVERSAL PANEL SCROLLING â€” ensure no content gets cut off
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#settings-panel,
#instructions,
#leaderboard {
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 104, 217, 0.4) transparent;
}
#settings-panel::-webkit-scrollbar,
#instructions::-webkit-scrollbar,
#leaderboard::-webkit-scrollbar { width: 5px; }
#settings-panel::-webkit-scrollbar-thumb,
#instructions::-webkit-scrollbar-thumb,
#leaderboard::-webkit-scrollbar-thumb {
    background: rgba(74, 104, 217, 0.4);
    border-radius: 4px;
}
#settings-panel::-webkit-scrollbar-track,
#instructions::-webkit-scrollbar-track,
#leaderboard::-webkit-scrollbar-track {
    background: transparent;
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   LEADERBOARD TABLE RESPONSIVE â€” prevent horizontal overflow
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.lb-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 400px) {
    #leaderboard th, #leaderboard td {
        padding: 6px 3px;
        font-size: 0.5em;
    }
    .lb-tab { font-size: 0.5em; padding: 6px 8px; }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   SETTINGS HUB RESPONSIVE â€” 1-col on tiny phones, 3-col on tablets
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 340px) {
    .settings-hub-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 600px) {
    .settings-hub-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   GAME-OVER / NAME ENTRY â€” clamp card sizes for all screens
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.game-over-card,
#name-entry-modal .modal-content {
    width: min(88vw, 420px);
    max-height: 90dvh;
    overflow-y: auto;
    box-sizing: border-box;
}

#name-entry-modal h2 { font-size: clamp(1.2em, 4vw, 2em); }

#name-entry-modal input[type="text"] {
    font-size: clamp(0.8em, 2.5vw, 1.2em);
    padding: clamp(8px, 2vw, 12px);
}

#name-entry-modal button {
    font-size: clamp(0.8em, 2.5vw, 1.2em);
    padding: clamp(10px, 2.5vw, 15px) clamp(18px, 5vw, 30px);
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   FIRST-RUN GUIDE â€” responsive for all screens
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 380px) {
    .guide-card { padding: 16px 12px 12px; width: min(480px, 100%); }
    .guide-icon { font-size: 2em; }
    .guide-title { font-size: clamp(0.6em, 3vw, 0.85em); }
    .guide-list li { font-size: clamp(0.38em, 2vw, 0.52em); padding: 6px 8px; }
    .guide-pu-row { font-size: clamp(0.36em, 2vw, 0.48em); padding: 5px 8px; }
    .guide-btn { padding: 8px 12px; font-size: clamp(0.4em, 2vw, 0.55em); }
}


/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   AUTH SCREEN â€” make it fit any device perfectly
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 380px) {
    #auth-screen { padding: calc(var(--sat) + 8px) 8px calc(var(--sab) + 8px); }
    .auth-card { padding: 14px 12px 10px; width: min(380px, 100%); }
    .auth-snake-emoji { font-size: 2em; }
    .auth-game-title { font-size: clamp(0.55em, 3.5vw, 0.8em); }
    .auth-tab { font-size: clamp(0.42em, 2.5vw, 0.58em); padding: 8px 4px; }
    .auth-submit-btn { padding: 10px 8px; font-size: clamp(0.44em, 2.5vw, 0.6em); }
}

@media (max-height: 600px) {
    .auth-card { max-height: 100dvh; overflow-y: auto; }
    .auth-logo { margin-bottom: 6px; }
    .auth-snake-emoji { font-size: 2em; }
    .auth-form { gap: 6px; }
    .auth-field input { padding: 7px 10px; }
    .auth-tabs { margin-bottom: 12px; }
}

/* Keep the refreshed home menu authoritative over earlier Android-specific rules. */
body.android-device #main-menu .menu-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "logo" "title" "actions" "version";
    width: min(100%, 520px);
    min-height: auto;
    padding: 26px 18px 20px;
}
body.android-device #main-menu .menu-snake-logo { display: flex; justify-content: center; }
body.android-device #main-menu .game-title { text-align: center; }
body.android-device #main-menu .button-container { padding: 14px; }
body.android-device #main-menu button { width: 100%; max-width: none; }

@media (max-width: 380px), (max-height: 600px) {
    body.android-device #main-menu .menu-snake-logo { display: none; }
}

@media (min-width: 721px) {
    #main-menu .menu-container {
        grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
        column-gap: clamp(42px, 6vw, 96px);
    }
    #main-menu .game-title { max-width: 650px; }
    #main-menu .game-title h1 {
        font-size: clamp(2.55rem, 4.1vw, 4.35rem);
        letter-spacing: 0;
    }
    #main-menu .button-container { position: relative; z-index: 2; }
}

/* Home menu redesign v2: intentionally simple, readable, and collision-free. */
#main-menu {
    background:
        radial-gradient(circle at 50% 5%, rgba(32, 90, 126, 0.34), transparent 34%),
        radial-gradient(circle at 50% 88%, rgba(19, 132, 83, 0.14), transparent 30%),
        #07101f;
}
#main-menu .geometric-pattern { opacity: 0.035; }
#main-menu .menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(540px, 100%);
    min-height: 0;
    margin: auto;
    padding: clamp(28px, 5vh, 52px) clamp(20px, 5vw, 44px) 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
#main-menu .menu-container::before,
#main-menu .menu-container::after,
#main-menu .corner-decoration { display: none; }
#main-menu .menu-snake-logo { margin: 0 0 16px; justify-content: center; }
#main-menu .snake-svg { width: 104px; }
#main-menu .game-title { max-width: none; margin: 0 0 30px; text-align: center; align-self: stretch; }
#main-menu .game-title h1 { font-size: clamp(2.15rem, 5vw, 4rem); line-height: 1.05; letter-spacing: 0; margin: 0 0 14px; }
#main-menu .game-tagline { font-size: clamp(0.42rem, 0.9vw, 0.62rem); letter-spacing: 3px; margin-bottom: 16px; }
#main-menu .title-decoration { max-width: 280px; margin: 0 auto; opacity: 0.8; }
#main-menu .button-container {
    width: min(410px, 100%) !important;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
#main-menu .button-container::before { display: none; }
#main-menu button {
    width: 100% !important;
    max-width: none !important;
    min-height: 58px;
    padding: 14px 12px;
    border-radius: 8px;
    text-align: center;
    font-size: clamp(0.5rem, 0.85vw, 0.65rem);
    box-shadow: 0 8px 18px rgba(0,0,0,0.22);
}
#main-menu #start-button {
    grid-column: 1 / -1;
    min-height: 68px;
    font-size: clamp(0.66rem, 1vw, 0.8rem);
}
#main-menu .menu-version { position: static; margin: 22px 0 0; text-align: center; align-self: center; }

@media (max-width: 720px), (max-height: 700px) {
    #main-menu { height: 100dvh; padding: 10px; overflow: hidden; }
    #main-menu .menu-container {
        box-sizing: border-box;
        width: 100% !important;
        max-width: 100% !important;
        padding: 24px 20px 20px;
        align-items: stretch;
    }
    #main-menu .menu-snake-logo { margin-bottom: 12px; }
    #main-menu .snake-svg { width: 84px; }
    #main-menu .game-title { margin-bottom: 24px; }
    #main-menu .game-title h1 {
        position: relative;
        left: 50%;
        width: calc(100vw - 40px);
        max-width: 360px;
        transform: translateX(-50%);
        font-size: clamp(1.45rem, 8vw, 2.35rem);
        overflow-wrap: anywhere;
    }
    #main-menu .button-container {
        box-sizing: border-box;
        width: 100% !important;
        max-width: none !important;
        margin: 0;
        transform: none;
        align-self: stretch;
        grid-template-columns: 1fr;
        gap: 9px;
    }
    #main-menu button, #main-menu #start-button { grid-column: auto; min-height: 54px; font-size: clamp(0.56rem, 3vw, 0.7rem); }
    #main-menu #start-button { min-height: 62px; }
}
