/* TypeTez: original styles. System fonts only; nothing is loaded from other sites. */
:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --ink: #1b2330;
  --muted: #4b5664;
  --line: #d6d1c4;
  --control-border: #857f70; /* form control edges: 3.99:1 on --surface, 3.63:1 on --bg (WCAG 1.4.11) */
  --brand: #0e5a63;
  --brand-strong: #0a434a;
  --brand-soft: #d8ecec;
  --accent: #b4410f;
  --ok: #14612f;
  --ok-bg: #e2f2e7;
  --bad: #a3221a;
  --bad-bg: #fde6e2;
  --miss: #5f5a4e;
  --cur-bg: #fff0b8;
  --focus: #b4410f;
  --radius: 12px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-deva: "Nirmala UI", "Mangal", "Noto Sans Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --surface: #1b232c;
    --surface-2: #222c36;
    --ink: #eef1f4;
    --muted: #b3bdc8;
    --line: #36424f;
    --control-border: #6b7785; /* 3.48:1 on --surface, 3.95:1 on --bg */
    --brand: #6cc4cc;
    --brand-strong: #9adbe0;
    --brand-soft: #1f3a3e;
    --accent: #f08a55;
    --ok: #86d6a0;
    --ok-bg: #173323;
    --bad: #ff9c90;
    --bad-bg: #3d1d1a;
    --miss: #c9c2b0;
    --cur-bg: #4a3f12;
    --focus: #f08a55;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.6; }
[lang="hi"] { font-family: var(--font-deva); }
a { color: var(--brand); text-underline-offset: 0.15em; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img, svg { max-width: 100%; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.01em; min-height: 44px; }
.brand-accent { color: var(--accent); }
nav { flex: 1 1 auto; min-width: 0; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.nav-list a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 999px; text-decoration: none; color: var(--ink); white-space: nowrap; font-weight: 600; font-size: 0.95rem; }
.nav-list a:hover { background: var(--surface-2); }
.nav-list a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); }

main { padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.2; margin: 0.2em 0 0.4em; letter-spacing: -0.015em; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 1.8em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 0.4em; }
.lede { font-size: 1.12rem; color: var(--muted); margin-top: 0; }
.prose { max-width: 46rem; }
.prose.wide { max-width: 60rem; }
code { font-family: var(--font-mono); font-size: 0.95em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 6px; overflow-wrap: anywhere; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.button.secondary { background: transparent; color: var(--brand); }
.button.secondary:hover { background: var(--brand-soft); color: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .button, .button:hover { color: #0b1a1c; } .button.secondary, .button.secondary:hover { color: var(--brand); } }

/* Tool */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 0 rgba(0,0,0,0.03); }
.tool-head h1 { margin-top: 0; }
.tool-head .lede { font-size: 1rem; margin-bottom: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; margin-bottom: 12px; }
.segmented { border: 0; padding: 0; margin: 0; }
.segmented legend { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; padding: 0; }
.segmented label { position: relative; display: inline-block; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 12px; border: 2px solid var(--control-border); background: var(--surface); margin-right: -2px; font-weight: 600; }
.segmented label:first-of-type span { border-radius: 10px 0 0 10px; }
.segmented label:last-of-type span { border-radius: 0 10px 10px 0; margin-right: 0; }
.segmented input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; position: relative; z-index: 1; }
@media (prefers-color-scheme: dark) { .segmented input:checked + span { color: #0b1a1c; } }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; z-index: 2; position: relative; }
.passage-pick { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; flex: 1 1 18rem; min-width: 0; max-width: 100%; }
.passage-pick label { width: 100%; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.passage-pick select { min-height: 44px; width: 12rem; max-width: 100%; min-width: 0; flex: 1 1 12rem; font: inherit; padding: 6px 10px; border: 2px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--ink); text-overflow: ellipsis; }
.live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.live-item { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; text-align: center; }
.live-label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.live-value { display: block; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.passage { position: relative; max-height: 13.5rem; overflow-y: auto; border: 2px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--bg); font-size: 1.2rem; line-height: 1.85; overflow-wrap: anywhere; }
.passage[lang="hi"] { font-size: 1.3rem; line-height: 2; }
.passage p { margin: 0 0 0.6em; }
.passage p:last-child { margin-bottom: 0; }
.w { border-radius: 4px; padding: 0 1px; }
.w.ok { color: var(--ok); }
.w.bad { color: var(--bad); background: var(--bad-bg); text-decoration: underline wavy var(--bad); text-underline-offset: 0.2em; }
.w.miss { color: var(--miss); text-decoration: line-through; }
.w.cur { background: var(--cur-bg); box-shadow: inset 0 -3px 0 var(--accent); }
.w.cur-bad { background: var(--bad-bg); box-shadow: inset 0 -3px 0 var(--bad); }
.type-label { display: block; font-weight: 700; margin-top: 12px; }
.typing-box { display: block; width: 100%; min-height: 6.5rem; margin-top: 6px; padding: 10px 12px; font: inherit; font-size: 1.15rem; line-height: 1.6; color: var(--ink); background: var(--surface); border: 2px solid var(--brand); border-radius: 10px; resize: vertical; }
.typing-box[lang="hi"] { font-family: var(--font-deva); font-size: 1.25rem; }
.typing-box[readonly] { border-color: var(--line); background: var(--surface-2); }
.help { font-size: 0.9rem; color: var(--muted); margin: 6px 0; }
.status-line { min-height: 1.6em; margin: 4px 0; font-weight: 600; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.results { margin-top: 16px; border-top: 2px dashed var(--line); padding-top: 8px; }
.results h2 { margin-top: 0.4em; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.result-item { background: var(--brand-soft); border-radius: 10px; padding: 8px 10px; }
.result-item dt { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.result-item dd { margin: 0; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.working { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: 8px 0; background: var(--surface); }
.working summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.mistakes { padding-left: 1.4em; }
.typed-bad { color: var(--bad); }
.review-note { margin: 6px 0 10px; }

/* History */
.history { margin-top: 28px; }
.history-summary p { margin: 4px 0; }
.table-wrap { overflow-x: auto; margin: 10px 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
caption { text-align: left; padding: 8px 10px; font-weight: 700; color: var(--muted); }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--surface-2); border-top: 0; }
.keymap td, .keymap th { text-align: center; min-width: 2.4em; }
.keymap td { font-size: 1.25rem; }

/* Content blocks */
.explain { max-width: 46rem; }
.formula-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 12px; }
.formula-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 10px; padding: 10px 14px; }
.formula-card h3 { margin-top: 0.2em; }
.formula-card p { margin: 0.2em 0 0.4em; }
.link-list { padding-left: 1.2em; }
.link-list li { margin: 6px 0; }
.source { font-size: 0.88rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
.sources { margin-top: 2.4em; border-top: 1px solid var(--line); }
.sources li { font-size: 0.92rem; margin: 6px 0; overflow-wrap: anywhere; }
.note { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; border-left: 5px solid var(--brand); }
.note.important { border-left-color: var(--accent); }
.note.limits { border-left-color: var(--accent); }
.note p { margin: 0.2em 0; }
.definitions dt { font-weight: 800; margin-top: 10px; }
.definitions dd { margin: 4px 0 0 0; }
.checklist li { margin: 8px 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 24px; }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h2 { font-size: 1.15rem; margin: 0.2em 0 0.4em; }
.card p { margin: 0; color: var(--muted); }
.toc ol { columns: 2 16rem; padding-left: 1.4em; }
.toc li { break-inside: avoid; margin: 3px 0; }
.passage-card { border-top: 1px solid var(--line); padding-top: 4px; }
.passage-card h2 { font-size: 1.2rem; }
.pid { font-family: var(--font-mono); font-size: 0.85em; color: var(--accent); }
.gloss { font-weight: 400; color: var(--muted); font-size: 0.9em; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 0; }
.passage-text { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.passage-text[lang="hi"] { font-size: 1.15rem; line-height: 1.9; }
.product-type { border-top: 1px solid var(--line); margin-top: 1.6em; }
.shop { margin-bottom: 4px; }
.disclosure-inline { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.setup-check { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.setup-check label { display: block; font-weight: 700; }
.setup-check input { width: 100%; min-height: 44px; font: inherit; font-size: 1.25rem; padding: 6px 10px; border: 2px solid var(--brand); border-radius: 10px; margin-top: 6px; background: var(--surface); color: var(--ink); }
.setup-result { font-weight: 600; }
.setup-chars { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.setup-chars li { background: var(--surface-2); border-radius: 8px; padding: 2px 8px; font-family: var(--font-mono); font-size: 0.85rem; }
.setup-chars .glyph { font-family: var(--font-deva); font-size: 1.2rem; margin-right: 2px; }
.clear-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); font-size: 0.92rem; color: var(--muted); }
.footer-inner { padding-top: 18px; padding-bottom: 24px; }
.footer-brand { color: var(--ink); font-weight: 700; }
.footer-links { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px 0 0; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .header-inner { flex-wrap: nowrap; gap: 8px; padding-top: 4px; padding-bottom: 4px; }
  .brand { font-size: 1.1rem; flex: 0 0 auto; }
  .logo-mark { width: 30px; height: 30px; }
  .nav-list a { padding: 0 9px; font-size: 0.9rem; }
  .segmented legend { font-size: 0.78rem; margin-bottom: 2px; }
  .passage-pick label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .review-note { font-size: 0.85rem; padding: 6px 10px; }
  .typing-box { min-height: 5rem; }
  main { padding-top: 12px; }
  .tool { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .passage-pick select { width: 8rem; flex: 1 1 8rem; }
  .live-label { text-transform: none; white-space: nowrap; font-size: 0.72rem; }
  .tool-head .lede { display: none; }
  .tool-head h1 { font-size: 1.45rem; margin-bottom: 8px; }
  .controls { gap: 8px 8px; margin-bottom: 8px; }
  .segmented span { padding: 0 9px; }
  .live { gap: 6px; }
  .live-item { padding: 4px 4px; }
  .live-value { font-size: 1.15rem; }
  .passage { max-height: 8rem; font-size: 1.08rem; padding: 8px 10px; }
  .passage[lang="hi"] { font-size: 1.15rem; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
