/* ============================================
   ekulki - Match-3 PWA
   Liquid Glass UI + Modern Aesthetics
   ============================================ */

/* CSS Variables - Design Tokens */
:root {
    /* Colors */
    --color-bg-primary: #0f0f1a;
    --color-bg-secondary: #1a1a2e;
    --color-bg-glass: rgba(255, 255, 255, 0.08);
    --color-glass-border: rgba(255, 255, 255, 0.15);
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-accent: #6366f1;
    --color-accent-glow: rgba(99, 102, 241, 0.4);

    /* Tile Colors */
    --tile-red: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 50%, #d63031 100%);
    --tile-blue: linear-gradient(135deg, #74b9ff 0%, #5da3e8 50%, #0984e3 100%);
    --tile-green: linear-gradient(135deg, #55efc4 0%, #40d9a8 50%, #00b894 100%);
    --tile-yellow: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 50%, #f39c12 100%);
    --tile-purple: linear-gradient(135deg, #a29bfe 0%, #8b7ff5 50%, #6c5ce7 100%);

    /* Power-up Colors */
    --tile-rocket: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    --tile-tnt: linear-gradient(135deg, #ff7675 0%, #d63031 50%, #b71c1c 100%);
    --tile-propeller: linear-gradient(135deg, #81ecec 0%, #00cec9 100%);
    --tile-lightball: linear-gradient(135deg, #fff 0%, #ffeaa7 50%, #fdcb6e 100%);

    /* Sizing */
    --board-size: min(90vw, 400px);
    --tile-gap: 4px;
    --tile-size: calc((var(--board-size) - 7 * var(--tile-gap)) / 8);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;

    /* Animation */
    --transition-fast: 150ms ease-out;
    --transition-medium: 250ms ease-out;
    --transition-slow: 400ms ease-in-out;

    /* Effects */
    --glass-blur: blur(12px);
    --shadow-tile: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    --shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

body {
    font-family:
        'Outfit',
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--color-bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: none;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-top: env(safe-area-inset-top, 16px);
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* ============================================
   Glass Panel Effect
   ============================================ */
.glass-panel {
    background: var(--color-bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-panel);
}

/* ============================================
   Header
   ============================================ */
.game-header {
    margin-bottom: 20px;
    position: relative;
    z-index: 120;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--border-radius-lg);
}

.game-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-display,
.moves-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label,
.moves-label {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-value,
.moves-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.moves-value {
    color: #ffeaa7;
}

/* Level Info */
.level-info {
    flex: 1;
    display: flex;
    align-items: center;
    display: flex;
    align-items: center;
}

.level-info>*:not(:last-child) {
    margin-right: 8px;
}

.level-number {
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    flex-shrink: 1;
}

/* Icon Button (Mute, Pause, Settings, Home) */
.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.3rem;
    line-height: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.08);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* ============================================
   Objectives Bar
   ============================================ */
.objectives-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 16px;
    background: var(--color-bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--border-radius-md);
}

.objective {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-fast);
}

.objective.completed {
    background: rgba(0, 184, 148, 0.2);
    border-color: rgba(0, 184, 148, 0.5);
}

.objective-icon {
    font-size: 1.2rem;
}

.objective-progress {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.objective.completed .objective-progress {
    color: #55efc4;
}

/* Level Complete Title */
.level-complete-title {
    font-size: 1.8rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Star Rating */
.level-stars {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    font-size: 2.5rem;
}

.level-stars .star {
    opacity: 0;
    transform: scale(0);
}

.level-stars .star.star-pop {
    animation: star-pop 0.4s ease-out forwards;
}

.level-stars .star.empty {
    filter: grayscale(100%) brightness(0.4);
}

.level-stars .star.star-earned {
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
}

@keyframes star-pop {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-20deg);
    }

    50% {
        transform: scale(1.3) rotate(10deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

.level-complete-score {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

#level-score {
    font-weight: 700;
    color: var(--color-text-primary);
}

.level-complete-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Success Button Variant */
.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.5);
}

.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Game Container
   ============================================ */
.game-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-wrapper {
    padding: 16px;
    background: var(--color-bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-panel);
    position: relative;
}

/* ============================================
   Combo Display
   ============================================ */
.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 50;
    pointer-events: none;
}

.combo-display.hidden {
    display: none;
}

.combo-multiplier {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.combo-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 4px;
}

.combo-level-2 {
    color: #ffeaa7;
}

.combo-level-3 {
    color: #74b9ff;
}

.combo-level-4 {
    color: #a29bfe;
}

.combo-level-max {
    color: #fd79a8;
    text-transform: uppercase;
}

.combo-animate {
    animation: combo-pop 0.3s ease-out;
}

@keyframes combo-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ============================================
   Score Popups
   ============================================ */
.score-popups-container {
    position: absolute;
    top: 16px;
    left: 16px;
    width: calc(100% - 32px);
    height: calc(100% - 32px);
    pointer-events: none;
    overflow: hidden;
}

.score-popup {
    position: absolute;
    font-size: 1rem;
    font-weight: 700;
    color: #ffeaa7;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    animation: score-float 1s ease-out forwards;
    z-index: 40;
}

@keyframes score-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.2);
    }
}

/* ============================================
   Shuffle Message
   ============================================ */
.shuffle-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-glass-border);
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 60;
    animation: shuffle-pop 0.5s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.shuffle-message.hidden {
    display: none;
}

@keyframes shuffle-pop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Shuffling animation for board */
.game-board.shuffling {
    animation: board-shake 0.3s ease-in-out;
}

@keyframes board-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

/* ============================================
   Game Board
   ============================================ */
.game-board {
    display: grid;
    grid-template-columns: repeat(8, var(--tile-size));
    grid-template-rows: repeat(8, var(--tile-size));
    gap: var(--tile-gap);
    position: relative;
}

/* ============================================
   Tiles
   ============================================ */
.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-tile);
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        opacity var(--transition-fast);
    position: relative;
    overflow: hidden;
}

/* Tile shine effect */
.tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    border-radius: var(--border-radius-md) var(--border-radius-md) 50% 50%;
    pointer-events: none;
}

/* Tile Colors */
.tile-red {
    background: var(--tile-red);
}

.tile-blue {
    background: var(--tile-blue);
}

.tile-green {
    background: var(--tile-green);
}

.tile-yellow {
    background: var(--tile-yellow);
}

.tile-purple {
    background: var(--tile-purple);
}

.tile-empty {
    visibility: hidden;
}

/* Power-up Tiles */
.tile-rocket-h,
.tile-rocket-v {
    background: var(--tile-rocket);
}

.tile-rocket-h::after {
    content: '→';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tile-rocket-v::after {
    content: '↓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tile-tnt {
    background: var(--tile-tnt);
}

.tile-tnt::after {
    content: '💣';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.tile-propeller {
    background: var(--tile-propeller);
    animation: spin 2s linear infinite;
}

.tile-propeller::after {
    content: '🌀';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.tile-lightball {
    background: var(--tile-lightball);
    animation: pulse 1s ease-in-out infinite;
}

.tile-lightball::after {
    content: '⭐';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ============================================
   Tile States & Animations
   ============================================ */
.tile:active {
    transform: scale(0.95);
}

.tile.selected {
    transform: scale(1.1);
    box-shadow:
        0 0 20px var(--color-accent-glow),
        var(--shadow-tile);
    z-index: 10;
}

.tile.focused {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
    z-index: 20;
}

/* Hint Pulse Animation */
.tile.hint-pulse {
    animation: hint-glow 1s ease-in-out infinite;
    z-index: 5;
}

@keyframes hint-glow {

    0%,
    100% {
        box-shadow: var(--shadow-tile);
        transform: scale(1);
    }

    50% {
        box-shadow:
            0 0 20px var(--color-accent-glow),
            0 0 40px rgba(99, 102, 241, 0.3),
            var(--shadow-tile);
        transform: scale(1.08);
    }
}

.tile.animating {
    pointer-events: none;
}

.tile.swapping {
    transition: transform var(--transition-medium);
    z-index: 5;
}

.tile.falling {
    transition: transform var(--transition-slow);
}

.tile.removing {
    animation: remove 200ms ease-in forwards;
}

.tile.spawning {
    animation: spawn 200ms ease-out;
}

/* Animations */
@keyframes remove {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

@keyframes spawn {
    0% {
        transform: scale(0) translateY(-50px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        box-shadow:
            0 0 10px rgba(255, 255, 255, 0.5),
            var(--shadow-tile);
    }

    50% {
        box-shadow:
            0 0 25px rgba(255, 255, 255, 0.8),
            var(--shadow-tile);
    }
}

/* ============================================
   Overlay & Game Over
   ============================================ */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 26, 0.95);
    /* More opaque specific to theme */
    backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity var(--transition-medium);
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    padding: 40px;
    text-align: center;
    max-width: 320px;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #fff 0%, #ffeaa7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-content p {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

#final-score {
    font-weight: 700;
    color: var(--color-text-primary);
}

/* ============================================
   Button
   ============================================ */
.btn-primary {
    padding: 14px 32px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--color-accent) 0%, #8b5cf6 100%);
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 14px 32px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-secondary:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================
   Confirm Modal
   ============================================ */
.confirm-popup {
    text-align: center;
    max-width: 320px;
}

.confirm-popup h2 {
    margin-bottom: 0.75rem;
}

.confirm-popup p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.confirm-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (min-width: 400px) {
    :root {
        --board-size: 360px;
    }
}

@media (min-width: 480px) {
    :root {
        --board-size: 400px;
    }
}

/* Dark mode preference (already dark by default) */
@media (prefers-color-scheme: light) {
    :root {
        /* Could add light mode support here */
    }
}

/* ============================================
   Debug UI
   ============================================ */
#debug-controls {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

#debug-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

#debug-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#debug-panel {
    background: rgba(26, 26, 46, 0.9);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

#debug-panel.hidden {
    display: none;
}

#debug-scenario-select {
    padding: 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
}

#debug-load-btn {
    padding: 8px;
    border-radius: 6px;
    background: var(--color-accent);
    color: white;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

#debug-load-btn:hover {
    opacity: 0.9;
}

/* Level Selection */
#level-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: level-select-fade-in 0.4s ease-out;
}

@keyframes level-select-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.level-select-title {
    font-size: 2.8rem;
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.total-stars-counter {
    display: block;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 2.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 180, 0, 0.1) 100%);
    border-radius: 16px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 320px;
    margin: 0 auto;
    padding: 0 1rem;
}

.level-btn {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    position: relative;
    animation: level-btn-pop-in 0.3s ease-out backwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.level-btn:nth-child(1) {
    animation-delay: 0.05s;
}

.level-btn:nth-child(2) {
    animation-delay: 0.1s;
}

.level-btn:nth-child(3) {
    animation-delay: 0.15s;
}

.level-btn:nth-child(4) {
    animation-delay: 0.2s;
}

.level-btn:nth-child(5) {
    animation-delay: 0.25s;
}

.level-btn:nth-child(6) {
    animation-delay: 0.3s;
}

.level-btn:nth-child(7) {
    animation-delay: 0.35s;
}

.level-btn:nth-child(8) {
    animation-delay: 0.4s;
}

.level-btn:nth-child(9) {
    animation-delay: 0.45s;
}

.level-btn:nth-child(10) {
    animation-delay: 0.5s;
}

@keyframes level-btn-pop-in {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.level-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.level-btn.locked {
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
    border-color: transparent;
}

.level-btn.completed {
    background: rgba(100, 255, 100, 0.15);
    border-color: rgba(100, 255, 100, 0.4);
}

.level-btn-stars {
    font-size: 0.8rem;
    margin-top: 5px;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.8));
}

/* ============================================
   Game Over Specific Styles
   ============================================ */
.game-over-content {
    /* Inherits from overlay-content but can be specialized */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.game-over-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 12px rgba(214, 48, 49, 0.3);
}

.game-over-score {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    padding: 16px 32px;
    width: 100%;
}

.game-over-buttons {
    display: flex;
    gap: 16px;
    width: 100%;
    margin-top: 8px;
}

.btn {
    flex: 1;
    padding: 14px 20px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.96);
}

.btn-retry {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-retry:hover {
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
    transform: translateY(-2px);
}

.btn-menu {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-menu:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ============================================
   Pause Overlay
   ============================================ */
.pause-popup {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 3rem;
    max-width: 400px;
    width: 90%;
}

.pause-popup h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* ============================================
   Settings Menu
   ============================================ */
.settings-popup {
    min-width: 300px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.settings-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.settings-group label {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.spacer {
    margin-top: 10px;
    margin-bottom: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.range-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.volume-icon-small,
.volume-icon-large {
    font-size: 1.2rem;
    opacity: 0.7;
}

/* Custom Range Slider */
input[type='range'] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type='range']:focus {
    outline: none;
}

/* Slider Track */
input[type='range']::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Slider Thumb */
input[type='range']::-webkit-slider-thumb {
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -10px;
    /* center thumb */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
}

input[type='range']::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #818cf8;
}

/* Firefox Support */
input[type='range']::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

input[type='range']::-moz-range-thumb {
    height: 28px;
    width: 28px;
    border: none;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, #d63031 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(214, 48, 49, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    box-shadow: 0 6px 20px rgba(214, 48, 49, 0.4);
}

.warning-text {
    font-size: 0.8rem;
    color: #ff7675;
    margin-bottom: 8px;
    text-align: center;
}

/* ============================================
   Objective Progress Animations
   ============================================ */
@keyframes objective-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes objective-complete {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.3);
        box-shadow: 0 0 16px rgba(76, 175, 80, 0.7);
    }

    100% {
        transform: scale(1);
    }
}

.objective-progress-pulse {
    animation: objective-pulse 400ms ease-out;
}

.objective-complete-pop {
    animation: objective-complete 600ms ease-out;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
}

/* ============================================
   Moves Counter Animations
   ============================================ */
@keyframes moves-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes moves-warning {
    0% {
        transform: scale(1) translateX(0);
    }

    20% {
        transform: scale(1.2) translateX(-3px);
    }

    40% {
        transform: scale(1.2) translateX(3px);
    }

    60% {
        transform: scale(1.2) translateX(-2px);
    }

    80% {
        transform: scale(1.1) translateX(0);
    }

    100% {
        transform: scale(1) translateX(0);
    }
}

.moves-pulse {
    animation: moves-pulse 400ms ease-out;
}

.moves-warning {
    animation: moves-warning 600ms ease-out;
}

.moves-low .moves-value {
    color: #ff7675;
    text-shadow: 0 0 8px rgba(255, 118, 117, 0.5);
}

/* ============================================
   Score Counter Animations
   ============================================ */
@keyframes score-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        text-shadow: 0 0 12px rgba(255, 234, 167, 0.6);
    }

    100% {
        transform: scale(1);
    }
}

.score-pulse {
    animation: score-pulse 400ms ease-out;
}

/* ============================================
   Level Transition Animation
   ============================================ */
@keyframes level-fade-out {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes level-fade-in {
    from {
        opacity: 0;
        transform: scale(1.05);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.level-transition-out {
    animation: level-fade-out 250ms ease-in forwards;
}

.level-transition-in {
    animation: level-fade-in 300ms ease-out;
}

.hidden {
    display: none !important;
}