/* Misread — neo-brutalist paper + highlighter. Rules in app/DESIGN.md. */
:root {
  --bg: #f6f1e7;
  --paper: #ffffff;
  --ink: #121212;
  --ink-2: #3a3a3a;
  --muted: #6b665c;
  --hl: #ffe14d;
  --hl-soft: #fff4b0;
  --beige-2: #ece3d1;  /* panel bars and quiet tiles */
  --wrong: #ff5a3c;  --wrong-bg: #ffe1d9;  --wrong-ink: #b8270d;
  --missing: #f2a20c; --missing-bg: #fff0c7; --missing-ink: #7d5200;
  --found: #19b36b;  --found-bg: #d4f5e3;  --found-ink: #0b6e40;
  --lilac: #c9b8ff;
  --sky: #b9e3ff;
  --r: 16px;
  --sh: 4px 4px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --sans: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --serif: "Source Serif 4", Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(rgba(18, 18, 18, .07) 1px, transparent 1px);
  background-size: 22px 22px;
}
main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px 64px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3d5afe; outline-offset: 3px; border-radius: 8px; }
.mono { font-family: var(--mono); letter-spacing: -.01em; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ top bar */
.top { width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { font: 800 26px/1 var(--display); letter-spacing: -.03em; text-decoration: none; }
.hl { background: var(--hl); border: 2px solid var(--ink); border-radius: 8px; padding: 0 5px; margin-right: 1px; box-shadow: 2px 2px 0 var(--ink); }
.top-nav { display: flex; gap: 8px; }
.top-nav a { font-weight: 600; text-decoration: none; padding: 8px 14px; border: 2px solid transparent; border-radius: 999px; }
.top-nav a:hover { border-color: var(--ink); background: var(--paper); }

/* ------------------------------------------------------------ buttons, cards, chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  min-height: 46px; padding: 0 20px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--paper); color: var(--ink); font: 700 16px/1 var(--sans); text-decoration: none; white-space: nowrap;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--hl); }
.btn.dark { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 #9a8f74; }
.btn.big { min-height: 58px; font-size: 18px; width: 100%; border-radius: 14px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn.ghost:hover { border-color: var(--ink); background: var(--paper); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh-lg); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 2px solid var(--ink); border-radius: 999px;
  background: var(--paper); font: 600 13px/1.2 var(--mono); text-decoration: none; white-space: nowrap;
}
a.chip, button.chip { cursor: pointer; transition: transform .12s, box-shadow .12s; }
a.chip:hover, button.chip:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--found); }
.chip .dot.saved { background: var(--sky); }
.chip.y { background: var(--beige-2); }

/* ------------------------------------------------------------ home: hero + drop */
.hero { padding: 40px 0 56px; text-align: center; }
.hero h1 { font: 800 clamp(40px, 6.4vw, 78px)/1 var(--display); letter-spacing: -.04em; max-width: 13ch; margin: 0 auto 20px; }
.marker { position: relative; white-space: nowrap; z-index: 0; }
.marker::before {
  content: ""; position: absolute; z-index: -1; left: -.08em; right: -.06em; top: .52em; height: .46em;
  background: var(--hl); transform: skew(-8deg) rotate(-1deg); border-radius: 3px;
  transform-origin: left; animation: swipe .7s cubic-bezier(.2, .8, .2, 1) .25s both;
}
@keyframes swipe { from { transform: skew(-8deg) rotate(-1deg) scaleX(0); } to { transform: skew(-8deg) rotate(-1deg) scaleX(1); } }
.sub { font-size: 19px; color: var(--ink-2); max-width: 46ch; margin: 0 auto 34px; }
.drop { max-width: 640px; margin: 0 auto; padding: 10px; transition: transform .15s, box-shadow .15s, background .15s; }
.drop-inner { border: 2px dashed var(--ink); border-radius: 12px; padding: 34px 20px 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.drop.over { background: var(--hl-soft); transform: translate(-2px, -2px) rotate(-.4deg); box-shadow: 9px 9px 0 var(--ink); }
.drop.busy { opacity: .55; pointer-events: none; }
.drop-icon svg { width: 54px; height: 54px; fill: var(--hl); stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.drop-icon svg path + path { fill: none; }
.drop-title { font: 700 24px/1.1 var(--display); letter-spacing: -.02em; }
.drop-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.paste { padding: 10px; }
.paste textarea { width: 100%; font: 16px/1.55 var(--serif); padding: 14px; border: 2px solid var(--ink); border-radius: 12px; resize: vertical; margin-bottom: 12px; }
.status-line { margin-top: 18px; }

/* ------------------------------------------------------------ home: examples + how */
.block { padding: 18px 0 42px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.block-head h2 { font: 800 32px/1 var(--display); letter-spacing: -.03em; }
.examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.examples.more { margin-top: 18px; }
.ex {
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 12px; padding: 18px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh);
  transition: transform .15s ease, box-shadow .15s ease; animation: rise .45s cubic-bezier(.2, .8, .2, 1) both;
}
.ex:hover { transform: translate(-3px, -3px) rotate(-.3deg); box-shadow: 7px 7px 0 var(--ink); }
.ex:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.ex-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ex h3 { font: 700 19px/1.2 var(--display); letter-spacing: -.02em; }
.ex .quote { font: 600 17px/1.3 var(--display); padding: 10px 12px; border-radius: 10px; background: var(--wrong-bg); border: 2px solid var(--ink); }
.ex .quote small { display: block; font: 500 12px/1.4 var(--mono); color: var(--wrong-ink); margin-bottom: 3px; }
.ex .ex-sum { color: var(--ink-2); font-size: 15px; }
.score-badge {
  display: inline-grid; place-items: center; min-width: 46px; height: 34px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 10px;
  font: 800 17px/1 var(--display); font-variant-numeric: tabular-nums;
}
.b-wrong { background: var(--wrong); } .b-missing { background: var(--missing); } .b-found { background: var(--found); }
.examples.more .ex { padding: 14px 16px; }
.examples.more .ex h3 { font-size: 16px; }

.bento { display: grid; grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: auto auto; gap: 18px; }
.tile { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.how-big { font: 800 30px/1.05 var(--display); letter-spacing: -.03em; }
.how-list { color: var(--ink-2); }
.t-read { grid-row: span 2; background: var(--beige-2); }
.t-ask { background: var(--paper); }
.t-fix { background: var(--paper); }
.t-models { grid-column: span 2; background: var(--beige-2); }
.t-models .muted { color: var(--muted); }
.models { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.models li { display: flex; flex-direction: column; gap: 2px; border-left: 3px solid var(--hl); padding-left: 10px; }
.models b { font: 700 17px/1.2 var(--display); }
.models span { font: 500 13px/1.3 var(--mono); color: var(--ink-2); }
.minis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: auto; }
.minis figure { margin: 0; text-align: center; font: 600 13px/1.3 var(--mono); }
.mini { height: 110px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); padding: 10px 8px; display: flex; flex-direction: column; gap: 7px; margin-bottom: 6px; }
.mini i { display: block; height: 7px; border-radius: 4px; background: var(--ink); }
.mini i:nth-child(2n) { width: 82%; } .mini i:nth-child(3n) { width: 64%; }
.mini.skim i:not(:nth-child(3n+1)) { opacity: .12; }
.mini.glance i { opacity: .12; } .mini.glance i:first-child, .mini.glance i:nth-child(4) { opacity: 1; width: 40%; }
.mini.m-phone { border-radius: 14px; } .mini.m-phone i:nth-child(n+3) { opacity: .12; }

/* ------------------------------------------------------------ letter page */
.work-top { display: flex; align-items: flex-start; gap: 16px; padding: 4px 0 22px; position: relative; }
.work-title { flex: 1; min-width: 0; }
.work-title h1 { font: 800 clamp(26px, 3.4vw, 38px)/1.08 var(--display); letter-spacing: -.03em; margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pop { position: absolute; z-index: 10; margin-top: 10px; max-width: 520px; padding: 14px 16px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--sh); font-size: 15px; animation: rise .2s ease both; }
.pop b { display: block; margin-bottom: 4px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; align-items: start; }
.viewer { min-width: 0; }
.viewer-bar { display: flex; justify-content: flex-end; min-height: 0; }
.viewer-bar:has(.seg:not([hidden])) { margin-bottom: 14px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

.window { background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--sh-lg); overflow: hidden; }
.window-bar { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-bottom: 2px solid var(--ink); background: var(--beige-2); overflow-x: auto; scrollbar-width: none; }
.window-bar::-webkit-scrollbar { display: none; }
.dots { display: inline-flex; gap: 6px; flex: none; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); }
.dots i:nth-child(1) { background: var(--wrong); } .dots i:nth-child(2) { background: var(--hl); } .dots i:nth-child(3) { background: var(--found); }
.tabs { display: inline-flex; gap: 6px; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 2px solid var(--ink); border-radius: 10px;
  background: var(--paper); font: 700 14px/1 var(--sans); cursor: pointer; white-space: nowrap; transition: transform .12s, box-shadow .12s;
}
.tabs button:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs button[aria-disabled="true"] { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.tabs .n { font: 700 12px/1 var(--mono); padding: 3px 6px; border-radius: 6px; border: 1.5px solid currentColor; }
.tabs .n.wrong { background: var(--wrong); color: var(--ink); border-color: var(--ink); }
.tabs .n.missing { background: var(--missing); color: var(--ink); border-color: var(--ink); }
.tabs .n.found { background: var(--found); color: var(--ink); border-color: var(--ink); }
.window-note { padding: 10px 18px; border-bottom: 2px dashed #d9d1bf; color: var(--muted); }
.stage { position: relative; }

.page { padding: 40px 52px 52px; font: 16.5px/1.68 var(--serif); color: #232323; overflow-wrap: anywhere; animation: fade .25s ease both; }
.page h3 { font: 700 16px/1.35 var(--sans); margin: 1.1em 0 .35em; color: var(--ink); }
.page p { margin: 0 0 .8em; }
.page .blk { margin-bottom: 1em; }
.page .li { padding-left: 1.2em; text-indent: -1em; margin: 0 0 .3em; }
.page strong { font-weight: 600; }
.page.partial .blk { color: #4a4a4a; }
.skip { display: inline-block; vertical-align: .08em; margin: 0 .25em; padding: 0 .55em; font: 600 11.5px/1.7 var(--mono); color: var(--muted); background: #efe9db; border: 1.5px dashed #b8ae98; border-radius: 6px; }
.placeholder { font-family: var(--sans); color: var(--muted); text-align: center; padding: 40px 0; }

mark.hl-m { color: inherit; border-radius: 4px; padding: 1px 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; scroll-margin: 140px; }
mark.hl-m::before {
  content: attr(data-label); display: inline-block; text-indent: 0; margin-right: 6px; vertical-align: .1em;
  font: 700 11px/1 var(--mono); padding: 4px 6px; border-radius: 6px; border: 1.5px solid var(--ink); color: var(--ink);
}
mark.wrong { background: var(--wrong-bg); box-shadow: inset 0 -3px 0 var(--wrong); }
mark.wrong::before { background: var(--wrong); }
mark.missing { background: var(--missing-bg); box-shadow: inset 0 -3px 0 var(--missing); }
mark.missing::before { background: var(--missing); }
mark.found { background: var(--found-bg); box-shadow: inset 0 -3px 0 var(--found); }
mark.found::before { background: var(--found); }
mark.flash { animation: flash 1.5s ease 1; }
@keyframes flash { 0%, 55% { outline: 3px solid var(--ink); outline-offset: 4px; background: var(--hl); } 100% { outline: 3px solid transparent; outline-offset: 4px; } }
.fixbox { border: 2px solid var(--ink); background: var(--found-bg); border-radius: 12px; padding: 14px 18px 8px; margin-bottom: 1.4em; box-shadow: 3px 3px 0 var(--ink); position: relative; }
.fixbox h3 { margin-top: 0; }
.fixbox-tag { position: absolute; top: -13px; right: 14px; font: 700 11.5px/1 var(--mono); padding: 5px 8px; border: 2px solid var(--ink); border-radius: 8px; background: var(--found); }

.phone { width: 340px; height: 640px; margin: 28px auto; border: 3px solid var(--ink); border-radius: 40px; background: var(--paper); position: relative; overflow: hidden; box-shadow: var(--sh-lg); animation: fade .25s ease both; }
.phone .notch { width: 96px; height: 22px; border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 14px 14px; margin: 0 auto 6px; background: var(--ink); }
.phone .content { padding: 4px 20px 0; font: 15px/1.5 var(--serif); }
.phone .content h3 { font: 700 14px/1.3 var(--sans); margin: .8em 0 .3em; }
.phone .content p { margin: 0 0 .65em; }
.phone .content .li { padding-left: 1.1em; text-indent: -.9em; margin-bottom: .3em; }
.phone .cut { position: absolute; left: 0; right: 0; bottom: 0; padding: 80px 16px 22px; text-align: center; background: linear-gradient(rgba(255,255,255,0), #fff 55%); }

/* loading: highlighter sweeping down the letter */
.scanning { position: relative; overflow: hidden; }
.scanning::after {
  content: ""; position: absolute; left: 0; right: 0; height: 90px; top: -90px; pointer-events: none;
  background: linear-gradient(transparent, rgba(255, 225, 77, .65) 45%, rgba(255, 225, 77, .65) 55%, transparent);
  mix-blend-mode: multiply; animation: scan 2.4s ease-in-out infinite;
}
@keyframes scan { 0% { top: -90px; } 100% { top: 100%; } }

/* ------------------------------------------------------------ side tiles */
.side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 18px; }
.side .tile { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.side .tile:nth-child(2) { animation-delay: .07s; } .side .tile:nth-child(3) { animation-delay: .14s; } .side .tile:nth-child(4) { animation-delay: .21s; }
.tile h2 { font: 800 18px/1.1 var(--display); letter-spacing: -.02em; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.score-tile { flex-direction: row; align-items: center; gap: 18px; }
.score-tile { background: var(--paper); border-left-width: 12px; }
.score-tile.s-wrong { border-left-color: var(--wrong); }
.score-tile.s-wrong .score-num { color: var(--wrong-ink); }
.score-tile.s-missing { border-left-color: var(--missing); }
.score-tile.s-missing .score-num { color: var(--missing-ink); }
.score-tile.s-found { border-left-color: var(--found); }
.score-tile.s-found .score-num { color: var(--found-ink); }
.score-tile.s-none { border-left-color: var(--beige-2); }
.score-tile.s-none .score-num { color: var(--muted); }
.score-num { font: 800 84px/.9 var(--display); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.score-num small { font: 700 18px/1 var(--mono); letter-spacing: 0; }
.score-tile p { font: 700 18px/1.25 var(--display); }
.score-tile .mono { display: block; margin-top: 6px; font-weight: 500; }

.mistake { width: 100%; text-align: left; cursor: pointer; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; transition: transform .12s, box-shadow .12s; }
.mistake:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.mistake[disabled] { cursor: default; transform: none; box-shadow: none; }
.mistake-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.tag { font: 700 11.5px/1 var(--mono); padding: 5px 7px; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--wrong); }
.said { font: 700 20px/1.22 var(--display); letter-spacing: -.01em; }
.truth { font-size: 14.5px; color: var(--ink-2); }
/* Long answers (web addresses, lists of contacts) must wrap and stay card-sized. */
.said, .truth, .tile dd, .fix-what, .page, .phone .content { overflow-wrap: anywhere; }
.said, .truth { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.said { -webkit-line-clamp: 4; }
.truth { -webkit-line-clamp: 4; }
.side, .side .tile, .mistake { min-width: 0; }
.truth b { color: var(--found-ink); font-family: var(--mono); font-size: 12px; margin-right: 4px; }
.goodnews { background: var(--paper); }

.fix-tile { background: var(--paper); }
.ba { display: flex; align-items: center; gap: 14px; }
.ba .n { font: 800 58px/.9 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ba .arrow { font: 800 30px/1 var(--display); }
.c-wrong { color: var(--wrong-ink); } .c-missing { color: var(--missing-ink); } .c-found { color: var(--found-ink); }
.fix-what { font-weight: 600; }
.mini-bars { display: grid; gap: 6px; }
.mini-bars .r { display: grid; grid-template-columns: 62px 1fr 34px; gap: 8px; align-items: center; font: 500 13px/1 var(--mono); }
.mini-bars .tr { height: 12px; border: 1.5px solid var(--ink); border-radius: 6px; background: var(--paper); overflow: hidden; position: relative; }
.mini-bars .tr i { position: absolute; inset: 0 auto 0 0; background: var(--found); border-right: 1.5px solid var(--ink); width: 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.mini-bars .tr s { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--wrong-ink); }
.warn { background: var(--paper); border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

details.more { border-top: 2px dashed #d9d1bf; padding-top: 10px; }
details.more summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
details.more summary::after { content: "+"; font: 700 18px/1 var(--mono); }
details.more[open] summary::after { content: "–"; }
details.more ol, details.more dl { margin: 10px 0 0; }
details.more li { margin-bottom: 6px; font-size: 14px; }
details.more li.picked { font-weight: 700; }
details.more dt { font: 600 12px/1.3 var(--mono); color: var(--muted); margin-top: 10px; }
details.more dd { margin: 2px 0 0; font-size: 15px; }
.dots-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
.dots-table th { font: 600 12px/1 var(--mono); color: var(--muted); padding-bottom: 8px; text-align: center; }
.dots-table th:first-child, .dots-table td:first-child { text-align: left; }
.dots-table td { padding: 6px 0; border-top: 1.5px solid #e6dfcf; text-align: center; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; }
.pips .found { background: var(--found); } .pips .missing { background: var(--paper); } .pips .wrong { background: var(--wrong); }

/* progress tile */
.prog-title { font: 800 22px/1.1 var(--display); letter-spacing: -.02em; }
.readers { display: grid; grid-template-columns: 64px repeat(3, 1fr); gap: 6px; align-items: center; font: 600 12px/1 var(--mono); }
.readers .cell { height: 30px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); transition: background .3s, transform .3s; }
.readers .cell.done { background: var(--ink); transform: scale(.94); }
.readers .cell.now { background: var(--hl); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; color: var(--muted); font-size: 15px; }
.steps li .ic { width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--mono); }
.steps li.done { color: var(--ink); } .steps li.done .ic { background: var(--found); border-color: var(--ink); }
.steps li.now { color: var(--ink); font-weight: 700; } .steps li.now .ic { background: var(--hl); border-color: var(--ink); animation: pulse 1s ease-in-out infinite; }
.steps .model { display: block; font: 500 12px/1.3 var(--mono); color: var(--muted); font-weight: 500; }
.bar { height: 16px; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; background: var(--paper); }
.bar i { display: block; height: 100%; background: repeating-linear-gradient(-45deg, var(--hl), var(--hl) 8px, #ffd21f 8px, #ffd21f 16px); border-right: 2px solid var(--ink); transition: width .5s ease; animation: stripes 1s linear infinite; background-size: 22px 22px; }
@keyframes stripes { to { background-position: 22px 0; } }
.bar-label { display: flex; justify-content: space-between; font: 500 13px/1 var(--mono); color: var(--muted); }

.form label { display: block; font: 600 13px/1.3 var(--mono); margin: 10px 0 5px; }
.form textarea, .form select { width: 100%; font: 15px/1.45 var(--sans); padding: 9px 11px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); resize: vertical; }

/* ------------------------------------------------------------ footer, toast, motion */
.foot { width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 24px 30px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; max-width: min(560px, calc(100vw - 32px)); padding: 13px 18px; background: var(--ink); color: var(--paper); border-radius: 12px; box-shadow: 4px 4px 0 var(--hl); font-weight: 600; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* "This isn't a letter" pop-up (app.js kindAlert) */
.kind-pop { width: min(480px, calc(100vw - 32px)); padding: 0; border: 2px solid var(--ink); border-radius: var(--r); background: var(--paper); color: var(--ink); box-shadow: var(--sh-lg); animation: rise .2s ease both; }
.kind-pop::backdrop { background: rgba(18, 18, 18, .5); }
.kind-body { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 24px 24px 22px; }
.kind-body h2 { padding-right: 40px; font: 800 24px/1.15 var(--display); letter-spacing: -.02em; }
.kind-tag { align-self: flex-start; padding: 3px 9px; background: var(--wrong-bg); color: var(--wrong-ink); border: 2px solid var(--ink); border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); font-weight: 700; }
.kind-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink); font: 700 16px/1 var(--sans); cursor: pointer; box-shadow: 2px 2px 0 var(--ink); }
.kind-x:hover { background: var(--hl-soft); }
.kind-body .row { gap: 12px; margin-top: 6px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.screen { animation: screen-in .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
::view-transition-old(root) { animation: .22s ease both vt-out; }
::view-transition-new(root) { animation: .38s cubic-bezier(.2, .8, .2, 1) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
/* Embedded in another site's window: the same feel without View Transitions. */
.embedded .stage > *, .embedded .seg, .embedded #docChips { animation: fade .2s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1060px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: -1; }
  .examples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: 1fr 1fr; }
  .t-read { grid-row: auto; grid-column: span 2; }
  .t-models { grid-column: span 2; }
}
@media (max-width: 640px) {
  main { padding: 0 16px 48px; }
  .top { padding: 16px; }
  .top-nav a { padding: 6px 8px; font-size: 14px; }
  .hero { padding-top: 18px; }
  .sub { font-size: 17px; }
  .examples, .bento { grid-template-columns: minmax(0, 1fr); }
  .t-read, .t-models { grid-column: auto; }
  .models { grid-template-columns: 1fr; }
  .minis { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 24px 20px 30px; font-size: 16px; }
  .phone { width: 290px; height: 560px; }
  .score-num { font-size: 68px; }
  .work-top { flex-direction: column; }
  .window-bar .dots { display: none; }
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; gap: 5px; }
  .tabs button { flex-direction: column; gap: 5px; padding: 7px 4px; font-size: 13px; justify-content: center; }
}

/* ------------------------------------------------------------ writer / reader */
.viewer-bar { justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.viewer-bar:has(.seg:not([hidden])) { margin-bottom: 14px; }
.tabs-note { font: 600 13px/1 var(--mono); padding: 8px 4px; color: var(--ink-2); }
.coach { display: block; font-size: 14px; line-height: 1.4; color: var(--ink-2); padding-top: 4px; }
.coach:first-of-type { border-top: 1.5px dashed #d9d1bf; margin-top: 4px; padding-top: 8px; }
.coach b { font: 700 11px/1 var(--mono); margin-right: 6px; padding: 2px 5px; border-radius: 4px; background: var(--beige-2); color: var(--ink); }
.coach.en { font-size: 13px; color: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; }
.checklist .ic { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; font: 800 13px/1 var(--display); }
.checklist li.ok .ic { background: var(--found); }
.checklist li.no .ic { background: var(--missing); }
.checklist b { display: block; font: 700 15px/1.3 var(--display); }
.checklist span:not(.ic) { display: block; font-size: 14px; color: var(--ink-2); }
.reader-tile .gist { font: 600 17px/1.4 var(--display); }
.reader-tile .ok-note { font-weight: 700; color: var(--found-ink); }
.todo { margin: 0; display: grid; gap: 4px; }
.todo dt { font: 700 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: 10px; }
.todo dd { margin: 0; font: 600 16px/1.4 var(--sans); }
.watch { border: 2px solid var(--ink); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
mark.read { background: var(--hl-soft); box-shadow: inset 0 -3px 0 var(--hl); }
mark.read::before { background: var(--hl); color: var(--ink); }
.lang-seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; flex: none; }
.lang-seg button { border: 0; background: var(--paper); font: 600 12px/1 var(--mono); padding: 6px 10px; cursor: pointer; }
.lang-seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

/* exact repeats: red dashed box around repeated paragraphs, red mark on a single repeated sentence */
.repeat-box { position: relative; border: 2.5px dashed var(--wrong); background: var(--wrong-bg); border-radius: 12px; padding: 18px 16px 2px; margin: 1.6em 0 1.2em; }
.repeat-box .blk { color: #6b4a42; }
.repeat-tag { position: absolute; top: -15px; left: 14px; font: 700 13px/1 var(--mono); padding: 6px 10px; border: 2px solid var(--ink); border-radius: 8px; background: var(--wrong); color: #fff; max-width: calc(100% - 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
mark.repeat { background: var(--wrong-bg); box-shadow: inset 0 0 0 1.5px var(--wrong); }
mark.repeat::before { background: var(--wrong); color: #fff; }

/* privacy line under the upload box */
.privacy-line { display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; margin: 14px auto 0; max-width: 640px; color: var(--ink); opacity: .78; }
.privacy-line svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* "Read in" language menu in the Reader view: a button and a two-column card of languages */
.reader-tile { position: relative; z-index: 3; }  /* the open menu sits above the tiles below */
.reader-tile h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.read-in { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-weight: 400; letter-spacing: normal; text-transform: none; }
.read-in-label { font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.read-in-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 12px 6px 14px;
  font: 700 15px/1.2 var(--sans); color: var(--ink); background: var(--paper); border: 2px solid var(--ink);
  border-radius: 999px; box-shadow: 2px 2px 0 var(--ink); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.read-in-btn:hover { background: var(--hl-soft); }
.read-in-btn:active, .read-in-btn[aria-expanded="true"] { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); background: var(--hl); }
.read-in-btn:focus-visible { outline: 3px solid var(--lilac); outline-offset: 2px; }
.read-in-btn:disabled { cursor: progress; opacity: .7; }
.read-in-btn svg { width: 12px; height: 8px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s ease; }
.read-in-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.read-in-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: min(340px, 88vw); max-height: min(480px, 72vh);
  overflow: auto; margin: 0; padding: 6px; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--sh);
  animation: menu-in .14s ease-out; }
.read-in-menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.read-in-menu li { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 44px; padding: 6px 10px;
  border: 2px solid transparent; border-radius: 10px; cursor: pointer; outline: none; }
.read-in-menu li:hover, .read-in-menu li:focus-visible { background: var(--beige-2); }
.read-in-menu li:focus-visible { border-color: var(--ink); }
.read-in-menu li[aria-selected="true"] { background: var(--hl); border-color: var(--ink); }
.ri-native { font: 600 15px/1.25 var(--sans); color: var(--ink); }
.read-in-menu li[aria-selected="true"] .ri-native::after { content: " ✓"; font-weight: 700; }
.ri-en { font: 500 10.5px/1.2 var(--mono); color: var(--muted); letter-spacing: .02em; }
@media (prefers-reduced-motion: reduce) { .read-in-menu { animation: none; } .read-in-btn, .read-in-btn svg { transition: none; } }
