/* ============================================================
   ENGLISH QUEST — Design System (vanilla, no build step)
   ============================================================ */
:root {
  --bg: #080a18;
  --bg2: #10142c;
  --card: rgba(255, 255, 255, 0.055);
  --card2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --txt: #eef1ff;
  --muted: #98a2c9;
  --cyan: #22e4ff;
  --pink: #ff3d8b;
  --yellow: #ffd23f;
  --green: #3df5c9;
  --purple: #8b6bff;
  --red: #ff4d6d;
  --orange: #ff8a3d;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, "Noto Sans KR", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--txt);
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(34, 228, 255, 0.16), transparent 60%),
    radial-gradient(900px 700px at 88% 0%, rgba(255, 61, 139, 0.14), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(139, 107, 255, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 20%, transparent 80%);
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 900; letter-spacing: -0.02em; }
p { margin: 0; line-height: 1.55; }
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; }
.hide, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.big { font-size: 30px; font-weight: 900; }
.huge { font-size: clamp(38px, 7vw, 64px); font-weight: 900; letter-spacing: -0.04em; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.mt { margin-top: 14px; } .mt-s { margin-top: 8px; } .mt-l { margin-top: 24px; }
.glow-text { text-shadow: 0 0 22px rgba(34, 228, 255, 0.55); }

/* ---------- buttons ---------- */
.btn {
  --b: var(--cyan); --btxt: #041018;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: 16px; font-weight: 800; font-size: 15px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--b) 88%, white), var(--b));
  color: var(--btxt); box-shadow: 0 5px 0 color-mix(in srgb, var(--b) 55%, black), 0 12px 26px rgba(0,0,0,.35);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  border: 1px solid rgba(255,255,255,.25); white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 55%, black); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.pink { --b: var(--pink); --btxt: #1a0310; }
.btn.yellow { --b: var(--yellow); --btxt: #201700; }
.btn.green { --b: var(--green); --btxt: #00201a; }
.btn.purple { --b: var(--purple); --btxt: #fff; }
.btn.red { --b: var(--red); --btxt: #fff; }
.btn.orange { --b: var(--orange); --btxt: #1e0d00; }
.btn.ghost { background: var(--card); color: var(--txt); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--card2); }
.btn.small { padding: 8px 13px; font-size: 13px; border-radius: 12px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.btn.big { padding: 18px 26px; font-size: 18px; border-radius: 20px; }
.btn.block { width: 100%; }
.btn.round { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 18px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(14px); box-shadow: 0 10px 34px rgba(0,0,0,.28);
}
.card.tight { padding: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 16px; margin-bottom: 12px; letter-spacing: -0.01em; }
.card-title .ico { font-size: 20px; }
.card.hero {
  background: linear-gradient(135deg, rgba(34,228,255,.16), rgba(139,107,255,.14) 45%, rgba(255,61,139,.14));
  border-color: rgba(34,228,255,.28); position: relative; overflow: hidden;
}
.card.hero::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -80px; top: -110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,228,255,.35), transparent 70%); pointer-events: none;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--card2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700;
}
.pill.cyan { background: rgba(34,228,255,.15); border-color: rgba(34,228,255,.4); color: var(--cyan); }
.pill.pink { background: rgba(255,61,139,.15); border-color: rgba(255,61,139,.4); color: #ff8fba; }
.pill.yellow { background: rgba(255,210,63,.14); border-color: rgba(255,210,63,.4); color: var(--yellow); }
.pill.green { background: rgba(61,245,201,.13); border-color: rgba(61,245,201,.4); color: var(--green); }
.pill.purple { background: rgba(139,107,255,.16); border-color: rgba(139,107,255,.45); color: #bda9ff; }

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(14px, 3vw, 34px);
  background: linear-gradient(180deg, rgba(8,10,24,.94), rgba(8,10,24,.72));
  backdrop-filter: blur(18px); border-bottom: 1px solid var(--line);
}
.hud .brand { display: flex; align-items: center; gap: 9px; font-weight: 900; letter-spacing: .04em; font-size: 15px; }
.hud .brand > div { display: flex; flex-direction: column; line-height: 1.15; }
.hud .brand .logo { font-size: 24px; filter: drop-shadow(0 0 10px rgba(34,228,255,.8)); }
.hud .brand small { color: var(--muted); font-weight: 700; font-size: 9.5px; letter-spacing: .14em; margin-top: 1px; }
.avatar {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 30px;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.25), rgba(255,255,255,.04));
  border: 1px solid var(--line); box-shadow: inset 0 0 18px rgba(34,228,255,.18); flex: none;
}
.avatar.lg { width: 72px; height: 72px; font-size: 44px; border-radius: 20px; }
.avatar.sm { width: 38px; height: 38px; font-size: 21px; border-radius: 11px; }
.level-ring {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--cyan) calc(var(--p, 0) * 1%), rgba(255,255,255,.09) 0);
  padding: 4px;
}
.level-ring > div { width: 100%; height: 100%; border-radius: 50%; background: #0d1126; display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.who b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22vw; }
.who span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 24vw; }
.xp-wrap { flex: 1; max-width: 260px; min-width: 90px; }
.xp-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 700; }
.xpbar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.09); overflow: hidden; }
.xpbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 14px rgba(34,228,255,.7); transition: width .6s cubic-bezier(.2,.9,.2,1); }
.hud-stats { display: flex; gap: 8px; margin-left: auto; align-items: center; }
.hud-stat {
  display: flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 14px;
}
.hud-stat .n { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
main.wrap { width: min(1180px, 100%); margin: 0 auto; padding: clamp(16px, 2.4vw, 28px) clamp(14px, 3vw, 28px) 110px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1.25fr .75fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }
.section-head h2 { font-size: 21px; }
.section-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- flywheel / routine ---------- */
.flywheel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.step {
  position: relative; padding: 14px 12px 13px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); display: flex; flex-direction: column; gap: 6px; text-align: left;
  transition: .16s ease; overflow: hidden;
}
.step:hover { background: rgba(255,255,255,.08); transform: translateY(-2px); }
.step .ic { font-size: 24px; }
.step .lb { font-weight: 800; font-size: 13.5px; }
.step .ds { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.step.done { border-color: rgba(61,245,201,.45); background: linear-gradient(180deg, rgba(61,245,201,.14), rgba(61,245,201,.04)); }
.step.done .ic { filter: drop-shadow(0 0 12px rgba(61,245,201,.6)); }
.step .check {
  position: absolute; top: 9px; right: 9px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 11px; color: var(--muted);
}
.step.done .check { background: var(--green); color: #00241d; font-weight: 900; }
.step .arrow { position: absolute; inset: auto 10px 10px auto; opacity: .5; font-size: 12px; }

.recommend {
  display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 16px;
  border-radius: 18px; border: 1px dashed rgba(34,228,255,.45); background: rgba(34,228,255,.07);
}
.recommend .em { font-size: 42px; animation: bob 2.4s ease-in-out infinite; }
.recommend .tx { flex: 1; min-width: 0; }
.recommend .tx b { font-size: 17px; display: block; }
.recommend .tx span { color: var(--muted); font-size: 13px; }

.streak-days { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.sday { flex: 1; min-width: 34px; text-align: center; padding: 8px 2px; border-radius: 11px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.sday b { display: block; font-size: 13px; color: var(--txt); margin-bottom: 2px; }
.sday.on { background: linear-gradient(180deg, rgba(255,138,61,.3), rgba(255,61,139,.16)); border-color: rgba(255,138,61,.55); }
.sday.today { outline: 2px solid var(--yellow); outline-offset: 1px; }
.flame { font-size: 26px; filter: drop-shadow(0 0 12px rgba(255,138,61,.8)); }

.mission { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(255,255,255,.08); }
.mission:last-child { border-bottom: 0; }
.mission .mi { font-size: 20px; width: 26px; text-align: center; }
.mission .mb { flex: 1; min-width: 0; }
.mission .mb b { font-size: 13px; font-weight: 800; }
.mini-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.09); overflow: hidden; margin-top: 5px; }
.mini-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); }

/* ---------- unit map ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.unit-card {
  position: relative; text-align: left; padding: 18px 16px 15px; border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.03));
  border: 1px solid var(--line); overflow: hidden; transition: .18s ease;
  display: flex; flex-direction: column; gap: 8px; min-height: 158px;
}
.unit-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--uc, var(--cyan)); box-shadow: 0 0 18px var(--uc, var(--cyan)); }
.unit-card::after {
  content: ""; position: absolute; right: -40px; bottom: -50px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--uc, var(--cyan)) 34%, transparent), transparent 70%); opacity: .5;
}
.unit-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--uc, var(--cyan)) 55%, transparent); }
.unit-card .ue { font-size: 36px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.unit-card h3 { font-size: 16px; }
.unit-card .uen { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.unit-card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.unit-card .prog { height: 5px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 4px; }
.unit-card .prog > i { display: block; height: 100%; background: var(--uc, var(--cyan)); }
.unit-card.current { outline: 2px solid var(--cyan); outline-offset: 2px; }
.unit-card.next-glow { animation: glowPulse 2.6s ease-in-out infinite; }

/* ---------- stats & charts ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .02em; }
.stat .v { font-size: 25px; font-weight: 900; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 3px; }
.chart-box { position: relative; width: 100%; }
.chart-box canvas { width: 100%; height: 190px; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* ---------- badges / shop / rank ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); opacity: .38; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: rgba(255,210,63,.4); background: linear-gradient(180deg, rgba(255,210,63,.13), rgba(255,210,63,.04)); }
.badge .bi { font-size: 24px; }
.badge .bn { font-size: 11px; font-weight: 800; margin-top: 4px; }
.badge .bd { font-size: 10px; color: var(--muted); margin-top: 2px; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.shop-item { padding: 12px 8px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); text-align: center; display: flex; flex-direction: column; gap: 5px; }
.shop-item .se { font-size: 32px; }
.shop-item .sn { font-size: 12px; font-weight: 800; }
.shop-item .sp { font-size: 12px; color: var(--yellow); font-weight: 800; }
.shop-item.owned { border-color: rgba(61,245,201,.35); }
.shop-item.equipped { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(34,228,255,.3) inset; }
.shop-item.locked { opacity: .55; }

.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.rank-row.me { border-color: var(--cyan); background: rgba(34,228,255,.09); }
.rank-row .rank { width: 32px; font-weight: 900; font-size: 16px; text-align: center; color: var(--muted); }
.rank-row .rank.g1 { color: var(--yellow); } .rank-row .rank.g2 { color: #cfd8e3; } .rank-row .rank.g3 { color: #d08a4c; }

/* ---------- tabs / nav ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 5px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.tab { padding: 9px 15px; border-radius: 12px; font-weight: 800; font-size: 13.5px; color: var(--muted); }
.tab.on { background: linear-gradient(180deg, rgba(34,228,255,.24), rgba(34,228,255,.12)); color: var(--txt); border: 1px solid rgba(34,228,255,.4); }
.bottomnav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 45;
  display: flex; gap: 4px; padding: 7px; border-radius: 22px; background: rgba(13,17,38,.92);
  border: 1px solid var(--line); backdrop-filter: blur(20px); box-shadow: var(--shadow);
}
.bottomnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 14px; border-radius: 14px; color: var(--muted); font-size: 10.5px; font-weight: 800; }
.bottomnav button .ic { font-size: 19px; }
.bottomnav button.on { color: var(--txt); background: rgba(34,228,255,.14); }
.bottomnav button .badge-n {
  position: absolute; transform: translate(16px, -8px); background: var(--red); color: #fff; border-radius: 99px;
  font-size: 9px; padding: 1px 5px; font-weight: 900;
}

/* ---------- forms ---------- */
.input, textarea.input, select.input {
  width: 100%; padding: 13px 15px; border-radius: 14px; background: rgba(255,255,255,.06);
  border: 1px solid var(--line); color: var(--txt); font-size: 15px; outline: none; transition: .15s;
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34,228,255,.15); background: rgba(255,255,255,.09); }
.input::placeholder { color: #6f7aa3; }
textarea.input { resize: vertical; min-height: 84px; }
.label { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 6px; display: block; letter-spacing: .02em; }
.field { margin-bottom: 13px; }
input[type="range"] { width: 100%; accent-color: var(--cyan); }
input[type="file"] { font-size: 12px; color: var(--muted); width: 100%; }

/* ---------- login ---------- */
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.orb { position: fixed; border-radius: 50%; filter: blur(50px); opacity: .5; pointer-events: none; animation: float 14s ease-in-out infinite; }
.orb.a { width: 420px; height: 420px; background: #124a63; top: -120px; left: -80px; }
.orb.b { width: 380px; height: 380px; background: #4a1240; bottom: -110px; right: -60px; animation-delay: -5s; }
.orb.c { width: 300px; height: 300px; background: #2a2064; top: 40%; left: 60%; animation-delay: -9s; }
.login-card { width: min(460px, 100%); position: relative; z-index: 2; }
.login-logo { font-size: 56px; line-height: 1; filter: drop-shadow(0 0 26px rgba(34,228,255,.6)); }
.login-title { font-size: clamp(30px, 8vw, 42px); letter-spacing: -0.04em; margin-top: 10px; }
.login-title span { background: linear-gradient(90deg, var(--cyan), var(--purple), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-sub { color: var(--muted); font-size: 14px; margin-top: 8px; line-height: 1.6; }
.login-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 22px 0 18px; padding: 5px; background: rgba(255,255,255,.06); border-radius: 16px; border: 1px solid var(--line); }
.login-tabs button { padding: 10px 4px; border-radius: 12px; font-weight: 800; font-size: 13px; color: var(--muted); }
.login-tabs button.on { background: var(--card2); color: var(--txt); box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.code-input { text-align: center; font-size: 28px; font-weight: 900; letter-spacing: .5em; text-transform: uppercase; padding: 16px; }
.login-err { color: #ff8fa5; font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 4px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.floating-emoji { position: fixed; font-size: 30px; opacity: .16; animation: float 10s ease-in-out infinite; pointer-events: none; }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 230; display: grid; place-items: center; padding: 16px;
  background: rgba(4,6,16,.78); backdrop-filter: blur(10px); animation: fadeIn .18s ease;
}
.modal {
  width: min(720px, 100%); max-height: 90dvh; overflow: auto; border-radius: 26px; padding: 24px;
  background: linear-gradient(180deg, #151a35, #0d1124); border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 30px 90px rgba(0,0,0,.65); animation: popIn .24s cubic-bezier(.2,.9,.25,1.2);
}
.modal.wide { width: min(980px, 100%); }
.modal.xwide { width: min(1160px, 100%); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-size: 22px; }
.modal-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-x { width: 38px; height: 38px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; font-size: 18px; flex: none; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(420px, 92vw); }
.toast {
  padding: 12px 18px; border-radius: 14px; background: rgba(20,25,52,.96); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 13.5px; font-weight: 700; animation: toastIn .25s ease; max-width: 100%;
}
.toast.ok { border-color: rgba(61,245,201,.55); }
.toast.err { border-color: rgba(255,77,109,.6); }
.toast.gold { border-color: rgba(255,210,63,.6); background: linear-gradient(180deg, rgba(70,55,10,.97), rgba(30,24,6,.97)); }

/* ---------- game overlay ---------- */
.game-root { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: radial-gradient(1200px 700px at 50% -20%, #18234d, #05060f 70%); overflow: hidden; }
.game-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(5,6,15,.6); backdrop-filter: blur(10px); z-index: 5; flex-wrap: wrap; }
.game-top .gname { font-weight: 900; font-size: 15px; }
.game-top .gstat { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.gstat-chip { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); font-weight: 900; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.stage { position: relative; flex: 1; overflow: hidden; }
.stage-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; text-align: center; }
.game-bottom { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(5,6,15,.72); backdrop-filter: blur(12px); z-index: 5; }
.mic-btn {
  width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; font-size: 38px; margin: 0 auto;
  background: radial-gradient(circle at 35% 25%, #6ef1ff, #14a7c9 60%, #0b6c86);
  box-shadow: 0 0 0 8px rgba(34,228,255,.12), 0 14px 30px rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.4);
  transition: .16s; color: #04202a;
}
.mic-btn.listening { animation: pulse 1.1s ease-in-out infinite; background: radial-gradient(circle at 35% 25%, #ff9ec4, #e0246f 60%, #8b0f45); }
.mic-btn:active { transform: scale(.94); }
.mic-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 700; }
.answer-row { display: flex; gap: 8px; margin-top: 10px; }
.answer-row .input { text-align: center; font-weight: 800; }
.prompt-card {
  padding: 22px 26px; border-radius: 24px; background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04));
  border: 1px solid var(--line); min-width: min(420px, 88vw); box-shadow: var(--shadow);
}
.prompt-card .pko { font-size: clamp(28px, 6vw, 44px); font-weight: 900; letter-spacing: -0.03em; }
.prompt-card .pen { font-size: 15px; color: var(--muted); margin-top: 6px; letter-spacing: .04em; }
.prompt-card .pemoji { font-size: 56px; margin-bottom: 4px; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: min(520px, 92vw); }
.choice {
  padding: 16px; border-radius: 16px; background: var(--card2); border: 1px solid var(--line);
  font-size: 17px; font-weight: 800; color: var(--txt); transition: .12s;
}
.choice:hover { background: rgba(34,228,255,.14); border-color: rgba(34,228,255,.5); }
.choice.correct { background: rgba(61,245,201,.24); border-color: var(--green); }
.choice.wrong { background: rgba(255,77,109,.22); border-color: var(--red); }
.word-feedback { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.wf { padding: 5px 9px; border-radius: 9px; font-weight: 800; font-size: 14px; background: rgba(255,255,255,.08); }
.wf.ok { background: rgba(61,245,201,.22); color: #b8fff0; }
.wf.bad { background: rgba(255,77,109,.22); color: #ffb3c1; }

.meteor-layer, .boss-layer, .float-layer, .fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.meteor {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px;
  border-radius: 16px; background: linear-gradient(180deg, rgba(255,180,90,.95), rgba(190,80,20,.95));
  color: #2a0d00; font-weight: 900; box-shadow: 0 0 26px rgba(255,140,40,.65), inset 0 -4px 0 rgba(0,0,0,.2);
  min-width: 92px; transform: translate(-50%, -50%); border: 2px solid rgba(255,235,190,.7);
}
.meteor .me { font-size: 30px; line-height: 1; }
.meteor .mt { font-size: 13px; white-space: nowrap; }
.meteor.hit { animation: meteorBoom .3s ease forwards; }
.hud-hp { width: min(520px, 90vw); height: 18px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; position: relative; border: 1px solid var(--line); }
.hud-hp > i { display: block; height: 100%; background: linear-gradient(90deg, #ff4d6d, #ff8a3d); transition: width .35s ease; }
.hud-hp.player > i { background: linear-gradient(90deg, #22e4ff, #3df5c9); }
.hud-hp .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 900; color: #04121a; text-shadow: 0 1px 0 rgba(255,255,255,.4); }
.boss-emoji { font-size: clamp(70px, 16vw, 130px); filter: drop-shadow(0 14px 30px rgba(0,0,0,.6)); transition: transform .1s; }
.boss-emoji.hurt { animation: shake .3s ease; }

.announcer {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%); z-index: 20;
  font-size: clamp(28px, 7vw, 60px); font-weight: 900; letter-spacing: .02em; text-align: center;
  color: var(--yellow); text-shadow: 0 0 30px rgba(255,210,63,.8), 0 6px 0 rgba(120,60,0,.6);
  animation: announce .9s cubic-bezier(.2,.9,.3,1.4) forwards; pointer-events: none; white-space: nowrap;
}
.float-score { position: absolute; font-weight: 900; font-size: 22px; color: var(--green); text-shadow: 0 2px 8px rgba(0,0,0,.6); animation: floatUp 1s ease-out forwards; pointer-events: none; }
.emoji-rain { position: fixed; inset: 0; pointer-events: none; z-index: 240; overflow: hidden; }
.emoji-rain span { position: absolute; font-size: 34px; animation: fall linear forwards; }
.shout {
  position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,.55), transparent 70%); animation: fadeIn .2s ease;
}
.shout b {
  font-size: clamp(40px, 11vw, 110px); font-weight: 900; letter-spacing: -0.04em; text-align: center; padding: 0 20px;
  color: #fff; text-shadow: 0 0 40px currentColor, 0 10px 0 rgba(0,0,0,.35); animation: popIn .35s cubic-bezier(.2,.9,.25,1.4);
}

/* chest */
.chest-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.chest { font-size: 96px; cursor: pointer; user-select: none; transition: transform .12s; filter: drop-shadow(0 0 30px rgba(255,210,63,.6)); animation: bob 1.6s ease-in-out infinite; }
.chest:active { transform: scale(.92); }
.chest.shake { animation: shake .28s ease infinite; }
.reward-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.reward-cell { padding: 12px 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: center; }
.reward-cell .rv { font-size: 20px; font-weight: 900; }
.reward-cell .rk { font-size: 11px; color: var(--muted); font-weight: 700; }
.rarity-common { color: #cfd8e3; } .rarity-rare { color: #4db8ff; } .rarity-epic { color: #c86bff; } .rarity-legendary { color: var(--yellow); }
.result-card { width: min(560px, 94vw); text-align: center; }
.xp-breakdown { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; text-align: left; }
.xp-row { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.05); }

/* ---------- tutor ---------- */
.tutor-layout { display: grid; grid-template-columns: 292px 1fr; gap: 16px; width: min(1500px, 100%); margin: 0 auto; padding: 16px clamp(12px, 2vw, 24px) 40px; align-items: start; }
.students-panel { position: sticky; top: 86px; max-height: calc(100dvh - 104px); display: flex; flex-direction: column; gap: 10px; }
.student-list { overflow: auto; display: flex; flex-direction: column; gap: 7px; padding-right: 3px; }
.student-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: left; width: 100%; transition: .14s; }
.student-item:hover { background: var(--card2); }
.student-item.sel { border-color: var(--cyan); background: rgba(34,228,255,.1); }
.student-item .si-main { flex: 1; min-width: 0; }
.student-item .si-name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-item .si-sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 2px; flex-wrap: wrap; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #556; display: inline-block; }
.online-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.badge-n { background: var(--red); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; font-weight: 900; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.live-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 13px; transition: .15s; }
.live-btn:hover { background: rgba(34,228,255,.12); border-color: rgba(34,228,255,.45); transform: translateY(-2px); }
.live-btn .li { font-size: 26px; }
.live-feed { max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.feed-row { font-size: 12.5px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.05); display: flex; gap: 8px; align-items: start; }
.feed-row .ft { color: var(--muted); font-size: 10.5px; flex: none; }
.chain-board { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px dashed var(--line); }
.cw { padding: 5px 9px; border-radius: 9px; font-weight: 800; font-size: 13px; }
.cw.student { background: rgba(34,228,255,.18); color: #a9f4ff; }
.cw.tutor { background: rgba(255,61,139,.18); color: #ffb2cd; }
.hw-item { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.hw-item audio { width: 100%; height: 36px; }
.stars { display: flex; gap: 3px; }
.stars button { font-size: 24px; opacity: .3; transition: .1s; }
.stars button.on { opacity: 1; filter: drop-shadow(0 0 8px rgba(255,210,63,.7)); }

/* ---------- admin funnel ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { padding: 16px; border-radius: 16px; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)); border: 1px solid var(--line); }
.kpi .kl { font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.kpi .kv { font-size: 28px; font-weight: 900; margin-top: 4px; }
.kpi .ks { font-size: 11px; color: var(--muted); margin-top: 2px; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-stage { display: grid; grid-template-columns: 150px 1fr 96px; gap: 12px; align-items: center; }
.funnel-bar { height: 34px; border-radius: 10px; background: rgba(255,255,255,.06); overflow: hidden; position: relative; }
.funnel-bar > i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, rgba(34,228,255,.85), rgba(139,107,255,.85)); transition: width .7s cubic-bezier(.2,.9,.2,1); }
.funnel-bar > span { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 10px; font-size: 12px; font-weight: 800; color: #04121a; }
.funnel-meta { font-size: 12px; text-align: right; color: var(--muted); font-weight: 700; }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; padding: 10px 12px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 11px; letter-spacing: .04em; font-weight: 800; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-top: 1px solid rgba(255,255,255,.06); white-space: nowrap; }
.tbl tr:hover td { background: rgba(255,255,255,.03); }
.stage-chip { padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 800; background: rgba(34,228,255,.14); color: #a9f4ff; }

/* ---------- parent ---------- */
.parent-hero { background: linear-gradient(135deg, rgba(255,210,63,.14), rgba(255,61,139,.1) 50%, rgba(34,228,255,.12)); border-color: rgba(255,210,63,.3); }
.child-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.child-tab { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 13px; }
.child-tab.on { border-color: var(--yellow); background: rgba(255,210,63,.14); }
.spectate-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: rgba(34,228,255,.07); border: 1px dashed rgba(34,228,255,.35); font-size: 12.5px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(61,245,201,.6); animation: ping 1.6s infinite; }
.live-feed-parent { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow: auto; }

/* ---------- chat ---------- */
.chat-fab { position: fixed; right: 18px; bottom: 92px; z-index: 60; width: 56px; height: 56px; border-radius: 50%; font-size: 26px; background: linear-gradient(180deg, #2a3568, #1a2148); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; }
.chat-panel { position: fixed; right: 18px; bottom: 160px; z-index: 61; width: min(360px, calc(100vw - 24px)); height: min(480px, 60dvh); border-radius: 20px; background: #10152e; border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: popIn .2s ease; }
.chat-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 14px; }
.chat-body { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; word-break: break-word; }
.msg.me { align-self: flex-end; background: linear-gradient(180deg, #2b7f9b, #1c5f78); border-bottom-right-radius: 4px; }
.msg.other { align-self: flex-start; background: rgba(255,255,255,.09); border-bottom-left-radius: 4px; }
.msg .meta { font-size: 10px; opacity: .7; margin-top: 3px; }
.chat-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input .input { padding: 10px 12px; font-size: 13px; }
.chat-file { font-size: 11px; color: var(--cyan); }

/* ---------- misc ---------- */
.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.loader { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--cyan); animation: spin .8s linear infinite; margin: 30px auto; }
.unit-song { padding: 14px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.lyric { display: flex; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 9px; font-size: 13px; transition: .15s; }
.lyric.on { background: rgba(34,228,255,.16); font-weight: 800; }
.lyric .lk { color: var(--muted); font-size: 11.5px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 260; }
.spark { position: fixed; pointer-events: none; z-index: 261; font-size: 18px; animation: sparkOut .8s ease-out forwards; }
.meter { height: 8px; border-radius: 99px; background: rgba(255,255,255,.1); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--cyan), var(--green)); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(18px,-22px) scale(1.05); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 8px rgba(255,61,139,.14), 0 0 34px rgba(255,61,139,.5); } 50% { box-shadow: 0 0 0 18px rgba(255,61,139,.05), 0 0 50px rgba(255,61,139,.7); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(61,245,201,.6); } 70% { box-shadow: 0 0 0 10px rgba(61,245,201,0); } 100% { box-shadow: 0 0 0 0 rgba(61,245,201,0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px) rotate(-2deg); } 75% { transform: translateX(5px) rotate(2deg); } }
@keyframes announce { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 25% { opacity: 1; transform: translateX(-50%) scale(1.1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) scale(1.02) translateY(-14px); } }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(.9); } 100% { opacity: 0; transform: translateY(-52px) scale(1.25); } }
@keyframes fall { to { transform: translateY(105vh) rotate(420deg); opacity: .2; } }
@keyframes meteorBoom { 0% { transform: translate(-50%,-50%) scale(1); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1.8); opacity: 0; } }
@keyframes sparkOut { 0% { opacity: 1; transform: translate(0,0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.4); } }
@keyframes glowPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,228,255,0); } 50% { box-shadow: 0 0 0 4px rgba(34,228,255,.18), 0 0 30px rgba(34,228,255,.25); } }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .tutor-layout { grid-template-columns: 1fr; }
  .students-panel { position: static; max-height: none; }
  .student-list { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .student-item { min-width: 190px; }
  .funnel-stage { grid-template-columns: 100px 1fr 74px; }
}
@media (max-width: 680px) {
  .hud { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .hud .brand small { display: none; }
  .who b { max-width: 30vw; font-size: 14px; }
  .who span { display: none; }
  .xp-wrap { order: 5; flex-basis: 100%; max-width: none; margin-top: 4px; }
  .hud-stats { gap: 5px; }
  .hud-stat { padding: 6px 8px; font-size: 12px; }
  .avatar { width: 42px; height: 42px; font-size: 24px; }
  .level-ring { width: 46px; height: 46px; }
  .level-ring > div { font-size: 14px; }
  .flywheel { grid-template-columns: repeat(2, 1fr); }
  .bottomnav { width: calc(100% - 20px); justify-content: space-around; gap: 0; }
  .bottomnav button { padding: 8px 6px; flex: 1; }
  .bottomnav button .ic { font-size: 18px; }
  .recommend { flex-wrap: wrap; }
  .recommend .btn { width: 100%; }
  .map-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .unit-card { min-height: 140px; padding: 14px 12px; }
  .unit-card .ue { font-size: 30px; }
  main.wrap { padding-bottom: 120px; }
  .modal { padding: 18px; }
  .reward-grid { grid-template-columns: 1fr; }
  .choices { grid-template-columns: 1fr; }
  .chat-panel { right: 8px; bottom: 150px; }
  .game-top .gname { font-size: 13px; }
}
