/* ══════════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════════ */
:root {
  --blue:      #60a5fa;
  --blue-d:    #2563eb;
  --pink:      #f0538e;
  --pink-d:    #be185d;
  --green:     #10b981;
  --green-d:   #059669;
  --gold:      #fbbf24;
  --violet:    #a78bfa;
  --bg:        #080813;
  --glass:     rgba(255,255,255,0.04);
  --glass-b:   rgba(255,255,255,0.08);
  --border:    rgba(255,255,255,0.09);
  --border-hi: rgba(255,255,255,0.18);
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --dim:       #475569;
  --r-sm:      10px;
  --r-md:      16px;
  --r-lg:      24px;
  --r-xl:      32px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Animated aurora blobs ── */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: blobDrift 18s ease-in-out infinite alternate;
}
.aurora-blob:nth-child(1) {
  width: 600px; height: 600px;
  background: var(--blue);
  top: -150px; left: -100px;
  animation-duration: 20s;
}
.aurora-blob:nth-child(2) {
  width: 500px; height: 500px;
  background: var(--pink);
  bottom: -100px; right: -80px;
  animation-duration: 16s;
  animation-delay: -6s;
}
.aurora-blob:nth-child(3) {
  width: 400px; height: 400px;
  background: var(--green);
  top: 40%; left: 40%;
  animation-duration: 22s;
  animation-delay: -10s;
}
@keyframes blobDrift {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(40px,-30px) scale(1.08); }
  66%  { transform: translate(-20px,50px) scale(0.94); }
  100% { transform: translate(30px,20px) scale(1.04); }
}

/* ── SCREENS ── */
.screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1rem;
}
.screen.active { display: flex; }

/* ══════════════════════════════════════════════
   HOME SCREEN
══════════════════════════════════════════════ */
#homeScreen {
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.home-logo {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  background: linear-gradient(135deg, var(--blue) 0%, var(--violet) 40%, var(--pink) 70%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200%;
  animation: logoShimmer 4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 40px rgba(96,165,250,0.25));
}
@keyframes logoShimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  backdrop-filter: blur(12px);
}
.home-badge span { color: var(--blue); }

/* Level select cards */
.level-select-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}

.level-select-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  max-width: 620px;
  width: 100%;
}

.level-btn {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 0.5rem 0.8rem;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s, background 0.18s;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.level-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 99px 99px 0 0;
  opacity: 0.8;
}
.level-btn:nth-child(1)::before { background: linear-gradient(90deg, #ef4444, #fbbf24); }
.level-btn:nth-child(2)::before { background: linear-gradient(90deg, #ef4444, #a855f7); }
.level-btn:nth-child(3)::before { background: linear-gradient(90deg, #60a5fa, #f0538e); }
.level-btn:nth-child(4)::before { background: linear-gradient(90deg, #f97316, #fbbf24); }
.level-btn:nth-child(5)::before { background: linear-gradient(90deg, #60a5fa, #a78bfa, #f0538e); }
.level-btn:hover {
  border-color: var(--border-hi);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 0 1px var(--border-hi);
  background: var(--glass-b);
}
.lvl-icon { font-size: 1.4rem; }
.lvl-num  { font-size: 0.7rem; font-weight: 700; color: var(--dim); letter-spacing: 0.08em; }
.lvl-name { font-size: 0.7rem; font-weight: 600; color: var(--muted); line-height: 1.2; }

/* CTA buttons */
.home-cta { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

.btn-start {
  position: relative;
  padding: 0.95rem 3rem;
  border: none;
  border-radius: 99px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  box-shadow: 0 0 0 0 rgba(96,165,250,0);
  transition: transform 0.18s, box-shadow 0.18s;
  overflow: hidden;
}
.btn-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  border-radius: inherit;
}
.btn-start:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 40px rgba(96,165,250,0.5), 0 0 0 1px rgba(96,165,250,0.3);
}
.btn-start:active { transform: scale(0.98); }

.btn-how {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.65rem 1.6rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}
.btn-how:hover { border-color: var(--border-hi); color: var(--text); }
a.btn-how { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.how-box {
  display: none;
  max-width: 400px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--muted);
  text-align: left;
  backdrop-filter: blur(16px);
}
.how-box strong { color: var(--text); }

/* ══════════════════════════════════════════════
   GAME SCREEN
══════════════════════════════════════════════ */
#gameScreen {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  height: 100%;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  overflow-y: auto;
}

/* ── HUD ── */
.hud {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(8,8,19,0.7);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.hud-level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  border-radius: var(--r-sm);
  padding: 0.3rem 0.65rem;
  flex-shrink: 0;
  min-width: 54px;
}
.hud-level-badge .lv-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  line-height: 1;
}
.hud-level-badge .lv-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}

.hud-lives {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.heart {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s;
}
.heart.lost { opacity: 0.25; filter: grayscale(1); }

.timer-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.timer-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.05em;
}
.timer-bar-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.6s linear, background 0.5s;
  box-shadow: 0 0 8px currentColor;
}
.timer-bar.urgent {
  background: linear-gradient(90deg, #ef4444, #f97316);
  animation: timerPulse 0.6s ease infinite alternate;
}
@keyframes timerPulse {
  from { opacity: 1; }
  to   { opacity: 0.65; }
}

.hud-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}
.hud-score .sc-label { font-size: 0.58rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-score .sc-val   { font-size: 1rem; font-weight: 800; color: var(--gold); line-height: 1.1; }

.btn-hint {
  flex-shrink: 0;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.6rem;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  line-height: 1.3;
  text-align: center;
}
.btn-hint:hover:not(:disabled) { background: rgba(251,191,36,0.16); border-color: rgba(251,191,36,0.5); }
.btn-hint:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-hud-home {
  flex-shrink: 0;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.btn-hud-home:hover { background: var(--glass-b); border-color: var(--border-hi); color: var(--text); }

.btn-hud-learn {
  flex-shrink: 0;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.55rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.btn-hud-learn:hover { background: var(--glass-b); border-color: var(--border-hi); color: var(--text); }

/* Level progress dots */
.level-progress {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 0.4rem 1rem 0;
  flex-shrink: 0;
}
.prog-dot {
  width: 28px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  transition: background 0.3s;
}
.prog-dot.done  { background: var(--green); }
.prog-dot.active { background: var(--blue); animation: dotPulse 1.2s ease infinite alternate; }
@keyframes dotPulse {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}

/* ── Game area ── */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem 1.5rem;
}

.level-header {
  text-align: center;
}
.level-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.level-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

.hint-box {
  display: none;
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.22);
  border-radius: var(--r-md);
  padding: 0.85rem 1.1rem;
  font-size: 0.84rem;
  color: var(--gold);
  text-align: center;
  line-height: 1.55;
  animation: slideDown 0.25s ease;
}
.hint-box.show { display: block; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

#challengeArea {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.submit-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn-check {
  background: linear-gradient(135deg, var(--green-d), var(--green));
  border: none;
  border-radius: 99px;
  padding: 0.9rem 2.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(16,185,129,0.35);
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}
.btn-check::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
}
.btn-check:hover  { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(16,185,129,0.5); }
.btn-check:active { transform: scale(0.97); }
.btn-check:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ══════════════════════════════════════════════
   LEVEL 1 — SELECT MULTIPLE
══════════════════════════════════════════════ */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 1rem 0;
}

.swatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
}

.swatch {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
}

.swatch.selected {
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 0 5px rgba(255,255,255,0.15), 0 8px 30px rgba(0,0,0,0.4);
}
.swatch.selected::before {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  z-index: 2;
}

.swatch-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.swatch-wrap:hover .swatch:not(.selected) { transform: scale(1.06); }

/* ══════════════════════════════════════════════
   LEVEL 2 — SLIDER
══════════════════════════════════════════════ */
.rgb-mixer-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.color-compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
.chip-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}
.color-chip {
  width: 88px;
  height: 88px;
  border-radius: var(--r-md);
  box-shadow: 0 6px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: background 0.1s;
  position: relative;
}
.color-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 55%);
}
.chip-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.compare-arrow {
  font-size: 1.5rem;
  color: var(--dim);
  flex-shrink: 0;
}

.sliders-panel {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  backdrop-filter: blur(12px);
}

.slider-row {
  display: grid;
  grid-template-columns: 1.2rem 1fr 2.2rem;
  align-items: center;
  gap: 0.75rem;
}
.slider-ch {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.slider-ch.r { color: #f87171; }
.slider-ch.g { color: #4ade80; }
.slider-ch.b { color: var(--blue); }

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
}
#slR { accent-color: #f87171; }
#slG { accent-color: #4ade80; }
#slB { accent-color: var(--blue); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: grab;
  transition: transform 0.12s;
}
input[type=range]::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}
.slider-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.match-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.match-track {
  height: 7px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}
.match-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width 0.12s, background 0.3s;
}
#matchPct { color: var(--text); min-width: 2.5rem; text-align: right; }

/* ══════════════════════════════════════════════
   LEVEL 3 — WHEEL CLICK
══════════════════════════════════════════════ */
.wheel-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.wheel-chips-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
.chip-group.selected-group #selectedColorChip {
  width: 72px;
  height: 72px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.06);
  border: 2px dashed var(--border-hi);
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}
.chip-group.selected-group #selectedColorChip.picked { border-style: solid; border-color: rgba(255,255,255,0.2); }

#wheelCanvas {
  display: block;
  border-radius: 50%;
  cursor: crosshair;
  max-width: 270px;
  max-height: 270px;
  box-shadow: 0 0 60px rgba(96,165,250,0.15), 0 0 0 1px rgba(255,255,255,0.06);
  touch-action: none;
}
#selectedColorLabel { font-size: 0.72rem; color: var(--muted); font-weight: 600; }

/* ══════════════════════════════════════════════
   LEVEL 4 & 5 — DRAG SLOTS
══════════════════════════════════════════════ */
.drag-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}

.drag-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  min-height: 72px;
  padding: 0.75rem;
  background: var(--glass);
  border: 1px dashed var(--border-hi);
  border-radius: var(--r-md);
  backdrop-filter: blur(8px);
}

.drag-chip {
  width: 62px;
  height: 62px;
  border-radius: var(--r-sm);
  cursor: grab;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  touch-action: none;
  position: relative;
  overflow: hidden;
}
.drag-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 55%);
}
.drag-chip::before {
  content: '⠿';
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  z-index: 2;
}
.drag-chip:hover  { transform: scale(1.08) translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.drag-chip:active { cursor: grabbing; transform: scale(0.95); }
.drag-chip.dragging { opacity: 0.45; transform: scale(0.92); }

.slots-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: center;
}

.slots-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.slot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.drop-slot {
  width: 78px;
  height: 78px;
  border-radius: var(--r-md);
  border: 2px dashed rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
}
.drop-slot::before {
  content: '+';
  font-size: 1.4rem;
  font-weight: 300;
  color: rgba(255,255,255,0.18);
}
.drop-slot.filled::before { display: none; }
.drop-slot.drag-over {
  border-color: var(--blue);
  background: rgba(96,165,250,0.08);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.2), inset 0 0 20px rgba(96,165,250,0.05);
}
.slot-label {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════
   OVERLAYS
══════════════════════════════════════════════ */
.overlay-screen {
  background: rgba(8,8,19,0.88);
  backdrop-filter: blur(24px);
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem 1.25rem;
}
.overlay-screen > * { animation: fadeUp 0.35s ease both; }
.overlay-screen > *:nth-child(2) { animation-delay: 0.05s; }
.overlay-screen > *:nth-child(3) { animation-delay: 0.1s;  }
.overlay-screen > *:nth-child(4) { animation-delay: 0.15s; }
.overlay-screen > *:nth-child(5) { animation-delay: 0.2s;  }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.overlay-icon-wrap {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(16,185,129,0.4));
}
.overlay-icon-wrap.fail   { filter: drop-shadow(0 0 24px rgba(240,83,142,0.4)); }
.overlay-icon-wrap.trophy { filter: drop-shadow(0 0 30px rgba(251,191,36,0.5)); }

.overlay-title {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}
.overlay-title.success { color: var(--green); }
.overlay-title.fail    { color: var(--pink); }
.overlay-title.win {
  background: linear-gradient(135deg, var(--gold) 0%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay-sub {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 360px;
  margin: 0 auto;
}

.score-earned {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.85rem 1.5rem;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.score-earned .se-label { font-size: 0.68rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; }
.score-earned .se-val   { font-size: 2rem; font-weight: 800; color: var(--gold); letter-spacing: -1px; }

.fact-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  max-width: 400px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  text-align: left;
  backdrop-filter: blur(12px);
}
.fact-card strong { color: var(--blue); font-style: normal; }

.overlay-btns {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-next {
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  border: none;
  border-radius: 99px;
  padding: 0.85rem 2.2rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(96,165,250,0.4);
  transition: transform 0.18s, box-shadow 0.18s;
}
.btn-next:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(96,165,250,0.5); }

.btn-home {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.85rem 1.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.18s, color 0.18s;
}
.btn-home:hover { border-color: var(--border-hi); color: var(--text); }

/* ── Flash feedback ── */
.flash-wrong { animation: flashR 0.45s ease; }
.flash-correct { animation: flashG 0.45s ease; }
@keyframes flashR {
  0%,100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 0 2000px rgba(240,83,142,0.08); }
}
@keyframes flashG {
  0%,100% { box-shadow: none; }
  50% { box-shadow: inset 0 0 0 2000px rgba(16,185,129,0.08); }
}

/* ── Particle burst ── */
.star-burst { position: fixed; pointer-events: none; z-index: 200; }
.star-p {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  animation: starFly 1.1s ease-out forwards;
}
@keyframes starFly {
  0%   { transform: translate(0,0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx),var(--ty)) scale(0); opacity: 0; }
}

/* ── Flash message ── */
#flashMsg {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  padding: 0.5rem;
  animation: slideDown 0.2s ease;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .level-select-grid { grid-template-columns: repeat(5,1fr); }
  .swatch { width: 68px; height: 68px; }
  #wheelCanvas { max-width: 230px; max-height: 230px; }
  .color-chip { width: 72px; height: 72px; }
  .drag-chip  { width: 54px; height: 54px; }
  .drop-slot  { width: 66px; height: 66px; }
}

/* ══ LEVEL BTN COLORS 6–10 ══ */
.level-btn:nth-child(6)::before  { background: linear-gradient(90deg,#10b981,#60a5fa); }
.level-btn:nth-child(7)::before  { background: linear-gradient(90deg,#f97316,#0066cc); }
.level-btn:nth-child(8)::before  { background: linear-gradient(90deg,#f8fafc,#94a3b8,#1e293b); }
.level-btn:nth-child(9)::before  { background: linear-gradient(90deg,#e60000,#ffd700,#22aa44,#0066cc); }
.level-btn:nth-child(10)::before { background: linear-gradient(90deg,#93c5fd,#3b82f6,#1e40af); }

/* ══ MCQ (Levels 6, 8, 9) ══ */
.mcq-container { display:flex; flex-direction:column; align-items:center; gap:1.5rem; }
.mcq-chips-row { display:flex; align-items:center; gap:1.5rem; justify-content:center; flex-wrap:wrap; }
.mcq-arrow { font-size:1.5rem; color:var(--dim); }
.mcq-choices { display:flex; gap:0.75rem; flex-wrap:wrap; justify-content:center; }
.mcq-btn {
  background:var(--glass); border:1.5px solid var(--border); border-radius:var(--r-md);
  padding:0.75rem 1.25rem; font-family:inherit; font-size:0.88rem; font-weight:700;
  color:var(--muted); cursor:pointer; backdrop-filter:blur(8px); min-width:110px;
  display:flex; flex-direction:column; align-items:center; gap:0.5rem;
  transition:border-color .18s,color .18s,background .18s,transform .18s;
}
.mcq-btn:hover   { border-color:var(--border-hi); color:var(--text); transform:translateY(-2px); }
.mcq-btn.selected{ border-color:var(--blue); color:var(--text); background:rgba(96,165,250,.12); box-shadow:0 0 0 3px rgba(96,165,250,.15); }
.mcq-choice-swatch { width:50px; height:50px; border-radius:13px; box-shadow:0 3px 14px rgba(0,0,0,.45); }
.mcq-q-text { font-size:0.92rem; font-weight:700; color:var(--muted); text-align:center; max-width:420px; line-height:1.6; }

/* ══ SORT BINS (Level 7) ══ */
.sort-grid { display:flex; flex-wrap:wrap; gap:1rem; justify-content:center; padding:0.5rem 0; }
.sort-chip-wrap {
  display:flex; flex-direction:column; align-items:center; gap:0.5rem;
  cursor:pointer; background:var(--glass); border:2px solid transparent;
  border-radius:var(--r-md); padding:0.75rem;
  transition:border-color .2s,transform .18s,box-shadow .18s;
}
.sort-chip-wrap:hover { transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.35); }
.sort-chip {
  width:62px; height:62px; border-radius:50%;
  border:3px solid rgba(255,255,255,.1);
  box-shadow:0 4px 20px rgba(0,0,0,.35);
  pointer-events:none;
}
.sort-pill {
  font-size:0.7rem; font-weight:700; padding:0.22rem 0.7rem; border-radius:99px;
  background:var(--glass-b); border:1px solid var(--border); color:var(--dim);
  min-width:72px; text-align:center; pointer-events:none;
  transition:background .18s,color .18s,border-color .18s;
}
.sort-pill.warm { background:rgba(249,115,22,.15); color:#f97316; border-color:rgba(249,115,22,.4); }
.sort-pill.cool { background:rgba(96,165,250,.12); color:var(--blue); border-color:rgba(96,165,250,.35); }
