/* Font nhúng sẵn trong dự án (giấy phép OFL, xem thư mục fonts/). Mỗi font chia 2 file: Latin và phần riêng của tiếng Việt. */
@font-face {
  font-family: "Be Vietnam Pro"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-400-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Be Vietnam Pro"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/be-vietnam-pro-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Be Vietnam Pro"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/be-vietnam-pro-vietnamese-600-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "JetBrains Mono"; font-weight: 100 800; font-style: normal; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-weight: 100 800; font-style: normal; font-display: swap;
  src: url("../fonts/jetbrains-mono-vietnamese-wght-normal.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --border: #e2ded4;
  --text: #23211c;
  --muted: #8a8578;
  --untyped: #a9a497;
  --accent: #0f8a6c;
  --accent-soft: #d9f0e9;
  --error: #d1433a;
  --error-soft: #fbe3e0;
  --pending: #b7791f;
  --star: #e0a100;
  --pace: #6d7688; /* vạch nhịp: xám trung tính, không trùng màu nào đang mang nghĩa khác */
  --row: 54px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", monospace;
  --sans: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #17181b;
  --surface: #1f2125;
  --border: #2f3238;
  --text: #e8e6e1;
  --muted: #8b8f98;
  --untyped: #666a73;
  --accent: #3fcfa6;
  --accent-soft: #173a31;
  --error: #f0685f;
  --error-soft: #47211f;
  --pending: #e3b25a;
  --star: #f2c230;
  --pace: #a4adc0;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.app { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.logo { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; }
.logo small { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.logo-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--bg); font-size: 18px;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 17px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Setup */
.setup { transition: opacity .25s; }
body.typing .setup, body.typing .history { opacity: .25; pointer-events: none; }
.row { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-bottom: 10px; }
.field { display: flex; align-items: center; gap: 10px; }
.field-label { font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px;
  padding: 6px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: var(--bg); font-weight: 600; }
.seg button .tag { font-size: 12px; opacity: .8; margin-left: 4px; }

.levels { display: flex; flex-wrap: wrap; gap: 6px; }
.level {
  position: relative; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px;
  display: inline-flex; align-items: center; gap: 7px; height: 36px;
}
.level-n { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.level .lock { width: 13px; height: 13px; fill: var(--muted); }
.level:hover { border-color: var(--accent); }
.level.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: var(--accent-soft); }
.level.locked { cursor: not-allowed; opacity: .55; }
.level.locked:hover { border-color: var(--border); }
.level.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.stars { letter-spacing: 1px; color: var(--border); font-size: 13px; }
.level .stars { color: color-mix(in srgb, var(--muted) 45%, transparent); font-size: 12px; }
.stars b { color: var(--star); font-weight: 400; }
.setup-note { margin: 0 2px; font-size: 13.5px; color: var(--muted); min-height: 21px; }
.setup-note b { color: var(--text); font-weight: 600; }
.setup-note.warn { color: var(--error); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.ui-seg { height: 36px; align-items: center; }
.ui-seg button { padding: 5px 8px; font-family: var(--mono); font-size: 12.5px; }
.icon-btn.text { width: auto; padding: 0 12px; font: inherit; font-size: 13.5px; }

/* Game */
.game { margin-top: 16px; }
.live { display: flex; align-items: baseline; gap: 30px; margin-bottom: 14px; flex-wrap: wrap; }
.live-item { display: flex; align-items: baseline; gap: 6px; }
.live-num { font-family: var(--mono); font-size: 30px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.live-label { font-size: 13px; color: var(--muted); }
.live-goal { margin-left: auto; font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.board {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 26px 18px; overflow: hidden; cursor: text;
}
.clip { height: calc(var(--row) * 3 - 6px); overflow: hidden; }
.board:focus-within { border-color: var(--accent); }
.words {
  position: relative; font-family: var(--mono); font-size: 25px; line-height: 46px;
  color: var(--untyped); transition: transform .15s ease-out; user-select: none;
}
.word { display: inline-block; margin: 0 14px 8px 0; height: 46px; white-space: pre; border-bottom: 2px solid transparent; }
.word.done { color: var(--text); }
.word.wrong { border-bottom-color: var(--error); }
.ch.ok { color: var(--text); }
.ch.pend { color: var(--pending); }
.ch.bad { color: var(--error); background: var(--error-soft); border-radius: 3px; }
.ch.extra { color: var(--error); opacity: .75; }
.caret {
  position: absolute; left: 0; top: 7px; width: 2.5px; height: 32px; border-radius: 2px;
  background: var(--accent); transition: left .08s ease-out, top .08s ease-out;
  animation: blink 1s steps(1) infinite;
}
body.typing .caret { animation: none; }
.pace {
  position: absolute; left: 0; top: 7px; width: 2.5px; height: 32px; border-radius: 2px;
  background: var(--pace); transition: left .1s linear;
}
.pace::before {
  content: ""; position: absolute; left: -3.5px; top: -6px;
  border: 5px solid transparent; border-top-color: var(--pace);
}
.live-goal.ahead { color: var(--accent); font-weight: 600; }
.live-goal.behind { color: var(--error); font-weight: 600; }
@keyframes blink { 50% { opacity: 0; } }
.ghost-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0;
  font-size: 16px; cursor: text; background: transparent; color: transparent; caret-color: transparent;
}
.blur-hint {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px);
  color: var(--text); font-size: 15px; pointer-events: none;
}
.board.blurred .blur-hint { display: grid; }

.hints { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
kbd {
  font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}

/* Result */
.result { margin-top: 26px; }
.verdict {
  border-radius: 14px; padding: 14px 18px; margin-bottom: 16px; font-size: 16px;
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.verdict.fail { background: var(--surface); border-color: var(--border); }
.verdict.pop { animation: verdictPop .45s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.verdict.pop .stars b { display: inline-block; animation: starPop .5s cubic-bezier(.2, 1.8, .4, 1) backwards; }
.verdict.pop .stars b:nth-child(1) { animation-delay: .35s; }
.verdict.pop .stars b:nth-child(2) { animation-delay: .6s; }
.verdict.pop .stars b:nth-child(3) { animation-delay: .85s; }
@keyframes verdictPop { from { transform: scale(.94); opacity: 0; } }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.level.unlocked-now { animation: unlockGlow 1.1s ease-out 3; }
@keyframes unlockGlow {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--star) 70%, transparent); border-color: var(--star); }
  100% { box-shadow: 0 0 0 14px transparent; border-color: var(--star); }
}
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
@media (prefers-reduced-motion: reduce) {
  .verdict.pop, .verdict.pop .stars b, .level.unlocked-now { animation: none; }
}
.verdict strong { font-size: 18px; }
.verdict .stars { font-size: 20px; margin-left: 8px; color: var(--muted); }
.verdict p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { grid-column: span 2; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.stat.big { grid-column: span 3; padding: 16px 18px; }
.stat-num { font-family: var(--mono); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.big .stat-num { font-size: 52px; line-height: 1.1; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--muted); }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.stat-strip div { display: flex; flex-direction: column; padding: 10px 14px; border-left: 1px solid var(--border); }
.stat-strip div:first-child { border-left: 0; }
.stat-strip b { font-family: var(--mono); font-size: 19px; font-variant-numeric: tabular-nums; }
.stat-strip span { font-size: 13px; color: var(--muted); }

/* Thang so sánh với mốc tham khảo */
.bench-line { margin: 0 0 6px; font-size: 15px; }
.bench { position: relative; padding: 26px 0 28px; }
.bench-track { position: relative; height: 12px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.bench-pro { position: absolute; top: -1px; bottom: -1px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.bench-tick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--muted); border-radius: 1px; }
.bench-num { position: absolute; top: 46px; transform: translateX(-50%); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bench-you { position: absolute; top: -7px; bottom: -7px; width: 4px; margin-left: -2px; background: var(--accent); border-radius: 2px; }
.bench-you-label {
  position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--accent);
}
.bench-key { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 8px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.bench-key b { font-family: var(--mono); color: var(--text); font-weight: 600; }
.bench-note { margin: 0; font-size: 13px; color: var(--muted); }
.bench-note a { color: inherit; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col .panel { margin-bottom: 16px; }

.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .avg { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .err { fill: var(--error); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.lg { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-line { width: 18px; height: 3px; background: var(--accent); border-radius: 2px; }
.lg-avg { width: 18px; height: 0; border-top: 2px dashed var(--muted); }
.lg-err { width: 8px; height: 8px; border-radius: 50%; background: var(--error); }

.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.insights li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; }
.insights .ico {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 1px;
  background: var(--accent-soft); color: var(--accent);
}
.insights li.warn .ico { background: var(--error-soft); color: var(--error); }
.insights li.tip .ico { background: var(--bg); color: var(--pending); border: 1px solid var(--border); }
.insights b { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 14px; padding: 5px 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border); display: inline-flex; gap: 8px; align-items: baseline;
}
.chip small { font-family: var(--sans); font-size: 12.5px; color: var(--muted); }
.chip.err { border-color: var(--error); }
.empty { color: var(--muted); font-size: 14px; }

.actions { display: flex; gap: 10px; justify-content: center; margin: 0 0 16px; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }

/* Modes */
.modes { flex-wrap: wrap; }
.modes .btn.on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.check:hover { color: var(--text); }
.sep { opacity: .5; margin: 0 4px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* Keyboard */
.kb-wrap {
  --f-ut: #c0527a; --f-apUt: #c98a2b; --f-giua: #7d5fc7; --f-tro: #3b7fc4; --f-cai: #8a8578;
  margin-top: 18px; display: grid; justify-items: center; gap: 8px;
}
.kb-hint { font-size: 14px; color: var(--muted); min-height: 21px; }
.kb-hint b { color: var(--text); font-family: var(--mono); }
.kb { display: grid; gap: 5px; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  --fc: var(--muted);
  width: 38px; height: 38px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 13.5px; color: var(--text);
  background: color-mix(in srgb, var(--fc) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--fc) 35%, var(--border));
}
.key.wide { width: 74px; font-size: 11px; }
.key.space { width: 270px; }
.key.home { box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--fc) 60%, transparent); }
.key.next { background: var(--fc); border-color: var(--fc); color: #fff; font-weight: 700; transform: translateY(-2px); box-shadow: 0 3px 0 color-mix(in srgb, var(--fc) 50%, #000); }
.f-ut { --fc: var(--f-ut); } .f-apUt { --fc: var(--f-apUt); } .f-giua { --fc: var(--f-giua); } .f-tro { --fc: var(--f-tro); } .f-cai { --fc: var(--f-cai); }
.hands { display: flex; justify-content: center; gap: 70px; margin-top: 4px; }
.hands svg { width: 150px; height: 120px; display: block; }
.hands .palm { fill: color-mix(in srgb, var(--muted) 12%, var(--surface)); stroke: var(--border); stroke-width: 1.5; }
.hands .fg {
  fill: color-mix(in srgb, var(--fc) 16%, var(--surface)); stroke: color-mix(in srgb, var(--fc) 45%, var(--border)); stroke-width: 1.5;
  transition: fill .08s;
}
.hands .fg.on { fill: var(--fc); stroke: var(--fc); }
.hands text { font-family: var(--sans); font-size: 11px; fill: var(--muted); text-anchor: middle; }
.kb-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.fk { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--fc); margin-right: 5px; }

/* Màn hình thấp (laptop): thu nhỏ bàn phím và ẩn hình bàn tay để mọi thứ nằm trong một màn hình */
@media (max-height: 900px) {
  .hands, .kb-legend { display: none; }
  .kb-wrap { margin-top: 10px; gap: 6px; }
  .key { width: 34px; height: 32px; font-size: 12.5px; }
  .key.wide { width: 66px; }
  .key.space { width: 240px; }
  .kb, .kb-row { gap: 4px; }
}
@media (max-height: 760px) {
  .top { margin-bottom: 12px; }
  .board { padding-top: 14px; padding-bottom: 10px; }
  .live { margin-bottom: 8px; }
  .live-num { font-size: 24px; }
}

/* Dialog */
.dlg { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); padding: 22px; width: min(560px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg h2 { margin: 0 0 6px; font-size: 18px; }
.dlg p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.dlg textarea {
  width: 100%; font-family: var(--mono); font-size: 14px; line-height: 1.6; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.dlg textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dlg .dlg-err { color: var(--error); min-height: 20px; margin: 6px 0 0; }
.dlg .actions { margin: 8px 0 0; justify-content: flex-end; }

/* Help */
.help-list { margin: 10px 0 16px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }

/* Focus rõ ràng cho người dùng bàn phím */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ghost-input:focus-visible { outline: none; }

/* History */
.history { margin-top: 26px; transition: opacity .25s; }
.history summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.history summary::-webkit-details-marker { display: none; }
.history summary::before { content: "▸"; color: var(--muted); }
.history[open] summary::before { content: "▾"; }
.history[open] summary { margin-bottom: 12px; }
.sum-title { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.history h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.scope { text-transform: none; letter-spacing: 0; font-weight: 400; }
.table-wrap { overflow-x: auto; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.mini-stats div { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.mini-stats b { font-family: var(--mono); font-size: 19px; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 13px; color: var(--muted); }
.chart .dot { fill: var(--accent); }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 18px; }
.btn.small { padding: 6px 12px; font-size: 13px; font-weight: 500; }
.history table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th { text-align: left; font-weight: 400; color: var(--muted); font-size: 13px; padding: 4px 8px; }
.history td { padding: 6px 8px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; white-space: nowrap; }
.history td.num { font-family: var(--mono); }

@media (max-width: 760px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip div:nth-child(3) { border-left: 0; }
  .stat-strip div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .live-goal { white-space: normal; text-align: left; }
  .sep { display: none; }
  /* Thu gọn phần thiết lập để khung gõ nằm trong màn hình đầu tiên */
  .field-label { display: none; }
  .row { gap: 8px 10px; margin-bottom: 8px; }
  .seg button { padding: 6px 10px; }
  .setup-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top { margin-bottom: 14px; }
  .game { margin-top: 10px; }
  .live { margin-bottom: 10px; gap: 6px 18px; }
  .stat-grid, .mini-stats { grid-template-columns: repeat(2, 1fr); }
  .kb-wrap, .check { display: none; } /* màn hình cảm ứng không cần bàn phím gợi ý */
  .stat { grid-column: span 1; }
  .stat.big { grid-column: span 2; }
  .stat.big .stat-num { font-size: 42px; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .words { font-size: 21px; }
  .board { padding: 18px 16px; }
  .live { gap: 18px; }
  .live-goal { margin-left: 0; width: 100%; }
  .logo small { display: none; }
}
