/* Medium-white chrome: the code block is the only colorful element. */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* defaults match the 'default' pygments style; applyTheme() re-derives
   every one of these from the selected palette's bg/fg/colors */
:root {
  --ink: #242424;
  --ink-soft: #6b6b6b;
  --ink-faint: #a8a8a8;
  --paper: #ffffff;
  --panel: #f5f5f5;
  --edge: #dddddd;
  --accent: #1a8917;
  --err: #c4320a;
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .25s ease, color .25s ease;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 64rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.4rem 1.5rem;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: -.03em;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}
.wm-bold { font-weight: 700; }
/* the wordmark types itself: a blinking block caret, until the user's
   own typing takes over (js adds .still on first interaction) */
.wm-caret {
  display: inline-block;
  width: .5em;
  height: 1em;
  margin-left: .18em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.wm-caret.still { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .wm-caret { animation: none; }
}

#account { font-family: var(--sans); font-size: .85rem; }
#account a { color: var(--ink-soft); text-decoration: none; }
#account a:hover { color: var(--ink); }
#account .login { color: var(--ink-soft); margin-right: .8em; }
/* the GitHub sign-in button, shared by the header and results screen */
.ghbtn {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .42rem .9rem;
  border: 1px solid var(--edge);
  border-radius: 6px;
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
}
.ghbtn:hover { border-color: var(--ink-soft); }
.ghbtn svg { width: 16px; height: 16px; fill: currentColor; }
.ghbtn.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: auto;
}

/* signed-in: avatar + themed account menu */
.userwrap { position: relative; }
.avatar-btn {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  display: block;
}
.avatar-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  display: block;
}
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 600;
}
.user-menu {
  position: absolute;
  top: calc(100% + .6rem);
  right: 0;
  z-index: 20;
  min-width: 14rem;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: .4rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14);
  font-family: var(--sans);
  font-size: .88rem;
}
.um-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .55rem .7rem .6rem;
  border-bottom: 1px solid var(--edge);
  margin-bottom: .3rem;
  color: var(--ink);
}
.um-head span { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.um-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .5rem .7rem;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
.um-item:hover { background: var(--panel); }
.um-item.um-soon { color: var(--ink-faint); cursor: default; }
.um-item.um-soon:hover { background: none; }
.soon-tag {
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--edge);
  border-radius: 99px;
  padding: .05em .5em;
}

main {
  flex: 1;
  width: 100%;
  /* wide enough for an 80-column snippet at the typing size */
  max-width: 64rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* pickers: quiet inline text controls */
.controls {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  margin-bottom: 2.2rem;
  font-family: var(--sans);
  font-size: .85rem;
}
/* display:flex above would otherwise beat the hidden attribute */
.controls[hidden] { display: none; }
.picker { display: flex; gap: .25rem; align-items: center; }
/* the breadcrumb beside the language: which tour and set this step is in */
.context {
  display: flex;
  align-items: center;
  gap: .5em;
  color: var(--ink-faint);
  min-width: 0;
}
.context-tour { color: var(--ink-soft); }
.context-set { color: var(--ink-faint); }
.context-sep { color: var(--ink-faint); opacity: .7; }
.context:empty, .context[hidden] { display: none; }
/* the help popover: the orientation a newcomer needs, out of the way */
.helpwrap { position: relative; }
.help-pop {
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  z-index: 20;
  width: min(24rem, calc(100vw - 3rem));
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14);
  text-align: left;
  cursor: default;
}
.help-pop[hidden] { display: none; }
.help-title {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .7rem;
}
.help-list dt {
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink);
  margin-top: .7rem;
}
.help-list dt:first-of-type { margin-top: 0; }
.help-list dd {
  font-family: var(--sans);
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: .15rem;
}
/* the subtle dropdowns: icon labels, borderless selects */
.selects { gap: 1.1rem; }
.selwrap { color: var(--ink-faint); display: inline-flex; gap: .4em;
           align-items: center; cursor: pointer; }
.selwrap svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.selwrap:hover { color: var(--ink-soft); }
.selwrap select {
  font: inherit;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--edge);
  background: none;
  padding: .15rem .1rem;
  cursor: pointer;
}
.selwrap select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.selwrap[hidden] { display: none; }
/* the language control: a logo and a name, no underline and no caret. A
   native <option> cannot hold an SVG, so the list is our own listbox. */
.langwrap { position: relative; }
.langwrap .langbtn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: .15rem .1rem;
  cursor: pointer;
}
.langwrap .langbtn:hover { color: var(--accent); }
.langwrap .langbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-icon { display: inline-flex; }
.lang-icon svg,
.lang-menu .lang-option svg {
  width: 18px;
  height: 18px;
  flex: none;
}
/* Rust's mark is black on white, so it follows the palette to stay visible
   on a dark theme; every other logo carries its own fixed colours. */
.lang-logo .rust-disc { fill: var(--ink); }
.lang-logo .rust-ring { stroke: var(--paper); }
.lang-logo .rust-mark { fill: var(--paper); }
/* the popup: roomier than the native list it replaces */
.lang-menu {
  position: absolute;
  top: calc(100% + .55rem);
  left: 0;
  z-index: 20;
  min-width: 12rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: .45rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14);
}
.lang-menu[hidden] { display: none; }
.lang-menu .lang-option {
  display: flex;
  align-items: center;
  gap: .75em;
  width: 100%;
  padding: .55rem .7rem;
  border: 0;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  cursor: pointer;
}
.lang-menu .lang-option-icon { display: inline-flex; }
.lang-menu .lang-option:hover,
.lang-menu .lang-option.active { background: var(--panel); }
.lang-menu .lang-option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.lang-menu .lang-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* the sprint control: just the clock (muted until set); the real select
   sits invisibly on top so the native themed popup still opens */
.durwrap {
  position: relative;
  gap: .3em;
  color: var(--ink-faint);
}
.durwrap.set { color: var(--ink); }
.durwrap .dur-text {
  font-variant-numeric: tabular-nums;
}
.durwrap select {
  position: absolute;
  inset: 0;
  opacity: 0;
  border: 0;
  cursor: pointer;
}
.durwrap:has(select:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* the path-map icon button */
.iconbtn {
  border: 0;
  background: none;
  padding: .2rem;
  color: var(--ink-faint);
  cursor: pointer;
  display: inline-flex;
}
.iconbtn:hover { color: var(--ink); }
.iconbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.custom-title {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 2.2rem 0 .4rem;
}
.custom-hint {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  margin-bottom: .8rem;
}
/* the popup option list follows the theme (with color-scheme set in JS);
   generous padding where the browser honors it (Chromium does) */
select option {
  background: var(--paper);
  color: var(--ink);
  padding: .55rem .9rem;
}
.picker button {
  font: inherit;
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: .2rem .5rem;
  border-radius: 3px;
}
.picker button:hover { color: var(--ink); }
.picker button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.picker button:focus-visible,
.actions button:focus-visible,
#theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.titlewrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: .5em;
  margin-bottom: .8rem;
}
.snippet-title {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* the (i) icon: the explanation waits behind it so typing stays clean */
.info-btn {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid var(--ink-faint);
  background: none;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: .72rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.info-btn:hover, .info-btn[aria-expanded="true"] {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--panel);
}
.info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a generous infowindow: what/why lead + ordered how-it-works steps */
.info-pop {
  position: absolute;
  top: calc(100% + .6rem);
  left: 0;
  z-index: 10;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  width: min(28rem, 85vw);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14);
}
.desc-lead {
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 .5rem;
}
.desc-lead:empty { display: none; }
.snippet-desc {
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 0 1.2em;
}
.snippet-desc li { padding-left: .2em; }
.snippet-desc li + li { margin-top: .25em; }
.snippet-desc li::marker { color: var(--ink-faint); }
.snippet-desc:empty { display: none; }
.desc-lead code, .snippet-desc code {
  font-family: var(--mono);
  font-size: .92em;
  color: var(--ink);
  background: var(--panel);
  border-radius: 3px;
  padding: .05em .3em;
}

/* the code block */
.codewrap { position: relative; }
/* the sprint clock: top-right of the code, fading in as typing starts */
.timer {
  position: absolute;
  top: .55rem;
  right: .9rem;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity .4s ease;
}
body.focus .timer { opacity: 1; }
.code {
  font-family: var(--mono);
  background: var(--panel);
  font-size: 1.2rem;
  line-height: 1.75;
  padding: 1.6rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
  tab-size: 4;
}
.code .line { min-height: 1.75em; }
.code .ch { border-radius: 1px; }
/* untyped code waits, dimmed; correct typing restores its full color */
.code .ch.pending { opacity: .38; }
.code .ch.err {
  opacity: 1;
  color: var(--err) !important;
  background: color-mix(in srgb, var(--err) 15%, transparent);
  text-decoration: underline;
  text-decoration-color: var(--err);
  text-underline-offset: .25em;
}
.code .ch.nl.err { background: color-mix(in srgb, var(--err) 35%, transparent); }
/* editor mode: after typing an opener, its matching closer glows for one
   keystroke — type the closer key now to place it there early */
.code .ch.armed {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 2px;
}

.caret {
  position: absolute;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
  transition: left 70ms ease-out, top 70ms ease-out;
  animation: blink 1.1s steps(1) infinite;
}
.caret.moving { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .caret { transition: none; }
}
@keyframes blink { 50% { opacity: 0; } }

.hint {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
  margin-top: 1.4rem;
}
.hint[hidden] { display: none; }

/* focus mode: while typing, everything but the code fades in place;
   mouse movement, Esc, or finishing brings it back */
.top, .titlewrap, .hint, .controls .selwrap, .controls .langwrap,
.controls .context, .controls .iconbtn {
  transition: opacity .4s ease;
}
body.focus .top,
body.focus .titlewrap,
body.focus .hint,
body.focus .controls .selwrap,
body.focus .controls .langwrap,
body.focus .controls .context,
body.focus .controls .iconbtn {
  opacity: .05;
  pointer-events: none;
}
kbd {
  font-family: var(--sans);
  border: 1px solid var(--edge);
  border-radius: 3px;
  padding: 0 .3em;
  font-size: .95em;
}

/* the learning path map */
.path-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
}
/* one chip per tour; the active one reads as the current stop */
.tour-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .6rem;
}
.tour-chips[hidden] { display: none; }
.tour-chip {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: .3em .9em;
  cursor: pointer;
}
.tour-chip:hover { color: var(--ink); }
.tour-chip.active {
  color: var(--ink);
  border-color: var(--accent);
  font-weight: 600;
}
.tour-chip-meta {
  margin-left: .55em;
  color: var(--ink-faint);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.tour-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#path-map h3 {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 1.6rem 0 .5rem;
}
.path-step {
  display: flex;
  align-items: baseline;
  gap: .9em;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--edge);
  padding: .55rem .2rem;
  cursor: pointer;
}
.path-step:hover:not(.locked) { background: var(--panel); }
.path-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.path-step.locked { color: var(--ink-faint); cursor: default; }
.path-stars {
  font-size: .95rem;
  color: var(--accent);
  letter-spacing: .1em;
  min-width: 3.2em;
}
.path-step.locked .path-stars { color: var(--ink-faint); }
.path-step-title { flex: 1; }
.path-step-meta { font-size: .78rem; color: var(--ink-faint); }
/* locked steps carry a padlock in place of the line count */
.path-step-meta svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
}
.path-soon { font-family: var(--sans); color: var(--ink-soft); }

/* project mode */
.proj-import {
  display: flex;
  gap: .6rem;
  margin-bottom: 1rem;
  font-family: var(--sans);
}
.proj-import[hidden] { display: none; }
.proj-import input {
  flex: 1;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: .5rem .8rem;
}
.proj-import button {
  font: inherit;
  padding: .5rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.proj-back { font-family: var(--sans); font-size: .85rem; margin-bottom: .8rem; }
.proj-back a { color: var(--ink-soft); text-decoration: none; }
.proj-back a:hover { color: var(--ink); }
/* per-file progress bar */
.fbar {
  width: 3.2em;
  height: 4px;
  border-radius: 2px;
  background: var(--edge);
  overflow: hidden;
  flex: none;
  align-self: center;
}
.fbar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* earned stars on the results screen */
.stars {
  font-size: 2.2rem;
  color: var(--accent);
  letter-spacing: .15em;
  margin: .4rem 0 -.6rem;
}
.xpline {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--accent);
  margin-top: .4rem;
}
.xpline:empty { display: none; }
/* the xp gain glows and swells as it lands */
.xpline.pop { animation: xp-pop 1s ease-out; }
@keyframes xp-pop {
  0%   { transform: scale(.6); opacity: 0; text-shadow: none; }
  35%  { transform: scale(1.35);
         text-shadow: 0 0 .5em var(--accent), 0 0 1em var(--accent); }
  100% { transform: scale(1); opacity: 1; text-shadow: none; }
}
/* finishing every step in a set earns a glowing banner */
.celebrate {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin: .8rem 0 .2rem;
  letter-spacing: .02em;
}
.celebrate[hidden] { display: none; }
.celebrate.pop { animation: set-cleared 1.4s ease-out; }
.celebrate-set { font: inherit; color: inherit; }
/* the set it opens up arrives just after the banner it belongs to */
.celebrate-unlock {
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--ink-soft);
  margin-top: .35rem;
}
.celebrate-unlock[hidden] { display: none; }
.celebrate-unlock.unlock { animation: unlocked 1.6s ease-out; }
.celebrate-unlock .key {
  color: var(--accent);
  font-weight: 600;
}
@keyframes unlocked {
  0% { opacity: 0; transform: translateY(6px); }
  30% { opacity: 1; transform: translateY(0); }
  55% { text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 60%, transparent); }
  100% { text-shadow: none; }
}

/* the keys a run fumbled, as a table rather than a run-on sentence */
.misses {
  font-family: var(--sans);
  font-size: .82rem;
  border-collapse: collapse;
  margin: 1.2rem auto 0;
  min-width: 18rem;
}
.misses[hidden] { display: none; }
.misses caption {
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding-bottom: .4rem;
}
.misses th {
  font-weight: 600;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  border-bottom: 1px solid var(--edge);
  padding: .25rem .7rem .3rem 0;
}
.misses th:last-child, .misses td:last-child { text-align: right; }
.misses td {
  padding: .38rem .7rem .38rem 0;
  border-bottom: 1px solid var(--edge);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.misses td code {
  font-family: var(--mono);
  font-size: .95em;
  color: var(--ink);
  background: var(--panel);
  border-radius: 3px;
  padding: .1em .45em;
}
.miss-bar {
  display: inline-block;
  height: .5rem;
  min-width: .5rem;
  border-radius: 99px;
  background: var(--err);
  opacity: .75;
  vertical-align: middle;
}
@keyframes set-cleared {
  0%   { transform: translateY(.4em) scale(.9); opacity: 0; }
  25%  { transform: translateY(0) scale(1.08); opacity: 1;
         text-shadow: 0 0 .6em var(--accent), 0 0 1.4em var(--accent); }
  70%  { text-shadow: 0 0 .3em var(--accent); }
  100% { transform: scale(1); opacity: 1; text-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  .xpline.pop, .celebrate.pop { animation: none; }
}

/* header xp badge */
#account .xp {
  color: var(--ink-faint);
  margin-right: 1em;
  font-variant-numeric: tabular-nums;
}

/* the profile page */
.profile-id {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--sans);
  color: var(--ink);
}
.profile-id .avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; }
.profile-xp { color: var(--ink-faint); font-size: .85rem; margin-top: .15rem; }
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--ink);
  padding: .8rem .2rem;
  border-bottom: 1px solid var(--edge);
}
.setting-row small {
  display: block;
  color: var(--ink-faint);
  font-size: .78rem;
  max-width: 26rem;
}
.setting-row select {
  font: inherit;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--edge);
  background: none;
  cursor: pointer;
}
.setting-row button {
  font-family: var(--sans);
  font-size: .85rem;
  padding: .35rem .9rem;
  border-radius: 99px;
  border: 1px solid var(--ink-faint);
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  flex: none;
}
.setting-row button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: .88rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stats-table th {
  text-align: left;
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: .3rem .6rem .3rem 0;
}
.stats-table td {
  padding: .45rem .6rem .45rem 0;
  border-top: 1px solid var(--edge);
}
.stats-table td:first-child { color: var(--ink); }
.stats-table td:not(:first-child), .stats-table th:not(:first-child) {
  text-align: right;
}

/* results: a pull-quote moment */
#results { text-align: center; padding-top: 1.5rem; }
.results-label {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.wpm-big {
  font-family: var(--serif);
  font-size: clamp(4.5rem, 16vw, 8rem);
  line-height: 1.1;
  color: var(--ink);
}
.wpm-unit {
  font-size: 1.4rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-left: .3em;
}
.statrow {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 1.6rem 0 1.2rem;
  font-family: var(--sans);
}
.stat span { font-size: 1.25rem; display: block; }
.stat label {
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.worst, .attr, .save {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  margin-top: .6rem;
}
.save {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  margin-top: 1.1rem;
}
.save:empty { display: none; }
.worst code { font-family: var(--mono); color: var(--err); }
.save a { color: var(--accent); }

.actions { margin-top: 1.8rem; display: flex; gap: .8rem; justify-content: center; }
.actions button {
  font-family: var(--sans);
  font-size: .9rem;
  padding: .5rem 1.1rem;
  border-radius: 99px;
  border: 1px solid var(--ink-faint);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.actions button:hover { border-color: var(--ink); }
.actions #btn-next { background: var(--ink); color: var(--paper); border-color: var(--ink); }


/* report: a quiet link at the end of the instruction line, and the panel it
   opens. The panel rises from the footer, so it is anchored bottom-right. */
#instructions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
/* an id beats `.hint[hidden]`, so say it again here or the map cannot
   hide the footer */
#instructions[hidden] { display: none; }
.instructions-text { flex: 1 1 auto; min-width: 0; }
.reportwrap { position: relative; flex: 0 0 auto; }

.linkbtn {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-faint);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--edge);
  text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--ink); text-decoration-color: currentColor; }
.linkbtn:focus-visible {
  outline: 2px solid var(--accent, var(--ink));
  outline-offset: 3px;
  border-radius: 3px;
}

.report-pop {
  position: absolute;
  bottom: calc(100% + .55rem);
  right: 0;
  z-index: 20;
  width: min(22rem, calc(100vw - 3rem));
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: .9rem 1rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .14);
  text-align: left;
  cursor: default;
}
.report-pop[hidden] { display: none; }
.report-pop h2 {
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .3rem;
}
.report-what {
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--ink);
  margin-bottom: .6rem;
}
.report-pop fieldset { border: 0; padding: 0; margin: 0 0 .6rem; }
.report-pop label {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink);
  padding: .12rem 0;
  cursor: pointer;
}
.report-pop textarea {
  width: 100%;
  font: inherit;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: .4rem .5rem;
  resize: vertical;
}
.report-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: .6rem;
}
.report-actions button {
  font-family: var(--sans);
  font-size: .8rem;
  padding: .3rem .7rem;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.report-actions #report-send { border-color: var(--ink-faint); }
.report-actions button:hover { border-color: var(--ink); }
.report-thanks {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--ink);
  margin: 0;
}
.report-thanks:empty { display: none; }

.visually-hidden:not(:focus):not(:active) {
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}
