:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #444;
  --muted: #777;
  --rule: #e6e2d6;
  --accent: #8a6d1f;
  --accent-soft: #c9a24a;
  --iron: #2c3e50;
  --iron-soft: #5a7593;
  --rust: #9b3a1c;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Menlo', 'Consolas', monospace;
  --max: 760px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 120ms ease, color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); color: var(--accent); }

code, .mono { font-family: var(--mono); font-size: 0.9em; }

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px 28px 32px;
}

/* ---------- Hero ---------- */

.hero {
  text-align: center;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.logo { width: 44px; height: 44px; display: block; }

.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 4.5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 auto 28px;
  max-width: 620px;
  color: var(--ink);
}

.authors {
  font-size: 15.5px;
  margin: 0 0 6px;
  color: var(--ink-soft);
}
.authors a {
  border-bottom: none;
  color: var(--ink-soft);
}
.authors a:hover { color: var(--accent); }
.authors sup { font-size: 10px; color: var(--muted); margin-left: 1px; }

.affiliations {
  font-size: 13.5px;
  color: var(--muted);
  margin: 4px 0 20px;
}
.affiliations sup { font-size: 10px; }
.affiliations .equal-contrib {
  font-style: italic;
}

.venue {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 28px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.btn:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-1px);
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

/* ---------- Sections ---------- */

.section { margin: 56px 0; }

.section h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.005em;
  margin: 0 0 18px;
  color: var(--ink);
}
.section h2::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--accent-soft);
  margin-top: 8px;
}

.section p {
  color: var(--ink-soft);
  font-size: 16.5px;
  margin: 0 0 14px;
}

.section strong { color: var(--ink); font-weight: 600; }

.abstract h2 { text-align: center; }
.abstract h2::after { margin-left: auto; margin-right: auto; }

.abstract .abstract-body {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 0 6px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.abstract .abstract-body p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 14px;
  text-align: justify;
  hyphens: auto;
}
.abstract .abstract-body p:last-child { margin-bottom: 16px; }

.section .caption {
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  margin: 14px 0 0;
  line-height: 1.6;
}

.pull-quote {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  margin: 22px 0;
  padding: 16px 0 16px 22px;
  border-left: 3px solid var(--accent-soft);
  font-style: italic;
}

/* ---------- Dilemma cards (the challenge) ---------- */

.dilemma {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 22px 0 18px;
}

.dilemma-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 18px 16px;
  transition: border-color 200ms ease, transform 200ms ease;
}
.dilemma-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
}

.dilemma-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: #f3ecd6;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.dilemma-card h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 8px;
  color: var(--ink);
}

.dilemma-card .dilemma-mech {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 12px;
  line-height: 1.55;
}

.dilemma-card .dilemma-issue {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.55;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.dilemma-issue-label {
  font-weight: 600;
  color: var(--rust);
  letter-spacing: 0.02em;
  margin-right: 4px;
}

.bridge {
  margin-top: 22px;
  padding: 14px 18px;
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft);
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.dilemma {
  margin-bottom: 0;
}
.castiron-bridge {
  display: flex;
  max-width: calc(50% - 7px);
  justify-content: center;
  height: 24px;
  margin: 0;
  padding: 0;
}
.castiron-connector {
  width: 2px;
  height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    var(--accent-soft) 0px,
    var(--accent-soft) 4px,
    transparent 4px,
    transparent 8px
  );
}
.castiron-card {
  max-width: calc(50% - 7px);
  margin-top: 0;
  background: linear-gradient(135deg, #fdfbf3 0%, #f7f0dc 100%);
  border: 2px solid var(--accent-soft);
  box-shadow: 0 2px 12px rgba(138, 109, 31, 0.1);
  position: relative;
  overflow: hidden;
}
.castiron-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(201, 162, 74, 0.08) 0%, transparent 60%);
  pointer-events: none;
}
.castiron-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(138, 109, 31, 0.18);
  transform: translateY(-3px);
}
.castiron-tag {
  background: var(--accent) !important;
  color: #fff !important;
}

@media (max-width: 600px) {
  .castiron-bridge { max-width: 100%; }
  .castiron-card { max-width: 100%; }
}

@media (max-width: 600px) {
  .dilemma { grid-template-columns: 1fr; }
}

/* ---------- CTC demo ---------- */

.ctc-demo {
  margin: 26px 0 8px;
  --ctc-tx-bg: #fdfbf3;
  --ctc-tx-ink: #2a2a2a;
  --ctc-tx-rule: #eae3cf;
  --ctc-highlight: var(--accent-soft);
  --ctc-reveal: var(--iron);
}

.ctc-stage {
  background: #1f2126;
  border: 1px solid #2c2f37;
  border-radius: 10px;
  padding: 12px 14px 16px;
  position: relative;
  overflow: hidden;
}

.ctc-feed-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #3a3d46;
}
.ctc-chain-name {
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f5f0e6;
}
.ctc-chain-sub {
  font-size: 11px;
  color: #9a9789;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ctc-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 280px;
  position: relative;
}

.ctc-tx {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: #2a2d35;
  border: 1px solid #353944;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: #c5c1b0;
  transition: background 600ms ease, border-color 600ms ease, color 600ms ease, opacity 600ms ease, transform 600ms ease;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
}
.ctc-tx.visible { opacity: 1; transform: translateY(0); }

.ctc-tx-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
  align-items: center;
  min-width: 0;
}
.ctc-tx-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.ctc-tx-cell .ctc-key {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6f7282;
  font-family: var(--sans);
}
.ctc-tx-cell .ctc-val {
  color: #d8d2bd;
}

.ctc-tx-block {
  font-size: 9.5px;
  color: #6f7282;
  letter-spacing: 0.06em;
  font-family: var(--sans);
  white-space: nowrap;
}

.ctc-tx.highlight {
  background: linear-gradient(90deg, #2a2d35 0%, #3a322a 100%);
  border-color: var(--ctc-highlight);
  box-shadow: 0 0 0 1px rgba(201, 162, 74, 0.3);
}
.ctc-tx.highlight .ctc-tx-cell .ctc-val {
  color: #f5edd6;
}

.ctc-tx.opened {
  background: linear-gradient(90deg, #2a2d35 0%, #2a3548 100%);
  border-color: var(--ctc-reveal);
  box-shadow: 0 0 0 1px rgba(90, 117, 147, 0.45);
}

.ctc-tx-reveal {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #3a3d46;
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #d8d2bd;
  line-height: 1.6;
}
.ctc-tx.opened .ctc-tx-reveal { display: block; }
.ctc-tx-reveal .rv-line { display: block; }
.ctc-tx-reveal .rv-key {
  display: inline-block;
  width: 92px;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b9bb3;
}
.ctc-tx-reveal .rv-val { color: #f0e4c4; }
.ctc-tx-reveal .rv-arrow {
  display: inline-block;
  margin: 0 6px;
  color: #8b9bb3;
}

/* --- CTC interactive panels --- */

.ctc-commit-panel {
  margin-bottom: 14px;
}
.ctc-input-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.ctc-input-row {
  display: flex;
  gap: 8px;
}
.ctc-input {
  flex: 1;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease;
}
.ctc-input:focus {
  border-color: var(--accent-soft);
}
.ctc-btn {
  padding: 10px 20px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
  white-space: nowrap;
}
.ctc-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.ctc-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.ctc-btn-reveal {
  background: var(--iron);
  border-color: var(--iron);
}
.ctc-btn-reveal:hover {
  background: var(--iron-soft);
  border-color: var(--iron-soft);
}

.ctc-open-panel {
  margin-top: 16px;
  padding: 14px 18px;
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.ctc-open-panel.visible {
  display: flex;
}
.ctc-open-prompt {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}

.ctc-verify {
  margin-top: 16px;
  display: none;
}
.ctc-verify.visible {
  display: block;
  animation: ctcFadeIn 400ms ease;
}
.ctc-verify-box {
  background: #1f2126;
  border: 1px solid #353944;
  border-radius: 8px;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  color: #c5c1b0;
}
.ctc-verify-line {
  display: block;
}
.ctc-verify-key {
  display: inline-block;
  width: 110px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b9bb3;
}
.ctc-verify-val {
  color: #f0e4c4;
  word-break: break-all;
}
.ctc-verify-result {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #3a3d46;
}
.ctc-verify-match {
  color: #6fbf73;
  font-weight: 600;
}
.ctc-verify-header {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b9bb3;
  margin-bottom: 6px;
}
.ctc-verify-step2-visible {
  animation: ctcFadeIn 400ms ease;
}
.ctc-verify-caption {
  margin-top: 12px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.55;
}

.ctc-commit-info {
  margin-bottom: 14px;
  display: none;
}
.ctc-commit-info.visible {
  display: block;
  animation: ctcFadeIn 400ms ease;
}
.ctc-commit-caption {
  margin: 10px 0 0;
  font-size: 13.5px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.55;
}

@keyframes ctcFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Timeline ---------- */

.timeline-stage {
  margin-top: 24px;
}

.tl-track {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: border-color 220ms ease;
}
.tl-track[data-track="cast-iron"] {
  border-color: var(--accent-soft);
  background: linear-gradient(180deg, #fdfbf3 0%, #fbfaf7 100%);
}

.tl-track-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}
.tl-track-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.tl-track-sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tl-canvas { width: 100%; }
.tl-canvas svg { width: 100%; height: auto; display: block; }

.tl-axis { stroke: #cfc8b3; stroke-width: 1; }
.tl-tick { stroke: #cfc8b3; stroke-width: 1; }
.tl-label-time {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--muted);
}
.tl-label-event {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--ink);
  font-weight: 500;
}
.tl-window-existing {
  fill: rgba(155, 58, 28, 0.14);
  stroke: rgba(155, 58, 28, 0.55);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.tl-window-castiron {
  fill: rgba(201, 162, 74, 0.13);
  stroke: rgba(138, 109, 31, 0.55);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.tl-event-dot { fill: var(--ink); }
.tl-event-dot-castiron { fill: var(--accent); }
.tl-icon-ic, .tl-icon-vote, .tl-icon-tally { fill: var(--ink); }
.tl-icon-sigma {
  fill: var(--accent);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}
.tl-icon-r {
  fill: var(--rust);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
}
.tl-stage-band {
  fill: #efe9d3;
  opacity: 0.6;
}
.tl-stage-label {
  font-family: var(--serif);
  font-size: 12px;
  fill: var(--ink-soft);
  font-style: italic;
}

.tl-attacker {
  fill: var(--rust);
  opacity: 0;
  transition: opacity 600ms ease, transform 800ms cubic-bezier(0.65, 0, 0.35, 1);
}
.tl-attacker.show { opacity: 1; }

.tl-flash {
  fill: rgba(201, 162, 74, 0.8);
  opacity: 0;
}
.tl-flash.pulse { animation: tlPulse 1200ms ease; }

@keyframes tlPulse {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

.tl-description {
  margin-top: 14px;
  padding: 12px 16px;
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  min-height: 48px;
  transition: color 200ms ease;
}
.tl-description.visible {
  color: var(--ink-soft);
}

.tl-hotspot {
  cursor: pointer;
  transition: opacity 150ms ease;
}
.tl-hotspot:hover { opacity: 0.85; }
.tl-hotspot-ring {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 2;
  stroke-dasharray: 3 2;
  opacity: 0.7;
  animation: hotspotPulse 2.4s ease-in-out infinite;
}

@keyframes hotspotPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ---------- Bribe game ---------- */

.bribe-game-wrap {
  margin: 22px 0 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px;
}

.bribe-game-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--ink);
}

.bribe-game-desc {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

/* Protocol parameter sliders */
.bg-controls { margin-bottom: 14px; }

.bg-slider-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 10px;
}

.bg-slider-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bg-slider-row label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.bg-slider-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.bg-slider-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
  outline: none;
}
.bg-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.bg-slider-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.bg-gap {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px 12px;
}
.bg-gap[data-level="small"] strong { color: #4a8c4a; }
.bg-gap[data-level="mid"]   strong { color: var(--accent); }
.bg-gap[data-level="large"] strong { color: var(--rust); }

.bg-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Bribe offer row */
.bg-offer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.bg-bribe-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}

.bg-bribe-slider {
  flex: 1;
  min-width: 80px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--rule);
  outline: none;
}
.bg-bribe-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--iron);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.bg-bribe-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--iron);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.bg-bribe-val {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--iron);
  min-width: 46px;
}

.bg-offer-btn {
  padding: 8px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--iron);
  border-radius: 8px;
  background: var(--iron);
  color: var(--bg);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
  white-space: nowrap;
}
.bg-offer-btn:hover {
  background: var(--iron-soft);
  border-color: var(--iron-soft);
  transform: translateY(-1px);
}

/* Stage: step cards */
.bg-stage {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bg-step {
  background: #fdfcf8;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px;
}

.bg-step-hidden {
  background: #f5f2eb;
  border-style: dashed;
}

.bg-step-observe {
  border-color: var(--iron-soft);
  background: linear-gradient(135deg, #fdfcf8 0%, #f4f7fa 100%);
}

.bg-step-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.bg-step-num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.bg-step-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.bg-step-title-muted {
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

/* Step 1: offer viz */
.bg-offer-viz {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bg-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.bg-pill-you   { background: #e4e0d6; color: var(--iron); }
.bg-pill-voter { background: #f3ecd6; color: var(--accent); }

.bg-arrow-txt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: -0.03em;
}

/* Step 2: decision */
.bg-u-drawn {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.bg-u-val { color: var(--ink); }

.bg-eu-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bg-eu-row {
  display: grid;
  grid-template-columns: 72px 1fr 56px 52px;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 4px;
}
.bg-eu-best { background: #f5eedd; }

.bg-eu-act {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}
.bg-eu-best .bg-eu-act { color: var(--accent); font-weight: 600; }

.bg-eu-bar-wrap {
  height: 5px;
  background: #ece6d3;
  border-radius: 3px;
  overflow: hidden;
}
.bg-eu-bar {
  height: 100%;
  background: #d6cdb5;
  border-radius: 3px;
}
.bg-eu-best .bg-eu-bar { background: var(--accent-soft); }

.bg-eu-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.bg-eu-best .bg-eu-num { color: var(--accent); }

.bg-eu-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

/* Step 3: vote */
.bg-vote-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bg-ballot {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}
.bg-ballot-yes {
  background: rgba(155,58,28,.1);
  color: var(--rust);
  border: 1px solid rgba(155,58,28,.3);
}
.bg-ballot-no {
  background: rgba(47,91,115,.1);
  color: var(--iron);
  border: 1px solid rgba(47,91,115,.3);
}

.bg-vote-note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Step 4: observe */
.bg-observe {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bg-obs-row {
  font-size: 13px;
  color: var(--ink-soft);
}

.bg-obs-ambig {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}

.bg-pay-outcome {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
}
.bg-paid     { background: rgba(74,140,74,.12); color: #3a7a3a; }
.bg-not-paid { background: rgba(155,58,28,.08); color: var(--rust); }

@media (max-width: 640px) {
  .bg-slider-grid { grid-template-columns: repeat(2, 1fr); }
  .bg-eu-row { grid-template-columns: 64px 1fr 50px 44px; }
}
@media (max-width: 400px) {
  .bg-slider-grid { grid-template-columns: 1fr; }
}

/* ---------- CoCo plot ---------- */

.coco-plot-wrap {
  margin-top: 22px;
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px;
}

.coco-plot { width: 100%; }
.coco-plot svg { width: 100%; height: auto; display: block; }

.coco-plot .coco-axis-line { stroke: #cfc8b3; stroke-width: 1; }
.coco-plot .coco-grid { stroke: #ece6d3; stroke-width: 1; stroke-dasharray: 2 3; }
.coco-plot .coco-tick {
  font-family: var(--sans);
  font-size: 14px;
  fill: #6b6757;
}
.coco-plot .coco-axis-title {
  font-family: var(--sans);
  font-size: 16px;
  fill: var(--ink);
  font-weight: 500;
}
.coco-plot .coco-curve {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 1700ms cubic-bezier(0.65, 0, 0.35, 1);
}
.coco-plot .coco-curve.draw { stroke-dashoffset: 0; }
.coco-plot .coco-curve-cast { stroke: #8a6d1f; stroke-width: 2.4; }
.coco-plot .coco-curve-loki { stroke: #b87333; }
.coco-plot .coco-curve-revote { stroke: #6b8a3a; }
.coco-plot .coco-curve-revote-adv { stroke: #2f5b73; }
.coco-plot .coco-label {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 800ms ease;
}
.coco-plot .coco-label.show { opacity: 1; }
.coco-plot .coco-label-cast { fill: var(--accent); }
.coco-plot .coco-label-loki { fill: #b87333; }
.coco-plot .coco-label-revote { fill: #6b8a3a; }
.coco-plot .coco-label-revote-adv { fill: #2f5b73; }

.coco-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.coco-legend .lg-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.coco-legend .lg-swatch {
  display: inline-block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
}
.coco-legend .lg-swatch.dashed {
  background: linear-gradient(to right, currentColor 60%, transparent 60%);
  background-size: 6px 2px;
  background-repeat: repeat-x;
  height: 2px;
}
.coco-legend .lg-meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.coco-caption {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
  text-align: center;
  letter-spacing: 0.02em;
}

.coco-description {
  margin-top: 14px;
  padding: 12px 16px;
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  min-height: 48px;
  transition: color 200ms ease;
}
.coco-description.visible {
  color: var(--ink-soft);
}

/* ---------- Results grid ---------- */

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 18px 16px;
  transition: border-color 200ms ease, transform 200ms ease;
}
.result-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
}

.result-headline {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 4px;
}

.result-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.result-detail {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .results-grid { grid-template-columns: 1fr; }
}

/* ---------- BibTeX ---------- */

.bibtex {
  background: #faf7ef;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent-soft);
  border-radius: 6px;
  padding: 18px 20px;
  margin: 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
}
.bibtex code { font-family: inherit; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .ctc-tx, .tl-attacker, .tl-flash, .coco-curve {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .page { padding: 48px 20px 32px; }
  .hero { padding-bottom: 36px; margin-bottom: 40px; }
  .section { margin: 44px 0; }
  .btn { padding: 8px 14px; font-size: 13.5px; }
  .ctc-tx { font-size: 10px; }
}
