/* Bunny Runner - one stylesheet for desktop + phones.
   Order: tokens -> base -> screens/menus -> buttons -> HUD -> touch controls -> other screens -> responsive.
   All responsive rules live at the bottom, so the cascade does the work (no !important). */

/* Inter, self-hosted (variable weight axis, latin subset) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
    /* palette */
    --color-pink: rgba(255, 182, 193, 1);
    --color-lavender: rgba(230, 230, 250, 1);
    --color-mint: rgba(152, 251, 152, 1);
    --color-sky: rgba(173, 216, 230, 1);
    --color-primary: #FF69B4;
    --color-text: rgba(19, 52, 59, 1);
    --color-text-secondary: rgba(98, 108, 113, 1);
    --color-bg-7: rgba(236, 72, 153, 0.08);

    /* type */
    --font-family-base: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 20px;
    --font-size-3xl: 24px;
    --font-size-4xl: 30px;
    --font-weight-medium: 500;
    --font-weight-semibold: 550;
    --font-weight-bold: 600;

    /* spacing */
    --space-2: 2px;
    --space-4: 4px;
    --space-6: 6px;
    --space-8: 8px;
    --space-10: 10px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px;
    --space-32: 32px;

    /* radius + shadow */
    --radius-sm: 6px;
    --radius-base: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

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

html {
    font-size: var(--font-size-base); /* 14px: every rem below is relative to this */
    font-family: var(--font-family-base);
    line-height: 1.5;
    color: var(--color-text);
    background-color: rgba(252, 252, 249, 1);
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family-base);
    background: linear-gradient(135deg, #ffe4f0 0%, #e8f5ff 50%, #fff0f5 100%);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* This gradient only shows if the 3D view can't (the error screen): the canvas covers the whole page and is opaque.
   It used to shift colour forever, and floating hearts drifted over it, all hidden behind the canvas and still
   repainted every frame (about a sixth of the menu's idle CPU in headless Chromium). Screenshots with both gone
   are pixel for pixel the same. */

h1, h2, h3 {
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }

p {
    margin: 0 0 var(--space-16) 0;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* screen titles take focus from script (UIController.showScreen), not from Tab: nothing to point at */
[tabindex="-1"]:focus {
    outline: none;
}

/* ---------- layers ---------- */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    touch-action: none;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: all 0.3s ease;
}

/* This only hides a screen to the eye. UIController.showScreen also makes it `inert`, which is what keeps its
   buttons out of the Tab order and away from screen readers (the moment it is hidden, not after the fade). */
.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

/* ---------- menu card (main menu, pause, game over, settings, ...) ---------- */
#main-menu {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
}

.menu-content {
    text-align: center;
    padding: clamp(var(--space-16), 4vw, var(--space-32));
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 245, 0.95) 100%);
    border-radius: 30px;
    box-shadow: 0 10px 40px rgba(255, 182, 193, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.8);
    border: 4px solid transparent;
    background-clip: padding-box;
    position: relative;
    max-width: min(90vw, 400px);
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 auto;
    width: 100%;
}

.menu-content::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #FFB6C1 0%, #DDA0DD 50%, #98FB98 100%);
    border-radius: 30px;
    z-index: -1;
    animation: borderRainbow 3s linear infinite;
}

@keyframes borderRainbow {
    0% {
        background: linear-gradient(135deg, #FFB6C1 0%, #DDA0DD 50%, #98FB98 100%);
    }
    33% {
        background: linear-gradient(135deg, #DDA0DD 0%, #98FB98 50%, #FFB6C1 100%);
    }
    66% {
        background: linear-gradient(135deg, #98FB98 0%, #FFB6C1 50%, #DDA0DD 100%);
    }
    100% {
        background: linear-gradient(135deg, #FFB6C1 0%, #DDA0DD 50%, #98FB98 100%);
    }
}

/* scrollable panels scroll, but never show a scrollbar */
.menu-content,
.settings-content,
.tutorial-content,
.leaderboard-content {
    scrollbar-width: none;
}

.menu-content::-webkit-scrollbar,
.settings-content::-webkit-scrollbar,
.tutorial-content::-webkit-scrollbar,
.leaderboard-content::-webkit-scrollbar {
    display: none;
}

.game-title {
    font-size: clamp(1.8rem, 8vw, 3rem);
    font-weight: var(--font-weight-bold);
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6C1 50%, #DDA0DD 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-8);
    text-shadow: 2px 2px 8px rgba(255, 182, 193, 0.6);
    filter: drop-shadow(2px 2px 4px rgba(255, 182, 193, 0.5));
    animation: titleFloat 3s ease-in-out infinite;
}

@keyframes titleFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

.game-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-24);
}

.character-preview {
    position: relative;
    margin: var(--space-24) 0;
}

.bunny-icon {
    font-size: 4rem;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(255, 182, 193, 0.4));
    transform-origin: center bottom;
}

.sparkles {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 1.2rem;
    animation: sparkle 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-15px) scale(1.05) rotate(-5deg);
    }
    50% {
        transform: translateY(-20px) scale(1.1) rotate(0deg);
    }
    75% {
        transform: translateY(-15px) scale(1.05) rotate(5deg);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    25% {
        opacity: 0.7;
        transform: rotate(90deg) scale(1.3);
    }
    50% {
        opacity: 0.4;
        transform: rotate(180deg) scale(1.5);
    }
    75% {
        opacity: 0.7;
        transform: rotate(270deg) scale(1.3);
    }
}

.best-score-display {
    margin-top: var(--space-20);
    padding: var(--space-12);
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-base);
    border: 2px solid var(--color-lavender);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    margin: var(--space-16) 0;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    margin-top: var(--space-24);
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-24);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 245, 0.95) 100%);
    color: #D81B60;
    border: 2px solid rgba(255, 182, 193, 0.8);
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.25);
    font-family: var(--font-family-base);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.4);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn--primary {
    background: linear-gradient(135deg, #FF69B4 0%, #FF8DA1 50%, #FFAEC9 100%);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    margin-bottom: var(--space-16);
    border: none;
}

.btn--primary:active {
    background: linear-gradient(135deg, #C71585 0%, #FF1493 100%);
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.4);
}

.btn--primary:hover {
    background: linear-gradient(135deg, #FF1493 0%, #FF69B4 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.6);
}

.btn--secondary {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 245, 0.95) 100%);
    color: #D81B60;
    border: 2px solid rgba(255, 182, 193, 0.8);
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.25);
    font-weight: 600;
}

.btn--secondary:active {
    background: #FFE4E1;
    transform: scale(0.96);
}

.btn--secondary:hover {
    background: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 100%);
    border-color: #FF69B4;
    color: #C2185B;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.45);
}

.btn--outline {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(255, 182, 193, 0.8);
    color: #D81B60;
    font-weight: 600;
}

.btn--outline:hover {
    background: var(--color-pink);
    border-color: #FF69B4;
    color: #FFFFFF;
    transform: translateY(-2px);
}

.btn--sm {
    padding: var(--space-8) var(--space-16);
    font-size: var(--font-size-sm);
}

#pause-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 240, 245, 0.95) 100%);
    color: #D81B60;
    border: 2px solid rgba(255, 182, 193, 0.8);
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.25);
    font-weight: 700;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

#pause-btn:hover {
    background: linear-gradient(135deg, #FFF0F5 0%, #FFE4E1 100%);
    border-color: #FF69B4;
    color: #C2185B;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.45);
}

#pause-btn:active {
    background: #FFE4E1;
    transform: scale(0.96);
}

.pause-text-full {
    display: inline-block;
}

.pause-text-short {
    display: none;
}

.btn--icon {
    padding: var(--space-8);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--color-pink);
    color: #D81B60;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn--icon:hover {
    background: var(--color-pink);
    color: white;
    transform: scale(1.1);
}

.btn-sparkle {
    position: absolute;
    top: -5px;
    right: -5px;
    animation: sparkle 2s ease-in-out infinite;
}

/* ---------- difficulty picker (main menu) ---------- */
.difficulty-selection {
    margin: var(--space-24) 0;
    width: 100%;
}

.difficulty-title {
    font-size: clamp(var(--font-size-lg), 4vw, var(--font-size-xl));
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    margin-bottom: var(--space-16);
    text-align: center;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid var(--color-pink);
    border-radius: var(--radius-full);
    padding: var(--space-12) var(--space-16);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    max-width: 320px;
    margin: 0 auto var(--space-8) auto;
}

.difficulty-selector:hover {
    box-shadow: var(--shadow-lg);
}

.difficulty-arrow {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-primary);
    cursor: pointer;
    padding: var(--space-8);
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.difficulty-arrow:hover {
    background: var(--color-pink);
    color: white;
    transform: scale(1.1);
}

.difficulty-arrow:active {
    transform: scale(0.95);
}

.difficulty-display {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    flex: 1;
    min-height: 60px;
}

.difficulty-icon {
    font-size: 2.5rem;
    animation: float 2s ease-in-out infinite;
    min-width: 50px;
    text-align: center;
}

.difficulty-info {
    flex: 1;
    text-align: left;
}

.difficulty-name {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-2);
    line-height: 1.2;
}

.difficulty-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.3;
}

/* shown (via .show) only for the recommended difficulty */
.recommended-badge {
    background: linear-gradient(135deg, #FF69B4 0%, #FFA07A 100%);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    padding: var(--space-4) var(--space-12);
    border-radius: var(--radius-full);
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.4);
    animation: glow 2s ease-in-out infinite alternate;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.recommended-badge.show {
    opacity: 1;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0% { box-shadow: var(--shadow-sm); }
    100% { box-shadow: 0 0 20px rgba(255, 105, 180, 0.4); }
}

/* ---------- in-game HUD ---------- */
#game-hud {
    background: transparent;
    pointer-events: none;
}

.hud-top {
    position: absolute;
    top: var(--space-20);
    left: var(--space-20);
    right: var(--space-20);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: all;
}

.hud-controls {
    display: flex;
    gap: var(--space-8);
    align-items: center;
}

.score-container {
    display: flex;
    gap: var(--space-16);
}

.score-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 240, 245, 0.9) 100%);
    padding: var(--space-8) var(--space-16);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 182, 193, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    text-align: center;
    min-width: 80px;
}

.score-item::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #FFB6C1 0%, #DDA0DD 100%);
    border-radius: 20px;
    z-index: -1;
}

.score-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
}

/* golden combo badge; its animations are restarted from JS (inline animation: none, then '') */
.combo-item {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF69B4 100%);
    animation: comboPulse 0.3s ease-out, comboGlow 1s ease-in-out infinite;
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.combo-item::before {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF1493 100%);
}

.combo-item .score-value {
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

@keyframes comboPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes comboGlow {
    0%, 100% {
        box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 6px 30px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
}

/* "+30 3x COMBO!" text that floats up from the upper middle of the screen.
   Created by JS (<div class="combo-feedback">), removed after 1s; all positioning lives here. */
.combo-feedback {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    animation: comboFadeUp 1s ease-out forwards;
}

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

.controls-hint {
    position: absolute;
    bottom: var(--space-20);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-8);
    background: rgba(255, 255, 255, 0.8);
    padding: var(--space-8) var(--space-16);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    font-size: var(--font-size-sm);
}

.control-key {
    background: var(--color-pink);
    color: white;
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
}

.control-text {
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

/* milestone progress bar (a card on desktop, a slim strip on phones) */
.milestone-progress {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    padding: var(--space-8);
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 500;
}

.milestone-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-4);
    text-align: center;
}

.milestone-bar {
    width: 100%;
    height: 8px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.milestone-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-pink), var(--color-lavender), var(--color-mint));
    transition: width 0.5s ease;
    border-radius: 8px;
}

/* achievement toast: invisible by itself, .show slides it in */
.achievement-toast {
    position: absolute;
    top: 180px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    display: flex;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-12) var(--space-16);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 182, 193, 0.95));
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.5);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s ease;
    z-index: 1000;
}

.achievement-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    animation: achievementBounce 0.6s ease;
}

@keyframes achievementBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

.achievement-icon {
    font-size: var(--font-size-3xl);
}

.achievement-info {
    flex: 1;
}

.achievement-title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--space-4);
}

.achievement-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* ---------- touch controls (shown by JS on touch devices: it removes .hidden) ---------- */
.touch-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: var(--space-16) var(--space-20) var(--space-20) var(--space-20);
}

.touch-controls.hidden {
    display: none;
}

.touch-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 240, 245, 0.9) 100%);
    border: 4px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: #FF69B4;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: all;
    box-shadow: 0 6px 20px rgba(255, 182, 193, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.touch-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 50%, #DDA0DD 100%);
    border-radius: 50%;
    z-index: -1;
}

.touch-btn:active {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6C1 100%);
    color: white;
    transform: scale(0.85);
    box-shadow: 0 2px 10px rgba(255, 105, 180, 0.6), inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.touch-left,
.touch-right {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.touch-jump {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6C1 50%, #DDA0DD 100%);
    color: white;
    font-size: 1.8rem;
    animation: cuteJumpPulse 2s ease-in-out infinite;
    min-width: 44px;
    min-height: 44px;
    box-shadow: 0 8px 25px rgba(255, 105, 180, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes cuteJumpPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(255, 105, 180, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 10px 30px rgba(255, 105, 180, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
}

.touch-jump:active {
    background: var(--color-primary);
    animation: none;
}

/* ---------- countdown ---------- */
#countdown-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 600; /* above the milestone bar */
}

/* JS restarts this animation on every tick (3, 2, 1, GO!) */
.countdown-number {
    font-size: clamp(5rem, 25vw, 12rem);
    font-weight: var(--font-weight-bold);
    background: linear-gradient(135deg, var(--color-pink), var(--color-lavender), var(--color-mint));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: countdownPulse 0.6s ease-out;
}

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

/* ---------- pause menu ---------- */
.pause-stats {
    display: flex;
    justify-content: space-around;
    margin: var(--space-24) 0;
    padding: var(--space-16);
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.1), rgba(221, 160, 221, 0.1));
    border-radius: var(--radius-lg);
}

.pause-stat {
    text-align: center;
}

.pause-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

.pause-value {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-pink);
}

.pause-controls-reminder {
    margin: var(--space-24) 0;
    padding: var(--space-16);
    background: linear-gradient(135deg, rgba(144, 238, 144, 0.1), rgba(176, 224, 230, 0.1));
    border-radius: var(--radius-lg);
    text-align: left;
}

.pause-controls-reminder h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-12);
    text-align: center;
}

.pause-control-item {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-8) 0;
}

.pause-control-item .key {
    display: inline-block;
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--color-mint), var(--color-lavender));
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-bold);
    min-width: 50px;
    text-align: center;
}

/* ---------- game over ---------- */
#game-over .menu-content {
    border-color: var(--color-mint);
}

.game-over-icon {
    font-size: 4rem;
    margin-bottom: var(--space-16);
    animation: bounce 2s ease-in-out infinite;
}

.score-summary {
    display: flex;
    justify-content: space-around;
    margin: var(--space-24) 0;
    gap: var(--space-16);
}

.final-score,
.best-score-final {
    text-align: center;
    padding: var(--space-16);
    background: var(--color-bg-7);
    border-radius: var(--radius-base);
    border: 2px solid var(--color-pink);
    flex: 1;
}

.score-big {
    display: block;
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin-top: var(--space-4);
}

/* confetti: JS shows/hides #celebration with inline display, so no display rule here */
.celebration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    font-size: 2rem;
    animation: confetti-fall 3s ease-in-out infinite;
}

.confetti:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    left: 40%;
    animation-delay: 0.5s;
}

.confetti:nth-child(3) {
    left: 60%;
    animation-delay: 1s;
}

.confetti:nth-child(4) {
    left: 80%;
    animation-delay: 1.5s;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* ---------- tutorial ---------- */
.tutorial-content {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-16) 0;
}

.tutorial-section {
    margin-bottom: var(--space-24);
    padding: var(--space-16);
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.1), rgba(221, 160, 221, 0.1));
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 182, 193, 0.3);
}

.tutorial-section h3 {
    font-size: var(--font-size-xl);
    color: var(--color-pink);
    margin-bottom: var(--space-12);
}

.tutorial-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    margin: var(--space-16) 0;
}

.tutorial-control {
    display: flex;
    align-items: center;
    gap: var(--space-16);
}

.control-keys {
    display: flex;
    gap: var(--space-8);
}

.control-keys .key {
    display: inline-block;
    padding: var(--space-8) var(--space-12);
    background: linear-gradient(135deg, var(--color-mint), var(--color-lavender));
    border-radius: var(--radius-md);
    font-weight: var(--font-weight-bold);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 60px;
    text-align: center;
}

.tutorial-mobile {
    margin-top: var(--space-12);
    font-style: italic;
    color: var(--color-text-secondary);
}

/* ---------- settings ---------- */
.settings-content {
    max-width: 500px;
    margin: 0 auto;
    padding: var(--space-16) 0;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-12) var(--space-16);
    margin-bottom: var(--space-12);
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.05), rgba(221, 160, 221, 0.05));
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 182, 193, 0.2);
    gap: var(--space-12);
    min-height: 60px;
}

.setting-item label {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(200, 200, 200, 0.5);
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--color-pink), var(--color-lavender));
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ---------- leaderboard ---------- */
.leaderboard-content {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-16) 0;
}

.leaderboard-tabs {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-16);
    border-bottom: 2px solid rgba(255, 182, 193, 0.3);
}

.leaderboard-tab {
    flex: 1;
    padding: var(--space-12);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    transition: all 0.3s ease;
}

.leaderboard-tab.active {
    color: var(--color-pink);
    border-bottom-color: var(--color-pink);
}

.leaderboard-list {
    min-height: 300px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: var(--space-12);
    margin-bottom: var(--space-8);
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.05), rgba(221, 160, 221, 0.05));
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 182, 193, 0.2);
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.3);
}

.leaderboard-rank {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    min-width: 50px;
    text-align: center;
}

.leaderboard-rank.gold { color: #FFD700; }
.leaderboard-rank.silver { color: #C0C0C0; }
.leaderboard-rank.bronze { color: #CD7F32; }

.leaderboard-info {
    flex: 1;
    margin: 0 var(--space-12);
}

.leaderboard-score {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-pink);
}

.leaderboard-meta {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-top: var(--space-4);
}

.leaderboard-empty {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 2rem 0;
}

/* ---------- loading + error ---------- */
#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-pink) 0%, var(--color-lavender) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* once the loader is gone, stop its idle animations */
#loading-screen.hidden * {
    animation-play-state: paused;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-bunny {
    font-size: 5rem;
    margin-bottom: var(--space-16);
    animation: bounce 1s ease-in-out infinite;
}

.loading-text {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-20);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-bar {
    width: 300px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 0 auto;
}

/* indeterminate: a short segment slides across the track, no JS needed */
.loading-progress {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-mint) 0%, var(--color-sky) 100%);
    border-radius: var(--radius-full);
    animation: loadingSlide 1.2s ease-in-out infinite;
}

@keyframes loadingSlide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

#error-screen {
    background: rgba(0, 0, 0, 0.95);
    z-index: 200; /* above the canvas, the HUD and the loading screen */
}

.error-icon {
    font-size: 4rem;
    margin-bottom: var(--space-16);
}

.error-details {
    margin: var(--space-16) 0;
    padding: var(--space-12);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

/* =====================================================================
   RESPONSIVE
   Order matters (later wins): short windows -> small widths -> touch -> phones.
   ===================================================================== */

/* desktop: the main menu is the tallest card, give it more room so it isn't clipped on a 1080p screen */
@media (min-width: 769px) {
    #main-menu .menu-content {
        max-height: 92vh;
    }
}

/* short windows */
@media (max-height: 600px) {
    .menu-content {
        padding: var(--space-16);
    }

    .difficulty-selection {
        margin: var(--space-16) 0;
    }

    .character-preview {
        margin: var(--space-16) 0;
    }
}

/* phones on their side */
@media (orientation: landscape) and (max-height: 500px) {
    .game-title {
        font-size: clamp(1.2rem, 6vw, 2rem);
        margin-bottom: var(--space-4);
    }

    .character-preview {
        display: none;
    }

    .difficulty-selection {
        margin: var(--space-12) 0;
    }

    .best-score-display {
        margin-top: var(--space-12);
    }
}

/* laptop-sized desktop windows: tighter main-menu / pause / game-over cards so every button fits without scrolling */
@media (min-width: 769px) and (min-height: 501px) and (max-height: 920px) {
    :is(#main-menu, #pause-menu, #game-over) .menu-content {
        padding: var(--space-16);
    }

    :is(#main-menu, #pause-menu, #game-over) .btn {
        padding-top: var(--space-8);
        padding-bottom: var(--space-8);
    }

    :is(#main-menu, #pause-menu, #game-over) .btn--primary {
        margin-bottom: var(--space-8);
    }

    :is(#pause-menu, #game-over) .button-group {
        margin-top: var(--space-12);
        gap: var(--space-8);
    }

    .game-title {
        font-size: 1.9rem;
        margin-bottom: var(--space-2);
    }

    .game-subtitle {
        margin-bottom: var(--space-8);
    }

    .character-preview {
        margin: var(--space-12) 0 var(--space-4); /* headroom for the floating sparkles */
    }

    .bunny-icon {
        font-size: 2.6rem;
    }

    .difficulty-selection {
        margin: var(--space-12) 0;
    }

    .difficulty-title {
        margin-bottom: var(--space-8);
    }

    .difficulty-selector {
        padding: var(--space-6) var(--space-16);
    }

    .difficulty-display {
        min-height: 48px;
    }

    .menu-buttons {
        gap: var(--space-8);
        margin: var(--space-8) 0;
    }

    .best-score-display {
        margin-top: var(--space-8);
        padding: var(--space-8) var(--space-12);
    }

    .pause-stats {
        margin: var(--space-12) 0;
        padding: var(--space-10);
    }

    /* the controls reminder becomes a compact wrapped row */
    .pause-controls-reminder {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 var(--space-16);
        margin: var(--space-12) 0;
        padding: var(--space-8) var(--space-12);
    }

    .pause-controls-reminder h3 {
        display: none;
    }

    .pause-control-item {
        padding: var(--space-4) 0;
    }

    .game-over-icon {
        font-size: 3rem;
        margin-bottom: var(--space-8);
    }

    .score-summary {
        margin: var(--space-12) 0;
    }
}

/* very short desktop windows (e.g. 1024x600): drop the decorative bunny too */
@media (min-width: 769px) and (min-height: 501px) and (max-height: 620px) {
    .character-preview {
        display: none;
    }
}

@media (max-width: 480px) {
    .score-container {
        flex-direction: column;
    }

    .difficulty-selector {
        max-width: 280px;
        padding: var(--space-8) var(--space-12);
    }

    .difficulty-display {
        gap: var(--space-8);
    }

    .difficulty-icon {
        min-width: 40px;
    }

    .difficulty-arrow {
        font-size: 1.3rem;
        min-width: 40px;
        min-height: 40px;
        padding: var(--space-6);
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
    }

    .difficulty-arrow {
        min-width: 48px;
        min-height: 48px;
    }
}

/* phones (and any narrow window) */
@media (max-width: 768px) {
    .screen {
        padding: var(--space-8);
    }

    /* HUD */
    .hud-top {
        top: 24px;
        left: var(--space-12);
        right: var(--space-12);
        gap: var(--space-4);
    }

    .hud-controls {
        flex-direction: column;
        gap: var(--space-4);
    }

    .score-container {
        gap: var(--space-6);
    }

    .score-item {
        padding: var(--space-4) var(--space-10);
        min-width: 70px;
    }

    .score-label {
        font-size: 10px;
        margin-bottom: 0;
    }

    .score-value {
        font-size: var(--font-size-lg);
    }

    /* keyboard hints are pointless on phones. visibility (not display) so JS toggling the inline display can't bring them back */
    .controls-hint {
        visibility: hidden;
    }

    .pause-text-full {
        display: none;
    }

    .pause-text-short {
        display: inline-block;
        font-size: 1.4rem;
        font-weight: bold;
        line-height: 1;
    }

    #pause-btn {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
        padding: var(--space-8);
        border-radius: var(--radius-full);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* slim milestone strip along the top edge */
    .milestone-progress {
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        padding: 0;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        transform: none; /* the desktop card is centred with translateX(-50%); the strip must not be shifted */
    }

    .milestone-label {
        font-size: var(--font-size-xs);
        margin-bottom: var(--space-2);
    }

    .milestone-bar {
        height: 4px;
        border-radius: 0;
    }

    /* achievement toast: compact, tucked under the strip, no bounce */
    .achievement-toast {
        min-width: auto;
        width: calc(100% - 24px);
        max-width: 320px;
        top: 6px;
        transform: translateX(-50%) translateY(-80px);
        padding: var(--space-6) var(--space-10);
        font-size: var(--font-size-xs);
        gap: var(--space-8);
        z-index: 501;
    }

    .achievement-toast.show {
        animation: none;
    }

    .achievement-icon {
        font-size: 1.5rem;
    }

    .achievement-title {
        font-size: 0.8rem;
        margin-bottom: 0;
    }

    .achievement-desc {
        font-size: 0.7rem;
        opacity: 0.9;
    }

    .combo-feedback {
        font-size: 1.5rem;
    }

    .countdown-number {
        font-size: clamp(6rem, 30vw, 12rem);
    }

    /* touch controls: bigger hit areas, respect the home-indicator inset */
    .touch-controls {
        bottom: env(safe-area-inset-bottom, 0);
    }

    .touch-btn {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    /* menu cards */
    .menu-content {
        padding: var(--space-10);
        max-height: 92vh;
        max-width: 96vw;
        border-radius: 20px;
    }

    .menu-content::before {
        border-radius: 20px;
    }

    .game-title {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-4);
        line-height: 1.1;
    }

    .game-subtitle {
        font-size: var(--font-size-sm);
        margin-bottom: var(--space-8);
    }

    .character-preview {
        margin: var(--space-12) 0;
    }

    .sparkles {
        font-size: var(--font-size-lg);
    }

    .difficulty-selection {
        margin: var(--space-12) 0;
    }

    .difficulty-title {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-8);
    }

    .difficulty-display {
        padding: var(--space-8);
    }

    .difficulty-icon {
        font-size: 2rem;
    }

    .difficulty-desc {
        font-size: var(--font-size-xs);
    }

    .best-score-display {
        margin-top: var(--space-8);
        font-size: var(--font-size-sm);
    }

    .menu-buttons {
        gap: var(--space-8);
        margin: var(--space-8) 0;
    }

    .button-group {
        gap: var(--space-8);
    }

    .btn {
        padding: var(--space-10) var(--space-16);
        font-size: var(--font-size-sm);
        min-height: 44px;
    }

    .btn--sm {
        padding: var(--space-6) var(--space-10);
        font-size: var(--font-size-xs);
    }

    .btn--icon {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-lg);
    }

    h2 {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-8);
    }

    h3 {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-6);
    }

    p {
        font-size: var(--font-size-sm);
        line-height: 1.4;
    }

    /* pause + game over */
    .pause-controls-reminder {
        display: none;
    }

    .pause-stats {
        gap: var(--space-8);
        margin: var(--space-12) 0;
    }

    .score-summary {
        flex-direction: column;
        gap: var(--space-12);
        margin: var(--space-12) 0;
    }

    .score-big {
        font-size: var(--font-size-3xl);
    }

    /* tutorial */
    .tutorial-content {
        max-height: 50vh;
        overflow-y: auto;
        padding: 0;
    }

    .tutorial-section {
        padding: var(--space-8);
        margin-bottom: var(--space-12);
    }

    .tutorial-section h3 {
        font-size: var(--font-size-base);
        margin-bottom: var(--space-8);
    }

    .tutorial-section p {
        font-size: var(--font-size-sm);
        line-height: 1.4;
    }

    .tutorial-control {
        gap: var(--space-8);
    }

    .control-keys {
        flex-shrink: 0;
    }

    .control-keys .key {
        padding: var(--space-4) var(--space-8);
        font-size: var(--font-size-xs);
        min-width: 40px;
    }

    /* settings */
    .settings-content {
        padding: var(--space-4) var(--space-8);
        max-height: 55vh;
    }

    .setting-item {
        padding: var(--space-8) var(--space-12);
        min-height: 48px;
        margin-bottom: var(--space-8);
    }

    .setting-item label {
        font-size: var(--font-size-sm);
        line-height: 1.2;
    }

    /* leaderboard */
    .leaderboard-content {
        max-height: 55vh;
        overflow-y: auto;
    }

    .leaderboard-tabs {
        gap: var(--space-4);
        margin-bottom: var(--space-12);
    }

    .leaderboard-tab {
        padding: var(--space-8);
        font-size: var(--font-size-xs);
    }

    @media (max-height: 500px) and (orientation: landscape) {
        .menu-content {
            max-height: 90vh;
            padding: var(--space-6);
        }

        .game-title {
            font-size: var(--font-size-xl);
            margin-bottom: var(--space-8);
        }

        .character-preview {
            display: none;
        }
    }
}

/* very short portrait phones (e.g. 320x568): drop the decorative bunny */
@media (max-width: 768px) and (max-height: 600px) and (orientation: portrait) {
    .character-preview {
        display: none;
    }
}

/* short portrait phones: squeeze the main menu so it fits without scrolling */
@media (max-width: 768px) and (max-height: 700px) and (orientation: portrait) {
    .character-preview {
        margin: var(--space-4) 0;
    }

    .bunny-icon {
        font-size: 3rem;
    }

    .difficulty-selection {
        margin: var(--space-8) 0;
    }
}

/* ---------- reduced motion ----------
   For people whose system asks for less motion: no idle loops, bouncing or floating, and the screens fade instead
   of zooming. Nothing is lost: the score, the combo badge and the countdown numbers still change, they just
   don't move while doing it. */
@media (prefers-reduced-motion: reduce) {
    .menu-content::before,
    .game-title,
    .bunny-icon,
    .sparkles,
    .btn-sparkle,
    .difficulty-icon,
    .recommended-badge,
    .combo-item,
    .combo-feedback,
    .touch-jump,
    .countdown-number,
    .achievement-toast.show,
    .game-over-icon,
    .loading-bunny {
        animation: none;
    }

    .confetti {
        display: none;
    }

    .screen {
        transition: opacity 0.2s ease;
    }

    .screen.hidden {
        transform: none;
    }
}
