:root {
  --text: #1a1a1a;
  --muted: #555;
  --border: #d4d4d4;
  --bg: #ffffff;
  --bg-subtle: #f7f7f7;
  --accent: #1a1a1a;
  --fail: #8b0000;
  --pass: #1a5c1a;
  --warn: #7a5c00;
  --font-serif: "Georgia", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "SF Mono", "Consolas", "Liberation Mono", monospace;
  --max-width: 920px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
}

header {
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 1.5rem 2rem;
  background: var(--bg);
}

header .wrap, main .wrap, footer .wrap {
  max-width: var(--max-width);
  margin: 0 auto;
}

header h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

header .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42rem;
}

header .meta {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

nav.toc {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
}

nav.toc .wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

nav.toc a {
  color: var(--text);
  text-decoration: none;
}

nav.toc a:hover { text-decoration: underline; }

main { padding: 2.5rem 1.5rem 4rem; }

section { margin-bottom: 3rem; }

h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.6rem;
}

p { margin-bottom: 0.85rem; }

ul, ol { margin: 0 0 0.85rem 1.25rem; }
li { margin-bottom: 0.35rem; }

a { color: var(--text); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0 1.5rem;
}

th, td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--bg-subtle);
  font-weight: 600;
}

td.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  margin-right: 0.25rem;
}

.tag.pass { border-color: var(--pass); color: var(--pass); }
.tag.fail { border-color: var(--fail); color: var(--fail); }
.tag.warn { border-color: var(--warn); color: var(--warn); }

.figure {
  border: 1px solid var(--border);
  margin: 1rem 0 1.5rem;
  background: var(--bg);
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
}

.figure figcaption {
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.demo-frame {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  margin: 1rem 0;
  background: #f5f5f5;
}

.code-block {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.25rem;
  white-space: pre-wrap;
  line-height: 1.5;
}

.pattern-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1.25rem 0;
}

@media (min-width: 700px) {
  .pattern-grid.two { grid-template-columns: 1fr 1fr; }
}

.pattern-card {
  border: 1px solid var(--border);
  padding: 1rem 1.1rem;
}

.pattern-card h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  margin-bottom: 0.4rem;
}

.pattern-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.pattern-card a.btn {
  display: inline-block;
  font-size: 0.82rem;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  margin-right: 0.4rem;
}

.pattern-card a.btn:hover { background: var(--bg-subtle); }

.bar-chart { margin: 1rem 0 1.5rem; }

.bar-row {
  display: grid;
  grid-template-columns: 7rem 1fr 3rem;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}

.bar-label { color: var(--muted); }

.bar-track {
  height: 1.1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  position: relative;
}

.bar-fill {
  height: 100%;
  background: #333;
}

.bar-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.episode-list {
  font-size: 0.82rem;
  font-family: var(--font-mono);
}

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.compare-table td.human { background: #fafafa; }
.compare-table td.machine { background: #f3f3f3; font-family: var(--font-mono); font-size: 0.8rem; }

.highlight,
mark,
.mark {
  background: #ffe566;
  color: #1a1a1a;
  padding: 0.08em 0.25em;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 600;
}

mark {
  font-weight: inherit;
}

.hl-row {
  background: #fff9c4 !important;
}

.hl-row td {
  background: transparent;
}

.callout {
  border-left: 3px solid var(--border);
  background: var(--bg-subtle);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0 1.5rem;
  font-size: 0.95rem;
}

.callout.important {
  border-left-color: #c9a000;
  background: #fff9c4;
  box-shadow: inset 0 0 0 1px #f0e6a0;
}

.callout.success {
  border-left-color: #c9a000;
  background: #fffde7;
  box-shadow: inset 0 0 0 1px #f5eec0;
}

.callout.warn {
  border-left-color: var(--border);
  background: #fafaf8;
}

.experiment-block.key-result {
  background: #fffde7;
  border-color: #e6d56a;
  box-shadow: inset 4px 0 0 #ffe566;
}

.callout strong { display: block; margin-bottom: 0.35rem; font-size: 0.88rem; text-transform: uppercase; letter-spacing: 0.03em; }

.stage-table td:first-child { font-weight: 600; white-space: nowrap; }

.experiment-block {
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem;
  margin: 1.25rem 0;
}

.experiment-block h3 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.15rem;
}

.experiment-block .verdict {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.roadmap ol { margin-left: 1.25rem; }
.roadmap li { margin-bottom: 0.75rem; }

.row-highlight { background: #fff9c4; }

.lead {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

/* Presentation layout */
.site-header { padding-bottom: 2rem; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 1rem;
}

.hero-btn {
  display: inline-block;
  font-size: 0.88rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.hero-btn:hover { background: var(--bg-subtle); }

.hero-btn.primary {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.stat-bar strong { color: var(--text); }

.scenario-preview-grid {
  display: grid;
  gap: 0.85rem;
  margin: 1rem 0 1.25rem;
}

@media (min-width: 640px) {
  .scenario-preview-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .scenario-preview-grid { grid-template-columns: repeat(3, 1fr); }
}

.scenario-preview-card {
  display: block;
  border: 1px solid var(--border);
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.scenario-preview-card:hover { background: #fffde7; }

.scenario-preview-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.scenario-preview-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.chip {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.back-link { font-size: 0.85rem; margin-bottom: 0.75rem; }
.back-link a { color: var(--muted); }

.scenario-section {
  margin: 2.5rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.scenario-section h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.35rem;
}

.scenario-task, .scenario-meta {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.variant-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (min-width: 700px) {
  .variant-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1000px) {
  .variant-grid { grid-template-columns: repeat(3, 1fr); }
}

.variant-card {
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  background: #fff;
}

.variant-card.key {
  background: #fffde7;
  border-color: #e6d56a;
  box-shadow: inset 3px 0 0 #ffe566;
}

.variant-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.channel-tag {
  font-weight: 600;
  font-size: 0.85rem;
}

.ssim-tag {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.variant-card p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
  min-height: 2.5rem;
}

.variant-card .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.variant-card .btn {
  display: inline-block;
  font-size: 0.78rem;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 0.25rem 0.55rem;
  color: inherit;
}

.results-block {
  margin: 2rem 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}

.results-block h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.results-block h4 {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.clean-results {
  background: #f8fff8;
  border: 1px solid #d4e8d4;
  padding: 1rem 1.25rem;
  border-radius: 4px;
}

.deceptive-results {
  background: #fffef8;
  border: 1px solid #e6e0c8;
  padding: 1rem 1.25rem;
  border-radius: 4px;
}

.scenario-results {
  margin: 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.scenario-results h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.scenario-results .scenario-task {
  font-size: 0.85rem;
  margin-bottom: 0.65rem;
}

.pending-row td {
  background: #fafafa;
  font-style: italic;
}

.method-body section {
  margin: 2.5rem 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.method-body section h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem;
}

.method-body .compact-list {
  margin-left: 1.25rem;
  font-size: 0.92rem;
}

.method-body .compact-list li {
  margin-bottom: 0.4rem;
}

.method-body pre.code-block {
  font-size: 0.78rem;
  line-height: 1.55;
}

.method-body .lead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
}

.method-body .callout {
  margin: 1.25rem 0;
}
