*, *::before, *::after { box-sizing: border-box; }
body {
    background: #020617;
    color: #fff;
    font-family: 'Inter', sans-serif;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 100vh; margin: 0;
    text-align: center; overflow: hidden;
    user-select: none;
}
#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-glow { position: fixed; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 40%, #1e3a8a44 0%, transparent 70%); z-index: 0; pointer-events: none; }
.back-home { position: fixed; top: 20px; left: 24px; font-size: 0.85rem; color: #475569; text-decoration: none; transition: color 0.2s; z-index: 10; }
.back-home:hover { color: #fff; }

.container { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 40px 24px; max-width: 600px; width: 100%; }

h1 { font-family: 'Syne', sans-serif; font-size: clamp(2rem, 8vw, 3rem); font-weight: 900; margin: 0 0 6px; letter-spacing: -2px; }
.subtitle { font-size: 0.95rem; color: #64748b; margin-bottom: 36px; }

/* score + streak row */
.stats-row { display: flex; gap: 24px; margin-bottom: 32px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.stat-val { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 900; color: #f8fafc; }
.stat-label { font-size: 0.7rem; color: #475569; text-transform: uppercase; letter-spacing: 1.5px; }

/* timer bar */
.timer-wrap {
    width: 100%; height: 8px;
    background: rgba(30,58,138,0.25);
    border-radius: 999px; overflow: hidden;
    margin-bottom: 32px;
}
.timer-bar {
    height: 100%; border-radius: 999px;
    background: #3b82f6;
    transition: width 0.1s linear, background 0.3s;
    width: 100%;
}
.timer-bar.warn  { background: #fbbf24; }
.timer-bar.danger { background: #ef4444; }

/* scrambled word */
.scramble-display {
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
    margin-bottom: 28px; min-height: 72px; align-items: center;
}

.letter-tile {
    width: 52px; height: 60px;
    background: rgba(30,58,138,0.35);
    border: 1.5px solid rgba(96,165,250,0.3);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 900;
    color: #f8fafc;
    transition: transform 0.15s, background 0.2s, border-color 0.2s;
    cursor: pointer;
}
.letter-tile:hover { background: rgba(37,99,235,0.45); border-color: #60a5fa; transform: translateY(-3px); }
.letter-tile.selected { background: rgba(37,99,235,0.55); border-color: #60a5fa; transform: translateY(-3px); opacity: 0.4; }
.letter-tile.correct { background: rgba(16,185,129,0.35); border-color: #10b981; }
.letter-tile.wrong   { background: rgba(239,68,68,0.35);  border-color: #ef4444; animation: shake 0.3s ease; }

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* answer slots */
.answer-row {
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
    margin-bottom: 24px; min-height: 72px; align-items: center;
}

.answer-slot {
    width: 52px; height: 60px;
    background: rgba(15,23,42,0.6);
    border: 1.5px dashed rgba(51,65,85,0.7);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 900;
    color: #f8fafc;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.answer-slot.filled { border-style: solid; border-color: rgba(96,165,250,0.4); background: rgba(30,58,138,0.35); }
.answer-slot.filled:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }

/* hint + clear row */
.action-row { display: flex; gap: 12px; margin-bottom: 28px; }

.action-btn {
    padding: 9px 20px;
    background: rgba(15,23,42,0.6);
    border: 1px solid rgba(51,65,85,0.7);
    border-radius: 999px; color: #94a3b8;
    font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.action-btn:hover { background: rgba(30,58,138,0.4); color: #fff; border-color: rgba(96,165,250,0.35); }
.action-btn:disabled { opacity: 0.3; cursor: default; }

/* hint text */
.hint-text {
    font-size: 0.85rem; color: #475569;
    min-height: 20px; margin-bottom: 20px;
    transition: opacity 0.3s; font-style: italic;
}

/* feedback flash */
.feedback {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem; font-weight: 700;
    min-height: 28px; margin-bottom: 0;
    transition: opacity 0.3s;
}
.feedback.correct { color: #10b981; }
.feedback.wrong   { color: #f87171; }

/* game over */
.gameover {
    position: fixed; inset: 0;
    background: rgba(2,6,23,0.9);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 50; opacity: 0; pointer-events: none;
    transition: opacity 0.4s; backdrop-filter: blur(8px);
}
.gameover.show { opacity: 1; pointer-events: all; }
.go-emoji { font-size: 4rem; margin-bottom: 12px; }
.go-title { font-family: 'Syne', sans-serif; font-size: clamp(2rem,8vw,3rem); font-weight: 900; margin: 0 0 8px; }
.go-score { font-size: 1rem; color: #64748b; margin-bottom: 28px; }
.go-score span { color: #60a5fa; font-weight: 700; }
.go-btn {
    padding: 13px 36px;
    background: rgba(37,99,235,0.3);
    border: 1.5px solid rgba(96,165,250,0.45);
    border-radius: 999px; color: #fff;
    font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: background 0.2s;
}
.go-btn:hover { background: rgba(37,99,235,0.5); }

/* category badge */
.category-badge {
    display: inline-block;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: #60a5fa;
    background: rgba(96,165,250,0.1);
    border: 1px solid rgba(96,165,250,0.2);
    padding: 4px 10px; border-radius: 99px;
    margin-bottom: 16px;
}
