/* FastFingers: its own app with its own sidebar. Theme tokens only, so every theme works. */
[hidden] { display: none !important; }
:root { --side: 232px; --side-mini: 60px; --type-fs: var(--type-fs-user, 28px); --type-font: var(--mono); }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
.grow { flex: 1; }
.muted { color: var(--muted); }
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100vh; transition: grid-template-columns .22s var(--ease); }
.side-mini .app { grid-template-columns: var(--side-mini) minmax(0, 1fr); }
/* while typing: the sidebar slides away and the rest of the chrome fades */
.typing .app.auto-hide { grid-template-columns: 0 minmax(0, 1fr); }
.typing .app.auto-hide .side { opacity: 0; pointer-events: none; }
.typing .chrome, .typing .theme-picker { opacity: 0; pointer-events: none; }
.typing.show-chrome .chrome { opacity: .55; pointer-events: auto; }
.typing body { cursor: none; }
.typing.show-chrome body { cursor: auto; }
.chrome { transition: opacity .2s var(--ease); }

/* ---- sidebar ---- */
.side { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface); overflow: hidden; min-width: 0; transition: opacity .2s var(--ease); }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 6px 12px; font-weight: 700; font-size: 17px; font-family: var(--display); white-space: nowrap; }
.mark { color: var(--accent); display: grid; place-items: center; flex: none; }
.collapse { border: 1px solid transparent; background: none; color: var(--muted); width: 28px; height: 28px; border-radius: var(--r); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.collapse:hover { color: var(--text); border-color: var(--line); }
.side-mini .collapse svg { transform: rotate(180deg); }
.nav { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r); background: none; color: var(--text);
  font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s; position: relative; }
.nav:hover { background: var(--surface-2); }
.nav[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ic { color: var(--muted); display: grid; place-items: center; flex: none; }
.nav[aria-current="true"] .ic { color: var(--accent); }
.nav kbd { margin-left: auto; }
.nav.home { color: var(--muted); font-size: 13.5px; }
.sep { height: 1px; background: var(--line); margin: 8px 4px; }
.side-mini .side .txt, .side-mini .side kbd, .side-mini .side .tp-label { display: none; }
.side-mini .brand { justify-content: center; padding-left: 0; padding-right: 0; flex-direction: column; gap: 10px; }
.side-mini .nav { justify-content: center; padding: 9px 0; }
.side-mini .goal { justify-content: center; padding: 10px 0; }
.side-mini .foot { flex-direction: column; }
.goal { display: flex; gap: 11px; align-items: center; padding: 12px 6px; margin: 8px 0 6px; border-top: 1px solid var(--line); }
.goal b { display: block; font-size: 13.5px; white-space: nowrap; } .goal small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ring { width: 38px; height: 38px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--good); stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 94.25; transition: stroke-dashoffset .6s var(--ease); }
.goal.met .ring-fg { stroke: var(--accent); }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.foot .theme-picker { position: static; }
.link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 6px; border-radius: var(--r); }
.link:hover { color: var(--text); background: var(--surface-2); }

/* ---- main ---- */
.main { overflow-y: auto; padding: 26px 48px 80px; }
.view { max-width: 1120px; margin: 0 auto; }
.view.wide { max-width: 1200px; }
h1.h { font-family: var(--display); margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; }

/* mode bar */
.modebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; padding: 6px; margin: 0 auto 10px; width: fit-content; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); font-size: 13.5px; }
.modebar .grp { display: flex; gap: 2px; align-items: center; }
.modebar .div { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.opt { border: 0; background: none; color: var(--muted); font: inherit; padding: 5px 9px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; transition: color .12s, background .12s; }
.opt:hover { color: var(--text); }
.opt[aria-pressed="true"] { color: var(--accent); font-weight: 600; }
.opt.mode[aria-pressed="true"] { background: var(--accent-soft); }
.opt .ic { display: grid; }
.storybar { display: flex; align-items: center; gap: 12px; justify-content: center; font-size: 13.5px; color: var(--muted); margin: 4px auto 0; max-width: 900px; }
.storybar b { color: var(--text); font-weight: 600; }
.storybar .mini-bar { width: 140px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.storybar .mini-bar span { display: block; height: 100%; background: var(--accent); }

/* the test */
.test { margin: 34px auto 0; max-width: 1040px; position: relative; }
.live { display: flex; gap: 22px; height: 34px; align-items: flex-end; font-family: var(--type-font); font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; padding-left: 2px; }
.live span:empty { display: none; }
.live #liveWpm, .live #liveAcc { color: var(--muted); font-size: 18px; }
.live.off #liveWpm, .live.off #liveAcc { display: none; }
.words-wrap { position: relative; overflow: hidden; font-family: var(--type-font); font-size: var(--type-fs); margin-top: 8px; cursor: text; user-select: none; }
.words { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; transition: transform .16s var(--ease); }
.w { margin: 0 .5ch .32em 0; line-height: 1.3; height: 1.3em; white-space: nowrap; color: var(--muted); border-bottom: 2px solid transparent; }
.w span { transition: color .06s; }
.w .c { color: var(--text); }
.w .x { color: var(--bad); }
.w .e { color: var(--bad); opacity: .65; }
.w.err { border-bottom-color: color-mix(in srgb, var(--bad) 70%, transparent); }
.hl-word .w.cur { background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: var(--r-sm); }
.w.ok-pop { animation: okpop .18s var(--ease); }
@keyframes okpop { 40% { color: var(--good); } }
.blind .w .x, .blind .w .e { color: var(--text); }
.blind .w.err { border-bottom-color: transparent; }
.caret { position: absolute; left: 0; top: 0; width: 2px; height: 1.15em; margin-top: .08em; background: var(--accent); border-radius: 1px; z-index: 2; pointer-events: none; }
.smooth .caret { transition: transform .085s linear; }
.caret.blink { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.caret.block { width: .62em; opacity: .35; }
.caret.under { width: .62em; height: 2px; margin-top: 1.18em; }
.caret.hide { display: none; }
.caret.pace { background: var(--muted); opacity: .5; }
.caret.pace.block, .caret.pace.under { opacity: .3; }
.blur-msg, .pause-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font); font-size: 16px; color: var(--text);
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(4px); z-index: 5; cursor: pointer; animation: rise .15s var(--ease) both; }
.pause-msg { pointer-events: none; color: var(--warn); }
.kbd-input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; border: 0; left: 0; top: 0; pointer-events: none; }
.under { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 26px; color: var(--muted); font-size: 12.5px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); border-color: var(--line); background: var(--surface); outline: none; }
.icon-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.loading-text { color: var(--muted); font-family: var(--font); font-size: 15px; padding: 10px 0; }

/* ---- result ---- */
.result { margin: 24px auto 0; animation: rise .22s var(--ease) both; }
.res-top { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 26px; align-items: stretch; }
.big { display: flex; flex-direction: column; gap: 16px; }
.big .k { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: lowercase; }
.big .v { font-family: var(--type-font); font-size: 60px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.big .v.acc { font-size: 44px; }
.pb { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--good); background: var(--good-soft); padding: 3px 8px; border-radius: var(--r-sm); animation: pop .45s var(--spring); }
.chart-box { position: relative; min-width: 0; overflow: hidden; height: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; }
.chart-box canvas { max-width: 100%; }
.chart-note { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13.5px; padding: 0 16px; }
.res-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; min-width: 0; }
.mini .k { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .v { font-family: var(--type-font); font-size: 22px; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini .v small { font-size: 13px; color: var(--muted); }
.res-actions { display: flex; gap: 8px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.res-actions .btn { display: inline-flex; gap: 7px; align-items: center; }
.res-note { text-align: center; margin-top: 14px; color: var(--muted); font-size: 13.5px; }
.res-keys { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; font-size: 13px; color: var(--muted); align-items: center; }
.keycap { font-family: var(--mono); display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-size: 13px; }
.keycap.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.keycap.slow { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

/* ---- stories ---- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; padding: 5px 11px; border-radius: var(--r); cursor: pointer; }
.pill:hover { color: var(--text); }
.pill[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.book { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 14px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .12s, transform .15s var(--ease); position: relative; overflow: hidden; }
.book:hover { border-color: var(--accent); transform: translateY(-2px); }
.book .spine { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--muted); }
.book .spine.easy { background: var(--good); } .book .spine.medium { background: var(--warn); } .book .spine.hard { background: var(--bad); }
.book .t { font-weight: 650; font-size: 15.5px; line-height: 1.3; }
.book .a { color: var(--muted); font-size: 13px; }
.book .m { display: flex; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.lvl { font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.lvl.easy { color: var(--good); } .lvl.medium { color: var(--warn); } .lvl.hard { color: var(--bad); }
.bar { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }
.book .pct { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.book.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.book-detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; }
.book-detail .card { padding: 16px; }
.chapters { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.chapters li { display: grid; grid-template-columns: 34px minmax(0, 1fr) 120px 112px; gap: 10px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.chapters li:last-child { border-bottom: 0; }
.chapters li.here { background: var(--accent-soft); }
.chapters .n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.chapters .bar { margin: 0; }
.chapters .btn { white-space: nowrap; }
.cat-h { margin: 22px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---- shared panels (stats, settings) ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; }
.panel h2 { flex-wrap: wrap; row-gap: 8px; margin: 0 0 12px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel h2 .grow { flex: 1; }
.panel h2 select { width: auto; margin: 0; padding: 3px 8px; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tile .v { font-family: var(--type-font); font-size: 26px; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d.up { color: var(--good); } .d.down { color: var(--bad); }
.chart-md { position: relative; height: 260px; }
.chart-sm { position: relative; height: 200px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.sort { cursor: pointer; } table.t th.sort:hover { color: var(--text); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--surface-2); }
.scroll { max-height: 420px; overflow: auto; }
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal i { width: 12px; height: 12px; border-radius: 2px; background: var(--surface-2); display: block; }
.cal i.l1 { background: color-mix(in srgb, var(--good) 30%, var(--surface-2)); }
.cal i.l2 { background: color-mix(in srgb, var(--good) 55%, var(--surface-2)); }
.cal i.l3 { background: color-mix(in srgb, var(--good) 80%, var(--surface-2)); }
.cal i.l4 { background: var(--good); }
.cal i.out { visibility: hidden; }
.cal-legend { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 8px; justify-content: flex-end; }
.cal-legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.kb { display: grid; gap: var(--kg); user-select: none; --kg: 5px; }
.kb .r { display: flex; gap: var(--kg); }
.kb .k { flex: none; width: var(--kw); height: calc(var(--kw) * .96); min-height: 30px; border-radius: var(--r); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; align-items: center; font-family: var(--mono); font-size: 14px;
  background: var(--surface-2); color: var(--text); position: relative; cursor: pointer; transition: transform .12s; }
.kb .k:hover { transform: translateY(-2px); border-color: var(--accent); }
.kb .k small { font-size: 9.5px; color: inherit; opacity: .75; font-family: var(--font); }
.kb .k.space { width: calc(var(--kw) * 6.5); }
.kb .k.none { opacity: .45; cursor: default; }
.kb .k.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.kb-legend { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 10px; }
.kb-legend .grad { width: 160px; height: 8px; border-radius: 4px; }
.fingers { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; }
.finger { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--muted); text-align: center; }
.finger .col { width: 100%; max-width: 38px; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--accent); min-height: 2px; transition: height .5s var(--ease); }
.finger b { color: var(--text); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.list-keys { display: grid; gap: 6px; }
.list-keys .row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 13px; }
.hbar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; padding: 4px 10px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.streaks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.week { display: flex; gap: 6px; margin-top: 10px; }
.week span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); padding: 6px 0; border-radius: var(--r-sm); background: var(--surface-2); }
.week span.on { background: var(--good-soft); color: var(--good); font-weight: 700; }
.week span.today { outline: 1px solid var(--accent); }

/* settings */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.set { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set b { font-size: 14px; font-weight: 600; display: block; } .set small { color: var(--muted); font-size: 12.5px; }
.set select, .set input[type="number"] { width: auto; margin: 0; padding: 6px 10px; font-size: 13.5px; }
.set input[type="number"] { width: 90px; }
.set input[type="range"] { width: 140px; margin: 0; padding: 0; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; padding: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .18s var(--spring), background .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--on-accent); }

/* drills */
.drill-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.drill { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s, transform .15s var(--ease); }
.drill:hover { border-color: var(--accent); transform: translateY(-2px); }
.drill b { font-size: 15px; } .drill p { margin: 0; color: var(--muted); font-size: 13px; }
.drill .keys { display: flex; gap: 4px; flex-wrap: wrap; }

.dlg { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 20px 22px; width: min(640px, 92vw); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg h2 { margin: 0 0 4px; font-size: 18px; }
.dlg .row { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; }
.dlg .row.end { justify-content: flex-end; }
.dlg textarea { font-family: var(--mono); font-size: 13.5px; }

.ic svg { display: block; }
@media (max-width: 1180px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .res-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .drill-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .main { padding: 22px 28px 70px; } }
@media (max-width: 900px) { .g2, .g3, .set-grid, .book-detail, .res-top { grid-template-columns: 1fr; } .streaks { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .app, .words, .smooth .caret, .book, .drill { transition: none; } .caret.blink { animation: none; } }
.wiki-topic input { width: 220px; margin: 0 4px; padding: 4px 9px; font-size: 13px; }
.storybar a { color: var(--accent); text-decoration: none; } .storybar a:hover { text-decoration: underline; }

/* ---- FastFingers additions ---- */
.brand-link { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; min-width: 0; }
.nav .count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.nav .count + kbd { margin-left: 6px; }
.side-mini .nav .count { position: absolute; margin: -14px 0 0 14px; }
.acct { display: flex; flex-direction: column; gap: 6px; padding: 8px 4px 4px; border-top: 1px solid var(--line); margin-top: 8px; }
.acct .signin { min-height: 36px; padding: 6px 10px; gap: 8px; }
.acct small { font-size: 11.5px; line-height: 1.3; padding: 0 2px; }
.acct .me { display: flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; padding: 5px 6px; border-radius: var(--r); min-width: 0; }
.acct .me:hover { background: var(--surface-2); }
.acct .me .txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.acct .me b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct .me small { font-size: 11.5px; padding: 0; }
.side-mini .acct small, .side-mini .acct .txt { display: none; }
.side-mini .acct .signin { padding: 6px; }
.av { display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--av); color: #fff; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.av svg { stroke: #fff; }
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.who:hover span:not(.av):not(.cc) { text-decoration: underline; }
.cc { font-size: 10.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; letter-spacing: .04em; }
.rank-tag { margin-left: auto; align-self: center; display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); white-space: nowrap; }
.rank-tag.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: var(--accent-soft); }
.res-rank { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 14px 0 0; font-size: 14px; min-height: 34px; }
.res-rank .ic { color: var(--accent); display: inline-grid; }
.takeaway { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.lb-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.lb-filters select { width: auto; margin: 0; padding: 5px 10px; font-size: 13px; }
.lb-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 13px; }
.you-are { font-size: 14px; } .you-are b { color: var(--accent); }
table.lb td { padding: 6px 8px; }
table.lb td.rank { width: 44px; color: var(--muted); font-weight: 700; }
table.lb .wpm { font-size: 17px; }
table.lb tr.p1 td.rank { color: #c98500; } table.lb tr.p2 td.rank { color: #8a8f98; } table.lb tr.p3 td.rank { color: #b0703a; }
table.lb tr.me-row td { background: var(--accent-soft); }
table.lb tr.gap td { height: 10px; border-bottom: 1px dashed var(--line); }
.daily-card { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.daily-card p { margin: 2px 0 0; font-size: 13px; }
.row-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row-form input { margin: 0; flex: 1; min-width: 0; }
.req { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.req:last-child { border-bottom: 0; }
.prof-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.prof-id .h { margin: 0; }
.prof-id .sub { margin: 4px 0 0; }
.prof-id .bio { margin: 8px 0 0; font-size: 14px; max-width: 60ch; }
.prof-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.prof-tiles { margin-top: 14px; }
.tiles.mini3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.badge { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); opacity: .42; filter: grayscale(1); }
.badge .bi { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.badge b { font-size: 13px; } .badge small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge.on { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.badge.on .bi { background: var(--accent-soft); color: var(--accent); }
.vs-form input { width: 150px; flex: none; }
.vs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.vs-side { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 18px; }
.vs-mid { font-weight: 800; color: var(--muted); letter-spacing: .1em; }
.key-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.vs-say { font-size: 14px; color: var(--text); margin: 0 0 12px; }
.vs-table td { padding: 7px 8px; }
.vs-table td.vs-l, .vs-table td.vs-r { width: 28%; }
.vs-table .win { font-weight: 700; }
.vs-bar { display: flex; height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.vs-l .vs-bar { flex-direction: row-reverse; }
.vs-bar > span { display: block; height: 100%; border-radius: 3px; }
.vs-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.vs-keys .keys { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.keys { display: flex; gap: 5px; flex-wrap: wrap; }
.av-pick { display: flex; gap: 16px; align-items: center; margin: 14px 0; }
.swatches, .glyphs { display: flex; gap: 6px; flex-wrap: wrap; }
.glyphs { margin-top: 8px; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.gl { width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; font: inherit; font-size: 12px; font-weight: 700; }
.gl[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dlg { width: min(520px, 92vw); }
.dlg label { display: block; margin-top: 12px; font-size: 13.5px; font-weight: 600; }
.dlg label input:not([type=checkbox]), .dlg label select { margin-top: 5px; }
.dlg label small { display: block; font-weight: 400; margin-top: 4px; }
.dlg label.row { font-weight: 500; }
.dlg-err { color: var(--bad); font-size: 13.5px; margin: 10px 0 0; }
.legal { max-width: 760px; margin: 0 auto; padding: 32px 24px 64px; line-height: 1.6; }
.legal h1 { font-size: 28px; margin: 0 0 6px; } .legal h2 { font-size: 18px; margin: 28px 0 6px; }
.res-tip { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; font-size: 13.5px; min-height: 34px; }
.recs h2 { margin-bottom: 10px; }
.rec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rec { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.rec b { font-size: 14px; } .rec p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; flex: 1; }
.rec .btn { align-self: flex-start; }
.weak-list { margin: 0; padding-left: 18px; line-height: 1.9; font-size: 14px; }
.weak-list .keycap { font-size: 12px; height: 22px; min-width: 22px; }
.steps { display: flex; gap: 6px; margin-bottom: 12px; }
.steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-2); transition: background .25s var(--ease); }
.steps span.on { background: var(--accent); }
.at-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); margin-top: 5px; padding-left: 10px; }
.at-input span { color: var(--muted); font-weight: 700; }
.at-input input { border: 0 !important; margin: 0 !important; background: transparent !important; box-shadow: none !important; }
.name-state { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 500; color: var(--muted); min-height: 18px; }
.name-state.good { color: var(--good); } .name-state.bad { color: var(--bad); }
.dlg .row.end .grow { flex: 1; }
.ob-preview { margin: 10px 0 4px; }
.pcard { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--bg); }
.pcard-banner { height: 44px; background: linear-gradient(120deg, var(--banner), color-mix(in srgb, var(--banner) 45%, var(--surface))); }
.pcard-body { display: flex; align-items: center; gap: 12px; padding: 0 14px 12px; margin-top: -20px; }
.pcard-body .av { box-shadow: 0 0 0 3px var(--bg); }
.pcard-body > div { display: flex; flex-direction: column; padding-top: 22px; }
.tabs-mini { display: flex; gap: 4px; margin: 12px 0 0; border-bottom: 1px solid var(--line); }
.tabs-mini button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px; padding: 7px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-mini button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.pin-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pin { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-sm); padding: 4px 9px; font: inherit; font-size: 12.5px; cursor: pointer; }
.pin.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pin:disabled { opacity: .4; cursor: not-allowed; }
.prof-head { position: relative; overflow: hidden; padding-top: 64px; }
.prof-banner { position: absolute; inset: 0 0 auto 0; height: 58px; background: linear-gradient(120deg, var(--banner), color-mix(in srgb, var(--banner) 40%, var(--surface))); }
.prof-head > .av { box-shadow: 0 0 0 4px var(--surface); position: relative; margin-top: -26px; }
.prof-head .fav { margin: 8px 0 0; }
.badge.pinned { border-color: var(--accent); }

/* ---- every screen size ---- */
/* keyboards scale with the space they get: 46px keys at most, smaller on narrow screens */
.kb-layout { display: flex; flex-wrap: wrap; gap: 20px 24px; align-items: flex-start; }
.kb-box { flex: 1 1 480px; max-width: 740px; min-width: 0; container-type: inline-size; --kw: clamp(20px, calc((100cqw - 62px) / 13.5), 46px); }
.kb-side { flex: 1 1 220px; min-width: 200px; }
.kb .k { font-size: clamp(11px, calc(var(--kw) * .31), 14px); }
@container (max-width: 520px) { .kb { --kg: 3px; } .kb .k small { font-size: 8px; } }
@container (max-width: 400px) { .kb .k small { display: none; } }
.kb-legend { flex-wrap: wrap; row-gap: 4px; }
.kb-legend .grad { flex: none; }
/* wide tables scroll inside their panel instead of pushing the page sideways */
.panel:has(table.t), .scroll { overflow-x: auto; }
.side { overflow-y: auto; scrollbar-width: none; }
.rec-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.vs-form { flex-wrap: wrap; }
.vs-form input { flex: 1 1 120px; width: auto; }
.vs-head { flex-wrap: wrap; }
.topbar, .scrim { display: none; }

@media (max-width: 1100px) {
  .main { padding: 20px 24px 64px; }
  .vs-keys { grid-template-columns: 1fr; }
}
/* phones and small tablets: a top bar with a menu button, the sidebar slides in as a drawer */
@media (max-width: 860px) {
  .app { display: flex; flex-direction: column; height: 100dvh; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 52px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; z-index: 30; }
  .topbar .brand-link { font-family: var(--display); font-weight: 700; font-size: 16px; }
  .topbar .mark { color: var(--accent); }
  .top-title { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .24s var(--ease); box-shadow: var(--shadow); }
  .nav-open .side { transform: none; }
  .side .collapse { display: none; }
  .side .nav { padding: 11px 10px; }
  .side .nav kbd { display: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: color-mix(in srgb, #000 45%, transparent); animation: rise .15s var(--ease) both; }
  .scrim[hidden] { display: none; }
  .main { flex: 1; min-height: 0; padding: 16px 16px 56px; }
  .typing .topbar { opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
  .under .keys { display: none; }
  :root { --type-fs: min(var(--type-fs-user, 28px), 24px); }
  .test { margin-top: 18px; }
  .modebar { font-size: 13px; padding: 4px; }
  .modebar .div { display: none; }
  .modebar .grp { flex-wrap: wrap; justify-content: center; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .big { flex-direction: row; flex-wrap: wrap; gap: 24px; }
  .big .v { font-size: 48px; }
  .head { align-items: flex-start; }
  h1.h { font-size: 22px; }
  .chapters li { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .chapters li .bar, .chapters li > :nth-child(3) { display: none; }
  .prof-head { padding: 64px 14px 16px; }
  .prof-acts { width: 100%; }
  .vs-side { font-size: 15px; }
  .fingers { height: 140px; font-size: 10.5px; }
  .dlg { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
}
@media (max-width: 600px) {
  table.lb td:nth-child(5), table.lb th:nth-child(5), table.lb td:nth-child(6), table.lb th:nth-child(6) { display: none; }
  .tiles.mini3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-card { flex-wrap: wrap; }
  .row-form { flex-wrap: wrap; }
  .row-form input { flex: 1 1 160px; }
  .cal-legend { justify-content: flex-start; }
}
@media (max-width: 400px) {
  .main { padding: 12px 12px 48px; }
  .tile .v { font-size: 22px; }
  .tiles { gap: 8px; }
}
/* touch screens: bigger targets */
@media (pointer: coarse) {
  .opt, .pill, .tabs-mini button, .btn.small { min-height: 38px; }
  .lb-filters select, .panel h2 select { min-height: 38px; }
  .sw { width: 32px; height: 32px; } .gl { width: 38px; height: 38px; }
  .seg button { min-height: 38px; padding: 6px 12px; }
  .switch::before { content: ""; position: absolute; inset: -10px -6px; }
  a.who { padding: 6px 0; }
}
@media (max-width: 860px) { .seg { flex-wrap: wrap; max-width: 100%; } }
/* short laptop screens and big zoom: less vertical padding */
@media (max-height: 640px) and (min-width: 861px) {
  .main { padding-top: 14px; }
  .test { margin-top: 14px; }
  .side .nav { padding-top: 6px; padding-bottom: 6px; }
  .goal { padding: 8px 6px; margin: 4px 0; }
}

/* ---- badge tiers ---- */
:root { --t-bronze: #b8763e; --t-silver: #9aa3ae; --t-gold: #d9a514; --t-diamond: #38bdf8; --t-legend: #a855f7; }
.badges { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.badge { grid-template-rows: auto auto auto auto; align-items: start; padding: 10px 12px; row-gap: 2px; --tc: var(--muted); }
.badge .bi { grid-row: span 4; align-self: center; width: 40px; height: 40px; }
.badge b { font-size: 13.5px; line-height: 1.3; }
.badge small { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.badge .tier-name { font-weight: 700; color: var(--tc); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.badge .tbar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.badge .tbar span { display: block; height: 100%; border-radius: 2px; background: var(--tc); transition: width .6s var(--ease); }
.badge .tnext { font-size: 11px; }
.badge.tier-bronze { --tc: var(--t-bronze); } .badge.tier-silver { --tc: var(--t-silver); } .badge.tier-gold { --tc: var(--t-gold); }
.badge.tier-diamond { --tc: var(--t-diamond); } .badge.tier-legend { --tc: var(--t-legend); }
.badge.on { border-color: color-mix(in srgb, var(--tc) 55%, var(--line)); background: color-mix(in srgb, var(--tc) 6%, var(--surface)); }
.badge.on .bi { color: #fff; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--tc) 55%, #fff), var(--tc) 55%, color-mix(in srgb, var(--tc) 70%, #000)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 35%, transparent); }
.badge.on .bi svg { stroke: #fff; }
.badge.tier-diamond .bi, .badge.tier-legend .bi { position: relative; overflow: hidden; }
.badge.tier-diamond .bi::after, .badge.tier-legend .bi::after { content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.55) 50%, transparent 60%); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 0%, 60% { transform: translateX(-60%); } 100% { transform: translateX(60%); } }
.badge.tier-legend { box-shadow: 0 0 14px -4px var(--t-legend); }
.badge.pinned { outline: 2px solid var(--tc); outline-offset: -1px; }
.tier-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.tier-dot.tier-bronze { background: var(--t-bronze); } .tier-dot.tier-silver { background: var(--t-silver); } .tier-dot.tier-gold { background: var(--t-gold); }
.tier-dot.tier-diamond { background: var(--t-diamond); } .tier-dot.tier-legend { background: var(--t-legend); }
@media (prefers-reduced-motion: reduce) { .badge .bi::after { animation: none; display: none; } }
.badge { grid-template-columns: 40px minmax(0, 1fr); }
/* tile notes wrap instead of being cut off with "..." */
.tile .d { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }

/* about and FAQ under the test, for visitors and search engines */
.about { max-width: 760px; margin: 18vh auto 32px; padding: 0 4px; color: var(--muted, #9a9a94); font-size: 14px; line-height: 1.6; transition: opacity .3s; }
.about h2 { font-size: 17px; color: var(--text, inherit); margin: 0 0 6px; }
.about p { margin: 0 0 12px; }
.about details { border-top: 1px solid var(--line, rgba(127,127,127,.2)); padding: 8px 0; }
.about summary { cursor: pointer; color: var(--text, inherit); }
.about details p { margin: 6px 0 0; }
.about-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; }
.about-links a { color: var(--accent, inherit); text-decoration: none; }
.about-links a:hover { text-decoration: underline; }
.signed-in .about { display: none; }
#v-type:has(.result:not([hidden])) .about { display: none; }
@media (pointer: coarse) { .about-links a { padding: 10px 0; } .about summary { padding: 8px 0; } }

/* keyboard heatmap: green (good) to amber to red (weak); lightness also changes so it reads without hue */
:root { --heat-0: #8fd694; --heat-1: #f0be4c; --heat-2: #c8352f; --heat-ink: #14251a; --heat-ink-2: #fff; }
:root[data-theme="dark"], :root[data-theme="amoled"], :root[data-theme="claude"], :root[data-theme="github"] { --heat-0: #2e6b43; --heat-1: #9a7020; --heat-2: #df4a3f; --heat-ink: #f2f5f2; --heat-ink-2: #fff; }
:root.heat-cb { --heat-0: #a6cdea; --heat-1: #f0cd63; --heat-2: #b9500c; --heat-ink: #142030; }
:root.heat-cb[data-theme="dark"], :root.heat-cb[data-theme="amoled"], :root.heat-cb[data-theme="claude"], :root.heat-cb[data-theme="github"] { --heat-0: #2a5c8c; --heat-1: #957821; --heat-2: #e2792b; --heat-ink: #f2f5f2; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]), :root[data-theme="auto"] { --heat-0: #2e6b43; --heat-1: #9a7020; --heat-2: #df4a3f; --heat-ink: #f2f5f2; }
  :root.heat-cb:not([data-theme]), :root.heat-cb[data-theme="auto"] { --heat-0: #2a5c8c; --heat-1: #957821; --heat-2: #e2792b; }
}
.kb-legend { flex-direction: column; align-items: flex-start; gap: 4px; }
.kb-legend .scale { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.kb-legend .scale .grad { flex: 0 1 160px; min-width: 48px; }
