/* ============================================================
   Luyện Vocab — thiết kế editorial / từ điển
   Nền giấy ấm · serif display · hairline · spine màu nhóm
   ============================================================ */
:root {
  --font-body: "Be Vietnam Pro", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Lora", "Be Vietnam Pro", Georgia, serif;

  --paper: #f7f5f0;
  --paper-2: #efede5;
  --card: #ffffff;
  --ink: #1d2030;
  --ink-2: #4a4f64;
  --ink-3: #666b84;
  --line: #e4e1d6;
  --line-2: #d5d2c4;

  --accent: #343cc9;
  --accent-soft: #eceefb;
  --accent-ink: #28309e;
  --gold: #b07d16;
  --ok: #137a56;
  --ok-soft: #e5f4ed;
  --bad: #bd3d1f;
  --bad-soft: #fbeae4;
  --warn: #9a6b0b;
  --warn-soft: #faf1dc;

  --spine-1: #343cc9; /* indigo */
  --spine-2: #0e7c86; /* teal */
  --spine-3: #b07d16; /* gold */
  --spine-4: #b3452c; /* brick */
  --spine-5: #5f3dc4; /* violet */
  --spine-6: #2f7d4f; /* green */
  --spine-7: #a0336b; /* plum */
  --spine-8: #4a6fa5; /* steel */

  --shadow-1: 0 1px 2px rgba(29, 32, 48, .04);
  --shadow-2: 0 2px 4px rgba(29, 32, 48, .05), 0 12px 32px -14px rgba(29, 32, 48, .16);

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 16px;
  --topbar-h: 60px;
}
html[data-theme="dark"] {
  --paper: #12141f;
  --paper-2: #1a1d2c;
  --card: #191c2a;
  --ink: #eef0f7;
  --ink-2: #b6bcd2;
  --ink-3: #8b92ac;
  --line: #272b3d;
  --line-2: #343950;

  --accent: #9aa2f2;
  --accent-soft: #232645;
  --accent-ink: #b7befa;
  --gold: #d9a83f;
  --ok: #57c695;
  --ok-soft: #15342a;
  --bad: #e27b5f;
  --bad-soft: #3a2119;
  --warn: #d3a03e;
  --warn-soft: #362c14;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 14px 36px -14px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
h1, h2, h3 { letter-spacing: -.01em; }
a { color: var(--accent-ink); text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- khung ---------- */
main { min-height: calc(100vh - var(--topbar-h)); }
.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 72px; }
.container.narrow { max-width: 720px; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; display: block; object-fit: cover; }
.brand-mark {
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  font-size: 1.3rem; color: var(--accent-ink); letter-spacing: -.02em;
}
.brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); align-self: center; }
.brand-name { font-weight: 600; font-size: .82rem; color: var(--ink-3); letter-spacing: .02em; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  color: var(--ink-2); font-weight: 500; font-size: .9rem;
  padding: 7px 13px; border-radius: 99px; transition: all .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.nav a svg { width: 15px; height: 15px; }
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a.active { color: var(--paper); background: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 37px; height: 37px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); cursor: pointer;
  display: grid; place-items: center; transition: all .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--card); }
.icon-btn.pinned { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--line)); }
.menu-btn { display: none; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  background: var(--warn-soft); color: var(--warn);
  font-size: .84rem; font-weight: 600; padding: 5px 12px; border-radius: 99px;
}
.streak-chip svg { width: 14px; height: 14px; }

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--ink); cursor: pointer; font-weight: 600; font-size: .92rem;
  padding: 10px 20px; border-radius: 10px; transition: all .15s;
  background: var(--ink); color: var(--paper);
  box-shadow: var(--shadow-1);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { border-color: var(--ink); }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; box-shadow: none; }
.btn.soft:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.lg { padding: 13px 26px; font-size: 1rem; border-radius: 12px; }
.btn.sm { padding: 7px 13px; font-size: .83rem; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- icon hệ thống ---------- */
.ico { display: inline-flex; flex: none; }
.ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.s svg { width: 14px; height: 14px; }
.ico.l svg { width: 22px; height: 22px; }

/* ---------- layout khối ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px; box-shadow: var(--shadow-1); }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; line-height: 1.2; }
.page-head .sub { color: var(--ink-2); margin: 5px 0 0; font-size: .92rem; }
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 34px 0 14px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.28rem; font-weight: 700; }
.section-head .rule { flex: 1; height: 1px; background: var(--line); }
.section-head .count { font-size: .8rem; color: var(--ink-3); font-weight: 500; }
.section-head a { font-size: .85rem; font-weight: 600; }

/* ---------- hero trang chủ ---------- */
.hero { padding: 44px 0 8px; max-width: 720px; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: 6px 0 0 -24px; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.5px);
  background-size: 22px 22px;
  mask-image: linear-gradient(120deg, #000 30%, transparent 75%);
  -webkit-mask-image: linear-gradient(120deg, #000 30%, transparent 75%);
}
.hero h1, .hero p, .hero-cta, .hero-note { position: relative; z-index: 1; }
.hero-lockup { display: flex; align-items: center; gap: 30px; position: relative; z-index: 1; }
.hero-logo {
  display: block; width: 148px; height: 148px; flex: none;
  border-radius: 30px; border: 1px solid var(--line);
  box-shadow: var(--shadow-2); object-fit: cover;
}
.hero-text { min-width: 0; }
.hero-text h1 { margin: 0 0 14px; font-family: var(--font-display); }
.hero-text p { margin: 0 0 24px; font-size: 1.02rem; color: var(--ink-2); max-width: 560px; }
.hero h1 {
  margin: 0 0 14px; font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 600; line-height: 1.14; letter-spacing: -.015em;
}
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.hero p { margin: 0 0 24px; font-size: 1.02rem; color: var(--ink-2); max-width: 560px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-note { display: flex; gap: 18px; margin-top: 18px; color: var(--ink-3); font-size: .82rem; flex-wrap: wrap; }
.hero-note span { display: inline-flex; gap: 6px; align-items: center; }
.hero-note svg { width: 14px; height: 14px; }

/* ---------- dải số liệu ---------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-l);
  overflow: hidden; margin: 30px 0 8px;
}
.stat { background: var(--card); padding: 16px 20px; }
.stat .stat-ico {
  width: 34px; height: 34px; border-radius: 10px; margin-bottom: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.stat.gold .stat-ico { background: var(--warn-soft); color: var(--warn); }
.stat .stat-num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat .stat-label { font-size: .78rem; color: var(--ink-3); font-weight: 500; margin-top: 2px; }

/* ---------- card lộ trình (roadmap) ---------- */
.road-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.road-card {
  position: relative; display: flex; gap: 14px; align-items: stretch;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 16px 16px 14px 18px; cursor: pointer; transition: all .18s;
  color: var(--ink); overflow: hidden;
}
.road-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--spine, var(--accent)); border-radius: 99px 0 0 99px; margin: 8px 0;
}
.road-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.road-card .road-main { flex: 1; min-width: 0; }
.road-card .road-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--paper-2); border: 1px solid var(--line);
  align-self: center; margin-top: 2px;
}
.road-card h3 { margin: 0 0 3px; font-family: var(--font-display); font-size: 1.02rem; font-weight: 700; line-height: 1.3; padding-right: 30px; }
.road-card .road-desc { color: var(--ink-3); font-size: .8rem; margin: 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.road-card .road-meta { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: .76rem; color: var(--ink-3); font-weight: 500; flex-wrap: wrap; }
.road-card .road-meta b { color: var(--ink-2); font-weight: 600; }
.dots { display: inline-flex; gap: 3px; align-items: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.dots i.on { background: var(--gold); }
.road-card .pin-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
  color: var(--ink-3); cursor: pointer; display: grid; place-items: center; transition: all .15s; opacity: 0;
}
.road-card:hover .pin-btn, .road-card .pin-btn.pinned { opacity: 1; }
.road-card .pin-btn:hover { color: var(--ink); background: var(--paper-2); }
.road-card .pin-btn.pinned { color: var(--gold); }
.road-card .pin-btn svg { width: 15px; height: 15px; }
.road-card .pin-btn.pinned svg { fill: currentColor; }

/* ring tiến độ */
.ring { --p: 0; --size: 44px; width: var(--size); height: var(--size); flex: none; position: relative; }
.ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--paper-2) 0); }
.ring::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .62rem; font-weight: 700; color: var(--ink-2); z-index: 1; }
.ring.big { --size: 120px; }
.ring.big span { font-size: .95rem; }

/* ---------- pinned row ---------- */
.pin-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---------- nút tìm kiếm ---------- */
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 460px; }
.search-box input {
  width: 100%; padding: 11px 15px 11px 42px;
  border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: .93rem; outline: none; transition: all .15s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.search-box .search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); display: grid; place-items: center; }
.search-box .search-ico svg { width: 16px; height: 16px; }

/* ---------- progress bar ---------- */
.pbar { height: 5px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.pbar.brand > i { background: var(--accent); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid transparent;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.gold { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }

/* ---------- set card trong lộ trình ---------- */
.set-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 13px 16px; cursor: pointer; transition: all .15s; color: var(--ink);
}
.set-row:hover { border-color: var(--line-2); transform: translateX(3px); }
.set-row .set-name { flex: 1; min-width: 0; font-weight: 600; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-row .set-meta { font-size: .78rem; color: var(--ink-3); font-weight: 500; flex: none; }
.set-row .chev { color: var(--ink-3); flex: none; }
.set-row .chev svg { width: 15px; height: 15px; }
.set-list { display: flex; flex-direction: column; gap: 8px; }

/* ---------- flashcard ---------- */
.study-wrap { max-width: 680px; margin: 0 auto; }
.study-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.study-count { font-weight: 600; color: var(--ink-2); font-size: .88rem; font-variant-numeric: tabular-nums; }
.flashcard { perspective: 1400px; height: 340px; cursor: pointer; user-select: none; }
.flashcard-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2, .8, .25, 1); }
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-2); padding: 30px; text-align: center;
}
.flashcard-face.back { transform: rotateY(180deg); }
.flashcard .fc-word { font-family: var(--font-display); font-size: clamp(1.7rem, 5vw, 2.7rem); font-weight: 600; word-break: break-word; line-height: 1.15; }
.flashcard .fc-pron { color: var(--ink-3); font-weight: 400; font-size: .98rem; font-style: italic; }
.flashcard .fc-pos { color: var(--gold); font-size: .8rem; text-transform: lowercase; font-style: italic; font-weight: 600; letter-spacing: .02em; }
.flashcard .fc-meaning { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 600; color: var(--ink); }
.flashcard .fc-example { color: var(--ink-2); font-size: .9rem; font-style: italic; max-width: 520px; }
.flashcard .fc-level { position: absolute; top: 14px; left: 14px; }
.flashcard .fc-speaker {
  position: absolute; top: 12px; right: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; transition: all .15s;
}
.flashcard .fc-speaker:hover { color: var(--accent-ink); border-color: var(--accent); }
.flashcard .fc-speaker svg { width: 16px; height: 16px; }
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 16px; }
.rate-btn {
  border: 1px solid var(--line-2); cursor: pointer; border-radius: 11px; padding: 12px 8px;
  font-weight: 600; font-size: .9rem; transition: all .15s; background: var(--card); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.rate-btn small { font-weight: 400; opacity: .65; font-size: .72rem; }
.rate-bad:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.rate-mid:hover { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.rate-ok:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }

/* ---------- quiz / typing ---------- */
.quiz-card { max-width: 620px; margin: 0 auto; text-align: center; }
.quiz-q { font-family: var(--font-display); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 600; margin: 6px 0 2px; word-break: break-word; line-height: 1.2; }
.quiz-sub { color: var(--ink-3); font-size: .82rem; font-weight: 500; margin-bottom: 18px; }
.opts { display: grid; gap: 9px; }
.opt-btn {
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  border-radius: 11px; padding: 13px 16px; font-size: .98rem; font-weight: 500;
  cursor: pointer; transition: all .13s; text-align: left; display: flex; align-items: center; gap: 11px;
}
.opt-btn:not(:disabled):hover { border-color: var(--ink); transform: translateX(2px); }
.opt-btn .opt-key {
  width: 24px; height: 24px; border-radius: 7px; background: var(--paper-2);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--ink-3); flex: none;
}
.opt-btn.right { border-color: var(--ok); background: var(--ok-soft); }
.opt-btn.right .opt-key { background: var(--ok); color: #fff; }
.opt-btn.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt-btn.wrong .opt-key { background: var(--bad); color: #fff; }
.opt-btn.dim { opacity: .45; }
.quiz-progress { display: flex; gap: 4px; margin: 16px 0; }
.quiz-progress i { flex: 1; height: 4px; border-radius: 99px; background: var(--paper-2); }
.quiz-progress i.done { background: var(--line-2); }
.quiz-progress i.right { background: var(--ok); }
.quiz-progress i.wrong { background: var(--bad); }
.type-input {
  width: 100%; padding: 14px 16px; font-size: 1.12rem; font-family: inherit; font-weight: 500;
  border-radius: 11px; border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink);
  outline: none; text-align: center; transition: all .15s;
}
.type-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.type-input.ok { border-color: var(--ok); background: var(--ok-soft); }
.type-input.bad { border-color: var(--bad); background: var(--bad-soft); }

/* ---------- kết quả ---------- */
.result-emoji { font-family: var(--font-display); font-size: 2.2rem; margin: 0; }
.result-acts { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- bảng từ ---------- */
.word-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.word-table th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line);
}
.word-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.word-table tr:last-child td { border-bottom: none; }
.word-table tr:hover td { background: var(--paper); }
.word-table .wt-word { font-weight: 600; white-space: nowrap; font-family: var(--font-display); font-size: .95rem; }
.word-table .wt-word small { display: block; color: var(--ink-3); font-size: .74rem; font-style: italic; font-family: var(--font-body); }
.word-table .wt-mean { color: var(--ink-2); }

/* ---------- games hub ---------- */
.game-card {
  display: flex; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 20px; cursor: pointer; transition: all .18s; color: var(--ink);
}
.game-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.game-ico {
  width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); color: var(--accent-ink); background: var(--accent-soft);
}
.game-ico svg { width: 22px; height: 22px; }
.game-card h3 { margin: 0 0 3px; font-size: .98rem; font-family: var(--font-display); }
.game-card p { margin: 0; color: var(--ink-2); font-size: .84rem; }

/* ---------- memory ---------- */
.mem-grid { display: grid; gap: 9px; grid-template-columns: repeat(4, 1fr); }
.mem-card {
  aspect-ratio: 3/2; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--ink); cursor: pointer; position: relative;
  display: grid; place-items: center; padding: 6px; text-align: center;
  color: transparent; font-weight: 600; font-size: .8rem; transition: all .22s;
  word-break: break-word; user-select: none;
}
.mem-card::after { content: "Lv"; font-family: var(--font-display); font-style: italic; font-size: 1rem; color: color-mix(in srgb, var(--paper) 55%, transparent); }
.mem-card.open { background: var(--card); color: var(--ink); border-color: var(--accent); }
.mem-card.open::after { display: none; }
.mem-card.matched { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); opacity: .75; cursor: default; }
.mem-card.matched::after { display: none; }

/* ---------- scramble ---------- */
.scramble-letters { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.scramble-letters span {
  width: 42px; height: 48px; border-radius: 10px; background: var(--paper);
  display: grid; place-items: center; font-size: 1.3rem; font-weight: 700;
  border: 1px solid var(--line-2); text-transform: uppercase; font-family: var(--font-display);
}

/* ---------- stats ---------- */
.heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; }
.heatmap i { width: 12px; height: 12px; border-radius: 3px; background: var(--paper-2); }
.heatmap i.l1 { background: #d9dcef; } .heatmap i.l2 { background: #b4bbec; }
.heatmap i.l3 { background: #8a93e0; } .heatmap i.l4 { background: #5a63d2; } .heatmap i.l5 { background: #343cc9; }
html[data-theme="dark"] .heatmap i.l1 { background: #232645; }
html[data-theme="dark"] .heatmap i.l2 { background: #33396e; }
html[data-theme="dark"] .heatmap i.l3 { background: #4c53a0; }
html[data-theme="dark"] .heatmap i.l4 { background: #7379c9; }
html[data-theme="dark"] .heatmap i.l5 { background: #a5adf5; }
.level-bars { display: grid; gap: 9px; }
.level-bar { display: grid; grid-template-columns: 86px 1fr 44px; align-items: center; gap: 12px; font-size: .84rem; font-weight: 500; color: var(--ink-2); }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 10px; font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-2); animation: toastIn .28s cubic-bezier(.2, .8, .25, 1);
  max-width: min(92vw, 480px); text-align: center;
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }

/* ---------- modal ---------- */
.modal-root:not(:empty) {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 45%, transparent); backdrop-filter: blur(3px); padding: 20px;
}
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px; max-width: 440px; width: 100%; box-shadow: var(--shadow-2);
  animation: toastIn .22s cubic-bezier(.2, .8, .25, 1);
}
.modal h3 { margin: 0 0 8px; font-family: var(--font-display); }
.modal p { color: var(--ink-2); margin: 0 0 18px; font-size: .92rem; }
.modal-acts { display: flex; gap: 9px; justify-content: flex-end; }

/* ---------- rỗng / tải ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty .big { font-family: var(--font-display); font-size: 2.2rem; margin-bottom: 8px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 70px 0; color: var(--ink-3); font-weight: 500; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 24px 20px 34px; text-align: center; color: var(--ink-3); font-size: .84rem; }
.footer p { margin: 0; }
.footer .muted { font-size: .78rem; margin-top: 5px; }

/* ---------- keyboard ---------- */
.kbd {
  display: inline-block; padding: 0 6px; border-radius: 5px; font-size: .73rem; font-weight: 600;
  background: var(--paper-2); border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--ink-2);
}
.hint-row { text-align: center; color: var(--ink-3); font-size: .78rem; margin-top: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid.cols-3, .grid.cols-4, .road-grid, .pin-row { grid-template-columns: repeat(2, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav {
    display: none; position: fixed; inset: var(--topbar-h) 0 auto 0;
    background: var(--card); border-bottom: 1px solid var(--line);
    flex-direction: column; padding: 12px 16px 18px; gap: 3px; margin: 0;
    box-shadow: var(--shadow-2);
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 14px; }
  .menu-btn { display: grid; }
  .hero { padding: 26px 0 0; }
  .hero-lockup { gap: 18px; align-items: flex-start; }
  .hero-logo { width: 92px; height: 92px; border-radius: 20px; }
  .hero-text h1 { font-size: 1.55rem !important; margin: 0 0 8px !important; }
  .hero-text p { font-size: .92rem; margin: 0 0 18px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .road-grid, .pin-row { grid-template-columns: 1fr; }
  .mem-grid { grid-template-columns: repeat(4, 1fr); }
  .container { padding: 20px 16px 56px; }
  .flashcard { height: 300px; }
  .word-table th:nth-child(3), .word-table td:nth-child(3) { display: none; }
  .brand-name { display: none; }
}
