:root {
  color-scheme:light;
  --paper:#faf9f6; --ink:#171915; --muted:#60635e; --accent:#344e70;
  --reading:"Helvetica Neue",Helvetica,Arial,sans-serif;
  --passage-size:clamp(20px,1.8vw,28px);
  --passage-leading:1.3;
  --edge:clamp(12px,3.5vw,66px);
  --pad:clamp(10px,1.7vw,30px);
  background:var(--paper);color:var(--ink);font:400 16px/1.4 var(--reading);
  -webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;
}
* {box-sizing:border-box}
[hidden] {display:none!important}
body,h1,h2,p,figure,blockquote,ol {margin:0}
main {
  max-width:2000px;margin:auto;min-height:100vh;min-height:100svh;display:grid;
  grid-template-rows:auto minmax(0,1fr);
  padding:0 max(var(--edge),env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(var(--edge),env(safe-area-inset-left));
}
header {position:sticky;top:0;z-index:3;background:var(--paper);display:flex;align-items:center;justify-content:space-between;
  min-height:clamp(56px,8svh,84px);padding-top:env(safe-area-inset-top)}
h1 {white-space:nowrap;font:400 1.125rem/1.75rem -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;letter-spacing:-.025em}
.wordmark {font-weight:500}
h1 i {font-weight:300}
.speed-control {display:grid;width:clamp(109px,9vw,136px);align-content:center}
.speed-rail {--position:66.6667%;position:relative;display:flex;align-items:center;height:26px}
.speed-rail::before {content:"";position:absolute;inset-inline:0;top:50%;height:1px;background:var(--ink);transform:translateY(-50%);pointer-events:none}
#speed {appearance:none;-webkit-appearance:none;position:absolute;z-index:1;top:50%;transform:translateY(-50%);background:transparent;outline:none;border:0;border-radius:0;margin:0;width:100%;height:44px;cursor:pointer}
#speed::-webkit-slider-runnable-track {height:100%;background:transparent;border:0}
#speed::-moz-range-track {height:100%;background:transparent;border:0}
#speed::-moz-range-progress {background:transparent;height:0}
#speed::-webkit-slider-thumb {appearance:none;-webkit-appearance:none;box-sizing:border-box;width:1px;height:44px;border:0;border-radius:0;background:transparent}
#speed::-moz-range-thumb {box-sizing:border-box;width:1px;height:44px;border:0;border-radius:0;background:transparent}
.speed-tick {position:absolute;top:50%;left:var(--position);width:1px;height:9.75px;border-radius:0;background:var(--ink);transform:translate(-50%,-50%);pointer-events:none}
.speed-rail:hover .speed-tick,#speed:focus-visible + .speed-tick {background:var(--accent)}
.speed-rail:has(#speed:focus-visible)::after {content:"";position:absolute;inset:3px -4px;border:1px dotted var(--muted);pointer-events:none}
.speed-ends {display:flex;justify-content:space-between;pointer-events:none}
.speed-ends button {position:relative;z-index:2;pointer-events:auto;margin:0;padding:4px 0 6px;border:0;background:transparent;color:var(--ink);font:400 .625rem/1.2 ui-monospace,monospace;cursor:pointer}
.speed-ends button:hover,.speed-ends button:focus-visible {color:var(--accent)}
@media(prefers-reduced-motion:no-preference) {
  .speed-tick {transition:left 90ms cubic-bezier(.22,1,.36,1)}
  .speed-rail[data-jump] .speed-tick {transition:left 320ms cubic-bezier(.83,0,.17,1)}
}
#stage {
  position:relative;min-width:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-rows:repeat(2,minmax(235px,1fr));
}
#study:not([data-passage]) .model-run,.model-run[data-phase="waiting"] {visibility:hidden}
#status {position:absolute;inset-inline:0;top:45%;text-align:center;color:var(--muted);font-size:.875rem}
#reference {grid-area:1/1}
[data-slot="2"] {grid-area:1/2}
[data-slot="3"] {grid-area:2/1}
[data-slot="4"] {grid-area:2/2}
#study[data-count="1"] {--stack-count:1}
#study[data-count="2"] {--stack-count:2}
#study[data-count="3"] {--stack-count:3}
#study[data-phase="writing"]:not([data-count="4"]) #stage {
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:repeat(var(--stack-count,1),minmax(0,1fr));
}
#study[data-phase="writing"]:not([data-count="4"]) [data-slot="2"] {grid-area:2/1}
#study[data-phase="writing"]:not([data-count="4"]) [data-slot="3"] {grid-area:3/1}
#study[data-phase="writing"]:not([data-count="4"]) .lane {min-height:0}
#study .model-run[data-phase="waiting"] {position:absolute;inset:0;grid-area:auto;pointer-events:none}
.model-run,#reference {min-width:0;padding:clamp(11px,1.6vw,26px) var(--pad)}
.model-run {display:grid;grid-template-rows:minmax(0,1fr)}
.lane {position:relative;isolation:isolate;min-width:0;min-height:205px;display:grid;align-items:center;container-type:inline-size}
.lane iframe {position:absolute;inset:0;width:100%;height:100%;border:0;opacity:0;pointer-events:none}
.lane[data-native="visible"] iframe[aria-hidden="false"] {opacity:1}
.lane[data-native="visible"] .transcript {visibility:hidden}
.transcript {position:absolute;inset:0;min-width:0;display:grid;align-items:center;grid-template-columns:minmax(0,1fr) min(43%,500px);gap:clamp(12px,2cqw,26px);padding:8px 2px}
.copy-space {min-width:0;min-height:0;max-height:100%;overflow:auto;scrollbar-width:none;display:grid}
.copy-space > p {grid-area:1/1}
.measure-model {visibility:hidden;pointer-events:none;user-select:none}
#quote,.model-text,.measure-model {font:400 var(--passage-size)/var(--passage-leading) var(--reading);letter-spacing:-.022em;overflow-wrap:anywhere;white-space:pre-wrap}
.candidates {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 12px;margin:0;padding:0;list-style:none}
.candidates li {display:flex;min-width:0;justify-content:space-between;align-items:baseline;gap:4px;color:var(--muted);font-size:.765rem;line-height:1.2;font-variant-numeric:tabular-nums}
.candidates li span:first-child {min-width:0;overflow-wrap:anywhere}
.candidates li span:last-child {flex:none}
.candidates li[data-selected] {color:var(--accent);font-weight:600}
.model-run[data-phase="finished"] .transcript {grid-template-columns:1fr;grid-template-rows:1fr}
#reference {display:grid;align-items:center}
#quote {display:grid;max-width:43ch}
#quote > span {grid-area:1/1}
#measure {visibility:hidden;user-select:none;pointer-events:none}
#source,.model-credit {margin-top:13px;color:var(--muted);font:400 .875rem/1.42 var(--reading);overflow-wrap:anywhere}
#source[aria-hidden="true"],.model-credit[aria-hidden="true"] {display:none}
#source .author,#source .work {display:block;width:fit-content;max-width:100%}
#source .work {font-style:italic;color:inherit;text-decoration:none}
#source a:hover,#source a:focus-visible {text-decoration:underline;text-underline-offset:3px}
/* Each pair shares its text and credit tracks, including wrapped publications. */
#study[data-phase="reading"] #stage {grid-template-rows:repeat(2,minmax(0,1fr) auto auto minmax(0,1fr))}
#study[data-phase="reading"] :is(#reference,.model-run) {grid-template-rows:subgrid;align-items:start}
#study[data-phase="reading"] :is(#reference,[data-slot="2"]) {grid-row:1/span 4}
#study[data-phase="reading"] :is([data-slot="3"],[data-slot="4"]) {grid-row:5/span 4}
#study[data-phase="reading"] :is(#quote,.lane) {grid-row:2;align-self:end}
#study[data-phase="reading"] :is(#source,.model-credit) {grid-row:3}
#study[data-phase="reading"] .lane {display:block;min-height:0}
#study[data-phase="reading"] .measure-model {display:none}
#study[data-phase="reading"] .transcript {position:static;display:block;padding:0}
#study[data-phase="reading"] .copy-space {max-height:none;overflow:visible}
@container (max-width:510px) {
  .transcript {grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;gap:5px}
  .candidates {grid-template-columns:repeat(3,minmax(0,1fr))}
}
@container (max-width:269px) {
  .candidates {grid-template-columns:repeat(2,minmax(0,1fr));gap:1px 8px}
  .candidates li {font-size:.75rem}
}
@container (max-width:214px) {
  .candidates {grid-template-columns:1fr;gap:1px}
  .candidates li {font-size:.72rem}
}
@media(max-width:650px) {
  :root {--passage-size:clamp(1.06rem,4.5vw,1.36rem);--passage-leading:1.28}
  header {min-height:51px}
  .model-run,#reference {padding:9px clamp(6px,2vw,12px)}
  .lane {min-height:224px}
  #source,.model-credit {margin-top:10px;font-size:.8125rem}
  #stage {grid-template-rows:repeat(2,minmax(256px,1fr))}
  main {padding-bottom:max(5px,env(safe-area-inset-bottom))}
}
@media(max-width:380px) {
  :root {--passage-size:16px;--passage-leading:1.24}
  #source,.model-credit {font-size:.775rem;line-height:1.35}
}
@media(max-width:380px) and (max-height:650px) {
  #study[data-phase="writing"] {height:max(560px,100svh)}
  #study[data-phase="writing"] #stage {min-height:0;grid-template-rows:repeat(2,minmax(0,1fr))}
  #study[data-phase="writing"] .lane {min-height:0;grid-template-rows:minmax(0,1fr)}
  #study[data-phase="writing"] .measure-model {max-height:100%;overflow:hidden}
  #study[data-phase="writing"] #reference {min-height:0;overflow-y:auto}
}
@media(prefers-reduced-motion:no-preference) {
  #study[data-phase="reading"] :is(#source,.model-credit) {animation:reveal-credit .55s ease-out both}
  @keyframes reveal-credit {from {opacity:0} to {opacity:1}}
}
