/* BehindTheHate v2 — Atlas of Neighbors
   A bold, warm, painterly design. One language across desktop + mobile. */

/* ==== Tokens ==== */
:root {
  --paper: #f6efdf;
  --paper-warm: #ede2c8;
  --paper-deep: #e0d3b2;
  --ink: #1c1612;
  --ink-2: #3a2f24;
  --ink-3: #6a5a48;
  --ink-4: #9a8a74;

  --ocean: #1a3c5a;
  --ocean-deep: #0f2838;
  --ocean-shine: #2a5a7a;

  /* Heat ramp — sage to burnt maroon */
  --heat-0: #8fae8a;
  --heat-1: #c6b46e;
  --heat-2: #d4a348;
  --heat-3: #c4531a;
  --heat-4: #7a1e18;

  /* Accents */
  --fox: #c4531a;
  --fox-warm: #d97748;
  --gold: #d4a348;
  --sage: #8fae8a;
  --rose: #b8423b;

  --rule: #d8c99f;
  --rule-2: #cebc86;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(.22,.8,.3,1);
  --ease-out: cubic-bezier(.2,.9,.25,1);

  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }

/* ==== Ocean parallax ==== */
.ocean {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 70% 30%, var(--ocean-shine) 0%, var(--ocean) 40%, var(--ocean-deep) 100%);
  overflow: hidden;
}
.wave {
  position: absolute; left: -10%; right: -10%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08) 20%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.08) 80%, transparent);
  opacity: .5;
}
.wave-a { top: 28%; animation: drift 40s linear infinite; }
.wave-b { top: 52%; animation: drift 60s linear infinite reverse; opacity: .3; }
.wave-c { top: 71%; animation: drift 80s linear infinite; opacity: .25; }
@keyframes drift { from { transform: translateX(-10%); } to { transform: translateX(10%); } }

.clouds { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cloud {
  position: absolute;
  width: 420px; height: 120px;
  background: radial-gradient(ellipse at center, rgba(246,239,223,.12) 0%, rgba(246,239,223,0) 60%);
  filter: blur(20px);
}
.cloud.c1 { top: 8%; left: 10%; animation: float 90s ease-in-out infinite; }
.cloud.c2 { top: 40%; right: 5%; animation: float 120s ease-in-out infinite reverse; }
.cloud.c3 { bottom: 15%; left: 30%; animation: float 150s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translate(0,0); }
  50% { transform: translate(60px, -20px); }
}

/* ==== Topbar ==== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 20px) 10px calc(var(--sal) + 20px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  background: linear-gradient(180deg, rgba(15,40,56,.85) 0%, rgba(15,40,56,0) 100%);
  color: var(--paper);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 34px; height: 34px; color: var(--gold);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.wordmark {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.01em;
}
.wordmark .wm-2 { color: var(--fox-warm); font-style: italic; margin: 0 1px; }
.wm-sub {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: rgba(246,239,223,.55);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 3px;
}
.topnav {
  display: flex; gap: 2px;
  background: rgba(0,0,0,.25);
  padding: 3px;
  border-radius: 999px;
  justify-self: center;
}
.topnav button {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(246,239,223,.65);
  transition: all .2s var(--ease);
}
.topnav button:hover { color: var(--paper); }
.topnav button.on {
  background: var(--paper);
  color: var(--ocean-deep);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.topmeta { display: flex; gap: 10px; align-items: center; }
.meta-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.25);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .2s var(--ease);
}
.meta-btn:hover { background: rgba(0,0,0,.4); }
.meta-btn.on { background: var(--fox); color: var(--paper); }
.k-icon { font-size: 14px; }
.streak {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--fox), var(--gold));
  color: var(--paper);
  font-weight: 600;
  font-size: 12.5px;
  box-shadow: 0 2px 10px rgba(196,83,26,.4);
}
.s-flame { font-size: 12px; }

/* ==== Views ==== */
.view {
  position: fixed;
  inset: 0;
  padding-top: calc(var(--sat) + 62px);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
  display: none;
  z-index: 1;
}
.view.on { display: block; }
.view-map.on {
  display: grid;
  grid-template-columns: 300px 1fr 380px;
  gap: 0;
}

/* ==== Rail (group picker) ==== */
.rail {
  position: relative;
  z-index: 2;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-warm) 100%);
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  box-shadow: inset -12px 0 24px -12px rgba(0,0,0,.08);
}
.rail-head {
  padding: 22px 22px 14px;
  border-bottom: 1px dashed var(--rule);
}
.rail-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--ink);
}
.rail-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.4;
}
.rail-body {
  flex: 1;
  padding: 8px 12px 20px;
  overflow-y: auto;
}
.cat {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-4);
  padding: 14px 10px 6px;
}
.grp {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s var(--ease);
  user-select: none;
}
.grp:hover { background: rgba(255,255,255,.5); }
.grp .g-chk {
  width: 18px; height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--rule-2);
  flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--paper);
  transition: all .15s var(--ease);
}
.grp.on .g-chk {
  background: var(--g-color, var(--fox));
  border-color: var(--g-color, var(--fox));
}
.grp.on .g-chk::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: rotate(-45deg) translate(1px, -2px);
}
.grp .g-lbl {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--ink-2);
}
.grp.on .g-lbl { color: var(--ink); font-weight: 500; }
.grp .g-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--g-color, var(--ink-4));
  opacity: .35;
  flex-shrink: 0;
}
.grp.on .g-dot { opacity: 1; }

.rail-foot {
  padding: 12px 16px calc(12px + var(--sab));
  display: flex; gap: 8px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.rail-foot button {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  background: var(--paper-warm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all .15s var(--ease);
}
.rail-foot button:hover { background: var(--paper-deep); }
.rail-foot button.alt {
  background: var(--ink);
  color: var(--paper);
}
.rail-foot button.alt:hover { background: var(--ink-2); }

/* ==== Stage (map) ==== */
.stage {
  position: relative;
  z-index: 1;
  overflow: hidden;
}
.stage-chrome {
  position: absolute;
  top: 14px; left: 18px; right: 18px;
  z-index: 4;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.stage-chrome > * { pointer-events: auto; }
.crumbs {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  background: rgba(246,239,223,.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.crumbs .crumb {
  cursor: pointer;
  transition: color .15s var(--ease);
}
.crumbs .crumb:not(.active):hover { color: var(--fox); }
.crumbs .crumb.active { color: var(--ink); cursor: default; }
.crumbs .crumb-sep { color: var(--ink-4); }

.stage-tools { display: flex; gap: 8px; }
.stage-tools .tool {
  padding: 7px 13px;
  background: rgba(246,239,223,.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all .15s var(--ease);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.stage-tools .tool:hover { background: var(--paper); color: var(--ink); }
.stage-tools .tool.on { background: var(--fox); color: var(--paper); border-color: var(--fox); }

.map {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: grab;
}
.map:active { cursor: grabbing; }

/* Map paths */
.sphere { fill: transparent; pointer-events: none; }
.graticule { fill: none; stroke: rgba(255,255,255,.05); stroke-width: .5; }
.country {
  stroke: rgba(0,0,0,.4);
  stroke-width: .4;
  fill: var(--paper-warm);
  transition: fill .2s var(--ease), filter .15s var(--ease);
  cursor: pointer;
}
.country:hover {
  filter: brightness(1.1) drop-shadow(0 0 6px rgba(212,163,72,.6));
}
.country.no-data {
  fill: var(--paper-deep);
  opacity: .35;
  cursor: default;
}
.country.selected {
  stroke: var(--ink);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 12px rgba(28,22,18,.4));
}
.subregion {
  stroke: rgba(0,0,0,.5);
  stroke-width: .5;
  transition: fill .2s var(--ease);
  cursor: pointer;
}
.subregion:hover { filter: brightness(1.12); }
.subregion.selected { stroke: var(--ink); stroke-width: 1.5; }

.marker {
  cursor: pointer;
  transition: r .2s var(--ease), stroke-width .15s var(--ease);
}

/* Legend */
.legend {
  position: absolute;
  bottom: 18px; left: 18px;
  z-index: 3;
  max-width: 340px;
  padding: 14px 16px;
  background: rgba(246,239,223,.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.leg-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -.01em;
}
.leg-title b { font-weight: 600; color: var(--fox); font-style: italic; }
.leg-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--heat-0) 0%, var(--heat-1) 25%, var(--heat-2) 50%, var(--heat-3) 75%, var(--heat-4) 100%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
}
.leg-scale {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.leg-note {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.4;
  border-top: 1px dashed var(--rule);
  padding-top: 8px;
}

.readout {
  position: absolute;
  top: 64px; right: 18px;
  z-index: 3;
  display: none;
  padding: 12px 16px;
  background: rgba(246,239,223,.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  max-width: 260px;
  pointer-events: none;
  animation: readoutIn .15s var(--ease);
}
@keyframes readoutIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.readout.on { display: block; }
.readout .r-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--ink);
}
.readout .r-region {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 10px;
}
.readout .r-bars { display: grid; gap: 5px; }
.readout .r-bar { display: grid; grid-template-columns: 86px 1fr 28px; align-items: center; gap: 8px; font-size: 11px; }
.readout .r-bar .rb-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout .r-bar .rb-trk { height: 6px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.readout .r-bar .rb-fl { height: 100%; border-radius: 3px; }
.readout .r-bar .rb-n { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: right; }

.compass {
  position: absolute;
  top: 58px; right: 20px;
  width: 54px; height: 54px;
  z-index: 2;
  color: var(--paper);
  opacity: .35;
  pointer-events: none;
  transition: opacity .2s;
}
.stage.has-readout .compass { opacity: 0; }

/* ==== Drawer (profile) ==== */
.drawer {
  position: relative;
  z-index: 2;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-warm) 100%);
  border-left: 1px solid var(--rule);
  box-shadow: inset 12px 0 24px -12px rgba(0,0,0,.08);
}

.drawer-empty {
  padding: 50px 30px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  color: var(--ink-3);
}
.de-art { opacity: .45; margin-bottom: 18px; color: var(--fox); }
.de-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -.01em;
}
.de-sub { font-size: 13px; line-height: 1.5; max-width: 260px; }

.drawer-body { padding: 0; position: relative; }
.drawer-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper-warm);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  z-index: 5;
  border: 1px solid var(--rule);
}
.drawer-close:hover { background: var(--paper-deep); color: var(--ink); }
@media (min-width: 961px) { .drawer-close { display: none; } }

/* Profile hero */
.ph {
  padding: 24px 24px 20px;
  background:
    linear-gradient(180deg, rgba(26,60,90,.0) 0%, rgba(26,60,90,.08) 100%),
    linear-gradient(135deg, var(--paper), var(--paper-warm));
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.ph-region {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.ph-flag { font-size: 16px; line-height: 1; }
.ph-name {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 10px;
  color: var(--ink);
}
.ph-summary {
  font-family: var(--serif);
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.ph-meta {
  display: flex; gap: 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ph-meta b { color: var(--ink); font-weight: 500; margin-right: 4px; }

/* Profile tabs */
.pt {
  display: flex;
  border-bottom: 1px solid var(--rule);
  padding: 0 18px;
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.pt button {
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s var(--ease);
}
.pt button:hover { color: var(--ink-2); }
.pt button.on {
  color: var(--ink);
  border-bottom-color: var(--fox);
}

.panel { padding: 18px 24px 80px; }

/* Bias cards */
.bias-list { display: grid; gap: 12px; }
.bc {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.bc::before {
  content: "";
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--bc-color, var(--fox));
}
.bc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.bc-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -.01em;
}
.bc-cat {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 2px;
}
.bc-score {
  text-align: right;
  flex-shrink: 0;
}
.bc-score .bc-n {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  color: var(--bc-color, var(--fox));
  letter-spacing: -.02em;
}
.bc-score .bc-lvl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 2px;
}
.bc-bar {
  height: 5px;
  background: var(--paper-deep);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}
.bc-fill {
  height: 100%;
  background: var(--bc-color, var(--fox));
  border-radius: 3px;
}
.bc-note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.bc-cite {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  line-height: 1.4;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
}
.bc-cite b { color: var(--ink-2); font-weight: 500; }

/* Origins */
.ori {
  padding: 14px 16px;
  background: var(--paper);
  border-left: 3px solid var(--fox);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 12px;
}
.ori-era {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fox);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 4px;
  font-weight: 500;
}
.ori-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink);
}
.ori-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.ori-src {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

/* What-if sliders */
.wif-intro {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--ink-2);
  line-height: 1.5;
  margin-bottom: 18px;
  padding: 14px;
  background: rgba(212,163,72,.1);
  border-radius: var(--radius);
}
.wif-row {
  padding: 14px 0;
  border-bottom: 1px dashed var(--rule);
}
.wif-row:last-child { border-bottom: 0; }
.wif-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.wif-lbl {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.wif-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fox);
  font-weight: 500;
}
.wif-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--paper-deep);
  border-radius: 3px;
  outline: none;
}
.wif-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fox);
  border: 3px solid var(--paper);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.wif-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fox);
  border: 3px solid var(--paper);
  cursor: pointer;
}
.wif-desc {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-top: 6px;
  font-style: italic;
}
.wif-result {
  margin-top: 20px;
  padding: 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-align: center;
}
.wif-result .wr-lbl {
  font-family: var(--mono);
  font-size: 10px;
  opacity: .6;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 6px;
}
.wif-result .wr-n {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
}
.wif-result .wr-delta {
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 6px;
  opacity: .8;
}
.wif-result.ok { background: #2a5a3e; }
.wif-result.bad { background: var(--heat-4); }

/* ==== Vivi fox ==== */
.vivi {
  position: fixed;
  bottom: calc(var(--sab) + 20px);
  right: calc(var(--sar) + 20px);
  z-index: 50;
  pointer-events: none;
}
.vivi > * { pointer-events: auto; }
.vivi-orb {
  position: relative;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--paper), var(--paper-warm));
  box-shadow: 0 6px 20px rgba(0,0,0,.35), 0 0 0 2px var(--fox);
  overflow: hidden;
  transition: transform .2s var(--ease);
}
.vivi-orb:hover { transform: translateY(-2px) scale(1.04); }
.vivi-orb:active { transform: scale(.95); }
.vivi-orb svg { width: 100%; height: 100%; }
.vivi-pulse {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--fox);
  animation: pulse 2s ease-out infinite;
  opacity: 0;
  pointer-events: none;
}
.vivi[data-state="excited"] .vivi-pulse { opacity: 1; }
.vivi[data-state="excited"] .vivi-orb { animation: bob .8s ease-in-out infinite; }
@keyframes pulse {
  0% { transform: scale(.85); opacity: .8; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.vivi-bubble {
  position: absolute;
  bottom: 70px; right: 0;
  width: 280px;
  padding: 16px 18px 14px;
  background: var(--paper);
  border-radius: 18px;
  border: 1.5px solid var(--fox);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: bubbleIn .25s var(--ease);
}
.vivi-bubble::after {
  content: "";
  position: absolute; bottom: -8px; right: 20px;
  width: 14px; height: 14px;
  background: var(--paper);
  border-right: 1.5px solid var(--fox);
  border-bottom: 1.5px solid var(--fox);
  transform: rotate(45deg);
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.vb-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.vb-body b { color: var(--fox); font-weight: 600; }
.vb-actions {
  display: flex; gap: 6px;
  margin-top: 12px;
}
.vb-actions button {
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--paper-warm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all .15s;
}
.vb-actions button:hover { background: var(--fox); color: var(--paper); }
.vb-actions button.prime { background: var(--fox); color: var(--paper); }
.vb-actions button.prime:hover { background: var(--heat-4); }

/* Kid mode overrides */
body.kids {
  --serif: "Fraunces", Georgia, serif;
  font-size: 15px;
}
body.kids .bc-note, body.kids .ph-summary, body.kids .wif-intro { font-size: 14px; line-height: 1.6; }
body.kids .ph-name { font-size: 34px; }
body.kids .grp .g-lbl { font-size: 14.5px; }
body.kids .meta-btn#btn-kids { background: var(--fox); color: var(--paper); }
body.kids .meta-btn#btn-kids .k-icon { filter: drop-shadow(0 0 6px rgba(255,200,120,.8)); }

/* ==== Quests / Library / You views ==== */
.quests-wrap, .library-wrap, .you-wrap {
  height: 100%;
  overflow-y: auto;
  padding: 40px 28px 120px;
  max-width: 900px;
  margin: 0 auto;
  background: rgba(246,239,223,.96);
  backdrop-filter: blur(8px);
}
.view-quests, .view-library, .view-you {
  background: rgba(246,239,223,.5);
}
.view-title {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: 6px;
}
.view-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .14em;
  margin-bottom: 28px;
}

/* Level card */
.level-card {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(196,83,26,.14), rgba(212,163,72,.08));
  border: 1px solid rgba(196,83,26,.2);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}
.level-ring {
  position: relative;
  width: 72px; height: 72px;
  flex-shrink: 0;
}
.level-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.lr-bg { fill: none; stroke: rgba(196,83,26,.2); stroke-width: 6; }
.lr-fg { fill: none; stroke: var(--fox); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .4s var(--ease); }
.lr-face {
  position: absolute; inset: 12px;
  font-size: 28px;
  display: grid; place-items: center;
}
.level-info .lv-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ink);
}
.level-info .lv-xp {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.level-info .lv-next {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 6px;
}

/* Quest list */
.quest {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: all .15s;
}
.quest:hover { border-color: var(--fox); background: var(--paper-warm); }
.quest.done {
  background: rgba(143,174,138,.1);
  border-color: rgba(143,174,138,.3);
}
.quest.done .q-title { text-decoration: line-through; color: var(--ink-3); }
.q-ico {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: rgba(196,83,26,.12);
  display: grid; place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.quest.done .q-ico { background: rgba(143,174,138,.25); }
.q-body { flex: 1; min-width: 0; }
.q-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 3px;
}
.q-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.q-xp {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fox);
  font-weight: 500;
  flex-shrink: 0;
  padding-top: 4px;
}

/* Badges grid */
.badges {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 32px;
}
.badge {
  aspect-ratio: 1;
  padding: 10px;
  background: var(--paper);
  border: 2px dashed var(--rule-2);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  opacity: .45;
  transition: all .2s var(--ease);
}
.badge.on {
  opacity: 1;
  background: linear-gradient(135deg, rgba(212,163,72,.15), rgba(196,83,26,.06));
  border: 2px solid var(--fox);
  border-style: double;
}
.badge-icon { font-size: 30px; margin-bottom: 4px; }
.badge.on .badge-icon { filter: none; }
.badge:not(.on) .badge-icon { filter: grayscale(1); }
.badge-name {
  font-family: var(--serif);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

/* Library */
.lib-section { margin-bottom: 32px; }
.lib-section h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
  margin: 0 0 12px;
}
.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.lib-card {
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
}
.lib-card:hover { border-color: var(--fox); transform: translateY(-1px); }
.lib-card .lc-flag { font-size: 22px; margin-bottom: 8px; }
.lib-card .lc-name { font-family: var(--serif); font-size: 16px; font-weight: 500; color: var(--ink); }
.lib-card .lc-sub { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 2px; text-transform: uppercase; letter-spacing: .1em; }
.lib-card .lc-risk { margin-top: 8px; font-size: 12px; color: var(--ink-2); }

/* ==== Guess modal ==== */
.guess-scrim {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(15,40,56,.8);
  backdrop-filter: blur(12px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.guess-card {
  width: 100%; max-width: 420px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: rise .3s var(--ease);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.gc-eyebrow {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--fox); text-transform: uppercase; letter-spacing: .14em;
  font-weight: 500;
  margin-bottom: 8px;
}
.gc-q {
  font-family: var(--serif); font-size: 22px; font-weight: 500;
  line-height: 1.3; letter-spacing: -.01em;
  margin-bottom: 20px;
  color: var(--ink);
}
.gc-q b { color: var(--fox); font-style: italic; }
.gc-slider-wrap {
  position: relative;
  padding: 20px 0 10px;
}
.gc-big {
  font-family: var(--serif);
  font-size: 72px;
  font-weight: 500;
  text-align: center;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--fox);
  margin-bottom: 4px;
}
.gc-lbl {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 20px;
}
.gc-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  background: linear-gradient(90deg, var(--heat-0) 0%, var(--heat-1) 25%, var(--heat-2) 50%, var(--heat-3) 75%, var(--heat-4) 100%);
  border-radius: 5px;
  outline: none;
}
.gc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.gc-slider::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
  cursor: pointer;
}
.gc-submit {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  background: var(--fox);
  color: var(--paper);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  transition: all .2s;
}
.gc-submit:hover { background: var(--heat-4); }
.gc-reveal {
  margin-top: 20px;
  padding: 18px;
  border-radius: 14px;
  text-align: center;
}
.gc-reveal.ok { background: #2a5a3e; color: var(--paper); }
.gc-reveal.close { background: var(--gold); color: var(--ink); }
.gc-reveal.miss { background: var(--heat-4); color: var(--paper); }
.gc-reveal-title { font-family: var(--serif); font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.gc-reveal-n { font-family: var(--mono); font-size: 13px; opacity: .9; }
.gc-note { margin-top: 12px; font-size: 12.5px; line-height: 1.5; opacity: .95; font-style: italic; }
.gc-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper-deep);
  display: grid; place-items: center;
  font-size: 18px;
  color: var(--ink-2);
}
.gc-close:hover { background: var(--ink); color: var(--paper); }

/* ==== Toasts ==== */
.toasts {
  position: fixed;
  top: calc(var(--sat) + 80px);
  right: calc(var(--sar) + 20px);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--fox), var(--gold));
  color: var(--paper);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(196,83,26,.4);
  font-size: 13.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .3s var(--ease);
  pointer-events: auto;
  max-width: 320px;
}
.toast .t-ico {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0,0,0,.2);
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ==== Mobile bottom nav ==== */
.mobnav { display: none; }

/* ==== Responsive ==== */
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: auto auto;
    padding: calc(var(--sat) + 10px) 14px 10px 14px;
    gap: 12px;
  }
  .topnav { display: none; }
  .wm-sub { display: none; }
  .wordmark { font-size: 16px; }
  .meta-btn .k-lbl { display: none; }
  .meta-btn { padding: 7px 9px; }

  .view-map.on {
    grid-template-columns: 1fr;
    padding-bottom: calc(var(--sab) + 64px);
  }

  .rail {
    position: fixed;
    top: calc(var(--sat) + 56px);
    left: 0;
    width: 100%;
    max-width: 360px;
    height: calc(100% - var(--sat) - var(--sab) - 56px - 64px);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    box-shadow: 6px 0 24px rgba(0,0,0,.3);
  }
  .rail.show { transform: none; }

  .drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 64px; /* above the mobile bottom nav */
    top: auto;
    width: 100%;
    max-width: none;
    height: 90px; /* compact badge strip by default */
    max-height: calc(100% - var(--sat) - 56px - 64px - 12px);
    z-index: 40;
    transform: translateY(100%);
    transition: transform .3s var(--ease), height .3s var(--ease);
    box-shadow: 0 -8px 28px rgba(0,0,0,.35);
    border-radius: 22px 22px 0 0;
    padding-top: 10px;
    overflow: hidden;
  }
  .drawer.show { transform: none; }
  .drawer.expanded {
    height: 62vh;
    overflow-y: auto;
  }
  .drawer::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: var(--rule-2);
    opacity: .7;
    pointer-events: none;
    z-index: 6;
  }
  /* Compact badge row (always shown when drawer.show) */
  .d-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px 16px;
    cursor: pointer;
    min-height: 80px;
    -webkit-tap-highlight-color: transparent;
  }
  .d-compact-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
  }
  .d-compact-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--serif);
    font-size: 17px;
    font-weight: 500;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .d-compact-flag { font-size: 18px; }
  .d-compact-region {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin-left: 4px;
  }
  .d-compact-chips {
    display: flex;
    gap: 5px;
    overflow: hidden;
  }
  .d-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--paper);
    background: var(--chip-bg, var(--ink-3));
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .d-chip-n { font-weight: 700; }
  .d-expand-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--paper-warm);
    color: var(--ink-3);
    font-size: 12px;
    transition: transform .2s var(--ease);
  }
  .drawer.expanded .d-expand-icon { transform: rotate(180deg); }
  .d-full {
    display: none;
    padding: 8px 0 20px;
    border-top: 1px dashed var(--rule);
    margin-top: 4px;
  }
  .drawer.expanded .d-full { display: block; }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15,40,56,.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease);
  }
  .scrim.show { opacity: 1; pointer-events: auto; }

  .stage {
    height: 100%;
  }
  .legend { bottom: 12px; left: 12px; right: 12px; max-width: none; }
  .leg-note { font-size: 11px; }
  /* When the drawer strip is shown, lift the legend above it so it's not hidden. */
  body:has(.drawer.show) .legend { bottom: calc(90px + 12px); }
  body:has(.drawer.show.expanded) .legend { display: none; }
  .stage-chrome { top: 10px; left: 12px; right: 12px; }
  .stage-chrome .tool { padding: 7px 11px; font-size: 11.5px; }
  .stage-chrome .m-tool { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .compass { top: 54px; right: 14px; width: 40px; height: 40px; display: none; }
  /* Hover-only readout: hide on mobile. Data shows in the compact drawer strip. */
  .readout { display: none !important; }

  .mobnav {
    display: grid;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 45;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px var(--sar) calc(var(--sab) + 6px) var(--sal);
    background: rgba(15,40,56,.95);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .mobnav button {
    padding: 8px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px;
    font-weight: 500;
    color: rgba(246,239,223,.55);
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 10px;
    transition: all .15s;
  }
  .mobnav button .mn-ic { font-size: 18px; }
  .mobnav button.on { color: var(--fox-warm); }

  .quests-wrap, .library-wrap, .you-wrap { padding: 24px 16px 100px; }
  .view-title { font-size: 28px; }

  .vivi { bottom: calc(var(--sab) + 72px); right: 14px; }
  .vivi-orb { width: 50px; height: 50px; }
  .vivi-bubble { width: 260px; right: -6px; }

  .ph { padding: 20px 20px 16px; }
  .ph-name { font-size: 26px; }
  .panel { padding: 16px 18px 80px; }
}

@media (max-width: 520px) {
  .vivi-bubble { width: calc(100vw - 36px); right: -10px; }
  .badges { grid-template-columns: repeat(3, 1fr); }
}

/* Scrollbars */
.rail::-webkit-scrollbar, .drawer::-webkit-scrollbar,
.quests-wrap::-webkit-scrollbar, .library-wrap::-webkit-scrollbar, .you-wrap::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.rail::-webkit-scrollbar-thumb, .drawer::-webkit-scrollbar-thumb,
.quests-wrap::-webkit-scrollbar-thumb, .library-wrap::-webkit-scrollbar-thumb, .you-wrap::-webkit-scrollbar-thumb {
  background: var(--paper-deep); border-radius: 4px;
}
.rail::-webkit-scrollbar-track, .drawer::-webkit-scrollbar-track { background: transparent; }

/* Utility */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15,40,56,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ==== Over-time tab ==== */
.ot-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-3);
  padding: 12px 14px;
  border-left: 3px solid var(--rule-2);
  background: rgba(216,201,159,.18);
  border-radius: 0 8px 8px 0;
  margin: 0 0 16px;
}
.ot-wrap { display: flex; flex-direction: column; gap: 20px; }
.ot-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper);
}
.ot-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.ot-grp {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -.005em;
}
.ot-fallback {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-4);
  background: var(--paper-deep);
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: .1em;
}
.ot-series {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.ot-series:first-of-type { border-top: 0; padding-top: 0; }
.ot-metric {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1.35;
}
.ot-metric-txt { flex: 1; }
.ot-dir {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.ot-dir.ok { background: rgba(143,174,138,.25); color: #3d6b4e; }
.ot-dir.bad { background: rgba(184,66,59,.2); color: #8a2f2a; }
.ot-dir.neutral { background: var(--paper-deep); color: var(--ink-3); }
.ot-chart { width: 100%; }
.ot-svg { display: block; }
.ot-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ot-pt { stroke: var(--paper); stroke-width: 1.5; }
.ot-tick-x, .ot-tick-y {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--ink-4);
}
.ot-tick-x { text-anchor: middle; }
.ot-tick-y { text-anchor: end; }
.ot-grid { stroke: var(--rule); stroke-width: .5; stroke-dasharray: 2 3; opacity: .5; }
.ot-anchor-line {
  stroke: var(--ink-4);
  stroke-width: .5;
  stroke-dasharray: 3 3;
  opacity: .55;
}
.ot-anchor-lbl {
  font-family: var(--mono);
  font-size: 8.5px;
  fill: var(--ink-3);
  text-anchor: middle;
  font-weight: 500;
}
.ot-end {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink);
}
.ot-bar-val {
  font-family: var(--mono);
  font-size: 9.5px;
  fill: var(--ink-2);
}
.ot-baseline {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(212,163,72,.14);
  border-radius: 0 8px 8px 0;
}
.ot-baseline.improving { border-left-color: var(--sage); background: rgba(143,174,138,.12); }
.ot-baseline.worsening { border-left-color: var(--rose); background: rgba(184,66,59,.1); }
.ot-src {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  line-height: 1.4;
}
.ot-src a { color: var(--fox); text-decoration: underline; }
.ot-caveat { color: var(--ink-3); }
.ot-laws {
  display: flex; flex-direction: column; gap: 4px;
  padding-left: 4px;
  border-left: 2px solid var(--rule-2);
  margin-left: 4px;
}
.ot-law {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-2);
}
.ot-law-y {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--fox);
  font-size: 11.5px;
  padding-top: 1px;
}
.ot-gap {
  padding: 18px 16px;
  border: 1px dashed var(--rule-2);
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(216,201,159,.25) 6px 7px);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-3);
}
.ot-gen {
  display: flex; flex-direction: column; gap: 10px;
}
.ot-gen-q {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.ot-gen-bars { display: flex; flex-direction: column; gap: 6px; }
.ot-gen-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 8px;
}
.ot-gen-lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 500;
}
.ot-gen-bar {
  background: var(--paper-deep);
  height: 18px;
  border-radius: 4px;
  overflow: hidden;
}
.ot-gen-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fox) 0%, var(--rose) 100%);
  border-radius: 4px;
}
.ot-gen-val {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}
.ot-gen-note {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
  padding-top: 4px;
}
