:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --ink: #1b1f24;
  --ink-soft: #4a5260;
  --ink-faint: #8a93a2;
  --rule: #e3e6eb;
  --accent: #1e88e5;
  --accent-ink: #0d5fae;

  /* method colours, matched to the paper's figures */
  --sear: #1e88e5;
  --chunk: #f2a81d;
  --nochunk: #c8173a;
  --low: #d9433b;

  --state-fill: #dcefd5;  --state-stroke: #5fa64a;
  --action-fill: #dde9fb; --action-stroke: #5b8def;
  --tf-fill: #fff1dc;     --tf-stroke: #f0a04b;
  --q-fill: #fadadd;      --q-stroke: #d6505a;
  --g-fill: #eef0f4;      --g-stroke: #9aa3b2;
  --reward: #7cb36a;

  --radius: 12px;
  --maxw: 1080px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; margin: 0 auto; }

/* ---------- hero ---------- */
.hero { padding: 72px 0 40px; text-align: center; }
.venue {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-ink); background: #e8f2fd;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 20px;
}
h1 {
  font-weight: 700; font-size: clamp(34px, 6vw, 58px);
  line-height: 1.08; margin: 0 0 8px; letter-spacing: -.01em;
}
h1 .acr { color: var(--sear); }
.subtitle { font-size: clamp(19px, 2.6vw, 25px); color: var(--ink-soft); margin: 0 0 28px; }
.authors { font-size: 17px; margin: 0 0 6px; }
.authors span { white-space: nowrap; margin: 0 9px; }
.affils { font-size: 15px; color: var(--ink-soft); margin: 0 0 28px; }
.affils span { margin: 0 10px; white-space: nowrap; }
sup { font-size: .7em; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; font-size: 15px;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: #343a43; transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- sections ---------- */
section { padding: 48px 0; }
section + section { border-top: 1px solid var(--rule); }
h2 {
  font-size: clamp(26px, 3.4vw, 34px); margin: 0 0 20px; text-align: center;
}
h3 { font-size: 20px; margin: 40px 0 10px; }
.lead { font-size: 18px; color: var(--ink-soft); }
.abstract { text-align: justify; hyphens: auto; }

.ideas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.idea { border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; }
.idea h4 { margin: 0 0 6px; font-size: 17px; }
.idea p { margin: 0; font-size: 15.5px; color: var(--ink-soft); }
.idea .tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sear); }

.eq { overflow-x: auto; padding: 4px 0; }

/* ---------- animation shells ---------- */
.demo {
  background: var(--bg-soft); border-radius: 16px; padding: 18px 18px 14px; margin: 22px 0 10px;
}
.demo svg { width: 100%; height: auto; display: block; }
.demo svg text { font-family: var(--sans); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px; font-size: 14.5px; }
.controls button {
  font: inherit; font-weight: 600; border: 1px solid var(--rule); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.controls button:hover { border-color: var(--ink-faint); }
.controls label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.controls input[type=range] { width: 110px; accent-color: var(--sear); }
.controls .val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); min-width: 1.2em; }
.toggle { cursor: pointer; }
.toggle input { accent-color: var(--sear); width: 16px; height: 16px; }
.caption-live {
  min-height: 3.4em; margin-top: 10px; padding: 10px 14px; background: #fff; border-radius: 10px;
  border-left: 4px solid var(--sear); font-size: 15.5px;
}
.caption-live b { color: var(--ink); }
.hint { font-size: 13.5px; color: var(--ink-faint); margin-left: auto; }
.nowrap { white-space: nowrap; }
.mh-note { margin: 8px 2px 0; font-size: 15px; color: var(--ink-soft); line-height: 1.55; }
.mh-note b { color: var(--ink); }

/* ---------- critic animation ---------- */
#critic .tok { opacity: 0; transition: transform .35s cubic-bezier(.3,.7,.2,1), opacity .25s ease, filter .35s ease; transition-delay: 0s; }
#critic.st1 .tok { opacity: 1; transform: none !important; transition-delay: var(--d, 0s), var(--d, 0s), 0s; }
#critic .chunk-hl { opacity: 0; transition: opacity .2s; }
#critic.st0 .chunk-hl { opacity: 1; animation: blink 1.1s ease-in-out infinite; }
#critic.st1 .chunk-hl { opacity: .35; animation: none; }

#critic .att { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .25s ease, opacity .35s ease, filter .35s ease, stroke-width .35s ease; opacity: .55; }
#critic.st2 .att { stroke-dashoffset: 0; transition-delay: var(--d, 0s), 0s, 0s, 0s; }
#critic .tf { opacity: .35; transition: opacity .25s; }
#critic.st1 .tf { opacity: 1; }
#critic .mask-cell.on { opacity: 0; transition: opacity .3s; }
#critic.st2 .mask-cell.on { opacity: 1; transition-delay: var(--d, 0s); }

#critic .pop { opacity: 0; transform: scale(.6); transform-box: fill-box; transform-origin: center; transition: opacity .18s, transform .23s cubic-bezier(.3,1.5,.5,1), filter .35s ease; }
#critic.st3 .pop.q, #critic.st4 .pop.g, #critic.st5 .pop.e, #critic.st6 .pop.u { opacity: 1; transform: none; transition-delay: var(--d, 0s), var(--d, 0s), 0s; }
#critic .rw { opacity: 0; transition: opacity .13s; }
#critic.st4 .rw { opacity: 1; transition-delay: var(--d, 0s); }

#critic .draw { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset .3s ease, opacity .05s, filter .35s ease; }
#critic.st3 .draw.q, #critic.st5 .draw.e, #critic.st6 .draw.u { stroke-dashoffset: 0; opacity: 1; transition-delay: var(--d, 0s), var(--d, 0s), 0s; }
#critic.st6 .flow { animation: dashflow .8s linear infinite; }
#critic.st6 .tf-body { animation: pulse 1.6s ease-in-out infinite; }

#critic .mh-wrap { transition: filter .35s ease; }
#critic.nomh .mh-only { filter: opacity(.15); }
#critic.nomh .mh-only .rw { opacity: 0 !important; }

#critic .dim { filter: opacity(.12); }
#critic .hot { stroke-width: 2.6 !important; opacity: 1 !important; }
#critic .hit { cursor: pointer; }

@keyframes blink { 50% { opacity: .35; } }
@keyframes dashflow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -16; } }
@keyframes pulse { 50% { fill: #ffe2b8; } }

/* ---------- coverage animation ---------- */
.cov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cov-panel { background: #fff; border-radius: 12px; padding: 12px 10px 10px; }
.cov-panel h4 { margin: 0 2px 2px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.cov-panel h4 i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.cov-panel .sub { margin: 0 2px 4px; font-size: 13px; color: var(--ink-soft); min-height: 4.1em; line-height: 1.35; }
.cov-panel .verdict { margin: 2px 0 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--ink-soft); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1.5px solid #555; }

/* ---------- results ---------- */
.figs { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 20px; }
figure { margin: 0; }
figure.card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 14px 10px; }
figure img { margin: 0 auto; }
.segue { margin: 26px auto 0; }
figure.side-fig { display: grid; grid-template-columns: minmax(0, 400px) 1fr; gap: 22px; align-items: center; margin: 14px 0 8px; padding: 16px 20px; }
figure.side-fig figcaption { margin: 0; font-size: 15px; }
figcaption { font-size: 14.5px; color: var(--ink-soft); margin-top: 8px; line-height: 1.5; }
figcaption b { color: var(--ink); }

/* ---------- bibtex ---------- */
pre.bib {
  background: #0f1720; color: #dbe4ee; border-radius: var(--radius); padding: 18px 20px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.55; overflow-x: auto; position: relative;
}
.copy { position: absolute; top: 10px; right: 10px; font: 600 12px var(--sans); background: #26313d; color: #dbe4ee; border: 0; border-radius: 6px; padding: 5px 10px; cursor: pointer; }

footer { padding: 30px 0 50px; text-align: center; font-size: 14px; color: var(--ink-faint); border-top: 1px solid var(--rule); }

.hscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 860px) {
  .hint { margin-left: 0; }
  .demo { padding: 12px 8px 10px; }
  figure.side-fig { grid-template-columns: 1fr; }
  .affils span, .authors span { white-space: normal; display: inline-block; }
  .cov-grid, .figs, .ideas { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .01s !important; }
}
