/* Snake: Dungeon Edition - Styles */

/* ============================================
   CSS VARIABLES - Color Palette from Spec
   ============================================ */
:root {
    /* Primary Dungeon Colors */
    --stone-dark: #1a1a2e;
    --stone-mid: #2d2d44;
    --stone-light: #4a4a6a;

    /* Organic Accent Colors */
    --moss-green: #3d5c3d;
    --vine-green: #5a8a5a;
    --moss-dark: #2a3d2a;

    /* Light and Fire */
    --torch-orange: #d4943a;
    --torch-yellow: #f4d03f;
    --torch-glow: rgba(212, 148, 58, 0.3);

    /* Snake Energy Colors */
    --snake-primary: #5dade2;
    --snake-glow: #85c1e9;
    --snake-energy: #d6eaf8;

    /* Treasure and Pickups */
    --gold: #f4d03f;
    --gem-red: #e74c3c;
    --gem-blue: #3498db;
    --gem-green: #2ecc71;
    --gem-purple: #9b59b6;

    /* Hazard Colors */
    --poison-purple: #6c3483;
    --bomb-red: #922b21;
    --danger-orange: #e67e22;

    /* UI Colors */
    --ui-background: rgba(10, 10, 20, 0.9);
    --ui-border: #4a4a6a;
    --ui-text: #f5f5dc;
    --ui-accent: #5dade2;

    /* Background */
    --void-black: #000000;
    --floor-dark: #16213e;
    --floor-pattern: #1f2f50;

    /* Fonts */
    --font-title: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--void-black);
    color: var(--ui-text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* ============================================
   GAME CONTAINER
   ============================================ */
#game-container {
    position: relative;
    width: min(800px, 100vw);
    height: min(600px, 100vh);
    aspect-ratio: 4 / 3;
    max-width: 100vw;
    max-height: 100vh;
    background: linear-gradient(135deg, var(--stone-dark), var(--floor-dark));
    border: 4px solid var(--ui-border);
    border-radius: 8px;
    box-shadow:
        0 0 20px rgba(93, 173, 226, 0.2),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   SCREEN OVERLAYS
   ============================================ */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center,
        rgba(26, 26, 46, 0.95) 0%,
        rgba(0, 0, 0, 0.98) 100%);
    z-index: 10;
    animation: fadeIn 0.3s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 10px;
}

.hidden {
    display: none !important;
}

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

/* ============================================
   TYPOGRAPHY
   ============================================ */
.game-title {
    font-family: var(--font-title);
    font-size: clamp(28px, 6vw, 48px);
    color: var(--snake-primary);
    text-shadow:
        3px 3px 0 var(--stone-dark),
        -1px -1px 0 var(--snake-glow),
        0 0 30px rgba(93, 173, 226, 0.5);
    letter-spacing: 4px;
    animation: titlePulse 2s ease-in-out infinite;
}

.game-subtitle {
    font-family: var(--font-title);
    font-size: clamp(12px, 2.5vw, 18px);
    color: var(--torch-orange);
    text-shadow: 2px 2px 0 var(--stone-dark);
    margin-top: 8px;
    letter-spacing: 2px;
}

@keyframes titlePulse {
    0%, 100% {
        text-shadow:
            3px 3px 0 var(--stone-dark),
            -1px -1px 0 var(--snake-glow),
            0 0 30px rgba(93, 173, 226, 0.5);
    }
    50% {
        text-shadow:
            3px 3px 0 var(--stone-dark),
            -1px -1px 0 var(--snake-glow),
            0 0 50px rgba(93, 173, 226, 0.8);
    }
}

h2 {
    font-family: var(--font-title);
    font-size: clamp(18px, 3.5vw, 24px);
    color: var(--torch-orange);
    text-shadow: 2px 2px 0 var(--stone-dark);
    margin-bottom: 15px;
    text-align: center;
}

h3 {
    font-family: var(--font-title);
    font-size: 12px;
    color: var(--snake-primary);
    margin-bottom: 10px;
}

/* ============================================
   MENU PANEL
   ============================================ */
.menu-panel {
    background: var(--ui-background);
    border: 3px solid var(--ui-border);
    border-radius: 8px;
    padding: 20px 25px;
    box-shadow:
        0 0 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: calc(100% - 40px);
    max-height: calc(100% - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
}

.wide-panel {
    width: min(700px, calc(100% - 40px));
}

/* ============================================
   BUTTONS
   ============================================ */
.menu-btn {
    font-family: var(--font-body);
    font-size: clamp(18px, 3vw, 24px);
    color: var(--ui-text);
    background: linear-gradient(180deg, var(--stone-mid) 0%, var(--stone-dark) 100%);
    border: 2px solid var(--ui-border);
    border-radius: 4px;
    padding: 10px 20px;
    margin: 6px 0;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: min(250px, 80%);
    max-width: 100%;
}

.menu-btn:hover {
    background: linear-gradient(180deg, var(--stone-light) 0%, var(--stone-mid) 100%);
    border-color: var(--snake-primary);
    color: var(--snake-glow);
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(93, 173, 226, 0.3);
}

.menu-btn:active {
    transform: scale(0.98);
}

.menu-btn.primary {
    background: linear-gradient(180deg, var(--snake-primary) 0%, #3498db 100%);
    color: var(--stone-dark);
    font-weight: bold;
}

.menu-btn.primary:hover {
    background: linear-gradient(180deg, var(--snake-glow) 0%, var(--snake-primary) 100%);
    color: var(--stone-dark);
}

.menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
    width: 100%;
}

/* ============================================
   HIGH SCORE DISPLAY
   ============================================ */
.high-score-display {
    font-family: var(--font-title);
    font-size: clamp(10px, 2vw, 14px);
    color: var(--gold);
    margin: 15px 0;
    padding: 10px 15px;
    background: rgba(244, 208, 63, 0.1);
    border: 2px solid var(--gold);
    border-radius: 4px;
}

.high-score-display .label {
    color: var(--ui-text);
    margin-right: 10px;
}

/* ============================================
   HUD (Heads-Up Display)
   ============================================ */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    padding: 10px 15px;
}

.hud-top-left {
    position: absolute;
    top: 10px;
    left: 15px;
}

.hud-top-right {
    position: absolute;
    top: 10px;
    right: 15px;
    text-align: right;
}

.hud-bottom-right {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-family: var(--font-title);
    font-size: 12px;
}

.hud-score, .hud-length, .hud-high-score {
    font-family: var(--font-title);
    font-size: clamp(9px, 1.5vw, 12px);
    margin-bottom: 5px;
    text-shadow: 2px 2px 0 var(--void-black);
}

.hud-score .label, .hud-length .label, .hud-high-score .label {
    color: var(--ui-text);
    opacity: 0.8;
}

.hud-score span:last-child {
    color: var(--gold);
}

.hud-high-score span:last-child {
    color: var(--torch-orange);
}

/* ============================================
   COMBO METER
   ============================================ */
#combo-meter {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ui-background);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--ui-border);
}

.combo-bar {
    width: 80px;
    height: 6px;
    background: var(--stone-dark);
    border: 1px solid var(--ui-border);
    border-radius: 3px;
    overflow: hidden;
}

.combo-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--torch-orange));
    transition: width 0.1s linear;
    border-radius: 2px;
}

.combo-text {
    font-family: var(--font-title);
    font-size: 14px;
    color: var(--gold);
    text-shadow: 2px 2px 0 var(--void-black);
    min-width: 30px;
}

/* Fullscreen button */
.hud-bottom-left {
    position: absolute;
    bottom: 10px;
    left: 15px;
}

.fullscreen-btn {
    background: var(--ui-background);
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
    font-size: 20px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.15s ease;
}

.fullscreen-btn:hover {
    background: var(--stone-mid);
    border-color: var(--snake-primary);
    color: var(--snake-glow);
}

/* ============================================
   POWER-UP INDICATORS
   ============================================ */
#power-up-indicators {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

.power-up-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: var(--ui-background);
    border: 1px solid var(--ui-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 16px;
}

.power-up-indicator.expiring {
    animation: powerupFlash 0.3s ease-in-out infinite;
}

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

/* ============================================
   GAME OVER SCREEN
   ============================================ */
.game-over-panel {
    text-align: center;
}

#game-over-title {
    font-size: 32px;
    color: var(--bomb-red);
}

#new-high-score-banner {
    font-family: var(--font-title);
    font-size: 16px;
    color: var(--gold);
    padding: 10px 20px;
    background: rgba(244, 208, 63, 0.2);
    border: 2px solid var(--gold);
    border-radius: 4px;
    margin: 15px 0;
    animation: highScorePulse 0.5s ease-in-out infinite;
}

@keyframes highScorePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.final-score {
    font-family: var(--font-title);
    font-size: 20px;
    margin: 20px 0;
}

.final-score .label {
    color: var(--ui-text);
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
}

.final-score span:last-child {
    color: var(--gold);
    font-size: 36px;
}

.run-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: clamp(14px, 2.5vw, 18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.game-tip {
    font-size: 16px;
    color: var(--snake-glow);
    font-style: italic;
    margin: 15px 0;
    padding: 10px;
    background: rgba(93, 173, 226, 0.1);
    border-radius: 4px;
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-group {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.setting-row label {
    font-size: 18px;
}

input[type="range"] {
    width: 150px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--stone-dark);
    border-radius: 4px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--snake-primary);
    border-radius: 50%;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--snake-primary);
}

/* ============================================
   STATISTICS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.stat-category {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 4px;
}

.stat-category h3 {
    border-bottom: 1px solid var(--ui-border);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

/* ============================================
   ACHIEVEMENTS
   ============================================ */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 15px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.achievement-card {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--ui-border);
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    transition: all 0.2s ease;
}

.achievement-card.unlocked {
    border-color: var(--gold);
    background: rgba(244, 208, 63, 0.1);
}

.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.achievement-name {
    font-family: var(--font-title);
    font-size: 10px;
    color: var(--ui-text);
    margin-bottom: 5px;
}

.achievement-desc {
    font-size: 14px;
    color: var(--stone-light);
}

/* ============================================
   CREDITS
   ============================================ */
.credits-content {
    text-align: center;
    margin: 20px 0;
}

.credit-section {
    margin: 20px 0;
}

.credit-title {
    font-family: var(--font-title);
    font-size: 14px;
    color: var(--snake-primary);
}

.credit-label {
    display: block;
    font-size: 14px;
    color: var(--torch-orange);
    margin-bottom: 5px;
}

.credit-name {
    display: block;
    font-size: 20px;
    color: var(--ui-text);
}

/* ============================================
   PUZZLE LEVEL SELECT
   ============================================ */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 12px;
    margin: 15px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.level-card {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--ui-border);
    border-radius: 4px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.level-card:hover:not(.locked) {
    border-color: var(--snake-primary);
    transform: scale(1.05);
}

.level-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.level-card.completed {
    border-color: var(--gem-green);
}

.level-number {
    font-family: var(--font-title);
    font-size: 20px;
    color: var(--gold);
}

.level-stars {
    color: var(--gold);
    margin-top: 5px;
}

/* ============================================
   SCORE POPUP ANIMATION
   ============================================ */
.score-popup {
    position: absolute;
    font-family: var(--font-title);
    font-size: 14px;
    color: var(--gold);
    text-shadow: 2px 2px 0 var(--void-black);
    pointer-events: none;
    animation: scoreFloat 1s ease-out forwards;
}

.score-popup.combo {
    color: var(--snake-glow);
    font-size: 18px;
}

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

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ============================================
   VIGNETTE OVERLAY
   ============================================ */
.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.3) 80%,
        rgba(0, 0, 0, 0.6) 100%);
    z-index: 4;
}

/* ============================================
   TITLE CONTAINER ANIMATION
   ============================================ */
.title-container {
    text-align: center;
    margin-bottom: 10px;
}

/* ============================================
   SECTION 2: VISUAL DESIGN ENHANCEMENTS
   Dungeon atmosphere, decorative elements
   ============================================ */

/* Animated torch glow effect for borders */
@keyframes torchFlicker {
    0%, 100% {
        box-shadow:
            0 0 20px rgba(212, 148, 58, 0.3),
            0 0 40px rgba(212, 148, 58, 0.1);
    }
    25% {
        box-shadow:
            0 0 25px rgba(212, 148, 58, 0.4),
            0 0 50px rgba(212, 148, 58, 0.15);
    }
    50% {
        box-shadow:
            0 0 18px rgba(212, 148, 58, 0.25),
            0 0 35px rgba(212, 148, 58, 0.08);
    }
    75% {
        box-shadow:
            0 0 22px rgba(212, 148, 58, 0.35),
            0 0 45px rgba(212, 148, 58, 0.12);
    }
}

/* Dungeon panel decoration */
.menu-panel::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        var(--torch-orange) 0%,
        transparent 30%,
        transparent 70%,
        var(--torch-orange) 100%);
    border-radius: 10px;
    z-index: -1;
    opacity: 0.3;
    animation: torchFlicker 3s ease-in-out infinite;
}

.menu-panel {
    position: relative;
}

/* Moss texture overlay for dungeon feel */
#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 10% 90%, rgba(61, 92, 61, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 10%, rgba(61, 92, 61, 0.1) 0%, transparent 15%),
        radial-gradient(circle at 5% 30%, rgba(61, 92, 61, 0.05) 0%, transparent 10%);
    z-index: 3;
}

/* Stone texture for buttons */
.menu-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 50%, rgba(255,255,255,0.03) 50%),
        linear-gradient(0deg, transparent 50%, rgba(255,255,255,0.03) 50%);
    background-size: 4px 4px;
    border-radius: 4px;
    pointer-events: none;
}

.menu-btn {
    position: relative;
    overflow: hidden;
}

/* Dust particle animation */
@keyframes dustFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100px) translateX(20px);
        opacity: 0;
    }
}

/* Cobweb corner decoration */
.menu-panel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg,
        transparent 60%,
        rgba(255, 255, 255, 0.05) 65%,
        transparent 70%,
        rgba(255, 255, 255, 0.03) 75%,
        transparent 80%);
    pointer-events: none;
}

/* Glowing text for important labels */
.final-score span:last-child,
#new-high-score-banner {
    text-shadow:
        0 0 10px var(--gold),
        0 0 20px rgba(244, 208, 63, 0.5),
        0 0 30px rgba(244, 208, 63, 0.3);
}

/* Gem sparkle animation */
@keyframes gemSparkle {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

/* Snake energy glow for UI accent elements */
.hud-score span:last-child,
.combo-text {
    animation: gemSparkle 2s ease-in-out infinite;
}

/* Poison visual effect class */
.poison-effect {
    animation: poisonPulse 0.3s ease-in-out infinite;
}

@keyframes poisonPulse {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(60deg); }
}

/* ============================================
   SECTION 13: USER INTERFACE ENHANCEMENTS
   Additional UI components and polish
   ============================================ */

/* Animated snake logo for start screen */
@keyframes snakeSlither {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(5px) rotate(2deg); }
    75% { transform: translateX(-5px) rotate(-2deg); }
}

.game-title {
    animation: titlePulse 2s ease-in-out infinite, snakeSlither 4s ease-in-out infinite;
}

/* Button press feedback */
.menu-btn:active {
    transform: scale(0.95);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Focus states for keyboard navigation */
.menu-btn:focus {
    outline: 2px solid var(--snake-primary);
    outline-offset: 2px;
}

.menu-btn:focus-visible {
    outline: 3px solid var(--snake-glow);
    outline-offset: 3px;
    box-shadow: 0 0 20px rgba(93, 173, 226, 0.5);
}

/* Loading indicator */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--stone-mid);
    border-top-color: var(--snake-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: var(--ui-background);
    border: 1px solid var(--ui-border);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 14px;
    max-width: 200px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

/* Progress bar component */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--stone-dark);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--snake-primary), var(--snake-glow));
    transition: width 0.3s ease;
}

/* Notification toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ui-background);
    border: 2px solid var(--gold);
    padding: 15px 25px;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 18px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   SECTION 14-15: ACCESSIBILITY & TECHNICAL
   Enhanced accessibility and responsive design
   ============================================ */

/* High contrast mode */
.high-contrast {
    --stone-dark: #000000;
    --stone-mid: #1a1a1a;
    --stone-light: #333333;
    --ui-text: #ffffff;
    --snake-primary: #00ffff;
    --gold: #ffff00;
}

/* Large text mode */
.large-text .menu-btn {
    font-size: 28px;
    padding: 16px 35px;
}

.large-text h2 {
    font-size: 32px;
}

.large-text .stat-row {
    font-size: 22px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus trap indicator */
.focus-trap-active {
    box-shadow: inset 0 0 0 3px var(--snake-primary);
}

/* Pause indicator for screen readers */
[aria-live="polite"] {
    position: absolute;
    left: -9999px;
}

/* Responsive design */
@media (max-width: 850px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border-width: 2px;
    }

    .screen {
        padding: 15px 10px;
    }

    .menu-panel {
        padding: 15px 20px;
        max-width: calc(100% - 20px);
        max-height: calc(100% - 30px);
    }

    .wide-panel {
        width: calc(100% - 20px);
    }

    h2 {
        font-size: clamp(16px, 3vw, 24px);
        margin-bottom: 15px;
    }

    .stat-row {
        font-size: 16px;
        padding: 4px 0;
    }
}

@media (max-width: 600px) {
    .screen {
        padding: 10px 5px;
    }

    .menu-panel {
        padding: 12px 15px;
    }

    h2 {
        margin-bottom: 10px;
    }

    h3 {
        font-size: 10px;
    }

    .stat-row {
        font-size: 14px;
    }

    .achievement-card {
        padding: 10px;
    }

    .achievement-icon {
        font-size: 24px;
    }

    .achievement-name {
        font-size: 8px;
    }

    .achievement-desc {
        font-size: 12px;
    }

    .level-card {
        padding: 10px;
    }

    .level-number {
        font-size: 16px;
    }

    .settings-group {
        padding: 10px;
        margin: 10px 0;
    }

    .setting-row label {
        font-size: 14px;
    }

    input[type="range"] {
        width: 100px;
    }

    .run-stats {
        padding: 10px;
        margin: 10px 0;
    }

    .final-score {
        font-size: 16px;
        margin: 10px 0;
    }

    .final-score span:last-child {
        font-size: 28px;
    }

    .game-tip {
        font-size: 14px;
        padding: 8px;
        margin: 10px 0;
    }

    #game-over-title {
        font-size: 24px;
    }

    #new-high-score-banner {
        font-size: 12px;
        padding: 8px 15px;
    }
}

@media (max-height: 500px) {
    .screen {
        justify-content: flex-start;
        padding-top: 10px;
    }

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

    .high-score-display {
        margin: 10px 0;
        padding: 8px 12px;
    }

    .menu-options {
        margin-top: 10px;
    }

    .menu-btn {
        padding: 8px 15px;
        margin: 4px 0;
    }

    h2 {
        margin-bottom: 10px;
    }
}

/* Print styles (for statistics) */
@media print {
    #game-container {
        box-shadow: none;
        border: 1px solid #000;
    }

    .menu-btn {
        display: none;
    }

    .screen {
        background: white;
        color: black;
    }
}

/* Ensure canvas doesn't blur on high DPI */
#game-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
