:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --paper-deep: #ebe6dc;
  --ink: #171714;
  --muted: #716f68;
  --line: #cec8bc;
  --accent: #ed5a3d;
  --accent-dark: #ca3d25;
  --good: #1a7a56;
  --bad: #c53c34;
  --white: #fffdf8;
  --shadow: 0 18px 50px rgba(39, 32, 23, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-width: 320px;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(237, 90, 61, 0.28);
  outline-offset: 3px;
}

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-header {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.04em;
  font-size: 21px;
}
.brand-mark { display: flex; gap: 3px; align-items: flex-end; height: 20px; }
.brand-mark i { display: block; width: 4px; border-radius: 3px; background: var(--ink); }
.brand-mark i:nth-child(1) { height: 12px; }
.brand-mark i:nth-child(2) { height: 20px; background: var(--accent); }
.brand-mark i:nth-child(3) { height: 16px; }
.header-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9b4aa; }
.status-dot.online { background: var(--good); box-shadow: 0 0 0 4px rgba(26, 122, 86, 0.10); }
.status-dot.offline { background: var(--bad); }

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr;
  align-items: end;
  gap: 70px;
  padding: 76px 0 50px;
}
.eyebrow { margin: 0 0 14px; font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--accent-dark); }
.hero h1 {
  margin: 0;
  max-width: 780px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  font-weight: 500;
}
.hero-copy { margin: 0 0 8px; color: var(--muted); line-height: 1.7; font-size: 15px; max-width: 390px; }

.test-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr); gap: 18px; align-items: stretch; }
.test-panel, .result-panel, .leaderboard-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.test-panel { padding: 22px 24px 18px; min-height: 510px; display: flex; flex-direction: column; }
.test-toolbar, .result-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; }
.duration-tabs, .filter-group { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--paper); }
.duration-button, .filter-group button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
}
.duration-button.active, .filter-group button.active { background: var(--ink); color: var(--white); }
.icon-button {
  width: 39px; height: 39px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer;
}
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { border-color: var(--ink); }

.live-row { display: flex; gap: 34px; padding: 29px 2px 18px; border-bottom: 1px solid var(--line); }
.live-row div { min-width: 76px; }
.live-row span { display: block; font-size: 27px; font-weight: 760; letter-spacing: -0.04em; }
.live-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.typing-stage {
  position: relative;
  flex: 1;
  min-height: 278px;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: text;
}
.passage {
  width: 100%;
  max-height: 230px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  color: #aaa59b;
  font: 500 22px/1.62 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -0.025em;
  user-select: none;
  word-break: normal;
  white-space: pre-wrap;
}
.passage::-webkit-scrollbar { display: none; }
.passage span { border-radius: 2px; transition: color 60ms linear, background 60ms linear; }
.passage span.correct { color: var(--ink); }
.passage span.incorrect { color: var(--bad); background: rgba(197, 60, 52, 0.10); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.passage span.current { position: relative; }
.passage span.current::before {
  content: ""; position: absolute; width: 2px; height: 1.2em; left: -1px; top: 0.08em; background: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
#typingInput {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0.01;
  resize: none;
  border: 0;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  font-size: 16px;
  z-index: 2;
}
#typingInput:disabled { cursor: default; }
.loading-state { color: var(--muted); font-size: 14px; }
.start-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  padding: 7px 12px; background: var(--ink); color: var(--white); border-radius: 999px;
  font-size: 11px; pointer-events: none; transition: opacity 160ms ease;
}
.start-hint.hidden { opacity: 0; }
.test-footer { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); padding-top: 15px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--paper); padding: 1px 5px; font-size: 10px; }

.result-panel { padding: 26px; min-height: 510px; }
.empty-result { height: 100%; min-height: 455px; display: flex; flex-direction: column; justify-content: flex-end; }
.result-number { font-family: Georgia, serif; color: var(--accent); font-size: 55px; line-height: 1; }
.empty-result h2 { margin: 16px 0 10px; font: 500 31px/1.05 Georgia, serif; letter-spacing: -0.04em; }
.empty-result p { color: var(--muted); line-height: 1.6; margin: 0; font-size: 14px; }
.hidden { display: none !important; }
.result-heading h2 { margin: 0; font-size: 48px; letter-spacing: -0.06em; }
.result-heading h2 small { font-size: 13px; letter-spacing: 0.08em; color: var(--muted); }
.result-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; }
.result-badge.saved { background: rgba(26, 122, 86, 0.10); border-color: rgba(26, 122, 86, 0.25); color: var(--good); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin: 22px 0 18px; }
.result-grid div { padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-grid strong { display: block; font-size: 19px; }
.result-grid span { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }
.comparison-box { background: var(--paper); border-radius: 12px; padding: 13px 14px; margin-bottom: 17px; }
.comparison-box span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.comparison-box strong { display: block; font-size: 13px; line-height: 1.35; }
.score-form label { display: block; font-size: 11px; font-weight: 760; margin-bottom: 7px; }
.score-form-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.score-form input { min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--white); padding: 10px 11px; font-size: 13px; }
.primary-button, .secondary-button { border: 0; border-radius: 9px; padding: 10px 13px; font-weight: 750; font-size: 12px; cursor: pointer; }
.primary-button { background: var(--accent); color: white; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: 0.55; cursor: not-allowed; }
.secondary-button { width: 100%; margin-top: 10px; background: var(--ink); color: var(--white); }
.form-message { min-height: 16px; margin: 6px 0 0; color: var(--bad); font-size: 10px; }

.leaderboard-section { padding: 96px 0 70px; }
.section-heading { align-items: flex-end; margin-bottom: 25px; }
.section-heading h2 { margin: 0; font: 500 clamp(38px, 5vw, 58px)/1 Georgia, serif; letter-spacing: -0.05em; }
.board-filters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--paper-deep); }
.summary-strip div { padding: 17px 20px; border-right: 1px solid var(--line); }
.summary-strip div:last-child { border-right: 0; }
.summary-strip span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.summary-strip strong { font-size: 21px; letter-spacing: -0.03em; }
.leaderboard-card { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; box-shadow: none; }
.leaderboard-head, .leaderboard-row {
  display: grid;
  grid-template-columns: 70px minmax(150px, 1.5fr) 0.75fr 0.85fr 0.9fr 0.8fr;
  align-items: center;
  gap: 12px;
}
.leaderboard-head { padding: 12px 20px; background: var(--ink); color: rgba(255,255,255,0.68); font-size: 9px; text-transform: uppercase; letter-spacing: 0.11em; }
.leaderboard-row { padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row:hover { background: #faf7f0; }
.leaderboard-row.highlight { background: rgba(237, 90, 61, 0.08); }
.rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank.medal { color: var(--accent-dark); font-weight: 800; }
.typist { font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speed { font-size: 17px; font-weight: 800; }
.metric, .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.board-message { padding: 45px 20px; text-align: center; color: var(--muted); font-size: 13px; }

footer { min-height: 100px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 55px; }
  .test-layout { grid-template-columns: 1fr; }
  .result-panel, .result-panel .empty-result { min-height: auto; }
  .empty-result { padding: 35px 0 8px; }
}

@media (max-width: 680px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .site-header { height: 68px; }
  .hero { padding: 44px 0 34px; }
  .hero h1 { font-size: clamp(38px, 13vw, 58px); }
  .hero-copy { font-size: 14px; }
  .test-panel { padding: 16px; min-height: 470px; }
  .live-row { gap: 18px; justify-content: space-between; }
  .live-row div { min-width: 0; }
  .passage { font-size: 18px; line-height: 1.65; max-height: 242px; }
  .typing-stage { min-height: 284px; }
  .test-footer span:last-child { display: none; }
  .result-panel { padding: 20px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 22px; }
  .board-filters { justify-content: flex-start; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip div:nth-child(2) { border-right: 0; }
  .summary-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .leaderboard-head { display: none; }
  .leaderboard-row { grid-template-columns: 45px 1fr auto; gap: 6px 10px; padding: 15px; }
  .leaderboard-row .rank { grid-row: 1 / 3; }
  .leaderboard-row .speed { text-align: right; }
  .leaderboard-row .metric { font-size: 11px; }
  .leaderboard-row .consistency { display: none; }
  .leaderboard-row .when { text-align: right; font-size: 10px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* Navigation and indexable content */
.site-nav { display: flex; align-items: center; gap: 22px; margin-left: auto; margin-right: 26px; }
.site-nav a, .site-footer a, .breadcrumbs a, .article-body a, .faq-list a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 690; }
.site-nav a:hover, .site-footer a:hover { color: var(--ink); }
.header-cta { color: var(--white); background: var(--ink); border-radius: 999px; padding: 9px 13px; text-decoration: none; font-size: 11px; font-weight: 760; }
.noscript-message { margin: 20px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-deep); color: var(--muted); }
.content-section { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr); gap: clamp(40px, 8vw, 110px); padding: 82px 0; border-top: 1px solid var(--line); }
.content-section h2, .article-cta h2 { margin: 0; font: 500 clamp(36px, 5vw, 58px)/1.02 Georgia, serif; letter-spacing: -.05em; }
.prose-stack { max-width: 690px; }
.prose-stack p { color: var(--muted); font-size: 16px; line-height: 1.8; margin: 0 0 18px; }
.text-link { display: inline-block; margin-top: 8px; color: var(--ink); font-size: 13px; font-weight: 780; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 3px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 90px; }
.feature-grid article { padding: 25px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,248,.58); }
.feature-number { color: var(--accent-dark); font: 500 28px/1 Georgia, serif; }
.feature-grid h3 { margin: 42px 0 10px; font-size: 18px; letter-spacing: -.025em; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.faq-section { padding-bottom: 96px; }
.faq-list details { border-top: 1px solid var(--line); padding: 20px 0; }
.faq-list details:last-child { border-bottom: 1px solid var(--line); }
.faq-list summary { cursor: pointer; font-weight: 760; list-style-position: outside; }
.faq-list p { color: var(--muted); line-height: 1.7; font-size: 14px; margin: 12px 0 0; max-width: 650px; }
.site-footer { min-height: 170px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 50px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer > div p { margin: 10px 0 0; }
.footer-brand { width: fit-content; }
.site-footer nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; }
.site-footer nav a { text-decoration: none; white-space: nowrap; }
.site-footer > p { text-align: right; max-width: 260px; justify-self: end; }

/* Guide pages */
.article-main { max-width: 930px; margin: 0 auto; padding-bottom: 100px; }
.breadcrumbs { display: flex; gap: 9px; padding: 30px 0 0; color: var(--muted); font-size: 11px; }
.article-hero { padding: 78px 0 64px; border-bottom: 1px solid var(--line); }
.article-hero h1 { margin: 0; max-width: 850px; font: 500 clamp(48px, 8vw, 84px)/.96 Georgia, serif; letter-spacing: -.06em; }
.article-hero > p:last-child { max-width: 720px; margin: 28px 0 0; color: var(--muted); font-size: 18px; line-height: 1.7; }
.article-body { max-width: 760px; margin: 0 auto; padding: 28px 0 60px; }
.article-body section { padding: 42px 0; border-bottom: 1px solid var(--line); }
.article-body h2 { margin: 0 0 18px; font: 500 36px/1.08 Georgia, serif; letter-spacing: -.035em; }
.article-body h3 { margin: 28px 0 8px; font-size: 17px; }
.article-body p, .article-body li { color: #4f4d48; font-size: 16px; line-height: 1.8; }
.article-body p { margin: 0 0 18px; }
.article-body ul, .article-body ol { padding-left: 23px; }
.article-body li { margin: 7px 0; }
.formula-box { margin: 24px 0; padding: 22px 24px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--white); font: 600 18px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.table-wrap { overflow-x: auto; margin: 26px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--white); }
table { border-collapse: collapse; width: 100%; min-width: 620px; }
th, td { padding: 15px 16px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { background: var(--ink); color: var(--white); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.article-cta { display: flex; justify-content: space-between; align-items: flex-end; gap: 35px; padding: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-deep); }
.article-cta h2 { font-size: clamp(30px, 4vw, 46px); max-width: 560px; }
.primary-link-button { display: inline-block; flex: 0 0 auto; padding: 13px 17px; border-radius: 999px; background: var(--accent); color: white; text-decoration: none; font-size: 12px; font-weight: 800; }
.primary-link-button:hover { background: var(--accent-dark); }
.error-page { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.error-page h1 { margin: 0; font: 500 clamp(48px, 8vw, 86px)/1 Georgia, serif; letter-spacing: -.06em; }
.error-page > p:not(.eyebrow) { color: var(--muted); margin: 20px 0 28px; }

@media (max-width: 900px) {
  .site-nav { gap: 15px; margin-right: 18px; }
  .site-nav a:nth-child(2) { display: none; }
  .content-section { grid-template-columns: 1fr; gap: 28px; }
  .site-footer { grid-template-columns: 1fr 1fr; padding: 38px 0; }
  .site-footer > p { grid-column: 1 / -1; justify-self: start; text-align: left; }
}
@media (max-width: 680px) {
  .site-nav { display: none; }
  .header-cta { margin-left: auto; }
  .header-meta { margin-left: auto; }
  .content-section { padding: 62px 0; }
  .feature-grid { grid-template-columns: 1fr; padding-bottom: 64px; }
  .feature-grid h3 { margin-top: 24px; }
  .site-footer { grid-template-columns: 1fr; gap: 28px; }
  .site-footer > p { grid-column: auto; }
  .article-hero { padding: 56px 0 46px; }
  .article-hero > p:last-child { font-size: 16px; }
  .article-body h2 { font-size: 31px; }
  .article-cta { align-items: flex-start; flex-direction: column; padding: 27px; }
}


/* Crawlable guide navigation shown on every screen size. */
.guide-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 30px;
  border: 1px solid var(--line);
  background: var(--line);
}
.guide-strip a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 14px;
  min-height: 98px;
  padding: 20px 22px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}
.guide-strip a:hover {
  background: var(--panel);
  transform: translateY(-1px);
}
.guide-strip span {
  grid-row: 1 / 3;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .12em;
  padding-top: 3px;
}
.guide-strip strong {
  font-size: 14px;
  line-height: 1.25;
}
.guide-strip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .guide-strip { grid-template-columns: 1fr; margin-bottom: 22px; }
  .guide-strip a { min-height: 76px; padding: 16px 18px; }
}
