/* ============ BHNKC English Quest ============ */
:root {
  --bg1: #1a1040;
  --bg2: #2d1b69;
  --card: rgba(255, 255, 255, 0.08);
  --card-solid: #241a52;
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.65);
  --accent: #ffd93d;
  --accent2: #ff6b9d;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #c084fc;
  --grammar: #ff6b9d;
  --vocab: #4ade80;
  --tsa: #60a5fa;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  min-height: 100%;
  font-family: 'Fredoka', 'Baloo 2', sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 55%, #1f2470 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; }
.hidden { display: none !important; }

/* ---------- background stars ---------- */
#bg-stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.star {
  position: absolute; border-radius: 50%;
  background: #fff; opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: .15; transform: scale(.8);} 50% { opacity: .8; transform: scale(1.2);} }

#fx-canvas { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---------- topbar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  background: rgba(20, 12, 50, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-left { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.logo-emoji { font-size: 26px; animation: float 3s ease-in-out infinite; display: inline-block; }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-4px);} }
.logo-text { font-family: 'Baloo 2'; font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.logo-text b { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 500;
}
.level-chip { background: var(--accent); color: #3a2c00; font-weight: 700; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; }
.xp-mini-track { width: 64px; height: 8px; background: rgba(255,255,255,.15); border-radius: 999px; overflow: hidden; }
#xp-mini-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #ffb43d); border-radius: 999px; transition: width .6s cubic-bezier(.22,1,.36,1); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: 1px solid rgba(255,255,255,0.12);
  font-size: 17px; color: var(--ink);
  display: grid; place-items: center;
  transition: transform .15s, background .15s;
}
.icon-btn:hover { transform: scale(1.1); background: rgba(255,255,255,0.16); }

/* ---------- main layout ---------- */
#view { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 20px 16px 90px; min-height: calc(100vh - 60px); }

.screen { animation: screenIn .35s cubic-bezier(.22,1,.36,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(16px);} to { opacity: 1; transform: none;} }

/* ---------- login ---------- */
.login-hero { text-align: center; padding: 48px 12px 26px; }
.login-hero .big-emoji { font-size: 84px; display: inline-block; animation: float 3s ease-in-out infinite; filter: drop-shadow(0 12px 24px rgba(255, 217, 61, .3)); }
.login-hero h1 { font-family: 'Baloo 2'; font-size: clamp(34px, 7vw, 52px); margin-top: 10px; line-height: 1.1; }
.login-hero h1 b { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: var(--ink-dim); font-size: 17px; margin-top: 10px; }
.login-worlds { display: flex; justify-content: center; gap: 14px; margin: 26px 0 30px; flex-wrap: wrap; }
.mini-world {
  background: var(--card); border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  padding: 14px 20px; text-align: center; font-size: 14px; font-weight: 500;
  animation: float 3.4s ease-in-out infinite;
}
.mini-world .mw-emoji { font-size: 32px; display: block; margin-bottom: 4px; }
.mini-world:nth-child(2) { animation-delay: .5s; }
.mini-world:nth-child(3) { animation-delay: 1s; }
.login-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.btn-big {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 270px; padding: 15px 30px; font-size: 17px; font-weight: 600;
  border-radius: 999px; color: #2b1d00;
  background: linear-gradient(90deg, var(--accent), #ffb43d);
  box-shadow: 0 8px 24px rgba(255, 200, 61, .35);
  transition: transform .15s, box-shadow .15s;
}
.btn-big:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 12px 30px rgba(255,200,61,.45); }
.btn-ghost { background: transparent; border: 2px solid rgba(255,255,255,.25); color: var(--ink); box-shadow: none; }
.btn-ghost:hover { border-color: rgba(255,255,255,.5); box-shadow: none; }
.login-note { color: var(--ink-dim); font-size: 13px; margin-top: 14px; }

/* ---------- onboarding / modal ---------- */
#modal-wrap {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 5, 30, .7); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 18px;
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--card-solid); border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px; padding: 26px; box-shadow: var(--shadow);
  animation: popIn .3s cubic-bezier(.34,1.56,.64,1);
  max-height: 86vh; overflow-y: auto;
}
@keyframes popIn { from { opacity: 0; transform: scale(.85);} to { opacity: 1; transform: scale(1);} }
.modal h2 { font-family: 'Baloo 2'; font-size: 24px; margin-bottom: 6px; }
.modal p.sub { color: var(--ink-dim); font-size: 14px; margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; color: var(--ink-dim); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.18); background: rgba(255,255,255,.07);
  color: var(--ink); font-size: 16px; font-family: inherit; outline: none;
  transition: border .15s;
}
.field input:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.form-error { color: var(--red); font-size: 13.5px; min-height: 18px; margin-bottom: 8px; }

/* ---------- home / worlds ---------- */
.hello-row { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 18px; flex-wrap: wrap; gap: 8px; }
.hello-row h1 { font-family: 'Baloo 2'; font-size: clamp(24px, 5vw, 34px); }
.hello-row .title-tag { color: var(--accent); font-size: 14.5px; font-weight: 500; }

.world-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.world-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius); padding: 24px 22px;
  border: 1px solid rgba(255,255,255,.14);
  cursor: pointer; transition: transform .2s, box-shadow .2s;
  min-height: 170px; display: flex; flex-direction: column; justify-content: flex-end;
}
.world-card:hover { transform: translateY(-5px) scale(1.015); box-shadow: var(--shadow); }
.world-card .w-emoji { font-size: 46px; position: absolute; top: 18px; right: 18px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.3)); animation: float 3.2s ease-in-out infinite; }
.world-card h2 { font-family: 'Baloo 2'; font-size: 23px; margin-bottom: 4px; }
.world-card p { font-size: 13.5px; opacity: .85; line-height: 1.45; }
.world-card .w-stat { margin-top: 10px; font-size: 12.5px; font-weight: 600; background: rgba(0,0,0,.22); border-radius: 999px; padding: 4px 12px; width: fit-content; }
.wc-grammar { background: linear-gradient(140deg, #b83280 0%, #7c2d9c 100%); }
.wc-vocab { background: linear-gradient(140deg, #15803d 0%, #0d9488 100%); }
.wc-tsa { background: linear-gradient(140deg, #1d4ed8 0%, #7c3aed 100%); }

.home-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 640px) { .home-panels { grid-template-columns: 1fr; } }
.panel {
  background: var(--card); border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius); padding: 18px;
}
.panel h3 { font-family: 'Baloo 2'; font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.quest-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.quest-item .q-emoji { font-size: 22px; }
.quest-item .q-body { flex: 1; }
.quest-item .q-name { font-size: 13.5px; font-weight: 500; }
.quest-track { height: 7px; background: rgba(255,255,255,.14); border-radius: 999px; margin-top: 5px; overflow: hidden; }
.quest-fill { height: 100%; background: linear-gradient(90deg, var(--green), #22d3ee); border-radius: 999px; transition: width .5s; }
.quest-item .q-val { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.quest-item.done .q-name { color: var(--green); }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.lb-row .lb-rank { width: 26px; text-align: center; font-weight: 700; }
.lb-row .lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-xp { font-weight: 600; color: var(--accent); }
.lb-row.me { background: rgba(255, 217, 61, .12); border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.lb-tabs, .seg-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-tab {
  flex: 1; padding: 7px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,.08); color: var(--ink-dim); border: 1px solid transparent;
}
.seg-tab.active { background: rgba(255,217,61,.18); color: var(--accent); border-color: rgba(255,217,61,.4); }

/* ---------- world detail ---------- */
.world-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.back-btn {
  width: 40px; height: 40px; border-radius: 50%; font-size: 18px;
  background: var(--card); border: 1px solid rgba(255,255,255,.14); color: var(--ink);
  transition: transform .15s;
}
.back-btn:hover { transform: translateX(-3px); }
.world-head h1 { font-family: 'Baloo 2'; font-size: clamp(22px, 5vw, 30px); }
.world-head p { color: var(--ink-dim); font-size: 13.5px; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 13px; }
.topic-card {
  background: var(--card); border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px; padding: 16px; cursor: pointer;
  transition: transform .18s, border-color .18s, background .18s;
  position: relative;
}
.topic-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.12); }
.topic-card .t-emoji { font-size: 30px; }
.topic-card h3 { font-size: 15.5px; margin: 8px 0 3px; font-weight: 600; }
.topic-card .t-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.4; min-height: 33px; }
.topic-card .t-form { position: absolute; top: 12px; right: 12px; font-size: 10.5px; font-weight: 700; background: rgba(255,255,255,.13); padding: 3px 8px; border-radius: 999px; color: var(--ink-dim); }
.topic-card .t-crown { position: absolute; top: 38px; right: 12px; font-size: 20px; }
.mastery-track { height: 7px; background: rgba(255,255,255,.13); border-radius: 999px; margin-top: 9px; overflow: hidden; }
.mastery-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f59e0b, #ffd93d); transition: width .5s; }

/* crown colors */
.crown-gold { filter: drop-shadow(0 0 6px rgba(255,215,0,.7)); }

/* ---------- game picker modal ---------- */
.game-pick { display: grid; gap: 10px; margin-top: 14px; }
.game-pick-btn {
  display: flex; align-items: center; gap: 13px; text-align: left;
  padding: 13px 15px; border-radius: 14px;
  background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.14);
  color: var(--ink); transition: border .15s, background .15s, transform .15s;
}
.game-pick-btn:hover { border-color: var(--accent); background: rgba(255,217,61,.1); transform: scale(1.02); }
.game-pick-btn .gp-emoji { font-size: 26px; }
.game-pick-btn .gp-name { font-weight: 600; font-size: 15px; }
.game-pick-btn .gp-desc { font-size: 12px; color: var(--ink-dim); margin-top: 1px; }
.gp-tag { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .5px; background: rgba(96,165,250,.2); color: var(--blue); border: 1px solid rgba(96,165,250,.4); padding: 3px 8px; border-radius: 999px; }

/* ---------- game screen ---------- */
.game-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.game-top .game-title { font-family: 'Baloo 2'; font-size: 17px; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.combo-chip {
  font-weight: 700; font-size: 14px; padding: 5px 13px; border-radius: 999px;
  background: rgba(255,255,255,.1); transition: transform .15s, background .3s;
}
.combo-chip.hot { background: linear-gradient(90deg, #f97316, #ef4444); animation: comboPulse .4s; }
@keyframes comboPulse { 50% { transform: scale(1.25);} }
.progress-dots { display: flex; gap: 5px; margin-bottom: 18px; flex-wrap: wrap; }
.pdot { width: 100%; flex: 1; height: 7px; border-radius: 999px; background: rgba(255,255,255,.14); transition: background .3s; }
.pdot.good { background: var(--green); }
.pdot.bad { background: var(--red); }
.pdot.now { background: var(--accent); animation: nowBlink 1s infinite; }
@keyframes nowBlink { 50% { opacity: .5; } }

.q-card {
  background: var(--card); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius); padding: 26px 22px; text-align: center;
  animation: qIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes qIn { from { opacity: 0; transform: translateX(40px);} to { opacity: 1; transform: none;} }
.q-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0);} 20% { transform: translateX(-9px);} 40% { transform: translateX(8px);} 60% { transform: translateX(-6px);} 80% { transform: translateX(4px);} }
.q-text { font-size: clamp(17px, 3.4vw, 21px); line-height: 1.55; margin-bottom: 22px; font-weight: 500; }
.q-text .blank { display: inline-block; min-width: 64px; border-bottom: 3px solid var(--accent); margin: 0 3px; }

.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media (max-width: 520px) { .opt-grid { grid-template-columns: 1fr; } }
.opt-btn {
  padding: 15px 14px; border-radius: 14px; font-size: 16px; font-weight: 500;
  background: rgba(255,255,255,.09); border: 2px solid rgba(255,255,255,.16);
  color: var(--ink); transition: all .15s;
}
.opt-btn:hover:not(:disabled) { border-color: var(--accent); background: rgba(255,217,61,.1); transform: scale(1.02); }
.opt-btn:disabled { cursor: default; }
.opt-btn.correct { background: rgba(74,222,128,.22); border-color: var(--green); animation: correctPop .35s; }
.opt-btn.wrong { background: rgba(248,113,113,.2); border-color: var(--red); opacity: .9; }
.opt-btn.dim { opacity: .4; }
@keyframes correctPop { 50% { transform: scale(1.06);} }

.explain-box {
  margin-top: 16px; padding: 13px 16px; border-radius: 13px; font-size: 14px; line-height: 1.5;
  background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.3);
  color: #dbeafe; text-align: left; animation: qIn .3s;
}
.next-btn {
  margin-top: 16px; padding: 13px 38px; border-radius: 999px;
  font-size: 16px; font-weight: 600; color: #2b1d00;
  background: linear-gradient(90deg, var(--accent), #ffb43d);
  animation: popIn .25s;
}

/* sentence builder */
.build-zone { min-height: 62px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 13px; border-radius: 14px; border: 2px dashed rgba(255,255,255,.25); margin-bottom: 18px; background: rgba(0,0,0,.14); }
.build-zone.correct { border-color: var(--green); background: rgba(74,222,128,.1); }
.build-zone.wrong { border-color: var(--red); }
.word-pool { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.word-chip {
  padding: 10px 16px; border-radius: 12px; font-size: 16px; font-weight: 500;
  background: rgba(255,255,255,.12); border: 1.5px solid rgba(255,255,255,.22);
  color: var(--ink); transition: all .13s; animation: popIn .25s;
}
.word-chip:hover { background: rgba(255,217,61,.16); border-color: var(--accent); transform: translateY(-2px); }
.word-chip.in-zone { background: rgba(192,132,252,.2); border-color: var(--purple); }

/* match game */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: flex; flex-direction: column; gap: 9px; }
.match-item {
  padding: 12px 13px; border-radius: 13px; font-size: 13.5px; text-align: center;
  background: rgba(255,255,255,.09); border: 2px solid rgba(255,255,255,.15);
  color: var(--ink); transition: all .15s; line-height: 1.35; font-weight: 500;
}
.match-item:hover:not(:disabled) { border-color: var(--accent); }
.match-item.sel { border-color: var(--accent); background: rgba(255,217,61,.15); transform: scale(1.03); }
.match-item.paired { opacity: 0; pointer-events: none; transform: scale(.7); }
.match-item.flash-bad { border-color: var(--red); background: rgba(248,113,113,.2); animation: shake .35s; }

/* spelling */
.speak-btn {
  width: 92px; height: 92px; border-radius: 50%; font-size: 40px; margin: 0 auto 8px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, #7c3aed, #4c1d95);
  border: 3px solid rgba(255,255,255,.25); color: #fff;
  box-shadow: 0 10px 28px rgba(124,58,237,.45);
  transition: transform .15s;
}
.speak-btn:hover { transform: scale(1.08); }
.speak-btn.talking { animation: talkPulse 1s infinite; }
@keyframes talkPulse { 50% { transform: scale(1.1); box-shadow: 0 10px 40px rgba(124,58,237,.7);} }
.spell-input {
  width: 100%; max-width: 340px; margin: 14px auto 0; display: block;
  padding: 14px 18px; border-radius: 14px; font-size: 22px; text-align: center;
  border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.2); color: var(--ink);
  font-family: inherit; letter-spacing: 2px; outline: none;
}
.spell-input:focus { border-color: var(--accent); }
.hint-text { color: var(--ink-dim); font-size: 13.5px; margin-top: 10px; }

/* scramble */
.scramble-slots { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-bottom: 18px; min-height: 54px; }
.slot-tile, .letter-tile {
  width: 46px; height: 52px; border-radius: 11px; font-size: 22px; font-weight: 700;
  display: grid; place-items: center; text-transform: lowercase;
}
.slot-tile { background: rgba(0,0,0,.25); border: 2px dashed rgba(255,255,255,.2); color: var(--accent); }
.slot-tile.filled { border-style: solid; border-color: var(--purple); background: rgba(192,132,252,.15); cursor: pointer; }
.letter-tile { background: rgba(255,255,255,.13); border: 2px solid rgba(255,255,255,.25); color: var(--ink); cursor: pointer; transition: all .12s; animation: popIn .3s; }
.letter-tile:hover { transform: translateY(-3px); border-color: var(--accent); }
.letter-tile.used { opacity: .25; pointer-events: none; }

/* rush timer */
.rush-timer { height: 10px; border-radius: 999px; background: rgba(255,255,255,.13); overflow: hidden; margin-bottom: 16px; }
.rush-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--accent), var(--red)); transition: width .1s linear; }

/* ---------- poem / tsa ---------- */
.poem-card {
  background: linear-gradient(150deg, rgba(255,255,255,.1), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.16); border-radius: var(--radius);
  padding: 24px; margin-bottom: 18px;
}
.poem-card h2 { font-family: 'Baloo 2'; text-align: center; font-size: 24px; margin-bottom: 14px; }
.stanza { margin-bottom: 16px; }
.stanza-label { font-size: 11.5px; font-weight: 700; letter-spacing: 1px; color: var(--accent); text-transform: uppercase; margin-bottom: 5px; }
.poem-line { font-size: 16.5px; line-height: 1.75; font-style: italic; opacity: .95; }
.listen-stage { text-align: center; padding: 30px 10px; }
.listen-stage h2 { font-family: 'Baloo 2'; font-size: 24px; margin-bottom: 8px; }
.listen-stage p { color: var(--ink-dim); margin-bottom: 22px; font-size: 14.5px; }
.listen-count { font-size: 13px; color: var(--ink-dim); margin-top: 10px; }

/* ---------- results ---------- */
.result-stage { text-align: center; padding: 26px 10px; }
.grade-ring {
  width: 150px; height: 150px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-family: 'Baloo 2'; font-size: 64px; font-weight: 800;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.22), rgba(255,255,255,.05));
  border: 4px solid var(--accent); box-shadow: 0 0 44px rgba(255,217,61,.35);
  animation: gradePop .55s cubic-bezier(.34,1.56,.64,1);
}
@keyframes gradePop { 0% { transform: scale(0) rotate(-30deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.grade-S { color: #ffd93d; } .grade-A { color: #4ade80; } .grade-B { color: #60a5fa; } .grade-C { color: #c084fc; } .grade-D { color: #f87171; border-color: #f87171 !important; box-shadow: 0 0 30px rgba(248,113,113,.3) !important; }
.result-stage h2 { font-family: 'Baloo 2'; font-size: 26px; margin-bottom: 4px; }
.result-sub { color: var(--ink-dim); font-size: 15px; margin-bottom: 18px; }
.xp-burst { font-size: 21px; font-weight: 700; color: var(--accent); margin-bottom: 6px; animation: popIn .5s .3s backwards; }
.result-extras { display: flex; flex-direction: column; gap: 9px; align-items: center; margin: 14px 0; }
.reward-chip {
  display: flex; align-items: center; gap: 9px; font-size: 14.5px; font-weight: 500;
  background: var(--card); border: 1px solid rgba(255,255,255,.16);
  padding: 9px 18px; border-radius: 999px; animation: popIn .4s backwards;
}
.reward-chip b { color: var(--accent); }
.result-actions { display: flex; gap: 11px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* level-up overlay text */
.levelup-banner {
  position: fixed; top: 30%; left: 50%; transform: translateX(-50%);
  z-index: 70; text-align: center; pointer-events: none;
  animation: levelUp 2.6s cubic-bezier(.22,1,.36,1) forwards;
}
.levelup-banner .lu-big { font-family: 'Baloo 2'; font-size: 46px; font-weight: 800; color: var(--accent); text-shadow: 0 4px 30px rgba(255,217,61,.6); }
.levelup-banner .lu-sub { font-size: 19px; color: #fff; }
@keyframes levelUp { 0% { opacity: 0; transform: translateX(-50%) scale(.5);} 15% { opacity: 1; transform: translateX(-50%) scale(1.1);} 25% { transform: translateX(-50%) scale(1);} 80% { opacity: 1;} 100% { opacity: 0; transform: translateX(-50%) translateY(-38px) scale(.95);} }

/* ---------- profile ---------- */
.profile-head { text-align: center; padding: 16px 0 6px; }
.profile-head .avatar { width: 86px; height: 86px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; background: linear-gradient(140deg, #7c3aed, #db2777); border: 3px solid rgba(255,255,255,.3); }
.profile-head h1 { font-family: 'Baloo 2'; font-size: 26px; }
.profile-head .p-sub { color: var(--ink-dim); font-size: 14px; margin-top: 2px; }
.xp-big-track { max-width: 380px; height: 14px; margin: 14px auto 5px; background: rgba(255,255,255,.13); border-radius: 999px; overflow: hidden; }
.xp-big-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ffb43d); border-radius: 999px; transition: width .8s cubic-bezier(.22,1,.36,1); }
.xp-big-label { text-align: center; font-size: 13px; color: var(--ink-dim); margin-bottom: 14px; }
.stat-band { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.stat-chip { text-align: center; background: var(--card); border: 1px solid rgba(255,255,255,.13); border-radius: 15px; padding: 11px 20px; min-width: 92px; }
.stat-chip .sc-num { font-family: 'Baloo 2'; font-size: 23px; font-weight: 700; color: var(--accent); }
.stat-chip .sc-label { font-size: 11.5px; color: var(--ink-dim); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 11px; }
.badge-card {
  text-align: center; padding: 15px 10px; border-radius: 15px;
  background: var(--card); border: 1px solid rgba(255,255,255,.13);
  transition: transform .15s;
}
.badge-card:hover { transform: translateY(-3px); }
.badge-card .b-emoji { font-size: 33px; }
.badge-card .b-name { font-size: 13px; font-weight: 600; margin: 6px 0 3px; }
.badge-card .b-desc { font-size: 11px; color: var(--ink-dim); line-height: 1.35; }
.badge-card.locked { opacity: .38; filter: grayscale(.9); }
.badge-card.earned { border-color: rgba(255,217,61,.45); background: rgba(255,217,61,.08); }

/* ---------- teacher table ---------- */
.t-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t-table th { text-align: left; color: var(--ink-dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.15); white-space: nowrap; }
.t-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }

/* ---------- teacher analytics charts ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 16px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-col .bar { width: 100%; max-width: 26px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--accent), #f59e0b); min-height: 2px; transition: height .5s cubic-bezier(.22,1,.36,1); }
.bar-col .bar-val { font-size: 10.5px; color: var(--ink-dim); margin-bottom: 3px; min-height: 14px; }
.bar-col .bar-label { font-size: 9.5px; color: var(--ink-dim); margin-top: 5px; }
.hbar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.hbar-name { width: 165px; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.hbar-track { flex: 1; height: 11px; background: rgba(255,255,255,.11); border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), #22d3ee); transition: width .6s cubic-bezier(.22,1,.36,1); }
.hbar-val { font-size: 12px; color: var(--ink-dim); white-space: nowrap; min-width: 86px; text-align: right; }
.class-select {
  margin-left: auto; font-family: inherit; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,.09); color: var(--ink);
  border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 5px 12px; outline: none; cursor: pointer;
}
.class-select option { background: var(--card-solid); color: var(--ink); }
@media (max-width: 560px) { .hbar-name { width: 110px; } .hbar-val { min-width: 70px; } }

/* ---------- toast ---------- */
#toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast {
  background: var(--card-solid); border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; padding: 11px 22px; font-size: 14.5px; font-weight: 500;
  box-shadow: var(--shadow); display: flex; gap: 9px; align-items: center;
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.9);} to { opacity: 1; transform: none;} }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px) scale(.94);} }

.center-load { text-align: center; padding: 60px 0; color: var(--ink-dim); font-size: 15px; }
.spin { display: inline-block; animation: spin 1s linear infinite; font-size: 28px; }
@keyframes spin { to { transform: rotate(360deg);} }

@media (max-width: 560px) {
  .logo-text { display: none; }
  #view { padding: 14px 12px 70px; }
  .q-card { padding: 20px 15px; }
}
