:root {
  --ink: #141414;
  --ink-2: #4a4a4a;
  --ink-3: #888;
  --rule: #e8e8e6;
  --rule-2: #cfcfcc;
  --wash: #f5f5f3;
  --accent: #1a5bd1;
  --win: #15803d;
  --win-wash: #e9f6ee;
  --bad: #b42318;
  --lab: 8rem;
  --gap: 24px;
  /* terminal */
  --t-bg: #0e1116;
  --t-bar: #1a1f27;
  --t-line: #2c333d;
  --t-ink: #e3e8ee;
  --t-dim: #8a94a1;
  --t-code: #181d24;
  --t-ok: #4ade80;
  --t-bad: #f87171;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #fff; color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
.muted { color: var(--ink-3); }

.page { max-width: 1240px; margin: 0 auto; padding: 40px 32px 96px; }
h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; margin: 0 0 28px; font-size: 26px; line-height: 1.2; font-weight: 650; letter-spacing: -0.015em; }
h1 .logo { width: 30px; height: 30px; margin-right: -2px; }
h1 .vs { margin: 0 4px; font-weight: 400; color: var(--ink-3); }
.logo { flex: none; display: block; width: 24px; height: 24px; object-fit: contain; }

/* tasks: one row per category, label in the same column as the sheet labels */
.tasks { margin: 0 0 40px; }
.tasks h2 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.ex-row { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); column-gap: var(--gap); align-items: center; padding: 5px 0; }
.ex-cat { font-size: 14px; color: var(--ink-3); }
.ex-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ex {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px 7px 11px; cursor: pointer;
  border: 1px solid var(--rule-2); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
  font-size: 14px; font-weight: 500; line-height: 1.3; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.ex::before { /* play triangle */
  content: ""; flex: none; width: 0; height: 0; border-left: 7px solid currentColor;
  border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; opacity: .55;
}
.ex:hover { border-color: #9a9a96; background: var(--wash); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.ex:active { transform: translateY(1px); }
.ex.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.ex.on::before { opacity: 1; }
.ex.on.busy::before { /* a running task shows a pulsing dot instead of the triangle */
  width: 7px; height: 7px; border: 0; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite;
}
.ex:focus-visible, .think summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes pulse { 50% { opacity: .25; } }

/* comparison sheet: every row shares one grid, so all columns line up */
.r {
  display: grid; grid-template-columns: var(--lab) minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gap);
  padding: 9px 0; border-top: 1px solid var(--rule);
}
.lab { color: var(--ink-3); font-size: 14px; }
.c { min-width: 0; font-variant-numeric: tabular-nums; }
.c.span { grid-column: 2 / 4; }
.r.head {
  position: sticky; top: 0; z-index: 3; align-items: center;
  padding: 10px 0; border-top: 0; border-bottom: 1.5px solid var(--ink); background: #fff;
}
.r.head + .r { border-top: 0; }
.model { display: flex; align-items: center; gap: 10px; }
.model .logo { width: 28px; height: 28px; }
.who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.name { font-size: 17px; font-weight: 650; }
.org { font-size: 12.5px; color: var(--ink-3); }
.badge {
  display: none; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px;
  background: var(--win); color: #fff; font-size: 12.5px; font-weight: 650; line-height: 1.5; white-space: nowrap;
}
.badge::before { /* check mark */
  content: ""; width: 4px; height: 8px; margin: -2px 2px 0 2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.win .badge { display: inline-flex; }
.model .badge { margin-left: 4px; }

.q-row { padding-top: 14px; padding-bottom: 14px; }
.u { margin-left: 3px; color: var(--ink-3); font-size: 13.5px; }
.stat .c:empty::before { content: "-"; color: var(--rule-2); }
.c.best { color: var(--win); font-weight: 650; }
.c.best .u { color: var(--win); }
.src { display: block; font-size: 12.5px; }
/* question and expected answer belong to both models, so they sit in one box across both columns */
.c.box { padding: 10px 14px; background: var(--wash); border-radius: 6px; }
.c.box > :last-child { margin-bottom: 0; }
.c.box p, .c.box ol, .c.box ul { margin: 0 0 8px; }
.c.box ol, .c.box ul { padding-left: 22px; }
.box code { font-family: var(--mono); font-size: 13px; background: #ebebe8; padding: 1px 4px; border-radius: 4px; }
.box pre { margin: 0 0 10px; padding: 10px 12px; overflow-x: auto; background: #ebebe8; border-radius: 6px; }
.box pre code { padding: 0; background: none; font-size: 12.5px; }
.group { margin-top: 36px; border-top: 1.5px solid var(--ink); }
.group .lab { color: var(--ink); font-weight: 650; }

/* terminals */
.r.terms { padding: 6px 0 18px; border-top: 0; align-items: start; }
.term {
  display: flex; flex-direction: column; overflow: hidden;
  height: clamp(340px, 52vh, 600px); border-radius: 10px; background: var(--t-bg);
  box-shadow: 0 0 0 1px #000, 0 6px 18px rgba(0, 0, 0, .14);
  color: var(--t-ink); font: 13px/1.6 var(--mono); transition: box-shadow .2s;
}
.term.win { box-shadow: 0 0 0 3px var(--win), 0 6px 18px rgba(21, 128, 61, .25); }
.term-bar {
  flex: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  background: var(--t-bar); border-bottom: 1px solid var(--t-line); font-family: var(--sans);
}
.dots { display: flex; gap: 6px; margin-right: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a414c; }
.term-bar .logo { width: 18px; height: 18px; }
.term-name { font-size: 13.5px; font-weight: 650; }
.term-bar .st { margin-left: auto; font-size: 12.5px; color: var(--t-dim); white-space: nowrap; }
.term-bar .badge { margin-left: 4px; }
.st.live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; vertical-align: 1px;
  border-radius: 50%; background: var(--t-ok); animation: pulse 1.2s ease-in-out infinite;
}
.st.err { color: var(--t-bad); }
.term-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px 16px; overflow-wrap: anywhere; scrollbar-color: #3a414c transparent; }
.term-body p { margin: 0 0 10px; }
.term .dim { color: var(--t-dim); }
.prompt { color: var(--t-ok); font-weight: 700; }
.cmd { color: var(--t-ink); }
.wait::after { content: "..."; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { to { width: 1.8em; } }
.cursor { display: inline-block; width: .6em; height: 1.15em; margin-left: 1px; vertical-align: -3px; background: var(--t-ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.term-foot {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 14px;
  border-top: 1px solid var(--t-line); background: var(--t-bar); font: 13px/1.4 var(--sans); color: var(--t-dim);
}
.verdict { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.verdict::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; background: center / 12px no-repeat;
}
.ok .verdict { color: var(--t-ok); }
.ok .verdict::before { background-color: var(--t-ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%230e1116' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.no .verdict { color: var(--t-bad); }
.no .verdict::before { background-color: var(--t-bad); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3.5 3.5l5 5M8.5 3.5l-5 5' fill='none' stroke='%230e1116' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.unk .verdict::before { border: 2px solid var(--t-dim); }
.checking .verdict::before { border: 2px solid var(--t-dim); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.why { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* reasoning streams in dim text, then folds away once the answer starts */
.think { margin: 0 0 12px; }
.think summary { list-style: none; cursor: pointer; padding: 1px 0; color: var(--t-dim); user-select: none; }
.think summary::-webkit-details-marker { display: none; }
.think summary::before {
  content: ""; display: inline-block; margin-right: 8px; vertical-align: 1px; transition: transform .15s;
  border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.think[open] summary::before { transform: rotate(90deg); }
.think summary:hover { color: var(--t-ink); }
.think-body { margin: 6px 0 0; padding-left: 12px; border-left: 2px solid var(--t-line); color: var(--t-dim); white-space: pre-wrap; }

.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p { margin: 0 0 12px; }
.answer h1, .answer h2, .answer h3 { margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: #fff; }
.answer strong { color: #fff; }
.answer ul, .answer ol { margin: 0 0 12px; padding-left: 22px; }
.answer li { margin: 3px 0; }
.answer pre { margin: 0 0 12px; padding: 10px 12px; overflow-x: auto; background: var(--t-code); border: 1px solid var(--t-line); border-radius: 6px; }
.answer code { font-family: var(--mono); font-size: 12.5px; background: var(--t-code); padding: 1px 4px; border-radius: 4px; }
.answer pre code { padding: 0; background: none; line-height: 1.55; }
.tbl { margin: 0 0 12px; overflow-x: auto; }
.tbl table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 4px 14px 4px 0; border-bottom: 1px solid var(--t-line); text-align: left; vertical-align: top; }
.tbl th { font-weight: 700; color: #fff; }
.answer hr { margin: 16px 0; border: 0; border-top: 1px solid var(--t-line); }
.answer .final { padding-top: 10px; border-top: 1px solid var(--t-line); font-weight: 700; color: #fff; }
.answer .note { color: var(--t-dim); }
.answer .note.err { color: var(--t-bad); }
.box .tbl th, .box .tbl td { border-bottom-color: var(--rule); }
.box .tbl th { color: var(--ink); border-bottom-color: var(--rule-2); }

/* result */
.result { padding: 14px 0; border-top: 0; }
.result .lab { padding-top: 1px; }
.result .c { font-size: 16px; font-weight: 650; }
.result .c.none { font-weight: 500; color: var(--ink-2); }

@media (max-width: 960px) {
  :root { --lab: 6.5rem; }
}
@media (max-width: 640px) {
  :root { --lab: 5.4rem; --gap: 12px; }
  body { font-size: 14px; }
  .page { padding: 22px 14px 72px; }
  h1 { font-size: 21px; margin-bottom: 20px; gap: 0 7px; }
  h1 .logo { width: 24px; height: 24px; }
  .tasks { margin-bottom: 28px; }
  .ex-row { grid-template-columns: minmax(0, 1fr); row-gap: 6px; padding: 6px 0; }
  .ex-cat { font-size: 13px; }
  .ex { padding: 7px 11px 7px 9px; font-size: 13.5px; }
  .lab { font-size: 13px; }
  .model { gap: 7px; }
  .model .logo { width: 22px; height: 22px; }
  .name { font-size: 14.5px; }
  .org { display: none; }
  .model .badge { display: none; }
  .r.terms { grid-template-columns: minmax(0, 1fr); row-gap: 18px; }
  .r.terms > .lab { display: none; }
  .term { height: min(58vh, 480px); }
  .term-body { padding: 10px 12px 14px; }
  .dots { display: none; }
}

/* math */
.math { margin: 0 0 12px; overflow-x: auto; overflow-y: hidden; }
.math .katex-display { margin: 4px 0; }
.katex { font-size: 1.08em; }
.tex-raw { font-family: var(--mono); font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.term .tex-raw { color: var(--t-dim); }
