/* Layout: one column of reading width; the blind pair is the only big object on the page. */
:root {
  --paper: #edf0f3;
  --sheet: #f9fafb;
  --ink: #16202e;
  --muted: #5a6779;
  --rule: #cbd3dc;
  --red: #d7263d;
  --red-wash: rgba(215, 38, 61, 0.12);
  --blue: #2f5bd3;
  --ui: "Bricolage Grotesque", system-ui, sans-serif;
  --read: "Newsreader", Georgia, serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10161f; --sheet: #172030; --ink: #e6ecf2; --muted: #9aa7b6; --rule: #2a3647;
    --red: #ff5a6e; --red-wash: rgba(255, 90, 110, 0.16); --blue: #85a6ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10161f; --sheet: #172030; --ink: #e6ecf2; --muted: #9aa7b6; --rule: #2a3647;
  --red: #ff5a6e; --red-wash: rgba(255, 90, 110, 0.16); --blue: #85a6ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-underline-offset: 3px; }
code { font: 500 0.88em ui-monospace, SFMono-Regular, Menlo, monospace; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
main { max-width: 1040px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 64px max(16px, env(safe-area-inset-left, 0px)); }
section { padding-top: 64px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-weight: 800; font-size: clamp(34px, 5.4vw, 60px); line-height: 1.02; max-width: 15ch; }
h2 { font-weight: 800; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.1; }
h3 { font-weight: 600; font-size: 17px; margin-bottom: 8px; }
.sec-lede { color: var(--muted); max-width: 62ch; margin: 8px 0 20px; }
.small { color: var(--muted); font-size: 14px; }

/* header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; display: flex; align-items: center; gap: 20px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.brand { font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand span { color: var(--red); }
.top nav { display: flex; gap: 18px; margin-left: auto; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.top nav a:hover { color: var(--ink); }
.theme { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; display: grid; place-items: center; }
.theme span { width: 13px; height: 13px; border-radius: 50%; background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); border: 1.5px solid var(--ink); transition: transform .5s; }
:root[data-theme="dark"] .theme span { transform: rotate(180deg); }
@media (max-width: 600px) { .top nav { display: none; } .theme { margin-left: auto; } }

/* hero: the pair is the control */
.hero { padding-top: 56px; }
.lede { font-size: 19px; color: var(--muted); max-width: 52ch; margin: 16px 0 26px; }
.genres { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.genres button { border: 0; background: none; padding: 8px 0; margin-bottom: -1px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 15px; }
.genres button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.brief { color: var(--muted); font-size: 14px; max-width: 80ch; margin: 0 0 16px; }
.duel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 760px) { .duel { grid-template-columns: minmax(0, 1fr); } }
.draft { position: relative; display: block; text-align: left; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 18px 20px 0; height: 400px; overflow: hidden; cursor: pointer; transition: border-color .2s, box-shadow .2s, opacity .3s; }
.draft:hover { border-color: var(--ink); }
.draft .tag { display: grid; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.draft .tag > span { grid-area: 1 / 1; transition: opacity .35s, transform .35s; }
.draft .real { opacity: 0; transform: translateY(6px); }
.revealed .draft .anon { opacity: 0; transform: translateY(-6px); }
.revealed .draft .real { opacity: 1; transform: none; }
.draft .sample { display: block; font-size: 16px; }
.draft .fade { position: absolute; inset: auto 0 0; height: 90px; background: linear-gradient(transparent, var(--sheet)); pointer-events: none; }
.revealed .draft { cursor: default; }
.revealed .draft:not(.chosen) { opacity: .62; }
.draft.chosen { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.draft.chosen .real { color: var(--blue); }
.verdict { min-height: 1.6em; margin: 16px 0 0; max-width: 70ch; }

/* install strip */
.install-strip { padding-top: 40px; }
.cmd { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--paper); border-radius: 8px; padding: 9px 9px 9px 14px; max-width: 640px; }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.cmd .dim { opacity: .5; }
.copy { flex: none; border: 0; border-radius: 5px; padding: 6px 12px; background: var(--paper); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.copy.done { background: var(--blue); color: #fff; }
.install-strip .small { margin: 8px 0 0; }

/* reading samples */
.sample { font-family: var(--read); line-height: 1.65; }
.sample h1, .sample h2, .sample h3 { font-family: var(--read); font-weight: 500; letter-spacing: 0; line-height: 1.25; margin: 0 0 .5em; max-width: none; }
.sample h1 { font-size: 1.4em; } .sample h2 { font-size: 1.12em; margin-top: 1em; } .sample h3 { font-size: 1.04em; }
.sample p { margin: 0 0 .85em; }
.sample mark { background: none; color: inherit; position: relative; }
.sample mark::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform .45s ease; }
.marks-on .sample mark { background: var(--red-wash); }
.marks-on .sample mark::after { transform: scaleX(1); }
.sample p.punch { transition: box-shadow .3s, padding .3s; }
.marks-on .sample p.punch { box-shadow: inset 3px 0 0 var(--red); padding-left: 10px; }

/* results */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
tr.lead td { font-weight: 700; }
td .of { color: var(--muted); font-weight: 400; font-size: 13px; }
.note { max-width: 70ch; margin: 16px 0 0; }
.more { margin-top: 18px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 15px; }
.more h3 { margin-top: 22px; }
.more .small { margin-top: 8px; }

/* all drafts */
.cmp-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 14px; }
select { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 10px; font-size: 14px; max-width: 100%; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 34px; height: 20px; border-radius: 999px; background: var(--rule); position: relative; transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); transition: transform .25s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--red); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }
.panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 820px) { .panes { grid-template-columns: minmax(0, 1fr); } }
.pane { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.pane .cfg { font-weight: 600; }
.pane .judge { font-size: 13px; color: var(--muted); margin: 8px 0 14px; }
.pane .sample { max-height: 620px; overflow-y: auto; padding-right: 6px; font-size: 16px; }

/* arena */
.arena-root { min-height: 48px; }
.btn { border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; background: var(--ink); color: var(--paper); text-decoration: none; display: inline-block; font-size: 15px; }
.btn:disabled { opacity: .35; cursor: default; }
.ar-top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 980px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; background: var(--sheet); display: flex; flex-direction: column; min-width: 0; }
.card.best { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.card.worst { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.card .who { font-weight: 800; display: flex; justify-content: space-between; gap: 8px; }
.card .reveal { font-weight: 600; font-size: 13px; color: var(--muted); opacity: 0; transition: opacity .4s; }
.card.revealed .reveal { opacity: 1; }
.card .ex { font-family: var(--read); font-size: 15px; line-height: 1.55; margin: 8px 0; flex: 1; }
.card .ex .gap { display: block; text-align: center; color: var(--muted); }
.card .full { font-size: 13px; background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; text-align: left; margin-bottom: 10px; }
.card .acts { display: flex; gap: 8px; }
.card .acts button { flex: 1; border: 1px solid var(--rule); background: var(--paper); border-radius: 6px; padding: 7px 6px; cursor: pointer; font-size: 14px; font-weight: 600; }
.card .acts .b[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }
.card .acts .w[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--red); }
.ar-foot { margin-top: 14px; }
.ar-sum { display: grid; gap: 6px; max-width: 420px; margin-bottom: 12px; font-size: 15px; }
.ar-sum div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rule); padding: 6px 0; }

/* use */
.use-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 20px; }
@media (max-width: 860px) { .use-grid { grid-template-columns: minmax(0, 1fr); } }
.use-grid .small { margin: 8px 0 12px; }

.method { max-width: 1040px; margin: 56px auto 0; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--rule); color: var(--muted); font-size: 14px; }
.method p { max-width: 80ch; margin: 0; }

.toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
