/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Russo One', 'Poppins', sans-serif;
    background: linear-gradient(160deg, #0d0f1d 0%, #171932 50%, #0d0f1d 100%);
    user-select: none;
    -webkit-user-select: none;
}

/* ===== CANVAS ===== */
#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* ===== DECORATIVE BACKGROUND PATTERN ===== */
.lobby-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 15% 85%, rgba(255, 126, 179, 0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 15%, rgba(167, 139, 250, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 215, 0, 0.08) 0%, transparent 55%),
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.06) 0%, transparent 30%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.04) 0%, transparent 30%);
    animation: lobbyBgShift 8s ease-in-out infinite alternate;
    pointer-events: none;
}

.lobby-bg::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.05) 1.5px, transparent 1.5px);
    background-size: 40px 40px, 60px 60px;
    background-position: 0 0, 20px 20px;
    opacity: 0.6;
}

@keyframes lobbyBgShift {
    0% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.03); }
    100% { opacity: 0.8; transform: scale(1.01); }
}

/* ===== LOADING SCREEN ===== */
.loading-overlay {
    background: linear-gradient(150deg, #090A10 0%, #111326 30%, #1A1D3A 55%, #15172E 80%, #090A10 100%);
    z-index: 999;
    overflow: hidden;
}

.loading-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255,126,179,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(167,139,250,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255,215,0,0.08) 0%, transparent 40%);
    animation: loadBgShift 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes loadBgShift {
    0% { opacity: 0.6; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.05) rotate(1deg); }
    100% { opacity: 0.7; transform: scale(1.02) rotate(-1deg); }
}

/* Floating background particles */
.load-particles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.load-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: lpFloat 4s ease-in-out infinite;
}

.lp1 { width: 8px; height: 8px; background: #FF7EB3; top: 15%; left: 10%; animation-delay: 0s; animation-duration: 5s; }
.lp2 { width: 6px; height: 6px; background: #A78BFA; top: 70%; left: 85%; animation-delay: 0.8s; animation-duration: 4.5s; }
.lp3 { width: 10px; height: 10px; background: #FFD700; top: 40%; left: 90%; animation-delay: 1.6s; animation-duration: 5.5s; }
.lp4 { width: 5px; height: 5px; background: #4ADE80; top: 80%; left: 20%; animation-delay: 2.4s; animation-duration: 4s; }
.lp5 { width: 7px; height: 7px; background: #60A5FA; top: 25%; left: 75%; animation-delay: 0.4s; animation-duration: 6s; }
.lp6 { width: 9px; height: 9px; background: #F472B6; top: 60%; left: 35%; animation-delay: 1.2s; animation-duration: 5s; }

@keyframes lpFloat {
    0% { opacity: 0; transform: translateY(0) scale(0); }
    15% { opacity: 0.7; transform: translateY(-20px) scale(1); }
    85% { opacity: 0.5; transform: translateY(-80px) scale(0.8); }
    100% { opacity: 0; transform: translateY(-120px) scale(0); }
}

.loading-content {
    text-align: center;
    position: relative;
    z-index: 1;
}

/* 3D Logo — text-shadow depth approach */
.load-logo {
    line-height: 1;
    position: relative;
    margin-bottom: clamp(0.6rem, 1.5vh, 1rem);
}

.load-logo::after {
    content: '';
    display: block;
    width: 50%;
    height: 3px;
    margin: clamp(8px, 1.5vh, 14px) auto 0;
    background: linear-gradient(90deg, transparent, rgba(255,126,179,0.6), rgba(255,215,0,0.5), rgba(167,139,250,0.6), transparent);
    border-radius: 2px;
    animation: loadUnderGlow 2.5s ease-in-out infinite;
}

@keyframes loadUnderGlow {
    0%, 100% { opacity: 0.3; width: 40%; }
    50% { opacity: 0.9; width: 65%; }
}

.load-title-flow, .load-title-2048 {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* FLOW — white with pink/purple 3D depth shadows */
.load-title-flow {
    font-size: clamp(3.2rem, 13vw, 6.5rem);
    color: #FFFFFF;
    text-shadow:
        0 4px 0 #9B3FB0,
        0 8px 0 #7A2D96,
        0 12px 30px rgba(0, 0, 0, 0.35),
        0 0 60px rgba(255, 126, 179, 0.35);
    animation: loadFlowFloat 3s ease-in-out infinite;
}

@keyframes loadFlowFloat {
    0%, 100% {
        transform: translateY(0) rotate(-0.5deg);
        text-shadow:
            0 4px 0 #9B3FB0,
            0 8px 0 #7A2D96,
            0 12px 30px rgba(0,0,0,0.35),
            0 0 60px rgba(255,126,179,0.35);
    }
    50% {
        transform: translateY(-6px) rotate(0.5deg);
        text-shadow:
            0 6px 0 #9B3FB0,
            0 12px 0 #7A2D96,
            0 18px 40px rgba(0,0,0,0.35),
            0 0 90px rgba(255,126,179,0.55);
    }
}

/* 2048 — gold/candy with orange 3D depth shadows */
.load-title-2048 {
    font-size: clamp(3.8rem, 16vw, 7.8rem);
    color: #FFD700;
    text-shadow:
        0 4px 0 #E08A00,
        0 8px 0 #B87000,
        0 12px 30px rgba(0, 0, 0, 0.35),
        0 0 60px rgba(255, 215, 0, 0.35);
    margin-top: -0.12em;
    animation: load2048Float 3s ease-in-out infinite 0.3s;
}

@keyframes load2048Float {
    0%, 100% {
        transform: translateY(0) rotate(0.5deg) scale(1);
        text-shadow:
            0 4px 0 #E08A00,
            0 8px 0 #B87000,
            0 12px 30px rgba(0,0,0,0.35),
            0 0 60px rgba(255,215,0,0.35);
    }
    50% {
        transform: translateY(-5px) rotate(-0.5deg) scale(1.02);
        text-shadow:
            0 6px 0 #E08A00,
            0 12px 0 #B87000,
            0 18px 40px rgba(0,0,0,0.35),
            0 0 100px rgba(255,215,0,0.55);
    }
}

/* Tagline */
.loading-tagline {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.75rem, 2.2vw, 1rem);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
    opacity: 0;
}

/* Modern Progress Bar */
.load-progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
}

.load-progress-track {
    width: clamp(180px, 50vw, 320px);
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.load-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #A78BFA, #FF7EB3, #FFD700);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
    z-index: 1;
}

.load-progress-glow {
    position: absolute;
    top: -4px; left: 0; right: 0; bottom: -4px;
    background: linear-gradient(90deg, rgba(167,139,250,0.3), rgba(255,126,179,0.4), rgba(255,215,0,0.3));
    border-radius: 6px;
    filter: blur(6px);
    opacity: 0.6;
    animation: progGlow 2s ease-in-out infinite alternate;
}

@keyframes progGlow {
    0% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

/* Loading dots */
.load-progress-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.load-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: dotPulse 1.2s ease-in-out infinite;
}

.load-dot:nth-child(2) { animation-delay: 0.2s; }
.load-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.3); background: #FF7EB3; }
}

/* Tap to start prompt */
.load-tap-prompt {
    cursor: pointer;
}

.load-tap-text {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1rem, 3.5vw, 1.4rem);
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.25em;
    text-shadow: 0 0 20px rgba(255, 126, 179, 0.5), 0 2px 4px rgba(0,0,0,0.2);
    animation: tapPulse 1.5s ease-in-out infinite;
}

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

/* ===== LOBBY SCREEN ===== */
#lobbyScreen {
    background: linear-gradient(160deg, #8B5CC8 0%, #A66DE0 25%, #C088F0 50%, #B47AE8 75%, #9B6DC6 100%);
    z-index: 100;
    overflow: hidden;
}

.lobby-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 3vh, 2rem);
    width: 90%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.game-title {
    line-height: 1;
}

.title-line {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.title-flow {
    font-size: clamp(3.2rem, 13vw, 6.5rem);
    color: #FFFFFF;
    text-shadow:
        0 4px 0 rgba(100, 50, 150, 0.5),
        0 8px 0 rgba(80, 30, 120, 0.3),
        0 0 30px rgba(255, 255, 255, 0.3),
        0 0 60px rgba(167, 139, 250, 0.4);
    animation: titleFloat 3s ease-in-out infinite;
}

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

.title-2048 {
    font-size: clamp(3.8rem, 15vw, 7.5rem);
    background: linear-gradient(135deg, #FFD700 0%, #FBBF24 30%, #FF7EB3 60%, #FF6B6B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 0 rgba(180, 100, 30, 0.4)) drop-shadow(0 8px 0 rgba(120, 60, 20, 0.2)) drop-shadow(0 0 30px rgba(255, 215, 0, 0.4));
    margin-top: -0.1em;
    animation: titleFloat 3s ease-in-out infinite 0.3s;
}

.game-title::after {
    content: '';
    display: block;
    width: 70%;
    height: 3px;
    margin: 12px auto 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), rgba(255, 215, 0, 0.4), rgba(255, 126, 179, 0.4), transparent);
    border-radius: 2px;
}

.lobby-tagline {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.lobby-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 6vw, 40px);
    width: 100%;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255,255,255,0.15);
}

.lobby-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lobby-stat-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.6rem, 1.5vw, 0.7rem);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.12em;
}

.lobby-stat-value {
    font-weight: 800;
    font-size: clamp(1.1rem, 3.2vw, 1.4rem);
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.trophy-svg path {
    fill: #FFD54F;
    filter: drop-shadow(0 0 4px rgba(255, 213, 79, 0.5));
}

/* Play button */
.play-btn {
    position: relative;
    background: linear-gradient(180deg, #4ADE80 0%, #22C55E 50%, #16A34A 100%);
    border: none;
    border-bottom: 6px solid #15803D;
    border-radius: 22px;
    padding: clamp(16px, 3vh, 22px) clamp(55px, 14vw, 110px);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow:
        0 6px 30px rgba(34, 197, 94, 0.4),
        0 0 60px rgba(74, 222, 128, 0.2),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
    animation: playBtnGlow 2s ease-in-out infinite alternate;
}

@keyframes playBtnGlow {
    0% { box-shadow: 0 6px 25px rgba(34, 197, 94, 0.35), 0 0 40px rgba(74, 222, 128, 0.15), inset 0 2px 0 rgba(255,255,255,0.25); }
    100% { box-shadow: 0 6px 40px rgba(34, 197, 94, 0.55), 0 0 80px rgba(74, 222, 128, 0.3), inset 0 2px 0 rgba(255,255,255,0.25); }
}

.play-btn:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
}

.play-btn-text {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 4.5vw, 2.1rem);
    color: #fff;
    letter-spacing: 0.2em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 1;
}

.play-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0%, 70% { left: -100%; }
    85%, 100% { left: 150%; }
}

.settings-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.settings-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.9);
}

.settings-btn svg path {
    fill: rgba(255, 255, 255, 0.7);
}

/* ===== HUD ===== */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud > * {
    pointer-events: auto;
}

.hud-top {
    width: 100%;
    padding: clamp(10px, 2vh, 18px) clamp(16px, 3vw, 28px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

/* Centered score pill — solid candy style */
.hud-score-bar {
    display: flex;
    align-items: center;
    gap: clamp(12px, 3vw, 20px);
    background: linear-gradient(180deg, #24274C 0%, #1A1C36 100%);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-bottom: 4px solid #121326;
    border-radius: 18px;
    padding: clamp(6px, 1.2vh, 10px) clamp(18px, 5vw, 32px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}

.score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.score-divider {
    width: 2px;
    height: clamp(28px, 4vh, 40px);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 1px;
}

.score-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.5rem, 1.4vw, 0.65rem);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
}

.score-value {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    color: #FFFFFF;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.best-label {
    color: rgba(255, 215, 0, 0.55);
}
.best-value {
    font-size: clamp(1.1rem, 3.8vw, 1.6rem);
    color: rgba(255, 215, 0, 0.85);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Pause button — solid candy, absolute right */
.pause-btn {
    position: absolute;
    right: clamp(16px, 3vw, 28px);
    top: clamp(10px, 2vh, 18px);
    width: clamp(38px, 5.5vw, 46px);
    height: clamp(38px, 5.5vw, 46px);
    border-radius: 14px;
    background: linear-gradient(180deg, #24274C 0%, #1A1C36 100%);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-bottom: 3px solid #121326;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.pause-btn:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.pause-icon {
    display: flex;
    gap: 3px;
}

.pause-icon span {
    display: block;
    width: 3.5px;
    height: 14px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
}

/* Combo */
.combo-display {
    text-align: center;
    margin-top: -4px;
}

.combo-value {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    font-size: clamp(1.3rem, 4.5vw, 2rem);
    color: #FFFFFF;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 16px rgba(167, 139, 250, 0.5);
    letter-spacing: 0.05em;
    transition: color 0.3s;
}

.combo-value.combo-yellow {
    color: #FBBF24;
    text-shadow: 0 0 16px rgba(251, 191, 36, 0.6), 0 2px 4px rgba(0,0,0,0.2);
}

.combo-value.combo-orange {
    color: #FB923C;
    text-shadow: 0 0 20px rgba(251, 146, 60, 0.7), 0 2px 4px rgba(0,0,0,0.2);
}

.combo-value.combo-red {
    color: #FF6B6B;
    text-shadow: 0 0 24px rgba(255, 107, 107, 0.8), 0 2px 4px rgba(0,0,0,0.2);
}

/* Next Tile — solid candy style */
.next-tile-container {
    position: fixed;
    bottom: clamp(16px, 3vh, 32px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 51;
}

.next-tile-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.55rem, 1.5vw, 0.7rem);
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.2em;
}

.next-tile-btn {
    width: clamp(54px, 11vw, 68px);
    height: clamp(54px, 11vw, 68px);
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-bottom: 4px solid #121326;
    background: linear-gradient(180deg, #24274C 0%, #1A1C36 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.12);
}

.next-tile-btn:active {
    transform: translateY(3px);
    border-bottom-width: 1px;
}

.next-tile-btn.glow {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
    animation: nextTileGlow 1.5s ease-in-out infinite alternate;
}

@keyframes nextTileGlow {
    0% { box-shadow: 0 0 14px rgba(167, 139, 250, 0.25); }
    100% { box-shadow: 0 0 28px rgba(167, 139, 250, 0.5); }
}

.next-tile-value {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    color: #FFFFFF;
    text-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

/* ===== FLOATING SCORE ===== */
#floatingScoreContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

.floating-score {
    position: absolute;
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.1rem, 3.5vw, 1.6rem);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 16px currentColor;
    pointer-events: none;
    white-space: nowrap;
}

/* ===== PAUSE SCREEN ===== */
#pauseScreen {
    background: rgba(13, 15, 29, 0.95);
}

.pause-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 3vh, 1.5rem);
}

.pause-title {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 10vw, 4.5rem);
    color: #FFFFFF;
    text-shadow:
        0 4px 0 rgba(80, 40, 130, 0.5),
        0 0 40px rgba(167, 139, 250, 0.5),
        0 0 80px rgba(255, 126, 179, 0.3);
    letter-spacing: 0.1em;
}

/* Menu buttons */
.menu-btn {
    position: relative;
    min-width: clamp(180px, 45vw, 260px);
    padding: clamp(12px, 2vh, 18px) clamp(30px, 6vw, 50px);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Russo One', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.9rem, 2.8vw, 1.1rem);
    color: #fff;
    letter-spacing: 0.1em;
    transition: transform 0.1s, border-bottom-width 0.1s;
    overflow: hidden;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.2);
}

.menu-btn:active {
    transform: translateY(3px);
    border-bottom-width: 1px;
}

.resume-btn, .retry-btn {
    background: linear-gradient(180deg, #A78BFA 0%, #8B5CF6 100%);
    border-bottom: 5px solid #6D28D9;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35), inset 0 2px 0 rgba(255,255,255,0.2);
}

.restart-btn {
    background: linear-gradient(180deg, #FF7EB3 0%, #F06292 100%);
    border-bottom: 5px solid #D84380;
    box-shadow: 0 4px 20px rgba(240, 98, 146, 0.3), inset 0 2px 0 rgba(255,255,255,0.2);
}

.lobby-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.12) 100%);
    border-bottom: 4px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    border-bottom: 4px solid rgba(255,255,255,0.1);
}

/* ===== GAME OVER SCREEN ===== */
#gameOverScreen {
    background: rgba(13, 15, 29, 0.95);
}

.gameover-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.8rem, 2.5vh, 1.4rem);
    max-width: 380px;
    width: 90%;
}

.gameover-title { line-height: 0.9; }

.go-line {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.go-game {
    font-size: clamp(3rem, 14vw, 6rem);
    color: rgba(255, 255, 255, 0.5);
    text-shadow: 0 3px 0 rgba(80, 40, 130, 0.4);
}

.go-over {
    font-size: clamp(3.8rem, 18vw, 7.5rem);
    color: #FF7EB3;
    text-shadow:
        0 4px 0 rgba(200, 70, 120, 0.5),
        0 0 30px rgba(255, 126, 179, 0.4);
    margin-top: -0.05em;
}

.go-card {
    width: 100%;
    background: linear-gradient(180deg, #7B4FAF 0%, #6B3F9F 100%);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-bottom: 4px solid #5A2F8F;
    border-radius: 22px;
    padding: clamp(16px, 3vh, 28px) clamp(20px, 5vw, 36px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}

.go-score-section { margin-bottom: clamp(10px, 2vh, 16px); }

.go-score-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.65rem, 1.8vw, 0.8rem);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.25em;
    margin-bottom: 4px;
}

.go-score-value {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    font-size: clamp(3rem, 12vw, 5rem);
    color: #FFFFFF;
    line-height: 1;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.2), 0 0 30px rgba(255, 215, 0, 0.3);
}

.go-new-best {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: #FFD700;
    letter-spacing: 0.15em;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3);
    margin-bottom: clamp(8px, 1.5vh, 14px);
    animation: newBestPulse 1s ease-in-out infinite alternate;
}
@keyframes newBestPulse {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.06); }
}

.go-retry-btn {
    width: 100%;
    padding: clamp(14px, 2.5vh, 20px);
    font-size: clamp(1.1rem, 3vw, 1.4rem) !important;
}

.go-divider {
    height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin-bottom: clamp(10px, 2vh, 16px);
}

.go-stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 8vw, 48px);
}

.go-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.go-stat-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.55rem, 1.5vw, 0.65rem);
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.1em;
}

.go-stat-value {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
}

.go-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== LEVEL SELECT ===== */
#levelSelectScreen {
    background: linear-gradient(160deg, #8B5CC8 0%, #A66DE0 30%, #C088F0 60%, #9B6DC6 100%);
    z-index: 100;
    flex-direction: column;
    align-items: stretch;
}

.ls-container {
    width: 100%;
    max-width: 520px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.ls-header {
    display: flex;
    align-items: center;
    padding: clamp(14px, 2.5vh, 20px) clamp(16px, 4vw, 24px);
    gap: 12px;
    flex-shrink: 0;
}

.ls-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.ls-back-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.3);
}

.ls-back-btn svg path {
    fill: #FFFFFF;
}

.ls-title {
    flex: 1;
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    color: #FFFFFF;
    letter-spacing: 0.15em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.ls-total-stars {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    color: #FFD54F;
    background: rgba(255, 255, 255, 0.12);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 215, 0, 0.2);
    text-shadow: 0 0 8px rgba(255, 213, 79, 0.4);
}

.ls-scroller {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px clamp(16px, 4vw, 24px) clamp(24px, 4vh, 40px);
    -webkit-overflow-scrolling: touch;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: clamp(8px, 2vw, 12px);
    align-content: start;
}

.ls-scroller::-webkit-scrollbar { width: 3px; }
.ls-scroller::-webkit-scrollbar-track { background: transparent; }
.ls-scroller::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 2px; }

.ls-btn {
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    color: #FFFFFF;
    padding: 0;
    outline: none;
}

.ls-btn:not(.locked):active { transform: scale(0.92); }

.ls-num {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1rem, 3vw, 1.3rem);
    line-height: 1;
    color: rgba(255, 255, 255, 0.6);
}

.ls-stars { display: flex; gap: 2px; }

.ls-star.earned { fill: #FFD54F; }
.ls-star.empty { fill: rgba(255, 255, 255, 0.15); }

.ls-btn.locked {
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}

.ls-btn.locked .ls-num { color: rgba(255, 255, 255, 0.15); }

.ls-lock {
    position: absolute;
    bottom: clamp(3px, 0.8vw, 6px);
}

.ls-lock svg { width: 12px; height: 12px; }
.ls-lock svg path { fill: rgba(255, 255, 255, 0.12); }

.ls-btn.done {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ls-btn.done .ls-num { color: rgba(255, 255, 255, 0.85); }

.ls-btn.current {
    border-color: rgba(255, 215, 0, 0.5);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 126, 179, 0.1));
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    animation: ls-pulse 2s ease-in-out infinite;
}

@keyframes ls-pulse {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 215, 0, 0.15); }
    50% { box-shadow: 0 0 28px rgba(255, 215, 0, 0.35); }
}

.ls-btn.current .ls-num { color: #FFD54F; }

/* ===== LEVEL COMPLETE ===== */
#levelCompleteScreen {
    background: rgba(100, 60, 160, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.lc-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.8rem, 2.5vh, 1.4rem);
    max-width: 380px;
    width: 90%;
}

.lc-title {
    font-family: 'Russo One', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: #FFFFFF;
    text-shadow:
        0 4px 0 rgba(180, 100, 30, 0.4),
        0 0 30px rgba(255, 215, 0, 0.5),
        0 0 60px rgba(255, 126, 179, 0.3);
    letter-spacing: 0.04em;
}

.lc-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 3vw, 16px);
}

.lc-star { filter: drop-shadow(0 2px 8px rgba(255, 213, 79, 0.4)); }
.lc-star.earned path { fill: #FFD54F; }

.lc-info {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: rgba(255, 255, 255, 0.5);
}

.lc-score-display {
    font-family: 'Russo One', sans-serif;
    font-weight: 800;
    font-size: clamp(1.1rem, 3.2vw, 1.4rem);
    color: #FFFFFF;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

.lc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.lc-next-btn {
    background: linear-gradient(180deg, #4ADE80 0%, #22C55E 100%);
    border-bottom: 5px solid #15803D;
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.4), inset 0 2px 0 rgba(255,255,255,0.2);
}

.lc-replay-btn, .lc-levels-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.08) 100%);
    border-bottom: 4px solid rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-bottom: 4px solid rgba(255,255,255,0.08);
}

/* ===== TUTORIAL ===== */
.tutorial-overlay {
    background: rgba(80, 40, 130, 0.88);
    z-index: 300;
}

.tutorial-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 3vh, 2rem);
    max-width: 340px;
    width: 85%;
}

.tutorial-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    color: #FFFFFF;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.tutorial-hand {
    animation: tutorialHandBob 1.5s ease-in-out infinite;
}

.tutorial-hand svg path { fill: rgba(255, 255, 255, 0.9); }

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

.tutorial-next-btn {
    font-family: 'Russo One', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: clamp(0.9rem, 2.8vw, 1.1rem);
    color: #fff;
    letter-spacing: 0.12em;
    background: linear-gradient(180deg, #A78BFA 0%, #8B5CF6 100%);
    border: none;
    border-bottom: 5px solid #6D28D9;
    border-radius: 14px;
    padding: 12px 36px;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35), inset 0 2px 0 rgba(255,255,255,0.2);
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.tutorial-next-btn:active {
    transform: translateY(3px);
    border-bottom-width: 1px;
}

/* ===== SETTINGS ===== */
#settingsScreen {
    background: linear-gradient(180deg, #1A1D3A 0%, #0D0F1D 100%);
    z-index: 150;
    flex-direction: column;
}

.settings-container {
    width: 90%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 10px 0;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-back-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(180deg, #24274C 0%, #1A1C36 100%);
    border: 3px solid #3A3F6C;
    border-bottom: 5px solid #121326;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, border-bottom-width 0.1s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    padding: 0;
}

.settings-back-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.settings-title {
    flex: 1;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #fff;
    letter-spacing: 0.12em;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.4);
}

.settings-section-label {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.65rem, 1.8vw, 0.8rem);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.15em;
    margin-top: 8px;
}

/* Toggle rows */
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 3px solid #6B3FA0;
    border-bottom: 5px solid #4A1F7F;
    background: linear-gradient(180deg, #5A2F8F 0%, #4A1F7F 100%);
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.settings-toggle-row:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.toggle-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.toggle-label {
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.toggle-switch {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #2a1548 0%, #1a0a2e 100%);
    border: 2px solid #4A1F7F;
    position: relative;
    transition: background 0.25s, border-color 0.25s;
    flex-shrink: 0;
}

.toggle-switch .toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(180deg, #7B5BAF 0%, #5A3F8F 100%);
    border: 2px solid #9B7FD0;
    border-radius: 50%;
    transition: left 0.25s, background 0.25s, border-color 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.settings-toggle-row.active .toggle-switch {
    background: linear-gradient(180deg, #1e4040 0%, #153030 100%);
    border-color: #3a8a6e;
}

.settings-toggle-row.active .toggle-switch .toggle-knob {
    left: 22px;
    background: linear-gradient(180deg, #5eddbb 0%, #38b289 100%);
    border-color: #80f0d0;
}

/* Volume slider row */
.settings-volume-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 3px solid #6B3FA0;
    border-bottom: 5px solid #4A1F7F;
    background: linear-gradient(180deg, #4A1F7F 0%, #3A1568 100%);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.volume-icon {
    flex-shrink: 0;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-track {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    position: relative;
    cursor: pointer;
    touch-action: none;
}

.volume-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #38b289, #5eddbb);
    width: 25%;
    pointer-events: none;
}

.volume-thumb {
    position: absolute;
    top: 50%;
    left: 25%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, #fff 0%, #d0d0d0 100%);
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: transform 0.1s;
}

.volume-track.dragging .volume-thumb {
    transform: translate(-50%, -50%) scale(1.15);
}

.volume-value {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    min-width: 36px;
    text-align: right;
}

/* Language list */
.settings-lang-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.settings-lang-list::-webkit-scrollbar { width: 3px; }
.settings-lang-list::-webkit-scrollbar-track { background: transparent; }
.settings-lang-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.settings-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 3px solid #6B3FA0;
    border-bottom: 5px solid #4A1F7F;
    background: linear-gradient(180deg, #5A2F8F 0%, #4A1F7F 100%);
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.settings-lang-item:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.settings-lang-item.active {
    background: linear-gradient(180deg, #3a8a6e 0%, #2a6a52 100%);
    border-color: #5cc8a0;
    border-bottom-color: #1e5040;
    box-shadow: 0 3px 12px rgba(78, 204, 163, 0.25);
}

.settings-lang-flag {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.settings-lang-name {
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.settings-lang-check {
    font-size: 1.1rem;
    color: #4ecca3;
    opacity: 0;
    transition: opacity 0.25s;
    flex-shrink: 0;
}

.settings-lang-item.active .settings-lang-check {
    opacity: 1;
}

/* Reset button */
.settings-reset-btn {
    width: 100%;
    padding: 14px 20px;
    border: 3px solid #ff8080;
    border-bottom: 5px solid #cc3333;
    border-radius: 14px;
    background: linear-gradient(180deg, #d85a5a 0%, #c03030 100%);
    color: #fff;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    margin-top: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.settings-reset-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.settings-reset-btn.confirming {
    background: linear-gradient(180deg, #ff5555 0%, #dd2020 100%);
    border-color: #ffaaaa;
    animation: resetPulse 0.6s ease-in-out infinite alternate;
}

@keyframes resetPulse {
    from { box-shadow: 0 0 8px rgba(255, 80, 80, 0.4); }
    to { box-shadow: 0 0 20px rgba(255, 80, 80, 0.7); }
}

/* Settings button in pause menu */
.settings-open-btn {
    background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.08) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    border-bottom: 4px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.settings-open-btn .settings-icon-svg {
    flex-shrink: 0;
}

.settings-open-btn .settings-icon-svg path {
    fill: rgba(255,255,255,0.8);
}

/* ===== CONFETTI ===== */
.confetti-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 500;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    will-change: transform, opacity;
}

/* ===== CSS BOARD OVERLAY (dark modern board interior) ===== */
#boardOverlay{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:5}
.board-bg{position:absolute;border-radius:18px;background:linear-gradient(150deg,#8A68B8 0%,#7E5CAE 50%,#7452A4 100%);box-shadow:inset 0 4px 14px rgba(255,255,255,0.07),inset 0 -4px 14px rgba(0,0,0,0.14),inset 0 0 0 1px rgba(255,255,255,0.06)}
.cell-slot{position:absolute;border-radius:14px;background:rgba(20,8,50,0.2);box-shadow:inset 0 2px 6px rgba(0,0,0,0.22),inset 0 -1px 3px rgba(255,255,255,0.05);border:1px solid rgba(0,0,0,0.06)}

/* ===== SVG TRAIL (smooth snake path) ===== */
#trailOverlay{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:8}
#trailOverlay svg{position:absolute;top:0;left:0;width:100%;height:100%}
.trail-arrows{animation:trailFlow .4s linear infinite}
@keyframes trailFlow{from{stroke-dashoffset:0}to{stroke-dashoffset:-24}}

/* ===== CANDY TILE BLOCKS (game4 style DOM overlay + 3D depth) ===== */
#tileOverlay{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;overflow:hidden;z-index:10}
.block{position:absolute;border-radius:14px 14px 16px 16px;border-bottom:7px solid var(--side-color,#999);z-index:20;pointer-events:none;will-change:transform,left,top;transform-origin:center bottom}
.block *{pointer-events:none}
.block .block-body{position:absolute;top:3px;left:3px;right:3px;bottom:3px;border-radius:12px;box-shadow:inset 0 4px 8px rgba(255,255,255,.4),inset 0 -3px 5px rgba(0,0,0,.08)}
.block .block-stripe{position:absolute;top:6px;left:6px;right:6px;bottom:6px;border-radius:10px;background:repeating-linear-gradient(45deg,transparent,transparent 5px,rgba(255,255,255,.1) 5px,rgba(255,255,255,.1) 10px)}
.block .block-shadow{position:absolute;left:2px;right:2px;bottom:-2px;height:8px;border-radius:0 0 14px 14px;background:linear-gradient(180deg,transparent,rgba(0,0,0,.15))}
.block .block-highlight{position:absolute;top:6px;left:12px;right:12px;height:5px;border-radius:4px;background:rgba(255,255,255,.4)}
.block .block-glow{position:absolute;top:45%;left:50%;width:60%;height:60%;transform:translate(-50%,-50%);border-radius:50%;background:radial-gradient(circle,var(--glow-color,rgba(255,255,255,.2)) 0%,transparent 70%);opacity:.5;animation:candyGlow 2.5s ease-in-out infinite}
.block .block-number{position:absolute;top:46%;left:50%;transform:translate(-50%,-50%);font-family:'Poppins',sans-serif;font-weight:900;color:#fff;text-shadow:0 2px 4px rgba(0,0,0,.3);z-index:5;line-height:1}
@keyframes candyGlow{0%,100%{opacity:.35;transform:translate(-50%,-50%) scale(1)}50%{opacity:.6;transform:translate(-50%,-50%) scale(1.15)}}

/* ===== RESPONSIVE ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .lobby-content { gap: 0.5rem; }
    .title-flow { font-size: 2rem; }
    .title-2048 { font-size: 2.5rem; }
    .play-btn { padding: 10px 40px; }
}

/* Portrait phone — compact HUD, adapted board */
@media (orientation: portrait) and (max-width: 600px) {
    .hud-score-bar {
        gap: 8px;
        padding: 5px 14px;
        border-radius: 14px;
        border-bottom-width: 3px;
    }
    .score-value {
        font-size: clamp(1.1rem, 5vw, 1.6rem);
    }
    .best-value {
        font-size: clamp(0.85rem, 3.5vw, 1.2rem);
    }
    .score-divider {
        height: 24px;
    }
    .pause-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }
    .next-tile-container {
        bottom: clamp(12px, 2vh, 20px);
    }
    .next-tile-btn {
        width: clamp(46px, 12vw, 58px);
        height: clamp(46px, 12vw, 58px);
        border-radius: 14px;
    }
    .board-bg {
        border-radius: 12px;
    }
    .cell-slot {
        border-radius: 10px;
    }
    .block {
        border-radius: 10px 10px 12px 12px;
        border-bottom-width: 5px;
    }
    .block .block-body {
        border-radius: 8px;
    }
    .block .block-highlight {
        top: 4px;
        left: 8px;
        right: 8px;
        height: 3px;
    }
}
