/* ===== Hana Dul – giao diện ===== */
:root {
  --bg: #fff8f2;
  --bg-2: #fff1e6;
  --surface: #ffffff;
  --surface-2: #fffaf6;
  --text: #2a2136;
  --muted: #6f6479;
  --line: #f0e3d8;
  --primary: #ff6b5b;
  --primary-2: #ff5470;
  --primary-ink: #d9433a;
  --primary-soft: #ffe7e1;
  --accent: #1fb894;
  --accent-soft: #dbf6ee;
  --sun: #ffbf3c;
  --sun-soft: #fff1cc;
  --sky: #4d8dff;
  --sky-soft: #e3edff;
  --ok: #1f9d5b;
  --ok-soft: #dff5e8;
  --bad: #e5484d;
  --bad-soft: #fde4e4;
  --shadow: 0 1px 2px rgba(42, 33, 54, .06), 0 8px 24px rgba(42, 33, 54, .07);
  --shadow-lg: 0 18px 50px rgba(255, 107, 91, .18);
  --radius: 18px;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ko: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17131d;
    --bg-2: #1e1826;
    --surface: #231c2c;
    --surface-2: #2a2234;
    --text: #f5edf3;
    --muted: #b1a5b9;
    --line: #3a3045;
    --primary: #ff8273;
    --primary-2: #ff6d86;
    --primary-ink: #ffb1a6;
    --primary-soft: #4a2a2e;
    --accent: #3fd6b2;
    --accent-soft: #173d35;
    --sun: #ffcf5c;
    --sun-soft: #44381a;
    --sky: #7aa9ff;
    --sky-soft: #1f2d4a;
    --ok: #4fd18b;
    --ok-soft: #173826;
    --bad: #ff7b7f;
    --bad-soft: #45201f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--primary-ink); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 8px; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
.muted { color: var(--muted); }
.ko { font-family: var(--font-ko); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #ff8a5c, var(--primary-2));
  color: #fff; font-weight: 700; font-size: 1.25rem;
  box-shadow: 0 6px 16px rgba(255, 84, 112, .3);
}
.brand-mark.small { width: 32px; height: 32px; font-size: 1rem; border-radius: 10px; }
.brand-text { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 8px; }
.brand-sub { font-weight: 500; font-size: .85rem; color: var(--muted); }
.stats { display: flex; gap: 6px; }
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 99px; font-weight: 700; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--line);
}
.stat.fire { color: #ff7a1a; }
.stat.xp { color: #e0a100; }
.stat.book { color: var(--sky); text-decoration: none; }
.stat.book:hover { border-color: var(--sky); }
@media (max-width: 420px) { .brand-sub { display: none; } }
@media (max-width: 370px) { .brand-text { display: none; } .stat { padding: 5px 8px; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none;
  padding: 13px 22px; border-radius: 14px; font-weight: 700; font-size: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  box-shadow: 0 4px 0 #c93a47, 0 10px 24px rgba(255, 84, 112, .25);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
  min-height: 48px;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c93a47, 0 4px 10px rgba(255, 84, 112, .2); }
.btn.ghost { background: var(--surface); color: var(--text); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.ghost:active { box-shadow: 0 0 0 var(--line); }
.btn.green { background: linear-gradient(135deg, #2fcf87, var(--ok)); box-shadow: 0 4px 0 #157443, 0 10px 24px rgba(31, 157, 91, .25); }
.btn.green:active { box-shadow: 0 1px 0 #157443; }
.btn.red { background: linear-gradient(135deg, #ff6b6f, var(--bad)); box-shadow: 0 4px 0 #a92d33; }
.btn.red:active { box-shadow: 0 1px 0 #a92d33; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- home: hero ---------- */
.hero { position: relative; overflow: hidden; padding: 40px 0 28px; }
.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--primary) 22%, transparent), transparent 65%);
  pointer-events: none;
}
.hero-grid { position: relative; display: grid; gap: 28px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } .hero { padding: 64px 0 40px; } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.1; letter-spacing: -.03em; margin: 14px 0 12px; font-weight: 800; }
.hero h1 .hl {
  background: linear-gradient(120deg, var(--primary), var(--primary-2) 60%, #ff9f43);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 22px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 22px; color: var(--muted); font-size: .92rem; }
.hero-facts b { color: var(--text); font-size: 1.1rem; display: block; }

.hero-art { position: relative; height: 300px; }
@media (max-width: 859px) { .hero-art { height: 230px; } }
.art-card {
  position: absolute; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.art-main {
  inset: 10% 14% 8% 14%; display: grid; place-items: center; text-align: center;
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  animation: floaty 6s ease-in-out infinite;
}
.art-main .big { font-family: var(--font-ko); font-weight: 900; font-size: clamp(3rem, 9vw, 4.6rem); line-height: 1; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.art-main .small { color: var(--muted); font-weight: 600; margin-top: 6px; }
.chip-float {
  position: absolute; padding: 8px 14px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow);
  font-size: .95rem; white-space: nowrap; animation: floaty 5s ease-in-out infinite;
}
.chip-float.c1 { top: 2%; left: 0; background: var(--sun-soft); color: #9a6a00; animation-delay: -1s; }
.chip-float.c2 { bottom: 0; right: 2%; background: var(--accent-soft); color: var(--accent); animation-delay: -2.5s; }
.chip-float.c3 { top: 38%; right: -2%; background: var(--sky-soft); color: var(--sky); animation-delay: -3.5s; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-float.c1 { color: var(--sun); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- home: continue + roadmap ---------- */
.continue {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin: 8px 0 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text);
}
.continue .emoji { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); flex: none; }
.continue .label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.continue .title { font-weight: 800; font-size: 1.1rem; }
.continue .go { margin-left: auto; font-size: 1.4rem; color: var(--primary); }
.continue.book .emoji { background: var(--sky-soft); }
.continue.book .go { color: var(--sky); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 36px 0 18px; }
.section-head h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.section-head p { margin: 2px 0 0; color: var(--muted); }
.level-progress { font-weight: 700; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.level-jump { display: flex; gap: 8px; margin: 30px 0 0; padding: 2px 2px 4px; overflow-x: auto; scrollbar-width: none; scroll-margin-top: 80px; }
.level-jump::-webkit-scrollbar { display: none; }
.level-jump a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; font-size: .92rem; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.level-jump a:hover { border-color: var(--primary); }
.level-jump a.active, .level-jump a[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(255, 107, 91, .28); }
.level-jump a:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
@media (max-width: 480px) {
  .level-jump { gap: 6px; }
  .level-jump a { flex: 1 1 0; min-width: 0; justify-content: center; padding: 9px 6px; font-size: .86rem; }
  .level-jump a > span { display: none; }
}
.level { scroll-margin-top: 80px; }
.level[hidden] { display: none; }
.level-head { margin-top: 26px; }
.level-badge { display: inline-block; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; letter-spacing: .02em; background: var(--primary-soft); color: var(--primary); }
.level-sc2 .level-badge { background: var(--accent-soft); color: var(--text); }
.level-sc2 .ring { --ring: var(--accent); }
.level-sc2 .node.done .ring { --ring: var(--ok); }
.level-tc3 .level-badge { background: var(--sky-soft); color: var(--text); }
.level-tc3 .ring { --ring: var(--sky); }
.level-tc3 .node.done .ring { --ring: var(--ok); }

.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path::before { content: ""; position: absolute; left: 35px; top: 30px; bottom: 30px; width: 4px; border-radius: 4px; background: repeating-linear-gradient(to bottom, var(--line) 0 10px, transparent 10px 18px); }
.path li { position: relative; margin: 0 0 14px; }
.node {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text);
  padding: 12px 16px 12px 12px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.node:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); box-shadow: var(--shadow-lg); }
.ring { --p: 0; position: relative; width: 48px; height: 48px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--ring, var(--primary)) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.ring > span { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 1.35rem; }
.node.done .ring { --ring: var(--ok); }
.node-body { min-width: 0; flex: 1; overflow: hidden; }
.node-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.node-no { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); }
.node-title { font-weight: 800; font-size: 1.08rem; }
.node-ko { color: var(--muted); font-weight: 500; }
.node-sum { display: block; color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { display: inline-flex; gap: 1px; font-size: .95rem; flex: none; }
.stars .off { filter: grayscale(1); opacity: .25; }
.soon { opacity: .6; }
.soon .node { box-shadow: none; background: transparent; border-style: dashed; }

.features { display: grid; gap: 14px; margin: 40px 0 10px; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; margin-bottom: 10px; }
.feature h3 { margin: 0 0 4px; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .93rem; }

/* ---------- lesson header ---------- */
.lesson-hero {
  margin: 18px 0 0; padding: 22px; border-radius: 26px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #ff8a5c, var(--primary-2));
  box-shadow: var(--shadow-lg);
}
.lesson-hero::after { content: attr(data-ko); position: absolute; right: -6px; bottom: -28px; font-family: var(--font-ko); font-weight: 900; font-size: 8rem; opacity: .14; line-height: 1; pointer-events: none; white-space: nowrap; }
.crumbs { font-size: .9rem; margin-bottom: 10px; opacity: .92; }
.crumbs a { color: #fff; }
.lesson-hero h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); letter-spacing: -.02em; line-height: 1.2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lesson-hero h1 .emoji { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .22); display: grid; place-items: center; font-size: 1.8rem; }
.lesson-hero p { margin: 10px 0 0; max-width: 40em; opacity: .95; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.meta-chips span { background: rgba(255, 255, 255, .2); padding: 4px 10px; border-radius: 99px; font-size: .85rem; font-weight: 600; }

.seg { display: inline-flex; padding: 4px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); margin: 20px 0 6px; }
.seg a { padding: 9px 18px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 700; }
.seg a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- study ---------- */
.study-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 20px 0 6px; }
.study-tools h2 { margin: 0; font-size: 1.35rem; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--muted); user-select: none; }
.toggle input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }
.group-title { margin: 22px 0 10px; font-size: 1rem; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.wcard {
  position: relative; text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
  border-radius: 16px; padding: 14px 14px 12px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  box-shadow: 0 2px 0 var(--line); transition: transform .12s, border-color .12s;
}
.wcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.wcard:active { transform: translateY(1px); }
.wcard .w-ko { font-family: var(--font-ko); font-weight: 700; font-size: 1.3rem; line-height: 1.25; }
.wcard .w-vi { color: var(--muted); font-size: .9rem; line-height: 1.35; }
.wcard .w-say { position: absolute; top: 10px; right: 10px; font-size: .85rem; opacity: .5; }
.hide-vi .wcard .w-vi { filter: blur(6px); transition: filter .2s; }
.hide-vi .wcard.reveal .w-vi { filter: none; }

.gnote { margin: 14px 0; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.gnote-head { padding: 14px 18px; background: var(--sky-soft); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gpat { font-family: var(--font-ko); font-weight: 800; font-size: 1.15rem; color: var(--sky); }
.gtitle { font-weight: 600; }
.gnote-body { padding: 6px 18px 14px; }
.gnote-body p { margin: 8px 0; }
.ex { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.ex li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.ex .ex-ko { font-family: var(--font-ko); font-weight: 600; }
.ex .ex-vi { color: var(--muted); font-size: .9rem; }
.ex .txt { flex: 1; min-width: 0; }

.speak {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 38px; height: 38px; flex: none;
  cursor: pointer; font-size: 1rem; display: inline-grid; place-items: center;
}
.speak:hover { border-color: var(--primary); }
.cta-bar { margin: 28px 0 10px; padding: 18px; border-radius: var(--radius); background: var(--accent-soft); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cta-bar strong { font-size: 1.05rem; }

/* ---------- quiz ---------- */
.quiz { max-width: 720px; margin: 0 auto; padding: 18px 16px 40px; }
.qbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.qclose { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; text-decoration: none; color: var(--muted); font-size: 1.1rem; flex: none; }
.qprog { flex: 1; height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.qprog > span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #2fcf87, var(--ok)); transition: width .35s ease; position: relative; }
.qprog > span::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.combo { font-weight: 800; color: #ff7a1a; min-width: 54px; text-align: right; transition: transform .2s; }
.combo.bump { transform: scale(1.3); }
.qsection { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent); font-size: .9rem; background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; }
.qsection.g { color: var(--sky); background: var(--sky-soft); }
.qsection.l { color: #b45309; background: var(--sun-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qsection.l { color: var(--sun); } }
.qsection.r { color: var(--primary-ink); background: var(--primary-soft); }
.qsection.t { color: var(--text); background: var(--sky-soft); border: 1px solid var(--sky); }
.passage.pre { white-space: pre-line; }
.qtext u { text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--primary); }
.dialog-script { margin: 6px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.dialog-script p { margin: 2px 0; word-break: keep-all; overflow-wrap: anywhere; }
.dialog-script .ko { font-family: var(--font-ko); }
.listen-box { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; padding: 14px; border-radius: 18px; background: var(--sun-soft); border: 2px solid color-mix(in srgb, var(--sun) 50%, var(--line)); }
.listen-box .play { width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.7rem; background: var(--sun); box-shadow: 0 4px 0 color-mix(in srgb, var(--sun) 60%, #000); flex: none; }
.listen-box .play:active { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--sun) 60%, #000); }
.listen-box .slow { margin-top: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: .88rem; color: var(--text); }
.passage { margin: 4px 0 16px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--primary); line-height: 1.8; font-size: 1.05rem; }
.passage .ko { font-family: var(--font-ko); }
.passage, .ex .ex-ko, .transcript { word-break: keep-all; overflow-wrap: anywhere; }
.transcript { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; font-weight: 700; }
.transcript .ko { font-family: var(--font-ko); }
.transcript .speak { width: 32px; height: 32px; }
.trans { margin: 6px 0; }
.trans summary { cursor: pointer; font-weight: 700; }
.qcard { margin-top: 14px; }
.qtext { font-size: clamp(1.25rem, 4vw, 1.6rem); font-weight: 800; line-height: 1.35; margin: 4px 0 20px; display: flex; gap: 12px; align-items: flex-start; letter-spacing: -.01em; }
.qtext .ko { font-weight: 700; }
.qtext .speak { width: 44px; height: 44px; margin-top: 2px; }
.hint { margin: -8px 0 16px; }
.hint summary { cursor: pointer; color: var(--sky); font-weight: 700; font-size: .92rem; }
.opts { display: grid; gap: 10px; }
@media (min-width: 560px) { .opts { grid-template-columns: 1fr 1fr; } }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface);
  box-shadow: 0 3px 0 var(--line); min-height: 60px; font-size: 1.05rem; font-weight: 600;
  transition: transform .08s, border-color .12s, background .12s;
}
.opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--sky) 60%, var(--line)); background: var(--surface-2); }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt .key { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; color: var(--muted); flex: none; font-weight: 700; }
.opt .ko { font-size: 1.12rem; }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 3px 0 var(--ok); }
.opt.correct .key { border-color: var(--ok); color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 var(--bad); animation: shake .35s; }
.opt.wrong .key { border-color: var(--bad); color: var(--bad); }
.opt.dim { opacity: .5; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .08);
  border-top: 2px solid var(--line); background: var(--surface);
  display: grid; gap: 12px; animation: slideup .22s ease-out;
}
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }
.fb-title { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.fb-text { margin: 0; }
@media (min-width: 640px) { .feedback { position: static; box-shadow: none; grid-template-columns: 1fr auto; align-items: center; border-radius: 18px; margin: 22px 0 0; border: 2px solid; } }
.quiz { padding-bottom: 200px; }
@media (min-width: 640px) { .quiz { padding-bottom: 40px; } }
@keyframes slideup { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.retry-tag { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--primary-ink); background: var(--primary-soft); padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: middle; }

/* start + result */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 24px; box-shadow: var(--shadow); text-align: center; }
.panel h2 { margin: 6px 0 6px; font-size: 1.6rem; letter-spacing: -.02em; }
.panel .big-emoji { font-size: 3.2rem; line-height: 1; }
.modes { display: grid; gap: 12px; margin: 20px 0 6px; text-align: left; }
@media (min-width: 560px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode { cursor: pointer; padding: 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); display: grid; gap: 4px; text-align: left; }
.mode:hover { border-color: var(--primary); }
.mode b { font-size: 1.1rem; }
.mode span { color: var(--muted); font-size: .92rem; }
.mode .tag { justify-self: start; font-size: .75rem; font-weight: 800; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; }
.result-stars { font-size: 2.8rem; letter-spacing: 6px; margin: 6px 0; }
.result-stars .off { filter: grayscale(1); opacity: .25; }
.result-stars span { display: inline-block; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.result-stars span:nth-child(2) { animation-delay: .15s; }
.result-stars span:nth-child(3) { animation-delay: .3s; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.rbox { border-radius: 16px; padding: 12px 8px; border: 2px solid var(--line); }
.rbox b { display: block; font-size: 1.4rem; }
.rbox span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.rbox.xp { border-color: var(--sun); background: var(--sun-soft); }
.rbox.acc { border-color: var(--ok); background: var(--ok-soft); }
.rbox.fire { border-color: #ff9a4d; background: color-mix(in srgb, #ff9a4d 16%, var(--surface)); }
.review { text-align: left; margin-top: 18px; }
.review h3 { font-size: 1rem; margin: 0 0 8px; }
.review li { margin: 6px 0; }
.review summary { cursor: pointer; font-weight: 800; }
.review ul { padding-left: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.write-panel { margin-top: 16px; text-align: left; }
.write-panel h2 { font-size: 1.3rem; }
.writing .w-prompt { font-weight: 600; margin: 4px 0 10px; }
.writing textarea { width: 100%; min-height: 110px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-family: var(--font-ko), var(--font); font-size: 1.05rem; resize: vertical; }
.writing textarea:focus { outline: none; border-color: var(--sky); }
.w-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.w-samples { margin-top: 12px; }
.w-tip { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sun-soft); }
.fill-item + .fill-item { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.fill-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.fill-mark { flex: none; font-weight: 800; font-size: 1.2rem; color: var(--primary-ink); }
.fill-in { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-family: var(--font-ko), var(--font); font-size: 1.05rem; }
.fill-in:focus { outline: none; border-color: var(--sky); }
.wb-group summary { cursor: pointer; list-style: none; }
.wb-group summary::-webkit-details-marker { display: none; }
.wb-group summary::before { content: "▸"; color: var(--muted); }
.wb-group[open] summary::before { content: "▾"; }
.wb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wb-list li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.wb-q { font-weight: 600; overflow-wrap: anywhere; }
.wb-a { color: var(--ok); font-weight: 700; }
.wb-n { color: var(--muted); font-size: .85rem; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.6s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

/* ---------- footer & toast ---------- */
.footer { margin-top: 48px; border-top: 1px solid var(--line); padding: 22px 0 28px; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; gap: 12px; align-items: flex-start; }
.footer p { margin: 2px 0; }
.toast { position: fixed; left: 50%; top: 74px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .92rem; max-width: calc(100% - 32px); z-index: 60; box-shadow: var(--shadow); }
.quiz-mode .footer { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- đăng ký nhận bài mới (dùng chung) ---------- */
[hidden] { display: none !important; }
.btn.small { padding: 8px 14px; font-size: .92rem; min-height: 40px; }
.signup-card { display: flex; gap: 16px; align-items: flex-start; margin: 28px 0 8px; padding: 20px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary-soft), var(--sun-soft)); border: 1px solid var(--line); text-align: left; }
.signup-card.compact { margin-top: 16px; }
.signup-card h2, .signup-card h3 { margin: 0 0 4px; letter-spacing: -.01em; }
.signup-card h3 { font-size: 1.1rem; }
.signup-card p.muted { margin: 0 0 12px; font-size: .93rem; }
.signup-ic { font-size: 1.8rem; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); flex: none; }
.signup-body { flex: 1; min-width: 0; }
.signup-form { display: flex; flex-wrap: wrap; gap: 8px; }
.signup-form input[type="email"] { flex: 1 1 200px; min-width: 0; }
.signup-form input[type="email"], .feedback-form input, .feedback-form textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; width: 100%;
}
.signup-form input:focus, .feedback-form input:focus, .feedback-form textarea:focus { outline: none; border-color: var(--sky); }
.form-msg { flex-basis: 100%; margin: 2px 0 0; font-size: .9rem; color: var(--muted); min-height: 1.2em; }
.form-msg:empty { display: none; }
.form-msg.bad { color: var(--bad); }
.form-done { margin: 0; font-weight: 700; color: var(--ok); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.channel-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.footer-links a { white-space: nowrap; }
@media (max-width: 480px) { .signup-card { flex-direction: column; } .signup-form .btn { width: 100%; } }
.hero-more { margin: 14px 0 0; font-weight: 600; font-size: .95rem; }
.hero-more a { text-decoration: none; }
.hero-more a:hover { text-decoration: underline; }

/* ---------- tài khoản (assets/account.js) ---------- */
.top-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text);
  padding: 5px 12px; border-radius: 99px; font-weight: 700; font-size: .9rem; background: var(--surface); border: 1px solid var(--line); white-space: nowrap;
}
.acct-btn:hover { border-color: var(--primary); }
.acct-btn.me { padding: 3px; border-radius: 50%; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--sky), #7a5cff); }
.avatar.big { width: 52px; height: 52px; font-size: 1.4rem; flex: none; }
.sync-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--bg); background: var(--ok); }
.sync-dot.busy { background: var(--sun); }
.sync-dot.bad { background: var(--bad); }
@media (max-width: 480px) { .acct-label { display: none; } .acct-btn:not(.me) { padding: 5px 9px; } }
.account-panel { margin-top: 14px; }
.account-panel .form-msg { margin-bottom: 10px; }
.acct-head { display: flex; gap: 14px; align-items: center; text-align: left; overflow-wrap: anywhere; }
.acct-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.acct-form input { flex: 1 1 220px; min-width: 0; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.acct-form input:focus { outline: none; border-color: var(--sky); }
@media (max-width: 480px) { .acct-form .btn { width: 100%; } }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; color: var(--muted); font-size: .88rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.small-note { font-size: .86rem; margin: 12px 0 0; }
.linkish { font: inherit; color: var(--primary-ink); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.danger-zone { margin: 20px 0 8px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.danger-zone .actions { justify-content: flex-start; }
.acct-card .emoji { background: var(--sky-soft); }
/* Tên hiển thị (trang Tài khoản) */
.name-panel { margin-top: 14px; text-align: left; }
.name-panel h2 { font-size: 1.25rem; margin: 0 0 8px; }
/* Đề thi thử (assets/exam.js) */
.continue.exam-card .emoji { background: var(--sun-soft); }
.continue.exam-card.doing { border-color: var(--sun); }
.exam-list { list-style: none; margin: 18px 0 8px; padding: 0; display: grid; gap: 10px; }
.exam-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.exam-item:hover { border-color: var(--primary); }
.exam-item .emoji { font-size: 1.8rem; flex: none; }
.exam-item-body { flex: 1; min-width: 0; }
.exam-list .tag, .exam-item .tag { flex: none; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.exam-item .tag.ok { color: var(--text); border-color: var(--ok); background: var(--ok-soft); }
.exam-item .tag.doing { color: var(--text); border-color: var(--sun); background: var(--sun-soft); }
.exam-intro { margin-top: 16px; text-align: left; }
.exam-rules { padding-left: 4px; list-style: none; margin: 8px 0 14px; }
.exam-rules li { margin: 8px 0; }
.exam-intro .actions { justify-content: flex-start; }
.exam-bar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); }
.exam-bar-in { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.exam-timer { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.exam-timer.warn { color: var(--bad); }
.exam-count { color: var(--muted); font-weight: 600; font-size: .92rem; }
.exam-bar .btn { margin-left: auto; padding: 8px 16px; }
.exam-mode .topbar { position: static; }
.exam-title { font-size: 1.4rem; margin: 18px 0 6px; }
.exam-confirm { margin: 12px 0; text-align: left; position: sticky; top: 64px; z-index: 15; }
.exam-confirm .actions { justify-content: flex-start; }
.ex-inst { font-size: 1rem; margin: 26px 0 10px; padding: 10px 14px; border-left: 4px solid var(--primary); background: var(--bg-2); border-radius: 0 12px 12px 0; line-height: 1.5; }
.ex-inst .muted { font-weight: 500; font-size: .88rem; }
.ex-set { margin: 0 0 18px; }
.ex-passage, .ex-box { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface); line-height: 1.85; margin: 0 0 10px; overflow-wrap: anywhere; }
.ex-box { position: relative; border-style: dashed; padding-top: 18px; }
.ex-box p { margin: 0; }
.ex-box-label { position: absolute; top: -11px; left: 14px; background: var(--bg); padding: 0 8px; font-weight: 700; font-size: .85rem; }
.ex-q { margin: 10px 0 16px; scroll-margin-top: 80px; }
.ex-qtext { margin: 0 0 8px; line-height: 1.6; }
.ex-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 560px) { .ex-opts { grid-template-columns: 1fr; } }
.ex-opt { display: flex; gap: 8px; align-items: flex-start; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px; cursor: pointer; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
button.ex-opt:hover { border-color: var(--sky); }
.ex-opt.on { border-color: var(--sky); background: var(--sky-soft); font-weight: 700; }
.ex-opt .circ { flex: none; font-weight: 700; }
.ex-nav { margin: 30px 0 10px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.ex-nav h2 { font-size: 1.05rem; margin: 0 0 10px; }
.ex-nav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; }
.ex-nav-grid button { font: inherit; font-weight: 700; padding: 7px 0; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.ex-nav-grid button.on { border-color: var(--sky); background: var(--sky-soft); color: var(--text); }
.exam-score { margin-top: 16px; }
.exam-types table { width: 100%; border-collapse: collapse; }
.exam-types td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.exam-types td.num { text-align: right; font-weight: 700; white-space: nowrap; }
.exam-types td.num.low { color: var(--bad); }
.exam-review { margin-top: 22px; }
.exam-review h2 { font-size: 1.3rem; }
.ex-filter { margin: 4px 0 10px; flex-wrap: wrap; }
.ex-filter button { font: inherit; font-weight: 700; padding: 8px 14px; border-radius: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.ex-filter button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.ex-rev .ex-q { padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.ex-rev .ex-q.wrong, .ex-rev .ex-q.blank { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.ex-rev .ex-opt { cursor: default; }
.ex-rev .ex-opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.ex-rev .ex-opt.chosen { border-color: var(--bad); text-decoration: line-through; }
.ex-mark { font-size: .9rem; white-space: nowrap; }
.ex-explain { margin: 10px 0 0; font-size: .94rem; }
.ex-vi { margin: 0 0 10px; font-size: .92rem; }
.ex-vi summary { cursor: pointer; color: var(--muted); font-weight: 700; }
/* Đề thi thử phần Viết */
.wr-q { padding: 0 0 6px; }
.wr-blank { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.wr-mark { flex: none; font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.wr-in, .wr-ta { width: 100%; min-width: 0; font: inherit; font-size: 1.02rem; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; line-height: 1.7; }
.wr-in:focus, .wr-ta:focus { outline: none; border-color: var(--sky); }
.wr-ta { display: block; resize: vertical; margin-top: 4px; }
.wr-count { margin: 6px 0 0; font-size: .88rem; color: var(--bad); text-align: right; }
.wr-count.ok { color: var(--ok); }
.small .wr-count { font-size: inherit; }
.wr-rev { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.wr-qpts { white-space: nowrap; font-size: .92rem; color: var(--muted); }
.wr-qpts b { color: var(--text); font-size: 1.05rem; }
.wr-item { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--bg-2); }
.wr-item p { margin: 0 0 6px; }
.wr-ans { overflow-wrap: anywhere; }
.wr-auto { color: var(--ok); font-weight: 700; }
.wr-mine { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.85; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg); margin: 6px 0 10px; }
.wr-sample { margin: 6px 0 10px; }
.wr-sample summary { cursor: pointer; font-weight: 700; }
.wr-rubric { margin-top: 8px; }
.sg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sg { font: inherit; font-size: .9rem; padding: 6px 11px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.sg[aria-pressed="true"] { border-color: var(--sky); background: var(--sky-soft); font-weight: 700; }
.wr-pending { margin: 8px 0; font-weight: 600; }
.wr-review .small, .wr-exam .small { font-size: .9rem; }
.bad-text { color: var(--bad); }
/* Chứng nhận trong trang Tài khoản */
.cert-panel { margin-top: 16px; text-align: left; }
.cert-panel h2 { margin-top: 0; }
.cert-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.cert-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cert-item .emoji { font-size: 1.5rem; flex: none; }
.cert-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cert-item .btn { flex: none; }
.cert-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; color: var(--text); }
.cert-bar { display: block; height: 6px; border-radius: 99px; background: var(--bg-2); margin-top: 6px; overflow: hidden; }
.cert-bar span { display: block; height: 100%; background: var(--ok); }
@media (max-width: 420px) { .cert-item { flex-wrap: wrap; } .cert-item .btn { width: 100%; } }
/* Bảng xếp hạng tuần (assets/rank.js) */
.continue.rank-card .emoji { background: var(--sun-soft); }
.rank-me { margin-top: 16px; text-align: left; }
.rank-me p { margin: 0 0 10px; }
.rank-tabs button { font: inherit; font-weight: 700; padding: 8px 16px; border-radius: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.rank-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.rank-list { list-style: none; margin: 8px 0 20px; padding: 0; display: grid; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.rank-row.top { border-color: var(--sun); }
.rank-row.me { border: 2px solid var(--sky); background: var(--sky-soft); }
.rank-n { flex: none; width: 32px; text-align: center; font-weight: 800; font-size: 1.05rem; }
.rank-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.rank-name .tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--sky); margin-left: 4px; }
.rank-xp { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-gap { text-align: center; color: var(--muted); }
.rank-empty { margin: 16px 0; }

/* ---------- tra từ, ngữ pháp (assets/search.js) ---------- */
.search { margin: 22px 0 8px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.search-label { display: block; font-weight: 700; margin-bottom: 8px; }
.search-input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem; }
.search-input:focus { outline: none; border-color: var(--sky); }
.search-results:empty { display: none; }
.search-results { margin-top: 8px; }
.sr-head { margin: 12px 0 6px; font-size: .9rem; color: var(--muted); }
.sr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sr-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.sr-item:hover, .sr-item:focus-visible { border-color: var(--sky); background: var(--sky-soft); }
.sr-ko { font-weight: 700; word-break: keep-all; }
.sr-vi { flex: 1; min-width: 8em; }
.sr-where { width: 100%; font-size: .82rem; color: var(--muted); }
.sr-empty, .sr-more { margin: 10px 2px 0; font-size: .9rem; }
.flash { animation: hd-flash 2.4s ease-out; }
@keyframes hd-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--sun); } 100% { box-shadow: 0 0 0 0 transparent; } }
