/* Tiếng Anh mỗi ngày - stylesheet. Colours and fonts are tokens at the top of :root. */
[hidden] { display: none !important; }
body { margin: 0; }
img { max-width: 100%; }
/* Layout concept: sticky tab bar, a CEFR staircase as the one bold moment on the home page. */
:root {
  color-scheme: light;
  --bg: #F1F4F6;
  --surface: #FFFFFF;
  --ink: #12213A;
  --muted: #566678;
  --line: #D3DBE2;
  --accent: #0A6E6A;
  --accent-ink: #FFFFFF;
  --mark: #FFE27A;
  --good: #1B7A43;
  --good-bg: #E3F4EA;
  --bad: #B3321F;
  --bad-bg: #FBE9E6;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body: 'Bitter', Georgia, 'Times New Roman', serif;
  --font-mono: 'Itim', 'Segoe Print', 'Comic Sans MS', cursive;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1620; --surface: #152130; --ink: #E6EDF3; --muted: #98A9BA; --line: #263647;
    --accent: #4FD1C5; --accent-ink: #06211F; --mark: #5E4E10;
    --good: #5BD08A; --good-bg: #123522; --bad: #FF8A75; --bad-bg: #3A1B16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1620; --surface: #152130; --ink: #E6EDF3; --muted: #98A9BA; --line: #263647;
  --accent: #4FD1C5; --accent-ink: #06211F; --mark: #5E4E10;
  --good: #5BD08A; --good-bg: #123522; --bad: #FF8A75; --bad-bg: #3A1B16;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--bg);
}
.wrap { max-width: 68rem; margin: 0 auto; min-width: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 2rem; padding-block: 0.6rem 0; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; padding-bottom: 0.5rem; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; min-width: 0; max-width: 100%; }
.tabs a { font-family: var(--font-display); font-weight: 500; font-size: 0.95rem; padding: 0.5rem 0.8rem; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding-block: 2.25rem 3rem; }
footer { padding-block: 1.5rem 2.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

/* Type */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1.12; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; line-height: 1.25; }
h3 { font-size: 1.1rem; line-height: 1.35; }
p { margin: 0; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 40rem; }
.call { font-family: var(--font-mono); font-size: 0.88rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.5rem; }
.muted { color: var(--muted); }
mark { background: var(--mark); color: var(--ink); padding: 0 0.2em; border-radius: 2px; }
.sec-head { display: grid; gap: 0.75rem; margin-bottom: 1.75rem; }
.sec-head .lead { font-size: 1.1rem; }
.stack { display: grid; gap: 2.5rem; }

/* Controls */
.btn { font-family: var(--font-display); font-weight: 500; font-size: 1rem; padding: 0.65rem 1.1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--bg); }
.btn.small { font-size: 0.875rem; padding: 0.35rem 0.7rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { font-family: var(--font-display); font-size: 0.875rem; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag { font-family: var(--font-mono); font-size: 0.85rem; padding: 0.15rem 0.5rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); white-space: nowrap; }
input[type="text"], input[type="search"], input[type="number"], input[type="date"], textarea {
  font: inherit; font-size: 1rem; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }
textarea { min-height: 5rem; resize: vertical; }
label { display: block; font-family: var(--font-display); font-weight: 500; font-size: 0.9rem; margin-bottom: 0.3rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; min-width: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }

/* Home */
.hero { display: grid; gap: 1.25rem; max-width: 46rem; }
.ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem; align-items: stretch; padding-top: 0.8rem; }
.step { font: inherit; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 0; padding: 0.9rem 0.9rem 1rem; cursor: pointer; display: grid; gap: 0.35rem; align-content: start; }
.step:hover { border-color: var(--accent); }
.step b { font-family: var(--font-display); font-size: 2rem; line-height: 1; letter-spacing: -0.03em; color: var(--accent); }
.step .nm { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.step .ds { font-size: 0.875rem; color: var(--muted); line-height: 1.4; }
.step .ct { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }
.step:hover, .step:focus-visible { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.step:hover b, .step:focus-visible b { color: var(--mark); }
.step:hover .ds, .step:hover .ct, .step:focus-visible .ds, .step:focus-visible .ct { color: var(--bg); opacity: 0.85; }
/* Playing-card hover: all steps are the same height; the hovered one lifts up. Change the translateY value for more or less lift. */
.step { transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.15s, color 0.15s, border-color 0.15s; }
.step:hover, .step:focus-visible { transform: translateY(-0.7rem); box-shadow: 0 10px 18px rgba(18, 33, 58, 0.18); }
@media (prefers-reduced-motion: reduce) { .step { transition: none; } .step:hover, .step:focus-visible { transform: none; } }
.card { display: grid; gap: 0.4rem; align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--ink); min-width: 0; }
a.card:hover { border-color: var(--accent); }
.card p { color: var(--muted); font-size: 0.98rem; }
.card .meta { font-family: var(--font-mono); font-size: 0.88rem; color: var(--muted); }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
.stat b { display: block; font-family: var(--font-display); font-size: 2.2rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.9rem; color: var(--muted); }

/* Grammar */
.tools { display: grid; gap: 0.8rem; margin-bottom: 1.25rem; }
.rule { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 0.6rem; }
.rule summary { display: grid; grid-template-columns: 1fr auto auto; gap: 0.75rem; align-items: baseline; padding: 0.9rem 1rem; cursor: pointer; list-style: none; }
.rule summary::-webkit-details-marker { display: none; }
.rule summary::after { content: "+"; font-family: var(--font-mono); color: var(--muted); }
.rule[open] summary::after { content: "\2212"; }
.rule summary .no { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.rule .body { padding: 0 1rem 1.1rem; display: grid; gap: 0.9rem; }
.form { font-family: var(--font-mono); font-size: 0.975rem; background: var(--bg); padding: 0.6rem 0.8rem; border-radius: 6px; overflow-x: auto; display: grid; gap: 0.35rem; }
.form > div + div { border-top: 1px dashed var(--line); padding-top: 0.35rem; }
.rule ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.25rem; }
.pair { display: grid; gap: 0.35rem; font-size: 0.98rem; }
.pair .no-way { color: var(--bad); }
.pair .yes-way { color: var(--good); font-weight: 600; }
.pair b { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; margin-right: 0.5rem; text-decoration: none; display: inline-block; }
.empty { padding: 1.5rem; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }
@media (max-width: 520px) { .rule summary { grid-template-columns: 1fr auto auto; } .rule summary .no { display: none; } }

/* Tests */
.quiz { max-width: 40rem; display: grid; gap: 1.1rem; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.qtext { font-family: var(--font-display); font-weight: 500; font-size: 1.4rem; line-height: 1.35; }
.opts { display: grid; gap: 0.5rem; }
.opt { font-family: var(--font-display); font-size: 1rem; text-align: left; display: flex; gap: 0.75rem; align-items: baseline; width: 100%; padding: 0.8rem 1rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:disabled { cursor: default; color: var(--ink); }
.opt i { font-style: normal; font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); }
.opt.right { background: var(--good-bg); border-color: var(--good); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.feedback { padding: 1rem 1.1rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 0.4rem; }
.feedback strong { font-family: var(--font-display); }
.score { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.4rem, 8vw, 3.6rem); letter-spacing: -0.03em; line-height: 1; }
.miss { display: grid; gap: 0.25rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }

/* Resources and tips */
.res .dom { font-family: var(--font-mono); font-size: 0.88rem; color: var(--accent); overflow-wrap: anywhere; }
.tip-list { margin: 0.6rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.6rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 36rem; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
td:first-child { font-family: var(--font-display); font-weight: 700; white-space: nowrap; }

/* Journal */
.jform { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.jform .full { grid-column: 1 / -1; }
.entry { display: grid; gap: 0.6rem; }
.entry header { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: baseline; justify-content: space-between; }
.entry h3 { font-size: 1.05rem; }
.words { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.word { font-family: var(--font-mono); font-size: 0.92rem; padding: 0.15rem 0.55rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.example { border-style: dashed; }
textarea.export { font-family: var(--font-mono); font-size: 0.95rem; min-height: 9rem; }
.lab { font-family: var(--font-display); font-weight: 700; }

/* Vocabulary */
.vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.vrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.7rem 0.9rem; }
.vrow > div { min-width: 0; }
.vrow .vw { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.vrow .vvi { grid-column: 1; color: var(--muted); }
.vrow .vact { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .vrow { grid-template-columns: minmax(0, 1fr); }
  .vrow .vact { grid-column: 1; grid-row: auto; justify-content: flex-start; order: 3; }
  .vrow .vvi { order: 2; }
}
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem 1.25rem; display: grid; gap: 1rem; justify-items: center; align-content: center; text-align: center; min-height: 14rem; }
.vcard .big { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem, 8vw, 3rem); letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.vcard .mean { font-size: 1.4rem; max-width: 30rem; }
.tag.on { color: var(--accent); border-color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.btn, .chip, .opt, .card { transition: border-color 0.15s; }

/* ---------- Home cards, vocabulary squares, big flashcard ---------- */
.bcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.bcards .btn { justify-content: center; padding-block: 0.9rem; font-size: 1.05rem; }
.vcard { min-height: 18rem; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.vsq { position: relative; min-width: 0; aspect-ratio: 1; }
.vsq-main { font: inherit; color: var(--ink); text-align: left; width: 100%; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; cursor: pointer; display: grid; grid-template-rows: auto auto 1fr auto; gap: 0.2rem; align-content: start; transition: border-color 0.15s, background 0.15s; }
.vsq-main:hover { border-color: var(--accent); }
.vsq-main .vw { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.vsq-main .vpos { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.vsq-main .vm { color: var(--muted); font-size: 0.92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.vsq-main .vst { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); align-self: end; }
.vsq.learning .vsq-main { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.vsq.learning .vst { color: var(--accent); font-weight: 600; }
.vsq.known .vsq-main { opacity: 0.7; }
.vsq-say { position: absolute; bottom: 0.5rem; right: 0.5rem; font: inherit; font-size: 0.72rem; padding: 0.2rem 0.45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
.vsq-say:hover { border-color: var(--accent); }

/* ---------- Journal: level, week chart, achievements ---------- */
.lvl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: center; }
.lvl-icon { width: 5.5rem; height: 5.5rem; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 2px solid var(--accent); display: grid; place-items: center; overflow: hidden; }
.lvl-icon span { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; color: var(--accent); line-height: 1; }
.lvl-icon img { width: 100%; height: 100%; object-fit: contain; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; height: 9rem; align-items: end; margin-top: 0.8rem; }
.wcol { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: end; height: 100%; gap: 0.2rem; }
.wcol i { display: block; width: 100%; max-width: 2.5rem; background: var(--line); border-radius: 4px 4px 0 0; }
.wcol i.on { background: var(--accent); }
.wn, .wl { font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.6rem; }
.ach { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem; display: grid; gap: 0.3rem; align-content: start; opacity: 0.75; }
.ach b { font-family: var(--font-display); }
.ach span { color: var(--muted); font-size: 0.9rem; }
.ach em { font-style: normal; font-family: var(--font-mono); font-size: 0.82rem; color: var(--muted); }
.ach.got { opacity: 1; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.ach.got em { color: var(--accent); }
.jbook > summary { cursor: pointer; list-style: none; }
.jbook > summary::-webkit-details-marker { display: none; }
.tip-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.5rem; }
.hint .tip-list { margin-top: 0.4rem; gap: 0.25rem; }
.jbook > summary h2::before { content: "+ "; color: var(--accent); }
.jbook[open] > summary h2::before { content: "\2212  "; }
.toast { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 0.7rem 1.1rem; border-radius: 8px; z-index: 50; max-width: calc(100vw - 2rem); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
@media (max-width: 560px) { .lvl { grid-template-columns: 1fr; justify-items: start; } .bcards { grid-template-columns: 1fr; } .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Grammar tag, vocab tabs and cards, rule view in test review ---------- */
.tag.lvtag { min-width: 2.6rem; text-align: center; justify-self: end; }
.rv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; padding: 0.9rem 1rem 0; }
.ruleview { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-top: 0.5rem; }
.subtabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.subtab { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 0.6rem 0.9rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.subtab:hover { color: var(--ink); }
.subtab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.vsq-main { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.3rem; padding: 0.75rem 0.6rem 2.4rem; }
.vsq-main .vw { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; }
.vsq-main .vpos { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; }
.vsq-main .vm { color: var(--accent); font-size: 1rem; font-weight: 500; text-align: center; }
.vsq-main .vst { position: absolute; left: 0.75rem; bottom: 0.65rem; }

/* ---------- Placement test: the main call to action on the tests page ---------- */
.placement { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); padding: 1.75rem; }
.placement h2 { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.02em; }
.placement > p { font-size: 1.1rem; }
.placement .btn { font-size: 1.1rem; padding: 0.85rem 1.4rem; }

/* ---------- Admin (hidden) ---------- */
.adm-note { font-family: var(--font-mono); font-size: 0.88rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-left: 3px solid var(--accent); padding: 0.3rem 0.6rem; margin: 0 0 0.6rem; }
.tag.adm { color: var(--accent); border-color: var(--accent); }
#tab-admin { color: var(--accent) !important; }

/* ---------- IPA chart ---------- */
.ipa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.5rem; }
.ipa-tile { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.4rem; cursor: pointer; display: grid; gap: 0.15rem; justify-items: center; transition: border-color 0.15s, background 0.15s; }
.ipa-tile b { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.ipa-tile span { font-size: 0.8rem; color: var(--muted); }
.ipa-tile:hover { border-color: var(--accent); }
.ipa-tile[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ipa-tile[aria-pressed="true"] b { color: var(--accent); }
.ipa-detail { scroll-margin-top: 5rem; }
.ipa-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.ipa-big { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 9vw, 4rem); color: var(--accent); line-height: 1; letter-spacing: -0.02em; }
.ipa-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.ipa-list li { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ipa-t { font-family: var(--font-mono); font-size: 1rem; }

/* Grammar: extra info block */
.more { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.more > summary { cursor: pointer; padding: 0.6rem 0.9rem; font-family: var(--font-display); font-weight: 500; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; font-family: var(--font-mono); color: var(--accent); width: 1ch; }
.more[open] > summary::before { content: "\2212"; }
.more-list { list-style: none; margin: 0; padding: 0 0.9rem 0.9rem; display: grid; gap: 0.7rem; }
.more-item { border-left: 3px solid var(--accent); padding-left: 0.8rem; display: grid; gap: 0.15rem; }
.more-item p { margin: 0; }
.more-item .mtag { font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.more-item.t-advanced { border-left-color: var(--bad); }
.more-item.t-advanced .mtag { color: var(--bad); }
.more-item.t-nuance { border-left-color: var(--muted); }
.more-item.t-nuance .mtag { color: var(--muted); }

/* Vocab: phonetic + UK/US audio */
.vph { font-family: var(--font-mono); font-size: 0.95rem; color: var(--muted); }
.vcard .vph { font-size: 1.05rem; }
.vsq-main { padding: 1.6rem 0.6rem 2.6rem; }
.vsq-main .vst { top: 0.5rem; bottom: auto; }
.vsq-say-row { position: absolute; bottom: 0.5rem; right: 0.5rem; display: flex; gap: 0.25rem; }
.vsq-say { position: static; }

/* Band (CEFR level) in the corner */
.vcard { position: relative; }
.vband { position: absolute; top: 0.75rem; right: 0.9rem; font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.06em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0.1rem 0.5rem; }
.vlv { position: absolute; top: 0.5rem; right: 0.6rem; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--accent); }

/* Admin: vocab ID tag */
.vid { position: absolute; bottom: 0.6rem; left: 0.7rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.vcard .vid { top: 0.85rem; bottom: auto; left: 0.9rem; font-size: 0.8rem; }

.adm-ok { margin-left: auto; font-family: var(--font-mono); font-size: 0.82rem; color: var(--good); }

.ipa-chart { display: grid; gap: 0.5rem; }
.ipa-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ipa-pair { display: flex; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.ipa-pair .ipa-tile { border: 0; border-radius: 0; width: 5.2rem; }
.ipa-pair .ipa-tile + .ipa-tile { border-left: 1px solid var(--line); }
.ipa-row > .ipa-tile { width: 5.2rem; }
.ipa-gap { width: 5.2rem; }
.ipa-vwrap { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; }
.ipa-tile.sho { background: hsl(25 80% 60% / 0.1); }
.ipa-tile.lon { background: hsl(25 80% 55% / 0.2); }
.ipa-tile.dip { background: hsl(15 80% 50% / 0.3); }
.ipa-tile.unv { background: hsl(110 45% 50% / 0.22); }
.ipa-tile.vcd { background: hsl(215 60% 55% / 0.24); }
.ipa-tile[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.ipa-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.8rem; }
.ipa-legend span { padding: 0.15rem 0.6rem; border-radius: 6px; border: 1px solid var(--line); }
.ipa-legend .sho { background: hsl(25 80% 60% / 0.1); } .ipa-legend .lon { background: hsl(25 80% 55% / 0.2); } .ipa-legend .dip { background: hsl(15 80% 50% / 0.3); }
.ipa-legend .unv { background: hsl(110 45% 50% / 0.22); } .ipa-legend .vcd { background: hsl(215 60% 55% / 0.24); }
.ipa-ref { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; align-items: start; }
.ipa-sym { font-family: var(--font-display); font-size: 1.15rem; width: 3.5rem; }
.elo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.8rem; }
.elo-f { display: grid; gap: 0.25rem; align-content: start; }
.elo-f input[type="number"] { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }
.elo-f input[type="checkbox"] { justify-self: start; width: 1.2rem; height: 1.2rem; }
.elo-eq { font-family: var(--font-mono); font-size: 0.92rem; background: var(--bg, transparent); border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem; overflow-x: auto; margin: 0; white-space: pre; }
@media (max-width: 480px) { .ipa-pair .ipa-tile, .ipa-row > .ipa-tile, .ipa-gap { width: 4.2rem; } .ipa-pair { flex-wrap: wrap; } }
.elo-f select { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%; box-sizing: border-box; }

/* Vocab grid: fewer, roomier cards; meaning scales with its length so nothing is cut off */
.vgrid { grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 1rem; }
.vsq { aspect-ratio: auto; min-height: 10.5rem; display: flex; }
.vsq-main { flex: 1; height: auto; min-height: 10.5rem; padding: 1.7rem 0.9rem 2.5rem; gap: 0.7rem; }   /* less space above and below, more space between word, IPA, type and meaning */
.vsq-main .vw { font-size: 1.3rem; }
.vsq-main .vph { font-size: 0.95rem; }
.vsq-main .vpos { font-size: 0.6rem; letter-spacing: 0.1em; }
.vsq-main .vm { display: block; -webkit-line-clamp: unset; overflow: visible; line-height: 1.3; overflow-wrap: anywhere; }
.vsq-main .vm-1 { font-size: 1.1rem; } .vsq-main .vm-2 { font-size: 1rem; } .vsq-main .vm-3 { font-size: 0.9rem; } .vsq-main .vm-4 { font-size: 0.8rem; }
.vsq-main .vst, .vsq-main .vlv { top: 0.65rem; }
.ipa-w { font: inherit; background: none; border: 0; border-bottom: 1px dotted var(--muted); padding: 0; color: inherit; cursor: pointer; }
.ipa-w:hover, .ipa-w:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 560px) { .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; } .vsq-main { padding: 1.6rem 0.5rem 2.5rem; gap: 0.6rem; } .vsq-main .vph { font-size: 0.9rem; } }

/* Admin: font picker */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.9rem; }
.fcard { border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; display: grid; gap: 0.7rem; background: var(--bg); align-content: space-between; }
.fcard .fname { font-weight: 700; font-size: 1rem; margin: 0 0 0.35rem; }
.fcard .fnote { font-weight: 400; font-size: 0.8rem; }
.fcard .fh { font-weight: 700; font-size: 1.35rem; line-height: 1.2; margin: 0 0 0.3rem; }
.fcard .fb { font-size: 1rem; margin: 0 0 0.3rem; line-height: 1.45; }
.fcard .fm { font-size: 0.85rem; margin: 0; color: var(--muted); }

/* Typing test: one square per letter */
.sqs { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; align-items: center; }
.sq { width: clamp(1.9rem, 8vw, 2.6rem); height: clamp(2.3rem, 9vw, 3rem); display: grid; place-items: center; border: 2px solid var(--line); border-radius: 6px; background: var(--bg);
  font-family: var(--font-mono); font-weight: 600; font-size: clamp(1.1rem, 4.5vw, 1.5rem); text-transform: uppercase; color: var(--ink); }
.sq.fill { border-color: var(--ink); }
.sq.rev { background: var(--mark); border-color: var(--mark); }
.sq.ok { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.sq.miss { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.sq-gap { width: 1.1rem; }
.sq-sep { font-family: var(--font-mono); font-size: 1.5rem; color: var(--muted); }
#tq-in { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: 0.15em; text-align: center; }

/* IPA practice */
.ipa-prompt { font-family: var(--font-mono); font-size: clamp(1.4rem, 5vw, 2rem); margin: 0; overflow-wrap: anywhere; text-align: center; }
.ipa-prompt.sent { font-size: clamp(1.05rem, 3.6vw, 1.35rem); line-height: 1.7; }
.ipa-row-w { display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; align-items: center; }
textarea#ip-in { width: 100%; font: inherit; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }

/* Typing test: the squares are the input (an invisible text box sits on top of them) */
.sqwrap { position: relative; width: 100%; max-width: 100%; }
.sqwrap input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: text; border: 0; padding: 0; }
.sq.cur { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.sqwrap:not(:focus-within) .sq.cur { box-shadow: none; border-color: var(--line); }
.sqwrap:focus-within .sqs { outline: none; }
.tq-note { margin: 0; font-size: 0.92rem; color: var(--muted); }
.tq-note.bad { color: var(--bad); font-weight: 600; }
.trans { margin: 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 4px; }
.trans .lab { display: block; margin-bottom: 0.15rem; }

/* Aligned answer rows (word | dots | IPA | audio) and stress dots drawn as circles */
.ipa-grid { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; align-items: center; gap: 0.6rem 1.1rem; }
.ipa-grid.c4 { grid-template-columns: max-content max-content minmax(0, 1fr) max-content; }
.ipa-grid.c3 { grid-template-columns: max-content minmax(0, 1fr) max-content; }
.ipa-grid li { display: contents; }
.ipa-grid .au { display: flex; gap: 0.4rem; justify-content: flex-end; }
.ipa-grid .oddw { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.ipa-grid u, .opt u { text-decoration: none; border-bottom: 2px solid var(--accent); font-variant-ligatures: none; }   /* a border, not text-decoration: an underline is not drawn under the tails of g, y, p, q, j ("skip-ink"), and a "fi" / "fl" ligature loses it too */
.dots { display: inline-flex; gap: 0.35rem; align-items: center; }
.dots .d { width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid var(--muted); display: inline-block; }
.dots .d.on { background: var(--accent); border-color: var(--accent); }
@media (max-width: 34rem) {
  .ipa-grid.c4 { grid-template-columns: max-content max-content minmax(0, 1fr); }
  .ipa-grid.c3 { grid-template-columns: max-content minmax(0, 1fr); }
  .ipa-grid .au { grid-column: 1 / -1; justify-content: flex-start; padding-bottom: 0.4rem; }
}

/* Personal note dots beside each option of the stress question (one tickable dot per syllable) */
.note-head { margin: 0 0 -0.25rem; text-align: right; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
.optrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; }
.notedots { display: inline-flex; gap: 0.15rem; padding: 0 0.25rem; }
.nd { width: 1.9rem; height: 1.9rem; padding: 0; background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.nd::before { content: ""; width: 0.85rem; height: 0.85rem; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.nd:hover::before { border-color: var(--ink); }
.nd[aria-pressed="true"]::before { background: var(--ink); border-color: var(--ink); }
.nd:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sound links in the answer feedback and the sound panel that pops up over the question */
.snd-link { font: inherit; font-family: var(--font-mono); color: var(--accent); background: none; border: 0; border-bottom: 1px dashed var(--accent); padding: 0 0.1rem; cursor: pointer; }
.snd-link:hover { background: var(--bg); }
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 1rem; overflow-y: auto; overscroll-behavior: contain; }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 30, 0.55); }
.modal-box { position: relative; width: 100%; max-width: 34rem; margin: 2rem 0; padding: 0.75rem; display: grid; gap: 0.75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }

.wlink { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: pointer; }   /* a clickable word that looks exactly like the plain word */
.opt .optpos { margin-left: auto; padding-left: 0.5rem; flex-shrink: 0; font-size: 0.9rem; color: var(--muted); white-space: nowrap; }
.opt:has(.optpos) { flex-wrap: wrap; }
.hint { margin: 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 4px; }

/* Admin: IPA test rows */
.adm-ok { background: var(--good-bg); font-weight: 600; }
#adm-ilist td, #adm-vlist td { vertical-align: top; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 0.15rem; }

/* Grammar "more": common mistakes get the warning colour */
.more-item.t-mistake { border-left-color: var(--bad); }
.more-item.t-mistake .mtag { color: var(--bad); }
.est .qtext { text-align: center; margin: 0; }
.est .vcard .big { font-size: 2.6rem; }
.est .opt { padding: 1rem 1.1rem; font-size: 1.05rem; }
.est-skip { width: 100%; padding: 0.9rem; font-size: 1.05rem; }
.est .score { font-size: 3.4rem; }
.est-home h2 { font-size: 1.6rem; }
.est-home { border-width: 2px; border-color: var(--accent); margin-bottom: 1.5rem; }
.est-reset { margin-top: 1rem; font-size: 0.9rem; }
.est-reset summary { cursor: pointer; color: var(--muted); }

/* Admin: collapsible sections (closed by default) */
.adm-sec > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.adm-sec > summary::-webkit-details-marker { display: none; }
.adm-sec > summary h2 { font-size: 1.15rem; }
.adm-sec > summary::after { content: "+"; font-family: var(--font-mono); color: var(--muted); font-size: 1.2rem; }
.adm-sec[open] > summary::after { content: "–"; }
.adm-sec[open] > summary { margin-bottom: 0.8rem; }

/* Rank mode (Xếp hạng) */
.rk-badge { display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; padding: 0.2rem 0.75rem; border-radius: 999px; color: #fff; background: #777; letter-spacing: 0.01em; }
.rk-r1 { background: #a8693a; } .rk-r2 { background: #7d8996; } .rk-r3 { background: #c28a0a; } .rk-r4 { background: #2f8f86; } .rk-r5 { background: #3b82d6; } .rk-r6 { background: linear-gradient(90deg, #7c3aed, #db2777); }
.rk-hero { display: grid; gap: 1.5rem; grid-template-columns: minmax(10rem, 14rem) 1fr; align-items: center; }
@media (max-width: 640px) { .rk-hero { grid-template-columns: 1fr; } }
.rk-hero-main { display: grid; gap: 0.35rem; justify-items: start; }
.rk-hero-side { display: grid; gap: 0.8rem; }
.rk-big { font-family: var(--font-display); font-weight: 700; font-size: 3.6rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.rk-bar { height: 0.6rem; }
.rk-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; color: var(--muted); }
.rk-stats b { color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; }
.rk-up-t { color: var(--good); } .rk-dn-t { color: var(--bad); }
.rk-graph { max-width: 40rem; height: auto; color: var(--ink); }
.rk-graph .rk-line { stroke: var(--accent); stroke-width: 2; }
.rk-graph .rk-gl { stroke: var(--line); stroke-dasharray: 3 3; }
.rk-graph .rk-gt { fill: var(--muted); font-size: 8px; font-family: var(--font-mono); }
.rk-graph .rk-up { fill: var(--good); } .rk-graph .rk-dn { fill: var(--bad); }
.rk-ranks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.rk-ranks li { display: flex; gap: 0.8rem; align-items: center; padding: 0.35rem 0.5rem; border-radius: 8px; }
.rk-ranks li.on { background: var(--bg); outline: 2px solid var(--accent); }
.rk-corner { position: fixed; top: 4.4rem; right: 0.8rem; z-index: 20; display: flex; align-items: center; gap: 0.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.8rem 0.3rem 0.4rem; box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.rk-corner .rk-elo { font-family: var(--font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.rk-corner small { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; }
@keyframes rk-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.rk-corner .pop-up, .rk-corner .pop-dn { animation: rk-pop 0.5s ease-out; display: inline-block; }
.rk-corner .pop-up { color: var(--good); } .rk-corner .pop-dn { color: var(--bad); }
.rk-timer { font-family: var(--font-mono); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.rk-timer.low { color: var(--bad); }
.rk-parts { margin: 0; font-family: var(--font-mono); font-size: 0.9rem; }
.rk-wild { border-color: var(--accent); color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .rk-corner .pop-up, .rk-corner .pop-dn { animation: none; } }
@media (max-width: 760px) { .rk-corner { top: auto; bottom: 0.8rem; right: 0.6rem; } }

.rk-warn { border-color: var(--bad); background: var(--bad-bg); color: var(--ink); padding: 0.7rem 1rem; }

/* Home: hero text on the left, "Việc cần làm hôm nay" (daily checks) on the right */
.hero-row { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.hero-row .hero { max-width: none; }
@media (max-width: 62rem) { .hero-row { grid-template-columns: minmax(0, 1fr); } }
.daily { display: grid; gap: 0.8rem; }
.dc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.dc-total { font-family: var(--font-mono); font-size: 0.95rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.dc-sub { margin: 0.2rem 0 0; font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.dc-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.dc-list > .dc-item:first-child { border-top: 0; }
.dc-check { width: 1.35rem; height: 1.35rem; border: 2px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-size: 0.85rem; line-height: 1; color: var(--accent-ink); background: transparent; }
.dc-item.done .dc-check { background: var(--accent); border-color: var(--accent); }
.dc-text { display: block; min-width: 0; }
.dc-hint { display: block; }
.dc-label { overflow-wrap: anywhere; }
.dc-item.done .dc-label, .dc-item.done .dc-count { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.dc-count { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
.dc-hint { font-size: 0.85rem; color: var(--muted); }
.dc-ok { font-family: var(--font-mono); font-size: 0.8rem; color: var(--good); white-space: nowrap; }
.dc-item .btn { white-space: nowrap; text-decoration: none; }
.dc-modal { align-items: center; }
.dc-pop { text-align: center; padding: 1.5rem 1.25rem; gap: 1rem; }
.dc-emoji { font-size: 3rem; line-height: 1; }
.dc-pop h2 { font-size: 1.6rem; text-wrap: balance; }

/* Auto pronounce bar (vocab tests, estimator, rank vocab questions) */
.pron-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.chip:disabled { opacity: 0.5; cursor: default; }

/* New version available (shown only while a test is open) */
.upd-banner { position: fixed; left: 0.75rem; right: 0.75rem; bottom: max(0.75rem, env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem;
  max-width: 44rem; margin: 0 auto; padding: 0.75rem 1rem; background: var(--ink); color: var(--bg); border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3); font-size: 0.95rem; }
.upd-banner .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }
