:root {
  --bg: #f3f2f2;
  --ink: #201e1d;
  --accent: #ec3013;
  --accent-600: #dd2b0f;
  --accent-700: #ae1800;
  --accent-800: #7c1405;
  --accent-100: #fff2ef;
  --n100: #f8f4f4;
  --n200: #eae7e7;
  --n300: #d7d3d3;
  --n600: #7d7979;
  --n700: #605d5d;
  --n800: #444141;
  --surface: #eae9e9;
  --divider: color-mix(in srgb, #201e1d 40%, transparent);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.4; }
a { color: var(--accent-700); }
a:hover { color: var(--accent); }
button { font-family: inherit; }
h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.015em; }
input[type=range] { accent-color: var(--accent); }
[hidden] { display: none !important; }

.muted { color: var(--n700); }
.muted12 { font-size: 12px; color: var(--n700); }
.muted13 { font-size: 13px; color: var(--n700); }
.kicker { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.kicker.muted { color: var(--n700); }

/* header */
.top { display: flex; align-items: center; gap: 24px; padding: 12px 20px; border-bottom: 2px solid var(--divider); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; margin-right: auto; letter-spacing: -0.015em; }
.brand a { color: var(--n700); text-decoration: none; font-weight: 400; font-size: 14px; }
.brand .sep { color: var(--n600); margin: 0 8px; font-weight: 400; }
.caption { font-size: 12px; color: var(--n700); }
.segmented { display: inline-flex; border: 1px solid var(--divider); }
.seg { padding: 7px 12px; font-size: 13px; cursor: pointer; border: 0; border-left: 1px solid var(--divider); background: transparent; color: var(--ink); }
.seg:first-child { border-left: 0; }
.seg:hover { background: var(--n200); }
.seg[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* main grid */
.app { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0; border-bottom: 2px solid var(--divider); }
.left { display: flex; flex-direction: column; border-right: 2px solid var(--divider); min-width: 0; }
.right { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 719px) { .left { border-right: 0; border-bottom: 2px solid var(--divider); } }

.winhead { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 20px 0; gap: 12px; flex-wrap: wrap; }
.winhead h2 { font-size: 28px; line-height: 1.1; }
.winctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.winctl .seg { padding: 5px 10px; font-size: 12px; }
.winctl .ghost { padding: 5px 10px; font-size: 12px; }
.winctl .ghost[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.globe-wrap { position: relative; padding: 8px 20px 12px; }
#globe { display: block; width: 100%; max-width: 680px; aspect-ratio: 1 / 1; margin: 0 auto; cursor: grab; touch-action: none; }
#globe:active { cursor: grabbing; }
.tooltip { position: absolute; transform: translate(-50%, calc(-100% - 14px)); background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 10px; max-width: 260px; pointer-events: none; line-height: 1.35; }
.tip-title { font-weight: 800; }
.tip-meta { opacity: .75; }

.legend { display: flex; gap: 16px 20px; flex-wrap: wrap; padding: 0 20px 14px; font-size: 11px; color: var(--n700); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.lg.esc { background: var(--accent); }
.lg.des { border: 1.5px solid var(--ink); }
.lg.mix { border: 1.5px solid var(--ink); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.lg.ctx { width: 7px; height: 7px; border-radius: 0; background: var(--ink); }
.lg.arc { width: 18px; height: 0; border-radius: 0; border-top: 2px dashed var(--accent); }

/* timeline */
.timeline { border-top: 2px solid var(--divider); padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.play { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; background: var(--accent); color: var(--bg); border: 0; cursor: pointer; font-weight: 800; font-size: 14px; }
.play:hover { background: var(--accent-600); }
.icon { height: 36px; width: 36px; border: 1px solid var(--divider); background: transparent; cursor: pointer; font-size: 14px; color: var(--ink); }
.icon:hover { background: var(--n200); }
.modes { margin-left: 4px; }
.modes .seg { height: 34px; padding: 0 12px; }
.eras { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.ghost { padding: 6px 10px; font-size: 12px; cursor: pointer; border: 1px solid var(--divider); background: transparent; color: var(--ink); }
.ghost:hover { background: var(--n200); }
.strip { display: flex; align-items: flex-end; gap: 1px; height: 44px; cursor: pointer; border-bottom: 1px solid var(--divider); }
.cell { flex: 1; min-width: 0; height: 1px; background: var(--n300); }
.cell.has { background: var(--ink); }
.cell.in { background: var(--accent); }
#slider { width: 100%; margin: 0; }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--n700); font-variant-numeric: tabular-nums; }

/* aside */
.filters { padding: 14px 20px; border-bottom: 2px solid var(--divider); display: flex; flex-direction: column; gap: 10px; }
.fhead { display: flex; justify-content: space-between; align-items: baseline; }
.link { border: 0; background: transparent; color: var(--accent-700); font-size: 12px; cursor: pointer; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; border: 1px solid var(--ink); background: transparent; color: var(--ink); }
.chip:hover { opacity: .8; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip .count { opacity: .6; font-variant-numeric: tabular-nums; }
.refine { font-size: 12px; }
.refine summary { cursor: pointer; color: var(--n700); }
.tags-wrap { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag { padding: 3px 8px; font-size: 11px; cursor: pointer; border: 1px solid var(--divider); background: transparent; color: var(--n600); text-decoration: line-through; }
.tag[aria-pressed="true"] { background: var(--n200); color: var(--ink); text-decoration: none; }

.lhead { padding: 12px 20px 4px; display: flex; justify-content: space-between; align-items: baseline; }
.lhead h3 { font-size: 16px; }
.empty { padding: 8px 20px 24px; margin: 0; color: var(--n700); font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0 20px 24px; display: flex; flex-direction: column; }
.row { border-top: 1px solid var(--divider); padding: 10px 0; display: grid; grid-template-columns: 22px 1fr; gap: 10px; }
.row.selected { background: var(--surface); }
.row.hovered { background: var(--n100); }
.gcol { display: flex; justify-content: center; padding-top: 3px; }
.glyph { display: inline-block; }
.glyph.escalatory { border-radius: 50%; background: var(--accent); }
.glyph.deescalatory { border-radius: 50%; border: 1.5px solid var(--ink); }
.glyph.mixed { border-radius: 50%; border: 1.5px solid var(--ink); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.glyph.contextual { background: var(--ink); }
.body { min-width: 0; }
.rowbtn { all: unset; cursor: pointer; display: block; width: 100%; }
.meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 11px; color: var(--n700); font-variant-numeric: tabular-nums; }
.mag { display: inline-flex; gap: 2px; margin-left: auto; }
.sq { width: 6px; height: 6px; background: var(--n300); display: inline-block; }
.sq.on { background: var(--ink); }
.row .title { font-weight: 800; font-size: 14px; line-height: 1.25; margin: 2px 0; text-wrap: pretty; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; }
.tag-group { padding: 2px 8px; background: var(--n200); color: var(--n800); }
.tag-sub { padding: 2px 8px; border: 1px solid var(--divider); color: var(--n700); }
.tag-metric { padding: 2px 8px; background: var(--accent-100); color: var(--accent-800); }
.detail { margin-top: 8px; font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 6px; }
.detail p { margin: 0; }
.detail .analysis { color: var(--n800); }
.detail .limits { font-size: 12px; color: var(--n700); }
.mechs { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11px; }
.mechs span { padding: 2px 8px; background: var(--n100); color: var(--n800); }
.actors { font-size: 12px; color: var(--n700); }
.srcline { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; align-items: center; }
.checked { color: #2f5f3a; }
.unchecked { color: var(--n700); }
.relhead { color: var(--n700); }
.rel { border: 0; background: transparent; color: var(--accent-700); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.rule { margin-top: auto; padding: 12px 20px 16px; border-top: 2px solid var(--divider); font-size: 11px; color: var(--n700); line-height: 1.5; }

/* prose below the app */
.prose { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0; }
.prose .col { padding: 20px; font-size: 14px; line-height: 1.55; }
.prose .col:first-child { border-right: 2px solid var(--divider); }
@media (max-width: 719px) { .prose .col:first-child { border-right: 0; border-bottom: 2px solid var(--divider); } }
.prose h2 { font-size: 18px; margin: 18px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; max-width: 48rem; }
.mechanisms { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 10px 16px; }
.mtitle { font-weight: 800; margin: 0 0 2px; }
.mtitle .image { font-weight: 400; color: var(--n700); font-size: 12px; }
.mnote { margin: 0; font-size: 13px; color: var(--n800); }
.defs, .cites { padding-left: 1.1rem; }
.defs li, .cites li { margin: 4px 0; }
.cites { font-size: 12px; color: var(--n800); }

/* reel */
.reelbtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.reel-card { position: absolute; left: 32px; bottom: 28px; max-width: min(420px, 70%); background: var(--ink); color: var(--bg); padding: 14px 16px 12px; border-left: 4px solid var(--accent); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.reel-card.deescalatory { border-left-color: var(--bg); }
.reel-card.mixed { border-left-color: var(--n600); }
.reel-card.contextual { border-left-color: var(--n300); }
.reel-card.intro, .reel-card.outro { border-left-color: var(--accent); }
.reel-kicker { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.reel-title { font-weight: 800; font-size: 18px; line-height: 1.2; margin-top: 4px; text-wrap: pretty; }
.reel-meta { font-size: 11px; opacity: .75; margin-top: 6px; }
.reel-track { height: 2px; background: rgba(243,242,242,.25); margin-top: 10px; }
.reel-bar { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
.auto { padding: 1px 6px; background: var(--accent-100); color: var(--accent-800); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }

/* subscribe */
.subscribe { padding: 14px 20px 16px; border-top: 2px solid var(--divider); display: flex; flex-direction: column; gap: 8px; }
.sub-lede { margin: 0; font-size: 13px; color: var(--n800); max-width: 48ch; }
.sub-form { display: flex; gap: 8px; flex-wrap: wrap; }
.sub-form input[type=email] { flex: 1; min-width: 200px; height: 36px; padding: 0 12px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.sub-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.sub-msg { margin: 0; font-size: 12px; color: var(--n700); min-height: 1em; }
.sub-alt { margin: 0; font-size: 11px; color: var(--n700); }

/* header extras */
.scalewrap { display: inline-flex; align-items: center; gap: 10px; }
.helpbtn { padding: 7px 12px; font-size: 13px; font-weight: 600; }

/* loading */
.loading { position: absolute; inset: 8px 20px 12px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--n700); pointer-events: none; }
.loading-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* guide */
.guide { position: fixed; inset: 0; z-index: 50; background: rgba(32,30,29,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.guide-box { background: var(--bg); color: var(--ink); max-width: 560px; width: 100%; padding: 24px 24px 20px; border-top: 4px solid var(--accent); max-height: calc(100vh - 40px); overflow: auto; }
.guide-box h2 { font-size: 24px; line-height: 1.15; margin: 4px 0 10px; }
.guide-lede { margin: 0 0 14px; font-size: 14px; color: var(--n800); }
.guide-steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; display: flex; flex-direction: column; gap: 8px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.guide-actions .play { height: 36px; }
.guide-actions .ghost { height: 36px; padding: 0 12px; }
.guide-fine { margin: 14px 0 0; font-size: 11px; color: var(--n700); }
@media (max-width: 600px) {
  .top { gap: 10px 16px; }
  .reel-card { left: 12px; right: 12px; bottom: 16px; max-width: none; }
  .guide-box { padding: 18px 16px 16px; }
  .guide-box h2 { font-size: 20px; }
}
