/* ทดสอบพิมพ์ดีด / Typing test (2026-11-18, typing phase A). On top of
   calc.css (cards, segmented switch, big numbers) and food.css (buttons). */
.tt-page { --tt-ok: var(--text); --tt-bad: #c4281c; --tt-wait: var(--muted, #6b655c); --tt-cur: color-mix(in srgb, var(--accent, #ff4b2b) 13%, transparent); --tt-lh: 44px; }
:root[data-theme="dark"] .tt-page { --tt-bad: #ff7a6b; --tt-cur: color-mix(in srgb, var(--accent, #ff4b2b) 22%, transparent); }

.tt-card, .tt-res { scroll-margin-top: calc(var(--nav-h, 64px) + 10px); }
html.cz-app .tt-card, html.cz-app .tt-res { scroll-margin-top: 66px; }

/* language + time */
.tt-setup { display: flex; flex-wrap: wrap; gap: 10px; }
.tt-seg button { min-height: 44px; padding: 6px 16px; }

/* clock row */
.tt-bar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tt-time { font: 700 30px/1 "Chakra Petch", var(--font-body); font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.tt-live { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; color: var(--muted, #6b655c); }
.tt-icon { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 999px;
  border: 0; background: var(--fill, rgba(17,17,17,.06)); color: var(--text); font: 800 14px/1.2 var(--font-body); cursor: pointer; }
.tt-icon img { width: 22px; height: 22px; }

/* the words */
.tt-words { position: relative; height: calc(var(--tt-lh) * 3); overflow: hidden; cursor: text;
  font: 600 22px/var(--tt-lh) var(--font-body); -webkit-user-select: none; user-select: none; overflow-wrap: normal; }
.tt-w { display: inline-block; height: var(--tt-lh); margin-right: .42em; padding: 0 4px; border-radius: 10px; color: var(--tt-wait); white-space: nowrap; }
.tt-w.ok { color: var(--tt-ok); }
.tt-w.bad { color: var(--tt-bad); text-decoration: underline 2px; text-underline-offset: 6px; }
.tt-w.cur { background: var(--tt-cur); color: var(--tt-wait); }
.tt-w .g-ok { color: var(--tt-ok); }
.tt-w .g-bad { color: var(--tt-bad); }
.tt-w .g-part { color: var(--tt-ok); opacity: .55; }
.tt-w .g-car { box-shadow: inset 2px 0 0 var(--accent, #ff4b2b); }
.tt-w .tt-x { color: var(--tt-bad); opacity: .75; }
.tt-w.cur.end::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -.15em; background: var(--accent, #ff4b2b); }
@media (prefers-reduced-motion: no-preference) {
  .tt-w .g-car, .tt-w.cur.end::after { animation: ttBlink 1s steps(1) infinite; }
}
@keyframes ttBlink { 50% { box-shadow: none; opacity: .35; } }

.tt-in { width: 100%; box-sizing: border-box; min-height: 52px; padding: 10px 14px; font: 600 20px/1.3 var(--font-body);
  color: var(--text); background: var(--bg); border: 2px solid var(--line-strong, rgba(17,17,17,.32)); border-radius: 14px; }
.tt-in:focus { outline: none; border-color: var(--accent, #ff4b2b); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #ff4b2b) 30%, transparent); }
.tt-in:disabled { opacity: .5; }
.tt-hint { margin: -4px 0 0; padding: 8px 12px; border-radius: 12px; font-size: 14px; font-weight: 700;
  background: color-mix(in srgb, var(--accent, #ff4b2b) 12%, transparent); color: var(--accent-text, #c22c0e); }
.tt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* a friend's challenge */
.tt-vs { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; border-radius: 18px; font-weight: 800; font-size: 15px;
  background: color-mix(in srgb, var(--accent, #ff4b2b) 12%, var(--surface)); }
.tt-vs img { width: 32px; height: 32px; flex: none; }

/* the result */
.tt-what { font-size: 13px; font-weight: 800; color: var(--muted, #6b655c); white-space: nowrap; }
.tt-res h2:focus { outline: none; }
.tt-wpm { display: grid; justify-items: center; gap: 2px; padding: 6px 0 2px; text-align: center; }
.tt-wpm b { font: 700 72px/1 "Chakra Petch", var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tt-wpm > span { font-size: 15px; font-weight: 800; color: var(--muted, #6b655c); }
.tt-newbest { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 4px 12px; border-radius: 999px; font-style: normal;
  font-weight: 800; font-size: 14px; background: var(--accent, #ff4b2b); color: #111111; }
.tt-newbest img { width: 20px; height: 20px; }
.tt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tt-stats .cc-big { text-align: center; justify-items: center; }
.tt-stats .tt-bad b { color: var(--tt-bad); }
.tt-sub, .tt-note, .tt-small { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted, #6b655c); }
.tt-sub { text-align: center; font-weight: 700; }
.tt-note { padding: 10px 12px; border-radius: 12px; background: var(--fill, rgba(17,17,17,.05)); color: var(--text); font-weight: 600; }
.tt-miss summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 800; }
.tt-miss ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.tt-miss li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 6px 10px; border-radius: 10px; background: var(--fill, rgba(17,17,17,.05)); }
.tt-miss li b { font-size: 17px; }
.tt-miss li span { font-size: 13.5px; color: var(--muted, #6b655c); }
.tt-miss li s { color: var(--tt-bad); text-decoration-thickness: 1.5px; }
.tt-acts { margin: 0; }
.tt-page .fd-btn.primary { color: #111111; }
.tt-acts .fd-btn img { width: 20px; height: 20px; }

/* bests */
.tt-best th:first-child, .tt-best td:first-child { text-align: left; }
.tt-best td.on { background: var(--tt-cur); border-radius: 8px; }
.tt-best td b { font-size: 16px; }

@media (max-width: 700px) {
  .tt-page { --tt-lh: 40px; }
  .tt-words { font-size: 20px; }
  .tt-time { font-size: 26px; }
  .tt-icon span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tt-icon { min-width: 44px; justify-content: center; padding: 6px; }
  .tt-wpm b { font-size: 64px; }
}

/* phase B: saving and the board (typing-board.js) */
.tt-save { display: grid; gap: 10px; justify-items: start; padding: 12px 14px; border-radius: 16px; background: var(--fill, rgba(17,17,17,.05)); }
.tt-save-t { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; }
.tt-save-t:empty { display: none; }
.tt-pend .cc-body { display: grid; gap: 10px; }
.tt-pend-t { margin: 0; font-weight: 700; line-height: 1.5; }
.tb-tabs { justify-self: stretch; display: flex; }
.tb-tabs button { flex: 1; }
.tb-tabs button[aria-selected="true"] { background: var(--app, #ffc21a); color: var(--app-ink, #111111); }
.tb-what { margin: 0; }
.tb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tb-list:empty { display: none; }
.tb-row { display: grid; grid-template-columns: 2.2em 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 40px; padding: 2px 8px; border-radius: 12px; }
.tb-row.me { background: var(--tt-cur); }
.tb-r { font: 700 15px/1 "Chakra Petch", var(--font-body); font-variant-numeric: tabular-nums; text-align: right; color: var(--muted, #6b655c); }
.tb-row:nth-child(-n+3) .tb-r { color: var(--text); }
.tb-av { width: 30px; height: 30px; }
.tb-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tb-n em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--accent-text, #c22c0e); }
.tb-v { font: 700 18px/1 "Chakra Petch", var(--font-body); font-variant-numeric: tabular-nums; }
.tb-gap { text-align: center; color: var(--muted, #6b655c); line-height: 1; }
.tb-msg { margin: 0; }
.tb-msg:empty { display: none; }
.tb-more { justify-self: center; }
