/* ===================================================
   MemoryMatch — Game-Themed UI
   Dark arcade aesthetic inspired by mobile puzzle games
   =================================================== */

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

/* ---- Base / Reset ---- */
html { font-size: 16px; }

body {
    font-family: "Rajdhani", "Inter", system-ui, sans-serif;
    background: #0a0820;
    color: #e2e8f0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Background Canvas ---- */
#bgCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0e0b2a; }
::-webkit-scrollbar-thumb { background: #3b3575; border-radius: 3px; }

/* ==================================================
   GAME WRAPPER
   ================================================== */
.game-wrapper {
    position: relative;
    z-index: 1;
    max-width: 860px;
    margin: 0 auto;
    padding: 16px 16px 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==================================================
   HEADER
   ================================================== */
.game-header {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 18px;
    padding: 16px 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.game-title-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3278d2, #00b4d8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 20px rgba(108,63,196,0.6);
    flex-shrink: 0;
}

.game-title {
    font-family: "Orbitron", sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 900;
    background: linear-gradient(90deg, #00e5ff, #b16cff, #ff6f91);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.game-subtitle {
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
    letter-spacing: 0.02em;
}

/* ---- Action Buttons ---- */
.header-actions {
    display: flex;
    gap: 8px;
    width: 100%;
}

.btn-icon {
    flex: 1;
    min-width: 0;
    height: auto;
    padding: 8px 6px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.08);
    color: #cbd5e1;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.18s ease;
}

.btn-label {
    font-family: "Rajdhani", sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.btn-icon:hover {
    background: rgba(255,255,255,0.16);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.btn-icon:active { transform: translateY(0); }

.btn-icon.btn-accent {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 0 12px rgba(99,102,241,0.5);
}
.btn-icon.btn-accent:hover { box-shadow: 0 0 20px rgba(99,102,241,0.7); }

.btn-icon.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 0 12px rgba(239,68,68,0.4);
}
.btn-icon.btn-danger:hover { box-shadow: 0 0 20px rgba(239,68,68,0.6); }

/* ---- Stats Row ---- */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 90px;
    transition: all 0.2s;
    cursor: default;
}

.stat-card.clickable {
    cursor: pointer;
}
.stat-card.clickable:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-1px);
}
button.stat-card { text-align: left; }

.stat-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.stat-icon.gold { color: #fbbf24; filter: drop-shadow(0 0 6px rgba(251,191,36,0.7)); }
.stat-icon.cyan { color: #22d3ee; filter: drop-shadow(0 0 6px rgba(34,211,238,0.6)); }
.stat-icon.red  { color: #f87171; filter: drop-shadow(0 0 6px rgba(248,113,113,0.6)); }

.stat-body { display: flex; flex-direction: column; }
.stat-label { font-size: 0.68rem; color: #64748b; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.stat-value {
    font-family: "Orbitron", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

/* ---- Progress Card ---- */
.progress-card {
    flex: 1;
    min-width: 160px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.progress-group { display: flex; flex-direction: column; gap: 4px; }
.progress-label-row { display: flex; justify-content: space-between; }

.progress-track {
    height: 7px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.progress-fill.glow-cyan {
    background: linear-gradient(90deg, #0891b2, #22d3ee);
    box-shadow: 0 0 8px rgba(34,211,238,0.6);
}
.progress-fill.glow-gold {
    background: linear-gradient(90deg, #d97706, #fbbf24);
    box-shadow: 0 0 8px rgba(251,191,36,0.6);
}

/* ==================================================
   MAIN CONTENT
   ================================================== */
.game-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- Feedback Banner ---- */
.feedback-banner {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px 18px;
    min-height: 56px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.feedback-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #cbd5e1;
    transition: all 0.3s ease;
    min-height: 1.4em;
    letter-spacing: 0.01em;
}

.last-move-text {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 3px;
    font-weight: 500;
}

/* Feedback states */
.feedback-correct2 {
    color: #4ade80 !important;
    animation: feedbackPop 0.5s ease;
}
.feedback-correct1 {
    color: #fbbf24 !important;
    animation: feedbackPop 0.5s ease;
}
.feedback-incorrect {
    color: #f87171 !important;
    animation: feedbackShake 0.4s ease;
}

@keyframes feedbackPop {
    0% { transform: scale(0.95); opacity: 0.5; }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes feedbackShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ---- Section ---- */
.game-section {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 16px 18px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.section-title {
    font-family: "Rajdhani", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #94a3b8;
}
.section-title i { margin-right: 6px; }

.section-hint {
    font-size: 0.72rem;
    color: #475569;
    font-weight: 500;
}

.btn-sm {
    padding: 5px 12px;
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 8px;
    color: #fbbf24;
    font-size: 0.78rem;
    font-family: "Rajdhani", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s;
    letter-spacing: 0.04em;
}
.btn-sm:hover { background: rgba(251,191,36,0.22); }

/* ---- Game Board ---- */
.game-board {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 130px;
    padding: 6px 2px;
    /* Limit repaint scope when bottles are added/removed */
    contain: layout style;
}

/* ---- Game Palette ---- */
.game-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 6px 2px;
    contain: layout style;
}

/* ==================================================
   SLOT
   ================================================== */
.slot {
    width: 52px;
    height: 116px;
    border-radius: 14px;
    border: 2px dashed rgba(255,255,255,0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    /* Only animate the properties that actually change — not 'all' */
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    cursor: pointer;
    touch-action: manipulation;
}

.slot-number {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.2);
    font-family: "Orbitron", sans-serif;
    font-weight: 700;
    position: absolute;
    bottom: 5px;
    letter-spacing: 0.05em;
}

.slot:hover:not(.locked):not(.guess-highlight),
.slot.drag-over:not(.locked):not(.guess-highlight) {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.07);
}
/* Stronger highlight specifically during drag (overrides :hover level) */
.slot.drag-over:not(.locked):not(.guess-highlight) {
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.slot.locked {
    border-style: solid;
    border-color: rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.04);
    cursor: default;
}

.slot.locked::after {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 9px;
    color: rgba(255,255,255,0.25);
    position: absolute;
    bottom: 5px;
}
/* During a hard-mode guess both slots look identical — hide the lock badge */
.slot.guess-highlight.locked::after { display: none; }

.slot.highlight {
    border-style: solid;
    border-color: #3b82f6;
    background: rgba(59,130,246,0.12);
    box-shadow: 0 0 14px rgba(59,130,246,0.4), inset 0 0 10px rgba(59,130,246,0.1);
    animation: pulseBlue 1.5s infinite;
}

.slot.guess-highlight {
    border-style: dashed;
    border-color: #f59e0b;
    background: rgba(245,158,11,0.1);
    box-shadow: 0 0 14px rgba(245,158,11,0.4);
    animation: pulseAmber 1.5s infinite;
}

@keyframes pulseBlue {
    0%, 100% { box-shadow: 0 0 8px rgba(59,130,246,0.4); }
    50% { box-shadow: 0 0 20px rgba(59,130,246,0.7); }
}
@keyframes pulseAmber {
    0%, 100% { box-shadow: 0 0 8px rgba(245,158,11,0.4); }
    50% { box-shadow: 0 0 22px rgba(245,158,11,0.7); }
}

/* ==================================================
   BOTTLE / ICON TOKEN
   ================================================== */
.bottle {
    width: 44px;
    height: 92px;
    border-radius: 22px 22px 16px 16px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    touch-action: manipulation;
    user-select: none;
    /* Specific properties only — 'all' causes paint on every property during drag */
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease;
    /* Pre-promote to compositor layer so drag/hover transform is GPU-only */
    will-change: transform;
    box-shadow:
        0 6px 16px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.2);
    /* border: 2px solid rgba(255,255,255,0.2); */
}

/* Bottle neck */
.bottle::before {
    content: "";
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 14px;
    border-radius: 5px 5px 0 0;
    background: inherit;
    border: 2px solid rgba(255,255,255,0.2);
    border-bottom: none;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.15);
}

/* Shine overlay */
.bottle::after {
    content: "";
    position: absolute;
    top: 10px;
    left: 8px;
    width: 8px;
    height: 28px;
    border-radius: 4px;
    background: rgba(255,255,255,0.22);
    pointer-events: none;
}

.bottle i {
    font-size: 20px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

.bottle:hover {
    transform: translateY(-5px) scale(1.04);
    box-shadow:
        0 14px 28px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.bottle:active { transform: translateY(-2px) scale(1.01); cursor: grabbing; }

/* Selected state */
.bottle.selected {
    box-shadow:
        0 0 0 3px #fff,
        0 0 20px rgba(255,255,255,0.5),
        0 6px 16px rgba(0,0,0,0.4);
    transform: translateY(-3px) scale(1.05);
}

/* Dragging source — semi-transparent, no transition flicker */
.bottle.dragging {
    opacity: 0.35;
    transition: none;
    cursor: grabbing;
}

/* Locked bottle */
.bottle.pointer-events-none { cursor: default; }
.bottle.pointer-events-none:hover { transform: none; }

/* Bottle ghost — invisible placeholder keeps palette row same width as board */
.bottle-ghost {
    width: 44px;
    height: 92px;
    flex-shrink: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Bounce in animation for new bottles */
@keyframes bottleIn {
    0% { transform: scale(0) translateY(20px); opacity: 0; }
    70% { transform: scale(1.1) translateY(-4px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
.bottle-spawn { animation: bottleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ==================================================
   LEVEL-UP FLASH
   ================================================== */
@keyframes levelUpFlash {
    0% { transform: scale(1); }
    30% { transform: scale(1.15); color: #fbbf24; }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}
.level-up { animation: levelUpFlash 0.65s ease; }

/* Lives pulse on loss */
@keyframes livesPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); color: #ef4444; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.lives-hurt { animation: livesPulse 0.5s ease; }

/* ==================================================
   FOOTER
   ================================================== */
.game-footer {
    text-align: center;
    font-size: 0.72rem;
    color: #334155;
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.footer-link {
    color: #64748b;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s;
}
.footer-link:hover { color: #94a3b8; }
.footer-sep { color: #3b4255; font-size: 1rem; }

/* ==================================================
   MODALS
   ================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: #11102b;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    overflow: hidden;
}
.modal-box.modal-wide { max-width: 560px; }

@keyframes modalIn {
    from { transform: scale(0.9) translateY(16px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    15%       { transform: translate(-5px, 2px) rotate(-0.5deg); }
    30%       { transform: translate(5px, -3px) rotate(0.5deg); }
    45%       { transform: translate(-4px, 4px) rotate(-0.3deg); }
    60%       { transform: translate(4px, -2px) rotate(0.3deg); }
    75%       { transform: translate(-2px, 3px) rotate(-0.2deg); }
    90%       { transform: translate(2px, -1px) rotate(0.1deg); }
}
.shake { animation: screenShake 0.4s ease; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.modal-title {
    font-family: "Orbitron", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.06em;
}
.modal-title i { margin-right: 8px; color: #818cf8; }

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    font-size: 14px;
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: #f87171; }

.modal-body {
    padding: 18px 20px 22px;
    max-height: 70vh;
    overflow-y: auto;
}

/* ---- Options ---- */
.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 12px;
}
.option-row:last-child { border-bottom: none; }

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #cbd5e1;
    flex-wrap: wrap;
}
.option-label i { color: #818cf8; width: 16px; text-align: center; }

.option-badge {
    font-size: 0.65rem;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ---- Toggles ---- */
.game-toggle {
    position: relative;
    width: 46px;
    height: 26px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s, box-shadow 0.3s;
    flex-shrink: 0;
}
.game-toggle.on {
    background: linear-gradient(90deg, #10b981, #34d399);
    border-color: transparent;
    box-shadow: 0 0 10px rgba(16,185,129,0.5);
}
.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.game-toggle.on .toggle-knob { transform: translateX(20px); }

/* ---- Leaderboard ---- */
.lb-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 10px 14px;
    gap: 10px;
}
/* nth-child(1) is the .lb-filter bar, so entries start at 2 */
.lb-entry:nth-child(2) { border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.05); }
.lb-entry:nth-child(3) { border-color: rgba(148,163,184,0.35); }
.lb-entry:nth-child(4) { border-color: rgba(180,127,100,0.35); }

.lb-rank {
    font-family: "Orbitron", sans-serif;
    font-size: 0.8rem;
    font-weight: 900;
    color: #475569;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.lb-entry:nth-child(2) .lb-rank { color: #fbbf24; }
.lb-entry:nth-child(3) .lb-rank { color: #94a3b8; }
.lb-entry:nth-child(4) .lb-rank { color: #b47f64; }

.lb-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #e2e8f0;
}
.lb-meta {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 1px;
}
.lb-score {
    font-family: "Orbitron", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fbbf24;
    text-align: right;
}
.lb-mode-badge {
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}
.lb-mode-hard {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
}
.lb-mode-normal {
    background: rgba(34,197,94,0.12);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.2);
}

.lb-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.lb-filter-btn {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: "Rajdhani", sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #94a3b8;
    transition: all 0.18s;
}
.lb-filter-btn.active {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.5);
    color: #a5b4fc;
}
.lb-filter-btn:hover { background: rgba(255,255,255,0.1); }

/* ---- Help ---- */
.help-body { display: flex; flex-direction: column; gap: 16px; }

.help-goal {
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: #c7d2fe;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}
.help-goal i { color: #818cf8; margin-top: 2px; flex-shrink: 0; }

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.help-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px;
}
.help-card-icon { font-size: 1.4rem; margin-bottom: 8px; }
.help-card-title {
    font-weight: 700;
    font-size: 0.82rem;
    color: #e2e8f0;
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}
.help-card p { font-size: 0.78rem; color: #94a3b8; line-height: 1.45; }

.help-tip {
    font-size: 0.78rem;
    color: #64748b;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.05);
}
.help-tip i { color: #fbbf24; margin-right: 6px; }

/* ==================================================
   LIGHT MODE — clean, solid, no glass
   ================================================== */
body.light-mode {
    background: #eef2ff;
    color: #1e293b;
}
body.light-mode #bgCanvas { display: none; }

/* Panels */
body.light-mode .game-header {
    background: #ffffff;
    border-color: #e0e7ff;
    box-shadow: 0 2px 12px rgba(99,102,241,0.09);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.light-mode .game-section {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
body.light-mode .feedback-banner {
    background: #f8fafc;
    border-color: #e2e8f0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Title */
body.light-mode .game-title {
    background: linear-gradient(90deg, #4338ca, #7c3aed, #db2777);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
body.light-mode .game-subtitle { color: #64748b; }

/* Stats */
body.light-mode .stat-card { background: #f8fafc; border-color: #e2e8f0; box-shadow: none; }
body.light-mode .stat-card.clickable:hover { background: #eff6ff; border-color: #c7d2fe; transform: none; }
body.light-mode .stat-value { color: #0f172a; }
body.light-mode .stat-label { color: #6b7280; }
body.light-mode .progress-track { background: #e2e8f0; }

/* Header buttons */
body.light-mode .btn-icon { background: #ffffff; border-color: #e2e8f0; color: #475569; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
body.light-mode .btn-icon:hover { background: #eff6ff; border-color: #c7d2fe; color: #4338ca; box-shadow: 0 2px 8px rgba(99,102,241,0.12); }
body.light-mode .btn-icon.btn-accent { background: linear-gradient(135deg, #0ea5e9, #6366f1); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }
body.light-mode .btn-icon.btn-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.25); }
body.light-mode .btn-sm { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.3); color: #4338ca; }
body.light-mode .btn-sm:hover { background: rgba(99,102,241,0.18); }

/* Sections */
body.light-mode .section-title { color: #475569; }
body.light-mode .section-hint  { color: #94a3b8; }

/* Feedback */
body.light-mode .feedback-text  { color: #334155; }
body.light-mode .last-move-text { color: #94a3b8; }

/* Slots */
body.light-mode .slot { border-color: #cbd5e1; background: #f1f5f9; }
body.light-mode .slot:hover:not(.locked):not(.guess-highlight) { border-color: #818cf8; background: #eef2ff; }
body.light-mode .slot.locked { border-color: #c7d2fe; background: #eef2ff; }
body.light-mode .slot.locked::after { color: rgba(99,102,241,0.45); }
body.light-mode .slot-number { color: rgba(0,0,0,0.28); }

/* Modals */
body.light-mode .modal-overlay { background: rgba(15,23,42,0.35); }
body.light-mode .modal-box { background: #ffffff; border-color: #e2e8f0; box-shadow: 0 16px 48px rgba(99,102,241,0.13); }
body.light-mode .modal-header { border-color: #f1f5f9; }
body.light-mode .modal-title { color: #1e293b; }
body.light-mode .modal-title i { color: #6366f1; }
body.light-mode .modal-close { background: #f1f5f9; border-color: #e2e8f0; color: #64748b; }
body.light-mode .modal-close:hover { background: #fee2e2; border-color: #fecaca; color: #ef4444; }

/* Options */
body.light-mode .option-row   { border-color: #f1f5f9; }
body.light-mode .option-label { color: #334155; }
body.light-mode .option-label i { color: #6366f1; }
body.light-mode .option-badge { background: rgba(239,68,68,0.08); color: #dc2626; border-color: rgba(239,68,68,0.2); }
body.light-mode .game-toggle  { background: #e2e8f0; border-color: #cbd5e1; }

/* Leaderboard */
body.light-mode .lb-entry { background: #f8fafc; border-color: #e2e8f0; }
body.light-mode .lb-entry:nth-child(2) { border-color: rgba(251,191,36,0.4); background: rgba(251,191,36,0.04); }
body.light-mode .lb-name  { color: #0f172a; }
body.light-mode .lb-meta  { color: #94a3b8; }
body.light-mode .lb-score { color: #4338ca; }
body.light-mode .lb-filter-btn { background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
body.light-mode .lb-filter-btn.active { background: rgba(99,102,241,0.1); border-color: rgba(99,102,241,0.4); color: #4338ca; }
body.light-mode .lb-filter-btn:hover  { background: #eff6ff; }

/* Help */
body.light-mode .help-goal { background: rgba(99,102,241,0.06); border-color: rgba(99,102,241,0.18); color: #3730a3; }
body.light-mode .help-goal i { color: #6366f1; }
body.light-mode .help-card  { background: #f8fafc; border-color: #e2e8f0; }
body.light-mode .help-card-title { color: #1e293b; }
body.light-mode .help-card p { color: #64748b; }
body.light-mode .help-tip { background: #f8fafc; border-color: #e2e8f0; color: #94a3b8; }

/* Footer */
body.light-mode .game-footer { color: #94a3b8; }
body.light-mode .footer-link { color: #6366f1; }
body.light-mode .footer-sep  { color: #cbd5e1; }

/* Scrollbar */
body.light-mode ::-webkit-scrollbar-track { background: #f1f5f9; }
body.light-mode ::-webkit-scrollbar-thumb { background: #c7d2fe; }

/* ==================================================
   MOBILE PERFORMANCE & LAYOUT
   ================================================== */

/* Remove backdrop-filter on mobile — saves battery & avoids rendering bugs */
@media (max-width: 640px) {
    .game-header, .game-section, .feedback-banner {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Stats row: 3-column grid so Score/Level/Lives sit on one line */
@media (max-width: 520px) {
    .stats-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .progress-card { grid-column: 1 / -1; flex: unset; min-width: 0; }
}

/* Disable sticky hover states on touch devices */
@media (hover: none) {
    .bottle:hover {
        transform: none;
        box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3), inset 0 -2px 0 rgba(0,0,0,0.2);
    }
    .slot:hover:not(.locked):not(.guess-highlight) {
        border-color: rgba(255,255,255,0.15);
        background: rgba(255,255,255,0.03);
    }
    .btn-icon:hover { transform: none; }
    .stat-card.clickable:hover { transform: none; }
}

/* ==================================================
   RESPONSIVE
   ================================================== */
@media (max-width: 480px) {
    .game-wrapper { padding: 10px 10px 24px; gap: 12px; }
    .header-top { flex-direction: column; align-items: flex-start; }
    .header-actions { align-self: flex-end; }
    .stats-row { gap: 8px; }
    .stat-card { padding: 8px 10px; min-width: 76px; }
    .stat-value { font-size: 0.95rem; }
    .progress-card { flex-basis: 100%; }

    .bottle {
        width: 38px;
        height: 80px;
        border-radius: 19px 19px 13px 13px;
    }
    .bottle::before { width: 13px; height: 12px; top: -10px; }
    .bottle i { font-size: 16px; }
    .bottle::after { width: 6px; height: 20px; top: 8px; }
    .bottle-ghost { width: 38px; height: 80px; }

    .slot { width: 42px; height: 98px; border-radius: 12px; }
    .game-board, .game-palette { gap: 8px; }

    .help-grid { grid-template-columns: 1fr 1fr; }
    .modal-box { border-radius: 16px; }
    .modal-body { max-height: 78vh; }
    .game-header { border-radius: 14px; padding: 12px 14px; }
    .game-section { border-radius: 12px; padding: 12px 14px; }
    .section-hint { display: none; }
    .game-board, .game-palette { min-height: 90px; }
}

@media (max-width: 340px) {
    .bottle { width: 32px; height: 68px; border-radius: 16px 16px 10px 10px; }
    .bottle-ghost { width: 32px; height: 68px; }
    .slot { width: 36px; height: 84px; }
    .bottle i { font-size: 13px; }
    .help-grid { grid-template-columns: 1fr; }
}
