/* =========================================================================
   ODYSSEY — design system
   Celestial cartography: deep space, warm gold, cosmic violet.
   ========================================================================= */

:root {
  /* surfaces */
  --bg-0: #07070d;
  --bg-1: #0b0b15;
  --bg-2: #11111e;
  --panel: rgba(255, 255, 255, 0.022);
  --panel-2: rgba(255, 255, 255, 0.04);
  --panel-hi: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);

  /* ink */
  --ink: #f4f3fb;
  --ink-2: #c4c3d6;
  --ink-3: #8a89a0;
  --ink-4: #5d5c72;

  /* accents */
  --gold: #f0c073;
  --gold-2: #e8a94e;
  --gold-soft: rgba(240, 192, 115, 0.14);
  --violet: #9a8bf7;
  --violet-2: #7a6cf0;
  --violet-soft: rgba(154, 139, 247, 0.14);
  --teal: #5fe3cf;
  --teal-soft: rgba(95, 227, 207, 0.14);
  --rose: #f58aa3;
  --rose-soft: rgba(245, 138, 163, 0.14);
  --sky: #76c6ff;

  /* semantic */
  --good: #5fe3cf;
  --warn: #f0c073;
  --bad: #f58aa3;

  /* type */
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* geometry */
  --r-sm: 9px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --sb-w: 256px;

  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
  --glow-gold: 0 0 0 1px rgba(118, 198, 255, 0.28), 0 14px 40px -14px rgba(118, 198, 255, 0.4);
  --on-accent: #08121f; /* text/icon colour on top of a filled accent surface */

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  font-feature-settings: "ss01", "cv11";
}

/* ambient gradient + starfield ------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(122, 108, 240, 0.18), transparent 60%),
    radial-gradient(900px 650px at 8% 108%, rgba(118, 198, 255, 0.12), transparent 55%),
    radial-gradient(700px 700px at 100% 100%, rgba(95, 227, 207, 0.06), transparent 60%),
    linear-gradient(180deg, #08080f, #06060c);
  z-index: -2;
}
#starfield { position: fixed; inset: 0; z-index: -1; opacity: 0.75; }

::selection { background: rgba(118, 198, 255, 0.30); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); background-clip: content-box; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  height: 100vh;
  transition: grid-template-columns 0.4s var(--ease);
}
.app[data-collapsed="true"] { grid-template-columns: 78px 1fr; }

/* ---------- sidebar ---------- */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.018), rgba(255,255,255,0));
  backdrop-filter: blur(14px);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  cursor: pointer;
  user-select: none;
}
.brand-mark {
  flex: none;
  width: 38px; height: 38px;
  color: var(--gold);
  filter: drop-shadow(0 4px 14px rgba(240, 192, 115, 0.45));
  transition: transform 0.6s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(72deg); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 3px; }

.app[data-collapsed="true"] .brand-text,
.app[data-collapsed="true"] .nav-label,
.app[data-collapsed="true"] .streak-label,
.app[data-collapsed="true"] .streak-count { display: none; }
.app[data-collapsed="true"] .streak { justify-content: center; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 4px 6px;
}
.nav-section {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 14px 12px 6px;
  font-weight: 600;
}
.app[data-collapsed="true"] .nav-section { opacity: 0; height: 10px; padding: 6px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  position: relative;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.nav-item:hover { color: var(--ink); background: var(--panel-2); }
.nav-item.active {
  color: var(--ink);
  background: linear-gradient(100deg, var(--gold-soft), rgba(154,139,247,0.06));
  border-color: var(--line-2);
}
.nav-item.active::before {
  content: "";
  position: absolute; left: -6px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 4px;
  background: linear-gradient(var(--gold), var(--gold-2));
  box-shadow: 0 0 12px var(--gold);
}
.nav-ico, [data-icon] { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; color: currentColor; }
.nav-ico svg, [data-icon] svg { width: 100%; height: 100%; }
.nav-item.active .nav-ico { color: var(--gold); }
.nav-label { white-space: nowrap; overflow: hidden; }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.streak {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
}
.streak-flame { color: var(--gold); filter: drop-shadow(0 0 6px var(--gold)); }
.streak-count { font-weight: 700; color: var(--ink); }
.streak-label { color: var(--ink-3); }

/* ---------- main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8,8,15,0.55);
  backdrop-filter: blur(16px);
  z-index: 20;
}
.menu-btn { display: none; }
.crumb { display: flex; flex-direction: column; min-width: 0; }
.crumb-eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.crumb-title { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.015em; line-height: 1.1; margin-top: 2px; }

.topbar-search {
  margin-left: auto;
  display: flex; align-items: center; gap: 9px;
  width: min(340px, 34vw);
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s;
}
.topbar-search:focus-within { border-color: var(--line-2); background: var(--panel-2); }
.topbar-search .search-ico { color: var(--ink-3); }
.topbar-search input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-size: 13px; font-family: inherit; min-width: 0; }
.topbar-search input::placeholder { color: var(--ink-4); }
.topbar-search kbd {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  transition: 0.18s;
}
.icon-btn:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line-2); }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--bg-0);
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  box-shadow: 0 6px 18px -6px var(--gold-2); cursor: pointer;
}

/* ---------- view ---------- */
.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 30px 28px 60px; outline: none; scroll-behavior: smooth; }
.view-inner { max-width: 1180px; margin: 0 auto; }
.wide .view-inner { max-width: 1320px; }

/* =========================================================================
   PRIMITIVES
   ========================================================================= */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
}
.card.glow { box-shadow: var(--shadow); }
.card-pad-lg { padding: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 11px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  transition: 0.18s; white-space: nowrap;
}
.btn:hover { background: var(--panel-hi); border-color: var(--line-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .ico, .btn [data-icon] { width: 16px; height: 16px; }
.btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--on-accent); border-color: transparent; box-shadow: 0 10px 28px -12px var(--gold-2);
}
.btn.primary:hover { box-shadow: var(--glow-gold); filter: brightness(1.04); }
.btn.violet { background: linear-gradient(135deg, var(--violet), var(--violet-2)); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); background: var(--panel); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2);
}
.chip.gold { background: var(--gold-soft); border-color: rgba(240,192,115,.3); color: var(--gold); }
.chip.violet { background: var(--violet-soft); border-color: rgba(154,139,247,.3); color: var(--violet); }
.chip.teal { background: var(--teal-soft); border-color: rgba(95,227,207,.3); color: var(--teal); }
.chip.rose { background: var(--rose-soft); border-color: rgba(245,138,163,.3); color: var(--rose); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.tag { font-size: 11px; padding: 3px 9px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-3); }

.eyebrow { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* inputs */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: 0.02em; }
.input, .textarea, .select {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; outline: none; transition: border-color 0.18s, box-shadow 0.18s;
}
.input:focus, .textarea:focus, .select:focus { border-color: rgba(240,192,115,.5); box-shadow: 0 0 0 3px var(--gold-soft); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a89a0' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; cursor: pointer; }

/* Searchable combobox (University Simulator country picker) */
.combo { position: relative; }
.combo .combo-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' fill='none' stroke='%238a89a0' stroke-width='2'%3E%3Ccircle cx='5.5' cy='5.5' r='4.5'/%3E%3Cpath d='M9 9l3 3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.combo-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  max-height: 290px; overflow-y: auto; padding: 5px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--shadow-lg);
}
.combo-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2);
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.combo-opt .combo-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-opt:hover, .combo-opt.active { background: var(--panel-hi); color: var(--ink); }
.combo-opt.sel { color: var(--ink); }
.combo-check { color: var(--gold); font-size: 12px; flex: none; }
.combo-empty { padding: 12px 11px; font-size: 12.5px; color: var(--ink-3); }

.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 26px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  cursor: pointer; transition: 0.2s; color: var(--ink-3); background: var(--panel);
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: var(--gold-soft); color: var(--ink-2); }
.dropzone .dz-ico { width: 34px; height: 34px; color: var(--gold); }

/* progress + bars */
.bar { height: 8px; border-radius: 99px; background: var(--panel-hi); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width 0.9s var(--ease); }
.bar.violet > span { background: linear-gradient(90deg, var(--violet), var(--violet-2)); }
.bar.teal > span { background: linear-gradient(90deg, var(--teal), #3fbfae); }
.bar.rose > span { background: linear-gradient(90deg, var(--rose), #e0657f); }

/* tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tab { padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer; border: none; background: none; font-family: inherit; transition: 0.16s; white-space: nowrap; }
.tab:hover { color: var(--ink-2); }
.tab.active { background: var(--panel-hi); color: var(--ink); box-shadow: 0 2px 8px -4px rgba(0,0,0,.6); }

/* grids */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-sm { gap: 8px; }
.mt { margin-top: 18px; } .mt-lg { margin-top: 28px; } .mt-sm { margin-top: 10px; }
.mb { margin-bottom: 18px; } .mb-lg { margin-bottom: 28px; }

/* stat */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num { font-family: var(--display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.stat-num.sm { font-size: 22px; }
.stat-label { font-size: 12px; color: var(--ink-3); }

/* =========================================================================
   PAGE HEADERS / HERO
   ========================================================================= */
.page-hero { margin-bottom: 26px; }
.page-hero h2 { font-family: var(--display); font-size: clamp(26px, 3vw, 34px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; }
.page-hero p { color: var(--ink-3); margin-top: 9px; max-width: 62ch; font-size: 14.5px; line-height: 1.55; }
.hero-ico {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--gold-soft), var(--violet-soft)); border: 1px solid var(--line-2); color: var(--gold);
}
.hero-ico svg { width: 26px; height: 26px; }

/* feature tile (dashboard) */
.tile {
  display: flex; flex-direction: column; gap: 12px;
  padding: 22px; border-radius: var(--r-lg);
  background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: 0.22s var(--ease); position: relative; overflow: hidden; min-height: 168px;
}
.tile::after { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 200px at 80% -20%, var(--tile-glow, rgba(240,192,115,.14)), transparent 70%); opacity: 0; transition: 0.3s; pointer-events: none; }
.tile:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: var(--shadow); }
.tile:hover::after { opacity: 1; }
.tile-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel-2); color: var(--tile-c, var(--gold)); }
.tile-ico svg { width: 22px; height: 22px; }
.tile h3 { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.tile p { font-size: 13px; color: var(--ink-3); line-height: 1.5; flex: 1; }
.tile-go { font-size: 12px; color: var(--ink-4); display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.tile:hover .tile-go { color: var(--gold); gap: 9px; }

/* list rows */
.lrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: none; }

/* probability rank rows (Exam Oracle) */
.rankrow { padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); transition: 0.2s; cursor: pointer; }
.rankrow:hover { border-color: var(--line-2); background: var(--panel-2); }
.rankrow.open { border-color: rgba(240,192,115,.35); }
.rank-num { font-family: var(--display); font-size: 20px; color: var(--ink-4); width: 34px; flex: none; }
.rank-num.hot { color: var(--gold); }
.expand { max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease); }
.rankrow.open .expand { max-height: 520px; }

/* priority quadrant */
.quad { position: relative; aspect-ratio: 1 / 0.78; border-radius: var(--r); background: linear-gradient(135deg, rgba(245,138,163,.05), rgba(95,227,207,.05)); border: 1px solid var(--line); overflow: hidden; }
.quad-axis { position: absolute; background: var(--line); }
.quad-dot { position: absolute; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%,-50%); display: grid; place-items: center; font-size: 11px; font-weight: 700; cursor: pointer; transition: 0.2s; border: 2px solid var(--bg-0); }
.quad-dot:hover { transform: translate(-50%,-50%) scale(1.18); z-index: 5; }
.quad-label { position: absolute; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); }

/* canvas mounts */
.canvas-wrap { position: relative; border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: radial-gradient(120% 120% at 50% 0%, rgba(122,108,240,.05), transparent), var(--bg-1); }
.canvas-wrap canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.canvas-wrap canvas:active { cursor: grabbing; }
.canvas-hud { position: absolute; display: flex; gap: 8px; }
.canvas-hud.tl { top: 14px; left: 14px; } .canvas-hud.tr { top: 14px; right: 14px; flex-direction: column; align-items: flex-end; }
.canvas-hud.bl { bottom: 14px; left: 14px; } .canvas-hud.br { bottom: 14px; right: 14px; }
.hud-btn { width: 34px; height: 34px; border-radius: 9px; background: rgba(10,10,18,.7); border: 1px solid var(--line-2); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); }
.hud-btn:hover { color: var(--ink); background: rgba(20,20,32,.9); }
.hud-pill { padding: 7px 12px; border-radius: 9px; background: rgba(10,10,18,.7); border: 1px solid var(--line-2); font-size: 11.5px; color: var(--ink-2); backdrop-filter: blur(8px); font-family: var(--mono); }

/* node inspector panel (floats over canvas) */
.inspector { position: absolute; top: 14px; right: 14px; width: 290px; max-width: calc(100% - 28px); background: rgba(11,11,21,.92); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px; backdrop-filter: blur(16px); box-shadow: var(--shadow-lg); transform: translateX(120%); transition: transform 0.4s var(--ease); }
.inspector.show { transform: translateX(0); }

/* chat (interview) */
.chatwrap { display: flex; flex-direction: column; height: min(62vh, 560px); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); overflow: hidden; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 12px; max-width: 82%; animation: fadeUp 0.4s var(--ease); }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-av { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.msg.bot .msg-av { background: linear-gradient(135deg, var(--violet), var(--violet-2)); color: #fff; }
.msg.me .msg-av { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--on-accent); }
.msg-body { padding: 12px 15px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg.bot .msg-body { background: var(--panel-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.me .msg-body { background: var(--gold-soft); border: 1px solid rgba(240,192,115,.25); border-top-right-radius: 4px; color: var(--ink); }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: var(--bg-2); }
.chat-input textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); margin: 0 1px; animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay: .2s } .typing span:nth-child(3){ animation-delay: .4s }

/* casebook */
.case-card { perspective: 1400px; }
.case-stage { padding: 26px; border-radius: var(--r-lg); border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.choice { text-align: left; padding: 15px 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); cursor: pointer; transition: 0.18s; width: 100%; font-family: inherit; color: var(--ink-2); display: flex; gap: 12px; align-items: flex-start; }
.choice:hover { border-color: var(--line-2); background: var(--panel-2); color: var(--ink); transform: translateX(3px); }
.choice.picked { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.choice.real { border-color: var(--teal); background: var(--teal-soft); }
.choice-key { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--panel-hi); border: 1px solid var(--line); }
.choice.picked .choice-key { background: var(--gold); color: var(--on-accent); border-color: transparent; }
.reveal { animation: fadeUp 0.5s var(--ease); }

/* heatmap (BrainGap) */
.heat-cell { aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 600; cursor: default; transition: 0.2s; border: 1px solid rgba(255,255,255,.05); }
.heat-cell:hover { transform: scale(1.08); z-index: 2; }

/* line chart */
.linechart { width: 100%; height: auto; overflow: visible; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-area { opacity: 0.18; }
.lc-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lc-dot { transition: r 0.2s; cursor: pointer; }

/* toast */
.toast-wrap { position: fixed; bottom: 26px; right: 26px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 11px; padding: 13px 17px; border-radius: var(--r); background: rgba(17,17,30,.96); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-size: 13.5px; color: var(--ink); min-width: 240px; animation: toastIn 0.35s var(--ease); backdrop-filter: blur(12px); }
.toast .t-ico { width: 20px; height: 20px; flex: none; }
.toast.good .t-ico { color: var(--teal); } .toast.gold .t-ico { color: var(--gold); } .toast.bad .t-ico { color: var(--rose); }

/* modal */
.modal-root { position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-root.show { display: flex; }
.modal-scrim { position: absolute; inset: 0; background: rgba(4,4,9,.66); backdrop-filter: blur(6px); animation: fadeIn 0.25s; }
.modal { position: relative; width: min(560px, 100%); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 28px; box-shadow: var(--shadow-lg); animation: modalIn 0.35s var(--ease); max-height: 88vh; overflow-y: auto; }

/* loading shimmer */
.shimmer { position: relative; overflow: hidden; background: var(--panel-2); border-radius: var(--r-sm); }
.shimmer::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); animation: shimmer 1.4s infinite; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--gold); animation: spin 0.7s linear infinite; }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch::after { content: ""; position: absolute; inset: 0; border-radius: 99px; background: var(--panel-hi); border: 1px solid var(--line-2); transition: 0.25s; }
.switch::before { content: ""; position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-3); transition: 0.25s var(--ease); z-index: 1; }
.switch:has(input:checked)::after { background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: transparent; }
.switch:has(input:checked)::before { transform: translateX(20px); background: var(--on-accent); }

.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); }
.empty .empty-ico { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--ink-4); opacity: .6; }

/* analysing pulse line */
.analysing { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--r); background: var(--violet-soft); border: 1px solid rgba(154,139,247,.25); color: var(--ink-2); font-size: 13.5px; }

/* settings ---------------------------------------------------------------- */
.set-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 18px; }
.set-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.set-ico { width: 22px; height: 22px; flex: none; color: var(--ink-2); display: inline-flex; }
.set-ico svg { width: 100%; height: 100%; }
.set-title { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.set-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.set-row-l { min-width: 0; }
.set-row-l b { font-size: 13.5px; }
.set-note { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; background: var(--bg-1); border: 1px solid rgba(245, 138, 163, 0.2); border-radius: var(--r); }
.swatch { width: 27px; height: 27px; border-radius: 50%; background: var(--sw); border: 2px solid transparent; cursor: pointer; transition: transform 0.18s var(--ease), box-shadow 0.18s; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch:hover { transform: scale(1.14); }
.swatch.on { border-color: var(--bg-0); box-shadow: 0 0 0 2px var(--sw); }
.range { -webkit-appearance: none; appearance: none; width: 150px; height: 5px; border-radius: 99px; background: var(--panel-hi); outline: none; cursor: pointer; }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg-0); cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.range::-moz-range-thumb { width: 15px; height: 15px; border: 2px solid var(--bg-0); border-radius: 50%; background: var(--gold); cursor: pointer; }
.mod-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); cursor: pointer; transition: border-color 0.18s; }
.mod-row:hover { border-color: var(--line-2); }
kbd { font-family: var(--mono); font-size: 11px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; }

/* exam planner — calendar + countdown */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-family: var(--display); font-weight: 600; font-size: 15.5px; }
.cal-nav { width: 32px; height: 32px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: 0.16s; }
.cal-nav:hover { color: var(--ink); border-color: var(--line-2); background: var(--panel-hi); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 10px; letter-spacing: 0.06em; color: var(--ink-4); padding: 4px 0; font-weight: 700; text-transform: uppercase; }
.cal-cell { aspect-ratio: 1; border: 1px solid transparent; border-radius: 9px; background: var(--panel-2); color: var(--ink-2); font-family: inherit; font-size: 13px; cursor: pointer; display: grid; place-items: center; transition: 0.14s; }
.cal-cell:hover { background: var(--panel-hi); border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); }
.cal-cell.empty { background: none; border: none; pointer-events: none; }
.cal-cell.past { color: var(--ink-4); opacity: 0.45; }
.cal-cell.today { border-color: var(--violet); color: var(--ink); font-weight: 600; }
.cal-cell.sel { background: linear-gradient(135deg, var(--violet), var(--violet-2)); color: #fff; border-color: transparent; font-weight: 700; box-shadow: 0 8px 18px -6px var(--violet-2); }
.cal-cell.sel:hover { transform: translateY(-1px) scale(1.03); }
.count-num { font-family: var(--display); font-size: 62px; font-weight: 600; line-height: 0.85; letter-spacing: -0.03em; background: linear-gradient(135deg, var(--violet), var(--gold)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.exam-count { background: linear-gradient(120deg, var(--violet-soft), transparent); }
.exam-dash .count-num { font-size: 42px; }
@media (max-width: 860px) { #examGrid { grid-template-columns: 1fr !important; } }

/* daily challenge — sidebar slide */
.daily-slide { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; margin: 2px 0 12px; padding: 11px 12px; border-radius: 13px; cursor: pointer; font-family: inherit; background: linear-gradient(120deg, var(--gold-soft), var(--violet-soft)); border: 1px solid var(--line-2); color: var(--ink); position: relative; overflow: hidden; transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s; }
.daily-slide::after { content: ""; position: absolute; inset: 0; background: radial-gradient(220px 90px at 88% -20%, var(--gold-soft), transparent 70%); opacity: 0.7; pointer-events: none; }
.daily-slide:hover { border-color: rgba(240, 192, 115, 0.45); transform: translateY(-1px); box-shadow: var(--shadow); }
.daily-slide.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft), var(--shadow); }
.ds-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--on-accent); position: relative; z-index: 1; }
.ds-ico svg { width: 17px; height: 17px; }
.ds-body { display: flex; flex-direction: column; min-width: 0; flex: 1; z-index: 1; }
.ds-title { font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; }
.ds-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-streak { font-size: 11px; font-weight: 700; color: var(--gold); display: flex; align-items: center; gap: 3px; z-index: 1; flex: none; }
.ds-go { color: var(--ink-4); z-index: 1; flex: none; display: inline-flex; }
.app[data-collapsed="true"] .daily-slide { justify-content: center; padding: 9px; }
.app[data-collapsed="true"] .ds-body, .app[data-collapsed="true"] .ds-streak, .app[data-collapsed="true"] .ds-go { display: none; }

/* daily challenge — quiz */
.qdots { display: flex; gap: 5px; }
.qdot { width: 7px; height: 7px; border-radius: 50%; background: var(--panel-hi); transition: 0.2s; }
.qdot.done { background: var(--teal); }
.qdot.now { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.quiz-q { font-family: var(--display); font-size: 20px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.choice.correct { border-color: var(--teal); background: var(--teal-soft); color: var(--ink); }
.choice.correct .choice-key { background: var(--teal); color: #06231f; border-color: transparent; }
.choice.wrong { border-color: var(--rose); background: var(--rose-soft); color: var(--ink); }
.choice.wrong .choice-key { background: var(--rose); color: #2a0a12; border-color: transparent; }
.choice:disabled { cursor: default; opacity: 1; }
.choice:disabled:hover { transform: none; }
.quiz-why { margin-top: 14px; padding: 12px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.55; border: 1px solid var(--line); }
.quiz-why.ok { background: var(--teal-soft); border-color: rgba(95, 227, 207, 0.3); }
.quiz-why.no { background: var(--rose-soft); border-color: rgba(245, 138, 163, 0.3); }
.quiz-why svg { vertical-align: -2px; }
.daily-score { font-family: var(--display); font-size: 64px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; margin: 6px 0 6px; background: linear-gradient(135deg, var(--gold), var(--violet)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rev-row { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.rev-row:first-child { border-top: none; }
.rev-ico { width: 22px; height: 22px; flex: none; border-radius: 7px; display: grid; place-items: center; }
.rev-ico.ok { background: var(--teal-soft); color: var(--teal); }
.rev-ico.no { background: var(--rose-soft); color: var(--rose); }

/* Polyglot roleplay — inline "hear it" speaker on a bot reply
   (the only Polyglot class not covered by the main block lower in this file) */
.rp-say {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; margin-left: 4px; vertical-align: -5px;
  cursor: pointer; transition: 0.15s; color: var(--teal);
  background: var(--panel-2); border: 1px solid var(--line);
}
.rp-say:hover { background: var(--teal-soft); border-color: rgba(95, 227, 207, 0.3); }

/* on-device model download banner */
.local-banner { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(440px, calc(100vw - 32px)); z-index: 220; background: rgba(17, 17, 30, 0.97); border: 1px solid var(--line-2); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-lg); backdrop-filter: blur(12px); animation: toastIn 0.35s var(--ease); }
.local-banner .lb-row { display: flex; align-items: center; gap: 10px; }
.local-banner .lb-text { flex: 1; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.local-banner .lb-pct { font-size: 13px; font-weight: 700; color: var(--violet); }

/* reduce motion */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }

/* =========================================================================
   BITS — wallet, dashboard orb & mystery presents
   ========================================================================= */
.wallet {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: 13px; cursor: pointer; font-family: inherit; color: var(--ink);
  background: linear-gradient(120deg, var(--gold-soft), transparent); border: 1px solid var(--line-2);
  position: relative; overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.wallet::after { content: ""; position: absolute; inset: 0; background: radial-gradient(200px 80px at 88% -20%, var(--gold-soft), transparent 70%); opacity: 0.7; pointer-events: none; }
.wallet:hover { transform: translateY(-1px); border-color: rgba(240, 192, 115, 0.45); box-shadow: var(--shadow); }
.wallet-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--on-accent); position: relative; z-index: 1; }
.wallet-ico svg { width: 17px; height: 17px; }
.wallet-body { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; z-index: 1; }
.wallet-amt { font-weight: 700; font-size: 15px; color: var(--ink); }
.wallet-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.app[data-collapsed="true"] .wallet { justify-content: center; padding: 9px; }
.app[data-collapsed="true"] .wallet-body { display: none; }

.bits-orb { width: 54px; height: 54px; flex: none; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--on-accent); box-shadow: 0 10px 28px -12px var(--gold-2); }
.bits-orb svg { width: 28px; height: 28px; }
.bits-orb.sm { width: 44px; height: 44px; border-radius: 13px; }
.bits-orb.sm svg { width: 23px; height: 23px; }

.present-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.present {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 11px;
  padding: 20px 10px 14px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--panel); cursor: pointer; font-family: inherit; color: var(--ink);
  overflow: hidden; transition: transform 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.present-glow { position: absolute; inset: 0; background: radial-gradient(120px 80px at 50% 0%, var(--gold-soft), transparent 70%); opacity: 0.6; pointer-events: none; }
.present:not(.revealed):hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--glow-gold); }
.present:not(.revealed):hover .gift { animation: giftShake 0.5s var(--ease); }
.present:disabled { cursor: default; }

.gift { position: relative; width: 62px; height: 58px; }
.gift-body { position: absolute; left: 5px; right: 5px; bottom: 0; height: 38px; border-radius: 6px; background: linear-gradient(160deg, #ffd98a, var(--gold-2)); box-shadow: inset 0 -7px 11px -7px rgba(0, 0, 0, 0.4); transition: background 0.4s; }
.gift-lid { position: absolute; left: 0; right: 0; top: 14px; height: 15px; border-radius: 6px; background: linear-gradient(160deg, #ffe6ab, var(--gold)); z-index: 2; box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.45); transition: transform 0.5s var(--ease), opacity 0.5s; }
.gift-ribbon { position: absolute; left: 50%; top: 6px; bottom: 0; width: 10px; margin-left: -5px; border-radius: 3px; background: linear-gradient(var(--violet), var(--violet-2)); z-index: 3; }
.gift-bow { position: absolute; left: 50%; top: -2px; width: 26px; height: 14px; margin-left: -13px; z-index: 4; transition: transform 0.5s var(--ease), opacity 0.5s; }
.gift-bow::before, .gift-bow::after { content: ""; position: absolute; top: 0; width: 12px; height: 13px; border: 3px solid var(--violet); border-radius: 70% 70% 55% 55%; }
.gift-bow::before { left: 0; transform: rotate(-20deg); }
.gift-bow::after { right: 0; transform: rotate(20deg); }

.present.revealed .gift-lid { transform: translateY(-32px) rotate(-16deg); opacity: 0; }
.present.revealed .gift-bow { transform: translateY(-36px) rotate(22deg); opacity: 0; }
.present.revealed .gift-body { background: linear-gradient(160deg, var(--panel-hi), var(--panel-2)); }

.present-q { font-family: var(--display); font-weight: 700; font-size: 21px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; min-height: 27px; }
.present.revealed .present-q { animation: coinPop 0.5s var(--ease) both; }
.present.won { border-color: var(--gold); box-shadow: var(--glow-gold); }
.present.won .present-q { color: var(--gold); font-size: 24px; }
.present.missed { opacity: 0.5; }
.prize-coin { color: var(--gold); display: inline-flex; }
.present-pick { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.present.won .present-pick { color: var(--gold); }

.reward-card .reward-ico svg { width: 30px; height: 30px; }
@media (max-width: 540px) { .present { padding: 16px 6px 12px; } .present-q { font-size: 18px; } }

/* =========================================================================
   ANIMATIONS
   ========================================================================= */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes giftShake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
@keyframes coinPop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.25); } 100% { transform: scale(1); opacity: 1; } }
.stagger > * { opacity: 0; animation: fadeUp 0.5s var(--ease) forwards; }
.stagger > *:nth-child(1){ animation-delay: .03s } .stagger > *:nth-child(2){ animation-delay: .08s }
.stagger > *:nth-child(3){ animation-delay: .13s } .stagger > *:nth-child(4){ animation-delay: .18s }
.stagger > *:nth-child(5){ animation-delay: .23s } .stagger > *:nth-child(6){ animation-delay: .28s }
.stagger > *:nth-child(7){ animation-delay: .33s } .stagger > *:nth-child(8){ animation-delay: .38s }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 980px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 100; transform: translateX(-104%); transition: transform 0.35s var(--ease); box-shadow: var(--shadow-lg); }
  .app[data-mobile-open="true"] .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar-search { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .view { padding: 22px 16px 50px; }
  .ws-toolbar { top: -22px; }   /* match the smaller mobile .view padding-top */
  .ws-timer-float { top: 62px; right: 16px; }
  .topbar { padding: 14px 16px; }
  .scrim-mobile { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; display: none; }
  .app[data-mobile-open="true"] .scrim-mobile { display: block; }
}
@media (max-width: 540px) {
  .crumb-title { font-size: 18px; }
  .page-hero h2 { font-size: 24px; }
}

/* =========================================================================
   SHOP / REWARDS
   ========================================================================= */
#shopTabs { flex-wrap: wrap; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; }
.shop-card { display: flex; flex-direction: column; gap: 5px; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); transition: 0.18s; }
.shop-card:hover { border-color: var(--line-2); background: var(--panel-2); transform: translateY(-2px); }
.shop-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft), var(--shadow); }
.shop-card-top { display: flex; align-items: flex-start; justify-content: space-between; min-height: 36px; }
.shop-ico { display: inline-flex; width: 34px; height: 34px; color: var(--gold); }
.shop-ico svg { width: 100%; height: 100%; }
.shop-emoji { font-size: 30px; line-height: 1; }
.shop-swatch { width: 34px; height: 34px; border-radius: 10px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 4px 14px -6px currentColor; }
.shop-feat { display: inline-flex; align-items: center; color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(240,192,115,.3); border-radius: 20px; padding: 3px 6px; }
.shop-feat svg { width: 11px; height: 11px; }
.shop-name { font-weight: 650; font-size: 14px; }
.shop-desc { font-size: 12px; color: var(--ink-3); line-height: 1.45; flex: 1; }
.shop-foot { margin-top: 9px; }
.shop-foot .btn, .shop-foot .chip { width: 100%; justify-content: center; }

.btn.teal { background: linear-gradient(135deg, var(--teal), #3fbfae); color: #06231f; border-color: transparent; }
.btn.teal:hover { filter: brightness(1.05); }

.spin-disc { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; align-items: center; justify-content: center; color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(240,192,115,.3); }
.spin-disc svg { width: 20px; height: 20px; }

.reward-pop { display: inline-flex; align-items: center; justify-content: center; color: var(--gold); margin: 8px 0; animation: rewardPop .5s var(--ease); }
.reward-pop svg { width: 42px; height: 42px; }
@keyframes rewardPop { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 60% { transform: scale(1.15) rotate(4deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }

/* prize wheel (animated) */
.wheel-wrap { position: relative; width: 252px; height: 252px; margin: 4px auto 2px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.wheel-svg { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; filter: drop-shadow(0 16px 30px rgba(0,0,0,.55)); }
.wheel-num { font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-size: 16px; fill: #0b0b15; }
.wheel-num.jackpot { font-size: 13.5px; fill: #4a3408; }
.wheel-pointer { position: absolute; top: -3px; left: 50%; width: 0; height: 0; margin-left: -13px; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 22px solid var(--gold); z-index: 3; filter: drop-shadow(0 3px 4px rgba(0,0,0,.55)); pointer-events: none; }
.wheel-hub { position: absolute; top: 50%; left: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; border: 3px solid var(--bg-2); background: radial-gradient(circle at 50% 32%, var(--gold), var(--gold-2)); color: #241803; font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .05em; cursor: pointer; z-index: 4; display: grid; place-items: center; box-shadow: 0 5px 16px -4px rgba(0,0,0,.65), inset 0 -3px 8px -3px rgba(0,0,0,.45); transition: transform .15s var(--ease); }
.wheel-wrap:hover .wheel-hub { transform: scale(1.06); }
.wheel-hub.on { animation: hubPulse 1s var(--ease) infinite; }
.wheel-hub.done { background: radial-gradient(circle at 50% 32%, var(--teal), #3fbfae); color: #06231d; font-size: 22px; }
@keyframes hubPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.wheel-result { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .45s var(--ease), opacity .4s var(--ease); }
.wheel-result.show { max-height: 200px; opacity: 1; margin-top: 6px; }
.reduce-motion .wheel-svg { transition: none !important; }

.locker-group { margin-bottom: 22px; }
.collectible { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; font-size: 26px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.redeem-code { font-family: var(--mono); font-size: 18px; letter-spacing: .06em; color: var(--gold); background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px; margin: 12px auto 0; max-width: 320px; word-break: break-all; }
.redeem-code.sm { font-size: 12px; padding: 5px 9px; margin: 0; display: inline-block; }
.dash-pet { font-size: .8em; margin-left: 6px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }

/* ===== Living companion: an animated, autonomously-roaming cat ===== */
.pet-floor { position: relative; height: 92px; margin: 16px 0 28px; max-width: 560px; }
.pet-rug { position: absolute; left: 0; right: 0; bottom: 8px; height: 22px; border-radius: 50%;
  background: radial-gradient(ellipse 58% 60% at 50% 52%, rgba(120,140,160,.18), transparent 72%); }
.pet-tag { position: absolute; left: 3px; bottom: -20px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.pet { position: absolute; bottom: 8px; left: 0; width: 96px; height: 76px; cursor: pointer; will-change: transform; }
.pet-bob { width: 100%; height: 100%; transform-origin: 50% 100%; transition: transform .4s ease; }
.pet-flip { width: 100%; height: 100%; transition: transform .18s ease; }
.pet.face-left .pet-flip { transform: scaleX(-1); }
.cat { width: 96px; height: auto; display: block; overflow: visible; filter: drop-shadow(0 4px 6px rgba(0,0,0,.28)); }
.cat-shadow { fill: rgba(0,0,0,.22); }
.pet-emoji { font-size: 54px; line-height: 1; display: block; filter: drop-shadow(0 5px 8px rgba(0,0,0,.4)); }
.pet:hover .pet-bob { transform: translateY(-2px); }

/* parts animate around their own box */
.cat-body, .cat-tail, .cat-ear, .cat-eyes, .cat-head { transform-box: fill-box; }
.cat-body { transform-origin: 50% 100%; animation: catBreathe 2.8s ease-in-out infinite; }
.cat-tail { transform-origin: 100% 100%; animation: catTail 3.4s ease-in-out infinite; }
.cat-ear.l { transform-origin: 50% 100%; animation: catEarL 7s ease-in-out infinite; }
.cat-ear.r { transform-origin: 50% 100%; animation: catEarR 9s ease-in-out infinite; }
.cat-eyes { transform-origin: 50% 50%; animation: catBlink 5s ease-in-out infinite; }
.cat-head { transform-origin: 50% 96%; animation: catLook 9s ease-in-out infinite; }
.cat-lids { opacity: 0; }

@keyframes catBreathe { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.04); } }
@keyframes catTail { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(9deg); } }
@keyframes catEarL { 0%,86%,100% { transform: rotate(0); } 90% { transform: rotate(-10deg); } 94% { transform: rotate(3deg); } }
@keyframes catEarR { 0%,80%,100% { transform: rotate(0); } 88% { transform: rotate(9deg); } 92% { transform: rotate(-3deg); } }
@keyframes catBlink { 0%,93%,100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }
@keyframes catLook { 0%,28%,100% { transform: rotate(0) translateX(0); } 46% { transform: rotate(2.5deg) translateX(1px); } 72% { transform: rotate(-2.5deg) translateX(-1px); } }
@keyframes catBob { 0%,100% { transform: translateY(0) rotate(-1.4deg); } 50% { transform: translateY(-5px) rotate(1.4deg); } }
@keyframes catGroom { 0%,100% { transform: rotate(0) translateY(0); } 40%,60% { transform: rotate(11deg) translateY(4px); } }
@keyframes catHop { 0% { transform: translateY(0); } 32% { transform: translateY(-17px); } 58% { transform: translateY(0); } 74% { transform: translateY(-5px); } 100% { transform: translateY(0); } }
@keyframes catStretch { 0% { transform: scale(1); } 42% { transform: translateX(5px) scaleX(1.16) scaleY(.86); } 100% { transform: scale(1); } }
@keyframes zfloat { 0% { opacity: 0; transform: translateY(0) scale(.6); } 22% { opacity: .95; } 100% { opacity: 0; transform: translateY(-24px) scale(1.15); } }
@keyframes heartUp { 0% { opacity: 0; transform: translateY(0) scale(.5); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-32px) scale(1.2); } }

/* states (driven by JS classes on .pet) */
.pet--walk .pet-bob { animation: catBob .42s ease-in-out infinite; }
.pet--walk .cat-tail { animation-duration: 1.4s; }
.pet--groom .cat-head { animation: catGroom 1.3s ease-in-out infinite; }
.pet--happy .pet-bob { animation: catHop .9s ease; }
.pet--stretch .pet-bob { animation: catStretch 1s ease; }
.pet--sleep .pet-bob { transform: translateY(9px) scaleY(.82) scaleX(1.07); }
.pet--sleep .cat-eye { opacity: 0; }
.pet--sleep .cat-eyes, .pet--sleep .cat-head, .pet--sleep .cat-ear { animation: none; }
.pet--sleep .cat-lids { opacity: 1; }
.pet--sleep .cat-body { animation-duration: 4.2s; }
.pet--sleep .cat-tail { animation: none; transform: rotate(15deg); }

.pet-z { position: absolute; left: 62px; top: -4px; display: none; font-family: var(--display); font-weight: 700; color: var(--gold); pointer-events: none; }
.pet--sleep .pet-z { display: block; }
.pet-z span { display: inline-block; opacity: 0; animation: zfloat 2.6s ease-in-out infinite; }
.pet-z span:nth-child(1) { font-size: 11px; }
.pet-z span:nth-child(2) { font-size: 14px; animation-delay: .55s; }
.pet-z span:nth-child(3) { font-size: 17px; animation-delay: 1.1s; }
.pet-heart { position: absolute; left: 52px; top: -2px; color: #ff6b81; font-size: 17px; pointer-events: none; animation: heartUp 1s ease forwards; text-shadow: 0 1px 3px rgba(0,0,0,.3); }

@media (prefers-reduced-motion: reduce) {
  .cat-body, .cat-tail, .cat-ear, .cat-eyes, .cat-head, .pet-bob, .pet-z span { animation: none !important; }
}

/* avatar frames */
.avatar.frame-bronze { box-shadow: 0 0 0 2px #b87333, 0 0 10px -2px #b87333; }
.avatar.frame-silver { box-shadow: 0 0 0 2px #c8cdd8, 0 0 10px -2px #c8cdd8; }
.avatar.frame-gold { box-shadow: 0 0 0 2px var(--gold), 0 0 12px -2px var(--gold); }
.avatar.frame-scholar { box-shadow: 0 0 0 2px var(--violet), 0 0 12px -2px var(--violet); }
.avatar.frame-neon { animation: neonPulse 1.6s ease-in-out infinite; }
@keyframes neonPulse { 0%,100% { box-shadow: 0 0 0 2px var(--teal), 0 0 8px 0 var(--teal); } 50% { box-shadow: 0 0 0 2px var(--violet), 0 0 18px 2px var(--violet); } }

/* memory-match mini-game */
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 280px; margin: 0 auto; }
.mem-card { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.16s; }
.mem-card:hover { background: var(--panel-hi); }
.mem-card .mem-face { color: var(--ink-3); }
.mem-card.flipped { background: var(--gold-soft); border-color: var(--gold); }
.mem-card.flipped .mem-face { color: var(--ink); }
.mem-card.done { opacity: .45; border-color: var(--teal); }

/* edu-comic reader */
.comic-panel { display: flex; gap: 12px; align-items: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 12px; padding: 18px; margin-top: 12px; min-height: 104px; }
.comic-panel svg { color: var(--gold); flex: none; margin-top: 2px; }
.comic-panel p { font-size: 15px; line-height: 1.65; color: var(--ink-2); }

/* aurora theme deepens the backdrop */
body[data-theme-bg="1"]::before {
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(122,108,240,.26), transparent 60%),
    radial-gradient(900px 650px at 8% 108%, rgba(95,227,207,.18), transparent 55%),
    radial-gradient(700px 700px at 100% 100%, rgba(118,198,255,.10), transparent 60%),
    linear-gradient(180deg, #07070f, #05050b);
}

/* =========================================================================
   ACHIEVEMENTS  (detail pane + searchable claim list)
   ========================================================================= */
.ach-shell { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .ach-shell { grid-template-columns: 1fr; } }

/* left detail pane */
.ach-detail { position: sticky; top: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 22px 18px; border-radius: var(--r-lg); background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); }
.ach-d-state { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.ach-d-state.claimable { color: var(--gold); }
.ach-d-state.claimed { color: var(--teal); }
.ach-d-ico { width: 64px; height: 64px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); background: var(--panel-hi); border: 1px solid var(--line); margin: 4px 0; }
.ach-d-ico svg { width: 32px; height: 32px; }
.ach-d-ico.claimable { color: var(--gold); background: var(--gold-soft); border-color: rgba(240,192,115,.32); box-shadow: 0 0 22px -6px var(--gold); }
.ach-d-ico.claimed { color: var(--teal); background: var(--teal-soft); border-color: rgba(95,227,207,.32); box-shadow: 0 0 22px -6px var(--teal); }
.ach-d-name { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.ach-d-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.ach-d-prog { display: flex; align-items: center; gap: 9px; width: 100%; margin: 6px 0 2px; }
.ach-d-prog .bar { flex: 1; }
.ach-d-prog .tnum { font-size: 11px; color: var(--ink-3); }
.ach-rewards { width: 100%; margin: 8px 0 14px; padding: 12px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); }
.ach-rewards .eyebrow { margin-bottom: 8px; }
.ach-reward-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.ach-reward-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(240,192,115,.28); border-radius: 20px; padding: 5px 11px; }
.ach-claim { margin-top: auto; }

/* right searchable list */
.ach-search { display: flex; align-items: center; gap: 8px; padding: 0 13px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); color: var(--ink-3); margin-bottom: 10px; }
.ach-search input { flex: 1; background: none; border: none; outline: none; color: var(--ink); font-family: inherit; font-size: 13.5px; padding: 11px 0; }
.ach-summary { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.ach-list { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 290px); overflow-y: auto; padding-right: 4px; }
.ach-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-family: inherit; transition: 0.16s; opacity: .82; }
.ach-row:hover { background: var(--panel-2); border-color: var(--line-2); }
.ach-row.sel { border-color: var(--line-2); box-shadow: inset 3px 0 0 var(--gold); }
.ach-row.claimable, .ach-row.claimed { opacity: 1; }
.ach-row-ico { flex: none; width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); background: var(--panel-hi); border: 1px solid var(--line); }
.ach-row.claimable .ach-row-ico { color: var(--gold); background: var(--gold-soft); border-color: rgba(240,192,115,.3); }
.ach-row.claimed .ach-row-ico { color: var(--teal); background: var(--teal-soft); border-color: rgba(95,227,207,.3); }
.ach-row-ico svg { width: 18px; height: 18px; }
.ach-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ach-row-name { font-weight: 650; font-size: 13.5px; }
.ach-row-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-row-prog { display: flex; align-items: center; gap: 8px; }
.ach-row-prog .bar { flex: 1; height: 6px; }
.ach-row-prog .tnum { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.ach-box { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; }
.ach-box.on { background: var(--teal); border-color: transparent; color: #06231f; }
.ach-box.ready { background: var(--gold); border-color: transparent; color: var(--on-accent); animation: achPulse 1.5s ease-in-out infinite; }
@keyframes achPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(240,192,115,.5); } 50% { box-shadow: 0 0 0 5px rgba(240,192,115,0); } }

/* ============ sidebar fit + signature banner (bottom) ============ */
.sidebar { height: 100vh; }   /* cap the sidebar to the viewport (.main already does this) ... */
.nav { min-height: 0; }       /* ...so nav scrolls internally and the bottom banner stays on screen */

.sidebar-banner { display: block; width: 100%; margin-top: 14px; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 26px -16px rgba(0, 0, 0, 0.7); opacity: 0.92; transition: opacity 0.25s var(--ease); }
.sidebar-banner:hover { opacity: 1; }
.sidebar-banner svg { display: block; width: 100%; height: auto; }
.app[data-collapsed="true"] .sidebar-banner { display: none; }

/* =========================================================================
   MISSIONS — deep-sea dive
   An immersive descent: sunlit teal at the surface fading to abyssal black,
   bioluminescent accents, a winding dive cable of mission nodes.
   ========================================================================= */
.missions {
  --sea-lume: #5fe3cf;
  --sea-lume-2: #56b8ff;
  --sea-glow: rgba(95, 227, 207, 0.5);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 30px 26px 40px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(820px 360px at 82% -8%, rgba(95, 227, 207, 0.14), transparent 60%),
    linear-gradient(180deg, #0b323f 0%, #0a2747 12%, #0c1c47 30%, #0a1338 50%, #080d2b 70%, #050a20 86%, #03060f 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), inset 0 40px 80px -40px rgba(120, 220, 255, 0.18);
}
.missions .view-inner { position: relative; z-index: 1; max-width: 880px; }

/* immersive single-zone tint while inside a dive */
.missions.dive-active {
  background:
    radial-gradient(700px 320px at 50% -10%, rgba(120, 220, 255, 0.12), transparent 60%),
    linear-gradient(180deg, var(--zone-deep, #0a1338) 0%, #070d24 64%, #03060f 100%);
}

/* light rays + drifting marine snow ------------------------------------- */
.dive-rays {
  position: absolute; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none; opacity: 0.55;
  mix-blend-mode: screen;
  background:
    linear-gradient(100deg, transparent 30%, rgba(120, 220, 255, 0.10) 38%, transparent 46%),
    linear-gradient(82deg, transparent 50%, rgba(150, 240, 220, 0.08) 58%, transparent 66%),
    linear-gradient(96deg, transparent 64%, rgba(120, 220, 255, 0.07) 72%, transparent 80%);
  animation: diveRays 15s ease-in-out infinite alternate;
}
@keyframes diveRays { from { transform: translateX(-12px); opacity: 0.35; } to { transform: translateX(12px); opacity: 0.6; } }
.dive-motes { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; border-radius: 50%; opacity: 0.5;
  background: radial-gradient(circle, rgba(155, 240, 255, 0.85), rgba(155, 240, 255, 0));
  animation: moteFloat ease-in-out infinite;
}
@keyframes moteFloat {
  0%, 100% { transform: translateY(7px) scale(0.8); opacity: 0.22; }
  50% { transform: translateY(-11px) scale(1.12); opacity: 0.85; }
}

/* hero: title + stats + depth gauge ------------------------------------- */
.dive-hero { display: grid; grid-template-columns: 1fr auto; gap: 26px; align-items: stretch; margin-bottom: 12px; }
.dive-title { font-family: var(--display); font-size: clamp(24px, 3.2vw, 34px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin-top: 6px; color: var(--ink); }
.dive-sub { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; max-width: 58ch; margin-top: 9px; }
.dive-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 17px; }
.dive-stat { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: var(--r); background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.dive-stat-ico { display: inline-flex; color: var(--sea-lume); }
.dive-stat-ico svg { width: 17px; height: 17px; }
.dive-stat-num { font-weight: 700; font-size: 15px; color: var(--ink); }
.dive-stat-lab { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.dive-gauge { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 86px; flex: none; }
.dive-gauge-mark { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.dive-gauge-track { position: relative; width: 12px; flex: 1; min-height: 156px; border-radius: 20px; background: linear-gradient(180deg, rgba(95, 227, 207, 0.12), rgba(3, 6, 15, 0.6)); border: 1px solid var(--line); }
.dive-gauge-fill { position: absolute; left: 0; right: 0; top: 0; border-radius: 20px 20px 8px 8px; background: linear-gradient(180deg, var(--sea-lume), var(--sea-lume-2)); box-shadow: 0 0 12px var(--sea-glow); transition: height 0.6s var(--ease); }
.dive-gauge-diver { position: absolute; left: 50%; transform: translate(-50%, -50%); color: var(--gold); filter: drop-shadow(0 0 6px rgba(240, 192, 115, 0.7)); transition: top 0.6s var(--ease); }

/* zone headers ----------------------------------------------------------- */
.dive-zone { position: relative; padding: 4px 0 8px; }
.dive-zone-head { display: flex; align-items: center; gap: 13px; padding: 20px 4px 8px; }
.dive-zone-badge { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; color: var(--zone-lume); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--zone-lume); box-shadow: 0 0 18px -5px var(--zone-lume); }
.dive-zone-name { display: block; font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--ink); letter-spacing: -0.01em; }
.dive-zone-depth { font-family: var(--mono); font-size: 11px; color: var(--zone-lume); margin-left: 7px; letter-spacing: 0.03em; }
.dive-zone-tag { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* the winding dive cable + mission nodes --------------------------------- */
.dive-path { position: relative; padding: 6px 0; }
.dive-path::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: linear-gradient(var(--zone-lume), transparent 97%); opacity: 0.38; }
.dive-stop {
  position: relative; display: grid; grid-template-columns: 1fr 76px 1fr; align-items: center; gap: 16px;
  width: 100%; margin: 0; padding: 13px 0; border: 0; background: none; cursor: pointer;
  font-family: inherit; color: inherit; text-align: left; -webkit-appearance: none; appearance: none;
}
.dive-stop:disabled { cursor: default; }
.dive-node { position: relative; grid-column: 2; justify-self: center; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: #06121f; background: linear-gradient(160deg, var(--zone-lume), var(--zone-deep)); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 9px 24px -9px var(--zone-lume), inset 0 -6px 12px -6px rgba(0, 0, 0, 0.5); transition: transform 0.2s var(--ease), box-shadow 0.3s; }
.dive-node-glow { position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; }
.dive-stop.open .dive-node-glow { box-shadow: 0 0 0 2px var(--zone-lume), 0 0 22px 1px var(--zone-lume); animation: divePulse 2.3s var(--ease) infinite; }
@keyframes divePulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.13); opacity: 1; } }
.dive-stop.cleared .dive-node { filter: saturate(0.85); color: #05231d; }
.dive-stop.locked .dive-node { background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)); color: var(--ink-4); box-shadow: inset 0 0 0 1px var(--line); }
.dive-stop.locked .dive-card { opacity: 0.5; }
.dive-stop:not(:disabled):hover .dive-node { transform: translateY(-3px) scale(1.05); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 28px 1px var(--zone-lume); }
.dive-stop:not(:disabled):hover .dive-card-name { color: #fff; }

.dive-card { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dive-stop.left .dive-card { grid-column: 1; align-items: flex-end; text-align: right; }
.dive-stop.right .dive-card { grid-column: 3; align-items: flex-start; text-align: left; }
.dive-card-n { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--zone-lume); opacity: 0.85; }
.dive-card-name { font-family: var(--display); font-weight: 600; font-size: 16px; color: var(--ink); letter-spacing: -0.01em; transition: color 0.2s; }
.dive-card-sub { font-size: 11.5px; color: var(--ink-3); }
.dive-stars { display: inline-flex; gap: 3px; margin-top: 3px; font-size: 12px; }
.dive-stars .ds { color: var(--ink-4); opacity: 0.45; }
.dive-stars .ds.on { color: var(--gold); opacity: 1; text-shadow: 0 0 8px rgba(240, 192, 115, 0.6); }

.dive-floor { display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 28px 0 4px; }
.dive-floor svg { color: var(--sea-lume); opacity: 0.7; }

/* a single dive (runner) ------------------------------------------------- */
.dive-run-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.dive-run-title { flex: 1; min-width: 0; }
.chip.dive-pay { color: var(--zone-lume); border-color: var(--zone-lume); }

.dive-result-stars { display: flex; justify-content: center; gap: 12px; margin: 8px 0 2px; }
.dive-result-stars .rs { font-size: 30px; color: var(--ink-4); opacity: 0.35; transform: scale(0.6); }
.dive-result-stars .rs.on { color: var(--gold); opacity: 1; text-shadow: 0 0 14px rgba(240, 192, 115, 0.7); animation: starPop 0.5s var(--ease) both; }
@keyframes starPop { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.3); } 100% { transform: scale(1) rotate(0); opacity: 1; } }

.dive-reward { display: flex; align-items: center; gap: 16px; }
.dive-reward.win { background: linear-gradient(120deg, var(--gold-soft), transparent); }
.dive-chest { width: 54px; height: 54px; border-radius: 14px; flex: none; display: grid; place-items: center; color: var(--gold); background: rgba(240, 192, 115, 0.1); border: 1px solid rgba(240, 192, 115, 0.3); box-shadow: 0 0 22px -6px rgba(240, 192, 115, 0.6); }
.dive-reward.win .dive-chest { animation: chestGlow 2.2s var(--ease) infinite; }
.dive-chest svg { width: 28px; height: 28px; }
.dive-chest.dim { color: var(--ink-4); background: rgba(255, 255, 255, 0.04); border-color: var(--line); box-shadow: none; }
.dive-reward-amt { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--gold); line-height: 1; }
.dive-reward-amt span { font-size: 14px; color: var(--ink-3); font-weight: 600; }
@keyframes chestGlow { 0%, 100% { box-shadow: 0 0 20px -8px rgba(240, 192, 115, 0.5); } 50% { box-shadow: 0 0 30px -2px rgba(240, 192, 115, 0.9); } }

/* responsive ------------------------------------------------------------- */
@media (max-width: 760px) {
  .dive-hero { grid-template-columns: 1fr; }
  .dive-gauge { display: none; }
}
@media (max-width: 640px) {
  .missions { padding: 24px 16px 34px; }
  .dive-path::before { left: 34px; }
  .dive-stop { grid-template-columns: 68px 1fr; gap: 13px; }
  .dive-stop .dive-node { grid-column: 1; }
  .dive-stop.left .dive-card, .dive-stop.right .dive-card { grid-column: 2; align-items: flex-start; text-align: left; }
  .dive-run-head { flex-wrap: wrap; }
}

/* respect reduced motion ------------------------------------------------- */
body.reduce-motion .mote,
body.reduce-motion .dive-rays,
body.reduce-motion .dive-stop.open .dive-node-glow,
body.reduce-motion .dive-reward.win .dive-chest,
body.reduce-motion .dive-result-stars .rs.on { animation: none; }
body.reduce-motion .dive-result-stars .rs { transform: none; opacity: 1; }
body.reduce-motion .dive-result-stars .rs:not(.on) { opacity: 0.35; }
@media (prefers-reduced-motion: reduce) {
  .mote, .dive-rays, .dive-node-glow, .dive-chest, .dive-result-stars .rs.on { animation: none !important; }
}

/* =========================================================================
   POLYGLOT — language course
   ========================================================================= */

/* ---- course picker ---- */
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 16px; }
.lang-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-family: inherit; color: var(--ink); transition: 0.18s; position: relative; overflow: hidden; }
.lang-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(420px 200px at 85% -30%, var(--teal-soft), transparent 70%); opacity: 0; transition: 0.3s; pointer-events: none; }
.lang-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.lang-card:hover::after { opacity: 1; }
.lang-flag { font-size: 40px; line-height: 1; }
.lang-meta { display: flex; flex-direction: column; }
.lang-native { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.lang-name { font-size: 12px; color: var(--ink-3); }
.lang-blurb { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; flex: 1; }
.lang-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; margin-top: 2px; }
.lang-foot-l { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.lang-bar { width: 100%; }
.sm-chip { padding: 2px 9px; font-size: 11px; }

/* ---- course home hero ---- */
.lang-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.lang-hero-flag { font-size: 54px; line-height: 1; flex: none; filter: drop-shadow(0 6px 16px rgba(0,0,0,.4)); }
.lang-hero-meta { flex: 1; min-width: 200px; }
.lang-hello { flex: none; }

/* course-track toggle (e.g. Chinese ↔ HSK) */
.track-toggle { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.track-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-3); background: none; border: none; cursor: pointer; transition: 0.16s; }
.track-btn svg { vertical-align: -2px; }
.track-btn:hover { color: var(--ink-2); }
.track-btn.active { color: var(--on-accent); background: linear-gradient(135deg, var(--gold), var(--gold-2)); box-shadow: 0 6px 16px -8px var(--gold-2); }
.lang-hsk-tag { position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; color: #1f0a04; background: linear-gradient(135deg, #e8956b, #e07a4e); box-shadow: 0 6px 14px -8px #e07a4e; }

/* HSK level picker — choose any level (HSK 1–6) and jump in.
   Pinned to the top of the scroll area so the level buttons stay reachable
   while the page below scrolls. */
.hsk-pick {
  position: sticky; top: 8px; z-index: 10;
  margin-bottom: 18px; padding: 11px 13px;
  background: color-mix(in srgb, var(--bg-1) 90%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.hsk-pick-label { font-size: 12px; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-bottom: 9px; }
.hsk-pick-label svg { vertical-align: -2px; }
.hsk-levels { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.hsk-level { flex: 0 0 auto; min-width: 96px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r); border: 1px solid var(--line); border-bottom: 3px solid var(--hl-c, var(--teal)); background: var(--panel); color: var(--ink); font-family: inherit; cursor: pointer; transition: 0.16s; }
.hsk-level:hover { background: var(--panel-2); transform: translateY(-2px); }
.hsk-level.active { border-color: var(--hl-c, var(--teal)); background: color-mix(in srgb, var(--hl-c) 16%, transparent); box-shadow: 0 0 0 1px var(--hl-c), var(--shadow); }
.hsk-level-t { font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.hsk-level-c { font-size: 10.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.hsk-level.active .hsk-level-c { color: var(--hl-c); }
.hsk-level.passed { border-bottom-color: var(--teal); }
.hsk-level.disabled { opacity: .4; cursor: not-allowed; filter: grayscale(.7); border-bottom-color: var(--line-2); }
.hsk-level.disabled:hover { background: var(--panel); transform: none; }

/* HSK exam — overview card */
.hsk-card { text-align: center; border-top: 3px solid var(--ch-c, var(--teal)); }
.hsk-card-badge { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; color: var(--ch-c, var(--teal)); background: color-mix(in srgb, var(--ch-c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--ch-c) 35%, transparent); }
.hsk-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 420px; margin: 18px auto 0; }
.hsk-stat { padding: 14px 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.hsk-stat-ico { color: var(--ch-c, var(--teal)); display: flex; justify-content: center; }
.hsk-stat-v { font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.hsk-stat-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-top: 2px; }
.hsk-reward-banner { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 16px auto 0; padding: 9px 16px; border-radius: 999px; font-size: 13px; color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(240,192,115,.3); }
.hsk-reward-banner svg { vertical-align: -2px; }
.hsk-reward-banner b { color: var(--ink); }
.hsk-tip { display: flex; gap: 8px; align-items: flex-start; text-align: left; max-width: 460px; margin: 18px auto 0; padding: 12px 15px; border-radius: var(--r); background: var(--violet-soft); border: 1px solid rgba(154,139,247,.25); font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.hsk-tip svg { color: var(--violet); flex: none; margin-top: 2px; }
.hsk-tip b { color: var(--violet); }

/* ── Mandarin · Tone Visual Trainer ─────────────────────────────────────── */
.tv-input { width: 100%; margin-top: 12px; padding: 13px 15px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); font-size: 20px; line-height: 1.5; font-family: var(--sans); resize: vertical; }
.tv-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

/* ===== Built-in pinyin IME (Chinese input for any keyboard) ===== */
.zime-bar { position: fixed; z-index: 1200; display: none; max-width: min(92vw, 560px); padding: 7px 8px; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); font-family: var(--sans); animation: zimePop .12s var(--ease); }
.zime-bar.show { display: flex; }
@keyframes zimePop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.zime-buf { flex: 0 0 auto; }
.zime-buf-py { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; color: var(--teal); background: var(--teal-soft); padding: 4px 9px; border-radius: 7px; white-space: nowrap; }
.zime-cands { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; align-items: center; }
.zime-cand { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border-radius: 9px; border: 1px solid transparent; background: var(--panel-2); color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s; }
.zime-cand:hover { background: var(--panel-hi); border-color: var(--line-2); }
.zime-cand:first-child { border-color: color-mix(in srgb, var(--teal) 38%, transparent); }
.zime-num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.zime-han { font-size: 19px; line-height: 1; }
.zime-empty { font-size: 12.5px; color: var(--ink-3); padding: 4px 2px; }
.zime-pager, .zime-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.zime-pg, .zime-tbtn { background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); border-radius: 7px; padding: 4px 9px; font-size: 12px; line-height: 1.4; cursor: pointer; transition: background .12s, color .12s; }
.zime-pg:hover, .zime-tbtn:hover { background: var(--panel-hi); color: var(--ink); }
.zime-tbtn.on { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }
.zime-pgn { font-size: 11px; color: var(--ink-3); font-family: var(--mono); min-width: 30px; text-align: center; }
.zime-hint { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); padding: 2px 2px 2px 4px; }
.zime-hint svg { color: var(--teal); flex: 0 0 auto; }
.zime-hint b { color: var(--ink); font-weight: 600; }
.zime-hint code { font-family: var(--mono); font-size: 11.5px; color: var(--teal); background: var(--teal-soft); padding: 1px 5px; border-radius: 5px; }
.zime-hint.off svg { color: var(--ink-4); }

.zime-picker { position: fixed; z-index: 1201; display: none; flex-direction: column; width: 420px; max-width: 92vw; max-height: min(58vh, 460px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; font-family: var(--sans); animation: zimePop .12s var(--ease); }
.zime-picker.show { display: flex; }
.zime-pk-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.zime-pk-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink); }
.zime-pk-x { background: none; border: none; color: var(--ink-3); cursor: pointer; padding: 3px; border-radius: 6px; display: flex; }
.zime-pk-x:hover { color: var(--ink); background: var(--panel-2); }
.zime-search { margin: 10px 12px 2px; padding: 9px 12px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px; font-family: var(--sans); }
.zime-search:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.zime-pk-body { overflow-y: auto; padding: 2px 12px 14px; }
.zime-pk-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 13px 2px 7px; }
.zime-pk-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.zime-pk-ch { min-width: 42px; padding: 7px 8px; font-size: 21px; line-height: 1; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s; }
.zime-pk-ch:hover { background: var(--panel-hi); }
.zime-pk-ch.ins, .zime-pk-row.ins { background: var(--teal-soft); border-color: var(--teal); }
.zime-pk-grid.punct .zime-pk-ch { font-size: 17px; min-width: 36px; }
.zime-pk-list { display: flex; flex-direction: column; gap: 4px; }
.zime-pk-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 9px; border: 1px solid transparent; background: var(--panel-2); color: var(--ink); cursor: pointer; text-align: left; }
.zime-pk-row:hover { background: var(--panel-hi); border-color: var(--line-2); }
.zime-pk-han { font-size: 18px; flex: 0 0 auto; }
.zime-pk-say { font-family: var(--mono); font-size: 12px; color: var(--teal); flex: 0 0 auto; }
.zime-pk-en { font-size: 12.5px; color: var(--ink-3); margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) {
  .zime-bar { border-radius: 12px 12px 0 0; max-width: none; }
  .zime-picker { width: auto !important; left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; max-width: none; border-radius: 14px 14px 0 0; max-height: 64vh; }
}
.tv-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.tv-leg { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); }
.tv-leg b { color: var(--lc); }
.tone-glyph { display: inline-block; vertical-align: middle; flex: none; width: 24px; height: 16px; }
.tv-glyph { width: 26px; height: 13px; margin-bottom: 1px; }
.tv-out { display: flex; flex-wrap: wrap; gap: 8px 4px; align-items: flex-end; min-height: 92px; padding: 20px 16px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); }
.tv-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 5px; border-radius: 10px; cursor: pointer; transition: background .15s var(--ease); }
.tv-cell[data-word]:hover { background: color-mix(in srgb, var(--tc) 18%, transparent); }
.tv-py { font-size: 12.5px; line-height: 1; font-weight: 600; color: var(--tc, var(--ink-3)); letter-spacing: .01em; }
.tv-han { font-size: 34px; line-height: 1.05; font-weight: 500; color: var(--tc, var(--ink)); }
.tv-unknown { cursor: default; opacity: .65; }
.tv-unknown .tv-han { color: var(--ink-3); }
.tv-unknown .tv-py { color: var(--ink-4); }
.tv-punct { font-size: 28px; line-height: 1; color: var(--ink-3); align-self: flex-end; padding: 0 2px 6px; }
.tv-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tv-stat { font-size: 12px; color: var(--ink-2); padding: 5px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.tv-stat b { color: var(--cc, var(--ink)); font-size: 13px; }
.tvq-han { font-family: var(--display); font-size: 58px; font-weight: 600; text-align: center; letter-spacing: .08em; color: var(--ink); margin: 10px 0 6px; }
.tvq-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 14px 0; }
.tvq-syl { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.tvq-syl-py { font-size: 15px; color: var(--ink-2); }
.tvq-syl-py .muted { font-size: 13px; }
.tvq-btns { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; max-width: 168px; }
.tvq-b { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 48px; height: 44px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-weight: 600; font-size: 12px; cursor: pointer; transition: all .12s var(--ease); }
.tvq-b .tvq-glyph { width: 26px; height: 12px; }
.tvq-b:hover:not(:disabled) { color: var(--ink); border-color: var(--bc, var(--teal)); }
.tvq-b.sel { border-color: var(--bc, var(--violet)); color: var(--ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bc, var(--violet)) 32%, transparent); }
.tvq-b.ok { background: var(--good); border-color: var(--good); color: #07271f; }
.tvq-b.no { background: var(--rose); border-color: var(--rose); color: #2a0a12; }
.tvq-b:disabled { cursor: default; }

/* ── Mandarin · Grammar Pattern Drill ───────────────────────────────────── */
.gr-wrap { display: grid; grid-template-columns: 244px 1fr; gap: 18px; align-items: start; }
.gr-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px; }
.gr-pat { text-align: left; padding: 10px 13px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: border-color .15s var(--ease), background .15s var(--ease); }
.gr-pat:hover { border-color: var(--line-2); }
.gr-pat.active { border-color: var(--gold); background: var(--gold-soft); }
.gr-pat-cn { font-size: 18px; font-weight: 600; color: var(--ink); font-family: var(--display); }
.gr-pat.active .gr-pat-cn { color: var(--gold); }
.gr-pat-gl { font-size: 11px; color: var(--ink-3); line-height: 1.3; }
.gr-big { font-family: var(--display); font-size: 40px; font-weight: 600; color: var(--gold); margin: 6px 0; letter-spacing: .04em; }
.gr-gloss { font-size: 14px; color: var(--ink); font-weight: 500; margin-bottom: 8px; }
.gr-drill { margin-top: 14px; }
.gr-dtype { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.gr-q { font-size: 22px; color: var(--ink); line-height: 1.7; }
.gr-blank { display: inline-block; min-width: 40px; border-bottom: 2px solid var(--gold); color: var(--gold); text-align: center; font-weight: 600; }
.gr-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.gr-opt, .gr-choice { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 16px; cursor: pointer; transition: border-color .12s var(--ease); }
.gr-choice { display: block; width: 100%; text-align: left; margin-top: 8px; }
.gr-opt:hover:not(:disabled), .gr-choice:hover:not(:disabled) { border-color: var(--gold); }
.gr-opt.ok, .gr-choice.ok { background: var(--good); border-color: var(--good); color: #07271f; }
.gr-opt.no, .gr-choice.no { background: var(--rose); border-color: var(--rose); color: #2a0a12; }
.gr-opt:disabled, .gr-choice:disabled { cursor: default; }
.gr-build { min-height: 50px; display: flex; flex-wrap: wrap; gap: 7px; padding: 11px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--line-2); align-items: center; }
.gr-bank { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.gr-chip { padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 16px; cursor: pointer; transition: border-color .12s var(--ease); }
.gr-chip:hover { border-color: var(--gold); }
.gr-chip.in { background: var(--gold-soft); border-color: rgba(240,192,115,.4); }
.gr-fb { margin-top: 12px; min-height: 4px; }
.gr-ok { color: var(--good); font-size: 14px; display: flex; align-items: center; gap: 7px; }
.gr-no { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.gr-no b { color: var(--gold); }
@media (max-width: 760px) { .gr-wrap { grid-template-columns: 1fr; } .gr-list { flex-direction: row; flex-wrap: wrap; position: static; } .gr-pat { flex: 1 1 140px; } }

/* ── Mandarin · 缩写 Summarization Trainer ───────────────────────────────── */
.sx-pickbtn.active { border-color: var(--rose); background: var(--rose-soft); color: var(--ink); }
.sx-passage { font-size: 18px; line-height: 2; color: var(--ink); padding: 18px 20px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); margin-top: 14px; text-align: justify; }
.sx-src { margin-top: 12px; }
.sx-src summary { cursor: pointer; font-size: 13px; color: var(--ink-3); }
.sx-src summary:hover { color: var(--ink-2); }
.sx-src .sx-passage { font-size: 15px; line-height: 1.8; }
.sx-card { margin-top: 16px; }
.sx-score { font-family: var(--display); font-size: 46px; font-weight: 600; color: var(--ink); line-height: 1; margin-top: 4px; }
.sx-score span { font-size: 15px; color: var(--ink-3); font-family: var(--sans); font-weight: 400; }
.sx-bars { display: flex; flex-direction: column; gap: 7px; min-width: 230px; flex: 1; max-width: 340px; }
.sx-bar-row { display: flex; align-items: center; gap: 10px; }
.sx-bar-l { font-size: 12px; color: var(--ink-2); width: 78px; flex: none; }
.sx-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.sx-bar span { display: block; height: 100%; border-radius: 999px; }
.sx-bar-n { font-size: 11.5px; color: var(--ink-3); width: 38px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.sx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.sx-h { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-bottom: 10px; }
.sx-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.sx-points li { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; line-height: 1.4; }
.sx-points li.on { color: var(--ink); } .sx-points li.on svg { color: var(--good); flex: none; margin-top: 2px; }
.sx-points li.off { color: var(--ink-3); } .sx-points li.off svg { color: var(--rose); flex: none; margin-top: 2px; }
.sx-annot { font-size: 16px; line-height: 1.9; color: var(--ink); padding: 14px 16px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); }
.sx-copied { background: var(--rose-soft); color: var(--rose); border-radius: 3px; padding: 0 1px; text-decoration: underline; text-decoration-color: var(--rose); }
.sx-tips { margin-top: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--violet-soft); border: 1px solid rgba(154,139,247,.22); }
.sx-tiplist { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.sx-tiplist li { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.sx-ai { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line-2); }
.sx-ai-body { font-size: 14px; line-height: 1.7; color: var(--ink); margin-top: 8px; }
@media (max-width: 760px) { .sx-grid { grid-template-columns: 1fr; } }

/* ── SUFE Finance · oral-exam simulator ─────────────────────────────────── */
.sf-tab.active { border-color: var(--rose); background: var(--rose-soft); color: var(--ink); }
.sf-prog { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.sf-dots { display: flex; gap: 5px; }
.sf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--panel-2); }
.sf-dot.cur { background: var(--rose); }
.sf-dot.done { background: var(--teal); }
.sf-prof { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; }
.sf-ava { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; color: var(--rose); background: var(--rose-soft); border: 1px solid rgba(245,138,163,.3); }
.sf-ava.big { width: 60px; height: 60px; margin: 0 auto; }
.sf-bubble { flex: 1; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; border-top-left-radius: 4px; padding: 13px 16px; }
.sf-prof-name { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.sf-q { font-size: 17px; line-height: 1.6; color: var(--ink); }
.sf-your, .sf-model { margin-top: 14px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); }
.sf-your { background: var(--panel); }
.sf-your-body { font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.sf-model { background: color-mix(in srgb, var(--teal) 7%, transparent); border-color: rgba(95,227,207,.22); }
.sf-model-body { font-size: 14.5px; line-height: 1.8; color: var(--ink); }
.sf-rate { margin-top: 16px; }
.sf-done { text-align: center; padding: 20px 10px; }
@media (max-width: 760px) { .sf-prog { justify-content: flex-start; } }

/* ── Concept Atlas · mastery legend ─────────────────────────────────────── */
.atlas-legend { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); }
.atlas-legend .alg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ── BrainGap · adaptive diagnostic ─────────────────────────────────────── */
.diag-flow, .diag-result { max-width: 640px; }
.diag-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.diag-prog { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin: 12px 0 18px; }
.diag-prog span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rose), var(--gold)); transition: width .3s var(--ease); }
.diag-q { font-size: 19px; line-height: 1.5; color: var(--ink); font-weight: 500; }
.diag-opts { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.diag-opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 15px; cursor: pointer; transition: border-color .12s var(--ease); }
.diag-opt:hover:not(:disabled) { border-color: var(--rose); }
.diag-opt.ok { background: var(--good); border-color: var(--good); color: #07271f; }
.diag-opt.no { background: var(--rose); border-color: var(--rose); color: #2a0a12; }
.diag-opt:disabled { cursor: default; }
.diag-fb { margin-top: 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.diag-fb.ok { color: var(--good); }
.diag-fb b { color: var(--ink); }
.diag-subj { font-size: 14px; }
.hsk-tierflag { font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.hsk-tierflag.t1 { color: var(--gold); background: var(--gold-soft); border: 1px solid rgba(240,192,115,.35); }
.hsk-tierflag.t2 { color: var(--rose); background: var(--rose-soft); border: 1px solid rgba(245,138,163,.35); }

/* HSK exam — runner */
.hsk-exam { display: flex; flex-direction: column; min-height: calc(100vh - 150px); max-width: 720px; margin: 0 auto; }
.hsk-exam-top { position: sticky; top: -22px; z-index: 6; display: flex; align-items: center; gap: 14px; padding: 14px 0 12px; background: linear-gradient(180deg, var(--bg-1) 70%, transparent); }
.hsk-timer { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
.hsk-timer.low { color: var(--rose); animation: heartShake 1s var(--ease) infinite; }
.hsk-grid { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 14px; }
.hsk-dot { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-3); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: 0.14s; }
.hsk-dot:hover { border-color: var(--line-2); }
.hsk-dot.done { background: var(--teal-soft); border-color: rgba(95,227,207,.4); color: var(--teal); }
.hsk-dot.cur { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); color: var(--ink); }
.hsk-stage { flex: 1; padding: 6px 0 20px; }
.hsk-q-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hsk-sec { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 4px 11px; border-radius: 999px; }
.hsk-sec.listening { color: var(--violet); background: var(--violet-soft); border: 1px solid rgba(154,139,247,.3); }
.hsk-sec.reading { color: var(--teal); background: var(--teal-soft); border: 1px solid rgba(95,227,207,.3); }
.hsk-sec.writing { color: var(--gold); background: rgba(240,192,115,.12); border: 1px solid rgba(240,192,115,.32); }
.hsk-instr { font-size: 13px; color: var(--ink-3); margin-bottom: 16px; }
/* passage / source text shown above a question (reading-comprehension, true-false, ordering) */
.hsk-passage { font-family: var(--display); font-size: 17px; line-height: 1.7; color: var(--ink-1); background: var(--panel-hi); border-left: 3px solid var(--ch-c, var(--teal)); border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; }
/* a full Chinese sentence prompt (fill-the-blank, etc.) — readable, not headline-sized */
.ex-q-zh { font-family: var(--display); font-size: clamp(19px, 4vw, 24px); font-weight: 600; line-height: 1.5; letter-spacing: -0.01em; }
.hsk-rev-en { font-size: 12px; margin-top: 3px; }

/* ===== HSK worksheet — black "paper", white text on screen; prints black-on-white ===== */
.ws-wrap { padding-bottom: 40px; }
/* top:-30px cancels .view's 30px padding-top so the pinned bar sits flush under
   the topbar — otherwise questions scroll into the gap above it (see mobile override). */
.ws-toolbar { position: sticky; top: -30px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 14px; margin-bottom: 8px; background: var(--bg-1); border-bottom: 1px solid var(--line-2); box-shadow: 0 8px 18px -10px rgba(0,0,0,.7); flex-wrap: wrap; transition: transform .28s var(--ease); will-change: transform; }
/* auto-hide: slide the bar up out of view on scroll-down, back in on scroll-up (toggled by JS) */
.ws-toolbar.ws-hidden { transform: translateY(-130%); }
/* enforced time-limit countdown (auto-submits at 0:00) */
.ws-timer { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 11px; min-width: 66px; text-align: center; }
.ws-timer.low { color: var(--rose); background: var(--rose-soft); border-color: rgba(245,138,163,.5); animation: heartShake 1s var(--ease) infinite; }
.ws-timer.up { color: #fff; background: var(--rose); border-color: var(--rose); }
/* when the clock hits 0 the paper is frozen — no more answering */
.ws-sheet.ws-locked .ws-opt { pointer-events: none; }
/* a duplicate timer that floats top-right ONLY while the toolbar is auto-hidden, so the clock is never lost */
.ws-timer-float { position: fixed; top: 78px; right: 30px; z-index: 30; opacity: 0; transform: translateY(-6px); pointer-events: none; box-shadow: var(--shadow); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.ws-timer-float.show { opacity: 1; transform: none; }

/* ===== FSRS spaced-repetition review ===== */
.srs-head { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.srs-pill { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-3); background: var(--panel); display: inline-flex; align-items: center; gap: 4px; }
.srs-pill svg { vertical-align: -1px; }
.srs-pill.due { color: var(--gold); border-color: rgba(240,192,115,.3); }
.srs-pill.new { color: var(--sky); border-color: rgba(118,198,255,.3); }
.srs-pill.done { color: var(--teal); border-color: rgba(95,227,207,.3); }
.srs-rate { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; width: 100%; }
.srs-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .14s var(--ease), background .14s, border-color .14s; }
.srs-btn:hover { transform: translateY(-2px); }
.srs-btn .srs-ivl { font-size: 11px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.srs-btn .srs-k { font-size: 9.5px; color: var(--ink-4); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-top: 1px; }
.srs-again { border-color: rgba(245,138,163,.45); } .srs-again:hover { background: var(--rose-soft); border-color: var(--rose); color: var(--rose); }
.srs-hard { border-color: rgba(240,192,115,.4); } .srs-hard:hover { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
.srs-good { border-color: rgba(95,227,207,.45); } .srs-good:hover { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.srs-easy { border-color: rgba(118,198,255,.45); } .srs-easy:hover { background: rgba(118,198,255,.14); border-color: var(--sky); color: var(--sky); }
.srs-badge { display: inline-block; background: var(--gold); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 800; margin-left: 5px; vertical-align: 1px; }
.ws-tb-mid { font-size: 13px; color: var(--ink-2); font-weight: 600; }
/* solid fills so Back / Reset / Check stay visible against the dark paper scrolling under the pinned bar */
.ws-toolbar .btn.ghost { background: var(--panel-2); border-color: var(--line-2); color: var(--ink); }
.ws-toolbar .btn.ghost:hover { background: var(--panel-hi); border-color: var(--line-2); }
.ws-sheet { background: #000; color: #fff; max-width: 880px; margin: 0 auto; padding: 46px 54px 56px; border-radius: 6px; border: 1px solid #2c2c2c; box-shadow: 0 10px 40px rgba(0,0,0,.6); font-family: "Noto Serif SC", Georgia, "Songti SC", serif; line-height: 1.6; }
.ws-sheet b { color: #fff; }
.ws-head { text-align: center; border-bottom: 2px solid #e8e8e8; padding-bottom: 18px; margin-bottom: 26px; }
.ws-title { font-size: 24px; font-weight: 700; letter-spacing: .01em; }
.ws-sub { font-size: 14px; color: #a8a8a8; margin-top: 4px; letter-spacing: .18em; text-transform: uppercase; }
.ws-notice { text-align: left; font-size: 12.5px; color: #dcdcdc; background: #141414; border: 1px solid #333; border-radius: 6px; padding: 12px 14px; margin-top: 18px; line-height: 1.7; }
.ws-section { margin-top: 30px; }
.ws-sec-h { font-size: 18px; font-weight: 700; color: #fff; border-left: 5px solid #fff; padding: 2px 0 2px 12px; margin: 0 0 14px; }
.ws-part { margin: 0 0 22px; padding-left: 4px; }
.ws-part-h { font-size: 14.5px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.ws-part-i { font-size: 12.5px; color: #a8a8a8; margin-bottom: 12px; }
.ws-item { margin: 0 0 13px; padding-left: 2px; }
.ws-item.open { margin-bottom: 18px; }
.ws-q { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.ws-n { font-weight: 700; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ws-stem { font-size: 15px; }
.ws-stem.zh { font-size: 17px; line-height: 1.7; }
.ws-passage { font-size: 16px; line-height: 1.85; background: #141414; border-left: 3px solid #555; border-radius: 5px; padding: 11px 14px; margin: 4px 0 9px; color: #dcdcdc; }
/* options are clickable on screen (radio per question), plain A/B/C text on print */
.ws-opts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0 0 26px; }
.ws-opt { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14.5px; font-family: inherit; color: #f4f4f4; background: #2b2b2b; border: 1px solid #6a6a6a; border-radius: 8px; padding: 6px 12px 6px 9px; cursor: pointer; text-align: left; line-height: 1.5; transition: background .12s, border-color .12s; }
.ws-opt:hover { background: #3a3a3a; border-color: #8a8a8a; }
.ws-ol { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; border-radius: 50%; border: 1px solid #8a8a8a; font-weight: 700; font-size: 12px; color: #eaeaea; flex: none; }
.ws-opt.sel { border-color: #5fe3cf; background: rgba(95,227,207,.16); }
.ws-opt.sel .ws-ol { background: #5fe3cf; border-color: #5fe3cf; color: #06231f; }
.ws-opt.correct { border-color: #3fbf8f; background: rgba(63,191,143,.20); }
.ws-opt.correct .ws-ol { background: #3fbf8f; border-color: #3fbf8f; color: #04140d; }
.ws-opt.wrong { border-color: #e06b67; background: rgba(224,107,103,.20); }
.ws-opt.wrong .ws-ol { background: #e06b67; border-color: #e06b67; color: #2a0a09; }
.ws-item.ws-active { background: rgba(95,227,207,.10); border-radius: 8px; box-shadow: 0 0 0 1.5px rgba(95,227,207,.55); }
.ws-kbd-hint { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .2px; }
.ws-input { font-family: inherit; font-size: 15px; width: 100%; max-width: 560px; margin: 7px 0 0 26px; padding: 7px 10px; border: 1px solid #3a3a3a; border-radius: 7px; background: #141414; color: #f0f0f0; }
.ws-textarea { font-family: inherit; font-size: 15px; width: 100%; margin: 7px 0 0; padding: 9px 11px; border: 1px solid #3a3a3a; border-radius: 7px; background: #141414; color: #f0f0f0; line-height: 1.7; resize: vertical; box-sizing: border-box; }
.ws-input:focus, .ws-textarea:focus { outline: none; border-color: #5fe3cf; box-shadow: 0 0 0 2px rgba(95,227,207,.22); }
.ws-ref { margin: 6px 0 0 26px; }
.ws-ref-in { display: inline-block; font-size: 13px; color: #9fe6b8; background: rgba(63,191,143,.14); border: 1px solid rgba(95,227,207,.3); border-radius: 6px; padding: 4px 9px; }
.ws-score { position: sticky; top: 4px; z-index: 4; max-width: 880px; margin: 0 auto 10px; background: var(--teal-soft); border: 1px solid rgba(95,227,207,.4); color: var(--ink-1); border-radius: 10px; padding: 11px 15px; font-size: 13.5px; line-height: 1.55; }
.ws-score-mut { color: var(--ink-3); }
.ws-audio { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 22px; border: 1px solid #3a3a3a; border-radius: 5px; background: #1c1c1c; color: #cccccc; cursor: pointer; vertical-align: middle; }
.ws-audio:hover { background: #262626; }
.print-only { display: none; }
.ws-lines { margin: 8px 0 0 26px; }
.ws-line { display: block; border-bottom: 1px solid #b9b9ab; height: 22px; }
.ws-key { margin-top: 34px; border-top: 2px dashed #444; padding-top: 18px; }
.ws-key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px 14px; font-size: 13px; }
.ws-key-i { color: #cfcfcf; }
.ws-key-i b { color: #fff; margin-right: 3px; }
@media print {
  @page { margin: 16mm; }
  body * { visibility: hidden !important; }
  #wsSheet, #wsSheet * { visibility: visible !important; }
  #wsSheet { position: absolute; left: 0; top: 0; width: 100%; max-width: none; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  /* print a clean black-on-white paper regardless of the dark on-screen theme */
  .ws-sheet { background: #fff !important; color: #000 !important; border: none !important; }
  .ws-sheet b, .ws-title, .ws-sec-h, .ws-part-h, .ws-n, .ws-stem, .ws-key-i b { color: #000 !important; }
  .ws-sub, .ws-part-i, .ws-notice, .ws-passage, .ws-key-i { color: #222 !important; }
  .ws-head { border-bottom-color: #16181d !important; }
  .ws-sec-h { border-left-color: #16181d !important; }
  .ws-notice { background: #f4f4ef !important; border-color: #e0e0d6 !important; }
  .ws-passage { background: #f6f6f1 !important; border-left-color: #b9b9ab !important; }
  /* options print as plain A/B/C text so the paper is a clean blank to write on */
  .ws-opts { gap: 4px 22px; }
  .ws-opt { border: none !important; background: transparent !important; padding: 0 !important; color: #000 !important; }
  .ws-opt .ws-ol { border: none; background: transparent !important; color: #000 !important; min-width: auto; }
  .ws-item.ws-active { background: none !important; box-shadow: none !important; }
  .ws-item, .ws-part-h, .ws-sec-h { page-break-inside: avoid; }
}

.hsk-listen { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 8px 0 24px; }
.hsk-foot-mid { font-size: 12px; text-align: center; flex: 1; }

/* HSK exam — result report */
.hsk-result { text-align: center; padding: 10px 6px; }
.hsk-stamp { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; font-family: var(--display); font-size: 30px; font-weight: 700; padding: 9px 26px; border-radius: 14px; border: 3px solid; transform: rotate(-5deg); margin: 10px 0 16px; letter-spacing: 2px; }
.hsk-stamp span { font-size: 11px; letter-spacing: 3px; font-family: var(--sans); font-weight: 700; }
.hsk-stamp.pass { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); text-shadow: 0 0 16px rgba(95,227,207,.4); animation: starPop 0.5s var(--ease) both; }
.hsk-stamp.fail { color: var(--rose); border-color: var(--rose); background: var(--rose-soft); }
.hsk-score { font-family: var(--display); font-size: 60px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; background: linear-gradient(135deg, var(--gold), var(--violet)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hsk-score span { font-size: 22px; -webkit-text-fill-color: var(--ink-3); }
.hsk-sections { max-width: 420px; margin: 20px auto 0; display: flex; flex-direction: column; gap: 10px; }
.hsk-sec-row { display: flex; align-items: center; gap: 12px; }
.hsk-sec-l { flex: 0 0 130px; text-align: left; font-size: 13px; font-weight: 600; }
.hsk-sec-bar { flex: 1; height: 9px; border-radius: 99px; background: var(--panel-hi); overflow: hidden; }
.hsk-sec-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #3fbfae); transition: width 0.7s var(--ease); }
.hsk-sec-n { flex: 0 0 44px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.hsk-review { max-width: 560px; margin: 20px auto 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.hsk-rev { display: flex; gap: 11px; padding: 11px 13px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); }
.hsk-rev.ok { border-color: rgba(95,227,207,.3); }
.hsk-rev.no { border-color: rgba(245,138,163,.3); background: var(--rose-soft); }
.hsk-rev-n { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--panel-hi); color: var(--ink-3); }
.hsk-rev-b { min-width: 0; }
.hsk-rev-q { font-size: 13.5px; }
.hsk-rev-a { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.hsk-rev-a svg { vertical-align: -2px; }
.hsk-rev.ok .hsk-rev-a svg { color: var(--teal); }
.hsk-rev.no .hsk-rev-a svg { color: var(--rose); }

/* ---- the winding path ---- */
.lp-path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 18px 0 8px; }
.lp-path::before { content: ""; position: absolute; top: 28px; bottom: 70px; left: 50%; width: 4px; transform: translateX(-50%); background: repeating-linear-gradient(180deg, var(--line-2) 0 9px, transparent 9px 20px); border-radius: 4px; z-index: 0; }
.lp-row { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 8px 0 18px; transform: translateX(var(--lp-x, 0)); }
.lp-node { position: relative; width: 80px; height: 74px; border: none; cursor: pointer; font-family: inherit; border-radius: 50% 50% 48% 48%; display: grid; place-items: center; color: var(--ink-2); background: linear-gradient(180deg, var(--panel-hi), var(--panel-2)); box-shadow: 0 7px 0 rgba(0,0,0,.4), inset 0 2px 3px rgba(255,255,255,.14); transition: transform 0.12s, box-shadow 0.12s; }
.lp-node:active { transform: translateY(4px); box-shadow: 0 3px 0 rgba(0,0,0,.4), inset 0 2px 3px rgba(255,255,255,.14); }
.lp-node-face { display: grid; place-items: center; }
.lp-node.done { color: var(--lp-on, #06231f); background: linear-gradient(180deg, var(--lp-c, var(--teal)), var(--lp-c2, #36b3a2)); box-shadow: 0 7px 0 var(--lp-sh, #1f7a6f), inset 0 2px 3px rgba(255,255,255,.4); }
.lp-node.active { color: var(--lp-on, var(--on-accent)); background: linear-gradient(180deg, var(--lp-c, var(--gold)), var(--lp-c2, var(--gold-2))); box-shadow: 0 7px 0 var(--lp-sh, #a9702a), inset 0 2px 3px rgba(255,255,255,.45); }
.lp-node.active::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid var(--lp-c, var(--gold)); opacity: 0.55; animation: lpPulse 1.9s var(--ease) infinite; }
.lp-node.locked { color: var(--ink-4); background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 6px 0 rgba(0,0,0,.35); cursor: default; }
.lp-node.custom { color: #fff; background: linear-gradient(180deg, var(--violet), var(--violet-2)); box-shadow: 0 7px 0 #4f43a8, inset 0 2px 3px rgba(255,255,255,.35); }
.lp-gold-ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 22px -2px var(--gold); pointer-events: none; }
.lp-crowns { display: flex; gap: 2px; height: 14px; }
.lp-pip { color: var(--ink-4); display: inline-flex; }
.lp-pip.on { color: var(--gold); filter: drop-shadow(0 0 4px rgba(240,192,115,.5)); }
.lp-label { font-family: var(--display); font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.lp-sub { font-size: 11.5px; color: var(--ink-3); }
.lp-start { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); background: var(--lp-c, var(--gold)); color: var(--lp-on, var(--on-accent)); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; padding: 5px 12px; border-radius: 9px; box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); animation: lpBob 1.6s var(--ease) infinite; z-index: 3; }
.lp-start::after { content: ""; position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--lp-c, var(--gold)); border-bottom: 0; }

/* chapter (unit) banners */
.lp-chapter { width: 100%; max-width: 460px; margin: 26px 0 14px; padding: 16px 18px; border-radius: var(--r-lg); position: relative; z-index: 1; background: linear-gradient(135deg, color-mix(in srgb, var(--ch-c) 22%, transparent), color-mix(in srgb, var(--ch-c) 8%, transparent)); border: 1px solid color-mix(in srgb, var(--ch-c) 38%, transparent); box-shadow: var(--shadow); }
.lp-chapter:first-child { margin-top: 4px; }
.lp-chapter.locked { background: var(--panel); border-color: var(--line); filter: saturate(0.5); opacity: 0.75; }
.lp-ch-top { display: flex; align-items: center; justify-content: space-between; }
.lp-ch-eyebrow { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; color: var(--ch-c); }
.lp-ch-count { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--ch-c); }
.lp-ch-lock { color: var(--ink-4); display: inline-flex; }
.lp-ch-title { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin-top: 3px; }
.lp-ch-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.lp-ch-bar { height: 6px; border-radius: 99px; background: rgba(0,0,0,.28); overflow: hidden; margin-top: 11px; }
.lp-ch-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--ch-c); box-shadow: 0 0 8px var(--ch-c); transition: width 0.6s var(--ease); }

/* ---- start popover ---- */
.start-pop .start-ico { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 10px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border: 1px solid rgba(95,227,207,.3); }

/* ---- lesson shell ---- */
.lesson-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 150px); max-width: 700px; margin: 0 auto; }
.lesson-top { position: sticky; top: -22px; z-index: 6; display: flex; align-items: center; gap: 14px; padding: 14px 0 12px; background: linear-gradient(180deg, var(--bg-1) 70%, transparent); }
.lesson-x { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); color: var(--ink-3); cursor: pointer; transition: 0.15s; }
.lesson-x:hover { color: var(--ink); background: var(--panel-2); }
.lesson-bar { flex: 1; height: 14px; border-radius: 99px; background: var(--panel-hi); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.3); }
.lesson-bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #3fbfae); box-shadow: 0 0 10px var(--teal); transition: width 0.4s var(--ease); }
.hearts { display: flex; gap: 2px; flex: none; }
.hearts.lose { animation: heartShake 0.4s var(--ease); }
.heart { transition: 0.2s; }
.heart.on { color: var(--rose); }
.heart.off { color: var(--ink-4); opacity: 0.5; }
.lesson-quit { border-color: rgba(245,138,163,.5); color: var(--rose); background: transparent; }
.lesson-quit:hover { background: var(--rose-soft); }

/* ---- exercise stage ---- */
.lesson-stage { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 14px 0 24px; }
.ex-head { margin-bottom: 18px; }
.ex-kicker { font-size: 13px; font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.ex-kicker svg { vertical-align: -2px; }
.ex-prompt { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.ex-q { font-family: var(--display); font-size: clamp(28px, 6vw, 40px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; }
.ex-q-sm { font-family: var(--display); font-size: clamp(20px, 4.5vw, 26px); font-weight: 600; letter-spacing: -0.01em; }
.ex-say { width: 48px; height: 48px; border-radius: 14px; border: 1px solid rgba(95,227,207,.4); background: var(--teal-soft); color: var(--teal); cursor: pointer; display: grid; place-items: center; flex: none; transition: 0.15s; }
.ex-say:hover { transform: scale(1.05); }
.ex-choices { display: grid; gap: 10px; }
.ex-tip { text-align: center; color: var(--ink-3); font-size: 12.5px; margin-top: 16px; }

/* ---- flashcard (new-word intro) ---- */
.flashcard { position: relative; text-align: center; padding: 32px 24px; border-radius: var(--r-lg); border: 1px solid var(--line); background: radial-gradient(130% 130% at 50% -10%, var(--teal-soft), transparent 55%), var(--panel); }
.flash-term { font-family: var(--display); font-size: clamp(30px, 7vw, 46px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.flash-say { font-family: var(--mono); font-size: 14px; color: var(--teal); margin-top: 10px; }
.flash-en { font-size: 16px; color: var(--ink-2); margin-top: 14px; }
.flash-audio { margin: 20px auto 0; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(95,227,207,.4); background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; cursor: pointer; transition: 0.15s; }
.flash-audio:hover { transform: scale(1.06); box-shadow: 0 0 22px -6px var(--teal); }

/* ---- listen ---- */
.listen-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px 0 26px; }
.listen-btn { width: 120px; height: 120px; border-radius: 50%; border: none; cursor: pointer; background: linear-gradient(135deg, var(--teal), #3fbfae); color: #06231f; display: grid; place-items: center; box-shadow: 0 16px 36px -12px var(--teal); transition: 0.15s; }
.listen-btn:hover { transform: scale(1.04); }
.listen-btn:active { transform: scale(0.96); }
.listen-slow { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-3); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.listen-slow:hover { color: var(--ink); background: var(--panel-2); }

/* ---- word bank ---- */
.wb-answer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 56px; padding: 12px 6px; border-bottom: 2px solid var(--line); margin: 4px 0 20px; transition: border-color 0.2s; }
.wb-answer.ok { border-color: var(--teal); }
.wb-answer.no { border-color: var(--rose); }
.wb-placeholder { color: var(--ink-4); font-size: 13px; }
.wb-bank { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.tile-word { padding: 9px 15px; border-radius: 12px; border: 1px solid var(--line-2); border-bottom-width: 3px; background: var(--panel-2); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.12s, transform 0.08s; }
.tile-word:hover { background: var(--panel-hi); }
.tile-word:active { transform: translateY(2px); border-bottom-width: 1px; }
.tile-word.used { visibility: hidden; }
.tile-word:disabled { cursor: default; }

/* ---- match pairs ---- */
.match-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; max-width: 480px; margin: 0 auto; }
.match-cell { padding: 16px 12px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 3px; background: var(--panel); color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: 0.14s; }
.match-cell:hover { border-color: var(--line-2); background: var(--panel-2); }
.match-cell.sel { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.match-cell.done { border-color: transparent; background: var(--panel-2); color: var(--ink-4); opacity: 0.4; pointer-events: none; }
.match-cell.bad { border-color: var(--rose); background: var(--rose-soft); animation: exShake 0.4s; }

/* ---- check footer ---- */
.lesson-foot { position: sticky; bottom: 0; margin-top: auto; }
.lesson-foot.show { padding: 16px 2px; border-top: 1px solid var(--line); background: var(--bg-1); }
.lesson-foot.ok { border-color: rgba(95,227,207,.45); background: linear-gradient(0deg, var(--teal-soft), var(--bg-1) 80%); }
.lesson-foot.no { border-color: rgba(245,138,163,.45); background: linear-gradient(0deg, var(--rose-soft), var(--bg-1) 80%); }
.cf-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 680px; margin: 0 auto; }
.cf-text { display: flex; align-items: center; gap: 11px; font-size: 14px; min-width: 0; }
.cf-text b { font-size: 15px; }
.cf-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--panel-hi); color: var(--ink-2); }
.lesson-foot.ok .cf-ico { background: var(--teal); color: #06231f; }
.lesson-foot.no .cf-ico { background: var(--rose); color: #2a0a12; }
.lesson-foot.ok .cf-text { color: var(--teal); }
.lesson-foot.no .cf-text { color: var(--rose); }
.cf-lines { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cf-detail { font-size: 12.5px; font-weight: 400; color: var(--ink-2); white-space: normal; }
.lesson-cta { flex: none; padding: 13px 30px; border-radius: 13px; border: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0.01em; color: var(--on-accent); background: linear-gradient(135deg, var(--gold), var(--gold-2)); box-shadow: 0 10px 24px -12px var(--gold-2); transition: filter 0.15s, transform 0.1s; }
.lesson-cta:hover { filter: brightness(1.05); }
.lesson-cta:active { transform: translateY(1px); }
.lesson-foot.ok .lesson-cta { background: linear-gradient(135deg, var(--teal), #3fbfae); color: #06231f; box-shadow: 0 10px 24px -12px var(--teal); }
.lesson-foot.no .lesson-cta { background: linear-gradient(135deg, var(--rose), #e0657f); color: #2a0a12; box-shadow: 0 10px 24px -12px var(--rose); }

/* ---- combo + completion ---- */
.combo-burst { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: var(--gold); color: var(--on-accent); font-weight: 800; font-size: 13px; box-shadow: 0 12px 28px -10px var(--gold-2); z-index: 5; animation: comboPop 1.1s var(--ease) both; }
.combo-burst svg { vertical-align: -2px; }
.lesson-done { text-align: center; padding: 16px 10px 8px; }
.ld-burst { width: 90px; height: 90px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; color: var(--gold); background: radial-gradient(circle, var(--gold-soft), transparent 70%); animation: rewardPop 0.6s var(--ease) both; }
.ld-crown { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 7px 15px; border-radius: 999px; background: var(--gold-soft); border: 1px solid rgba(240,192,115,.3); color: var(--gold); font-weight: 600; font-size: 13px; }
.lc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 420px; margin: 24px auto 0; }
.lc-stat { padding: 16px 8px; border-radius: var(--r); border: 1px solid var(--line); border-top: 3px solid var(--sc, var(--gold)); background: var(--panel); }
.lc-stat-ico { color: var(--sc, var(--gold)); display: flex; justify-content: center; }
.lc-stat-val { font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--ink); margin-top: 5px; letter-spacing: -0.01em; }
.lc-stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin-top: 3px; }

@keyframes lpPulse { 0% { transform: scale(1); opacity: 0.55; } 70% { transform: scale(1.22); opacity: 0; } 100% { opacity: 0; } }
@keyframes lpBob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-4px); } }
@keyframes heartShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes exShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes comboPop { 0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.7); } 16% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.06); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(0.95); } }

@media (max-width: 560px) {
  .lp-row { transform: translateX(calc(var(--lp-x, 0) * 0.62)); }
  .lp-node { width: 70px; height: 64px; }
  .lc-stats { gap: 8px; }
  .lc-stat-val { font-size: 20px; }
  .cf-detail { display: none; }
  .lesson-cta { padding: 12px 22px; }
}

body.reduce-motion .lp-node.active::after,
body.reduce-motion .lp-start,
body.reduce-motion .combo-burst { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .lp-node.active::after, .lp-start, .combo-burst, .ld-burst { animation: none !important; }
}


/* ===== Finance Chinese track (SUFE vocab) ===== */
.fin-cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.fin-cat { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s; }
.fin-cat:hover { background: var(--panel-2); }
.fin-cat.active { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, transparent); }
.fin-cat b { font-size: 15px; color: var(--ink); }
.fin-cat span { font-size: 11px; color: var(--ink-3); }
.fin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.fin-card { position: relative; padding: 16px 16px 14px; border-radius: var(--r); background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--cc); }
.fin-card-top { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 8px; }
.fin-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.fin-dot.new { background: var(--ink-4); }
.fin-dot.due { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.fin-dot.known { background: var(--teal); }
.fin-say { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--cc, var(--teal)); cursor: pointer; transition: background .12s; }
.fin-say:hover { background: var(--panel-hi); }
.fin-say.big { width: 34px; height: 34px; }
.fin-han { font-size: 27px; line-height: 1.15; color: var(--ink); font-weight: 500; }
.fin-han.big { font-size: 54px; text-align: center; margin: 6px 0; }
.fin-py { font-family: var(--mono); font-size: 13px; color: var(--cc, var(--teal)); margin-top: 3px; }
.fin-han.big + .fin-py, .fin-study-card .fin-py { text-align: center; }
.fin-en { font-size: 14px; color: var(--ink-2); margin-top: 5px; }
.fin-ex { font-size: 14px; color: var(--ink); margin-top: 10px; line-height: 1.6; }
.fin-exen { font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.fin-study-card { text-align: center; padding: 26px 18px; margin: 16px 0; border-radius: var(--r-lg); background: var(--bg-2); border: 1px solid var(--line); border-top: 3px solid var(--cc); }
.fin-study-card .fin-say { margin: 0 auto 4px; }
.fin-reveal { margin-top: 12px; }
.fin-reveal .fin-en { font-size: 16px; }
.fin-reveal .fin-ex, .fin-reveal .fin-exen { text-align: center; }
.fin-quiz-q { text-align: center; margin: 14px 0 6px; }
.fin-quiz-q .fin-say { margin: 0 auto 6px; }
.fin-quiz-q .fin-py { text-align: center; }
.fin-opts { display: grid; gap: 8px; margin-top: 10px; }
.fin-opt { text-align: left; padding: 12px 15px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 14px; cursor: pointer; transition: background .12s, border-color .12s; }
.fin-opt:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line-2); }
.fin-opt:disabled { cursor: default; }
.fin-opt.ok { background: color-mix(in srgb, var(--good) 16%, transparent); border-color: var(--good); }
.fin-opt.no { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: var(--bad); }

/* ============================================================ INSIGHTS · learner model + retention */
.ins-list { display: flex; flex-direction: column; }
.ins-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ins-row:last-child { border-bottom: 0; }
.ins-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(255,255,255,.04); }
.ins-ring { position: relative; display: grid; place-items: center; flex: none; }
.ins-ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ins-load { display: flex; align-items: flex-end; gap: 5px; height: 86px; padding: 6px 0 0; }
.ins-loadcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.ins-loadbar { width: 100%; max-width: 22px; min-height: 2px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, var(--violet), var(--violet-2)); transition: height .5s var(--ease); }

/* ============================================================ ROLEPLAY */
.rp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; cursor: pointer; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; position: relative; overflow: hidden; }
.rp-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--rp-c, var(--teal)); opacity: .7; }
.rp-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow); }
.rp-flag { font-size: 32px; line-height: 1; margin-bottom: 10px; }
.rp-card h3 { font-family: var(--display); font-size: 17px; font-weight: 600; margin: 0; }
.rp-cn { font-size: 13px; color: var(--rp-c, var(--teal)); margin-top: 2px; }
.rp-card p { color: var(--ink-3); font-size: 12.5px; line-height: 1.5; margin: 10px 0 0; }
.rp-go { margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--rp-c, var(--teal)); display: inline-flex; align-items: center; gap: 5px; }
.rp-ava { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.rp-goal { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-bottom: 12px; }
.rp-goal .eyebrow { display: inline; margin-right: 6px; }
.rp-targets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.rp-tw { font-family: var(--display); font-size: 15px; padding: 2px 9px; border-radius: 8px; background: var(--gold-soft); border: 1px solid rgba(240,192,115,.3); color: var(--ink); cursor: default; }
.rp-say { margin-left: 8px; background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 2px; vertical-align: middle; border-radius: 6px; }
.rp-say:hover { color: var(--gold); background: var(--panel-hi); }
.rp-tips { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; line-height: 1.7; }

/* ============================================================ PRONUNCIATION */
.pr-word { text-align: center; padding: 14px 0 4px; }
.pr-han { font-family: var(--display); font-size: 56px; font-weight: 600; line-height: 1.1; }
.pr-say { font-size: 15px; margin-top: 4px; }
.pr-fb { margin-top: 14px; min-height: 8px; }
.pr-result { max-width: 360px; margin: 0 auto; }
.btn.pr-mic.listening { background: linear-gradient(135deg, var(--rose), #e0657f); color: #2a0a12; animation: prPulse 1.1s ease-in-out infinite; }
@keyframes prPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,138,163,.5); } 50% { box-shadow: 0 0 0 9px rgba(245,138,163,0); } }
body.reduce-motion .btn.pr-mic.listening { animation: none; }
@media (prefers-reduced-motion: reduce) { .btn.pr-mic.listening { animation: none; } }

/* ============================================================ OFFLINE STATUS CHIP */
.off-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink-2); }
.off-chip.off { background: var(--rose-soft); border-color: rgba(245,138,163,.4); color: #f9b8c6; }
.off-chip.sync { background: var(--teal-soft); border-color: rgba(95,227,207,.4); color: var(--teal); }
