/* Haju Playable Shock Hub: dark-first executive cockpit, no external fonts or assets. */
:root {
  color-scheme: dark;
  --bg: #0d0f12; --surface: #15181e; --sunken: #1b1f27; --hover: #1f242e;
  --fg: #f0f2f5; --fg-2: #c5cbd4; --mut: #8e97a4; --line: #252a34; --line-2: #373f4e;
  --acc: #60a5fa; --acc-soft: #15243b; --acc-line: #23406b; --on-acc: #08101c;
  --ok: #4ade80; --ok-soft: #0f2618; --ok-dot: #22c55e;
  --warn: #fbbf24; --warn-soft: #2a1f0b; --warn-line: #553d12; --warn-dot: #f59e0b;
  --bad: #f87171; --bad-soft: #2b1416; --bad-line: #5e2226; --bad-dot: #ef4444;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f5; --surface: #ffffff; --sunken: #f5f5f2; --hover: #efefeb;
  --fg: #141413; --fg-2: #42423e; --mut: #6b6b65; --line: #e5e5e0; --line-2: #cfcfc8;
  --acc: #2563eb; --acc-soft: #eff6ff; --acc-line: #bfdbfe; --on-acc: #ffffff;
  --ok: #15803d; --ok-soft: #f0fdf4;
  --warn: #b45309; --warn-soft: #fffbeb; --warn-line: #fde68a;
  --bad: #b91c1c; --bad-soft: #fef2f2; --bad-line: #fecaca;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--fg); overflow-wrap: anywhere;
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: 1.28; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }
p { margin: 0; }
ul, ol { margin: 0; }
.mut { color: var(--mut); font-size: 0.82rem; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  min-height: 34px; padding: 0.3rem 0.85rem; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--surface); font-size: 0.83rem; font-weight: 600;
}
.btn:hover { background: var(--hover); }
.btn-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.btn-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-dot); }

.hub-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; max-width: 1420px; margin: 0 auto;
  padding: 0.85rem 1.25rem;
}
.brand { display: flex; align-items: baseline; gap: 0.55rem; }
.brand strong { font-size: 1.15rem; }
.brand span { color: var(--mut); font-size: 0.85rem; }
.sector-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sector-tab {
  min-height: 34px; padding: 0.25rem 0.85rem; border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; font-size: 0.82rem;
}
.sector-tab[aria-pressed="true"] { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.head-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.head-cta .cta-button { display: inline-block; padding: 0.35rem 0.9rem; font-size: 0.82rem; white-space: nowrap; }

.hub { display: flex; flex-direction: column; gap: 1.1rem; max-width: 1420px; margin: 0 auto; padding: 0 1.25rem 2.5rem; }
.intro { display: flex; flex-direction: column; gap: 0.65rem; }
.subtitle { color: var(--fg-2); }
.facts { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; color: var(--mut); font-size: 0.82rem; }
.facts .proof { color: var(--fg-2); font-weight: 600; }
.method-note { padding-top: 0.45rem; border-top: 1px solid var(--line); color: var(--mut); font-size: 0.76rem; }
.method-banner {
  padding: 0.55rem 0.85rem; border: 1px solid var(--acc-line); border-radius: 8px; background: var(--acc-soft);
  color: var(--fg-2); font-size: 0.86rem;
}
.heroes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 0.75rem; }
.hero {
  display: flex; flex-direction: column; gap: 0.3rem; padding: 0.8rem 1rem; text-align: left;
  background: var(--surface); border: 1px solid var(--acc-line); border-radius: 12px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.hero:hover { border-color: var(--acc); transform: translateY(-1px); }
.hero-label { font-weight: 700; }
.hero-summary { color: var(--mut); font-size: 0.82rem; line-height: 1.45; }

.stage-panel {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; scroll-margin-top: 0.5rem;
}
.stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.stage-tools { display: flex; align-items: center; gap: 0.6rem; }
.zoom { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.zoom button {
  min-width: 32px; min-height: 30px; padding: 0.15rem 0.6rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--fg-2); font-size: 0.82rem; font-weight: 600;
}
.zoom button:hover { background: var(--hover); color: var(--fg); }
.status { color: var(--fg-2); font-size: 0.88rem; min-height: 1.4em; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; align-items: stretch; }
.stage.has-drawer { grid-template-columns: minmax(0, 1fr) 380px; }
.map-viewport {
  display: flex; align-items: center; min-width: 0; overflow: hidden; border: 1px solid var(--line);
  border-radius: 10px; background-color: var(--sunken);
  background-image: radial-gradient(circle, var(--line-2) 1px, transparent 1px); background-size: 22px 22px;
  cursor: grab; user-select: none;
}
.map-viewport:active { cursor: grabbing; }
.focus-map { display: block; width: 100%; height: auto; max-height: 72vh; }

/* the map, in the cockpit's own look */
.focus-col-label { fill: var(--mut); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.focus-node-group { cursor: pointer; outline: none; }
.focus-node-group, .focus-map [data-edge-from] { transition: opacity 0.18s ease; }
.focus-node-box {
  fill: var(--surface); stroke: var(--line-2); stroke-width: 1.3;
  filter: drop-shadow(0 2px 6px rgb(0 0 0 / 0.1)); transition: stroke 0.2s ease, fill 0.2s ease;
}
.focus-node-group.tone-bad .focus-node-box { fill: var(--bad-soft); stroke: var(--bad-dot); stroke-width: 2; }
.focus-node-group.tone-ok .focus-node-dot { fill: var(--ok-dot); }
.focus-node-group.tone-warn .focus-node-dot { fill: var(--warn-dot); }
.focus-node-group.tone-bad .focus-node-dot { fill: var(--bad-dot); }
.focus-node-pulse {
  fill: none; stroke: var(--bad-dot); stroke-width: 1.5; opacity: 0.55; transform-box: fill-box;
  transform-origin: center; animation: pulse 2.2s ease-out infinite;
}
.focus-node-group:hover .focus-node-box, .focus-node-group:focus-visible .focus-node-box,
.focus-node-group.is-active .focus-node-box, .focus-node-group.is-inspected .focus-node-box {
  stroke: var(--acc); stroke-width: 2.2;
}
.focus-node-meta { fill: var(--mut); font-size: 11px; font-weight: 500; }
.focus-node-group.is-has-delta .focus-node-meta { opacity: 0; }
.focus-node-pct { fill: var(--fg); font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-node-title { fill: var(--fg); font-size: 13px; font-weight: 600; }
.focus-gauge-track { fill: var(--line); }
.focus-gauge { fill: var(--acc); transition: width 0.26s ease, fill 0.2s ease; }
.focus-node-group.tone-bad .focus-gauge { fill: var(--bad-dot); }
.focus-node-group.is-sim-weakens .focus-gauge { fill: var(--warn-dot); }
.focus-node-group.is-sim-strengthens .focus-gauge { fill: var(--ok-dot); }
.focus-delta-bg { fill: var(--sunken); stroke: var(--line-2); stroke-width: 1; }
.focus-delta-text { fill: var(--fg); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.focus-delta-bg.is-delta-up { fill: var(--ok-soft); stroke: var(--ok-dot); }
.focus-delta-text.is-delta-up { fill: var(--ok); }
.focus-delta-bg.is-delta-down { fill: var(--bad-soft); stroke: var(--bad-dot); }
.focus-delta-text.is-delta-down { fill: var(--bad); }
.focus-delta-bg.is-delta-source { fill: var(--acc-soft); stroke: var(--acc); }
.focus-delta-text.is-delta-source { fill: var(--acc); }
.focus-edge { fill: none; stroke-width: 1.7; transition: stroke-width 0.2s ease; }
.focus-edge-supports { stroke: var(--ok-dot); }
.focus-edge-contradicts { stroke: var(--warn-dot); stroke-dasharray: 7 5; }
.focus-edge-refers { stroke: var(--line-2); }
.focus-arrow-supports { fill: var(--ok-dot); }
.focus-arrow-contradicts { fill: var(--warn-dot); }
.focus-arrow-refers { fill: var(--line-2); }
.focus-map .is-dimmed { opacity: 0.18; }
.focus-map .is-active .focus-edge { stroke-width: 3; }
.focus-map .is-sim-edge .focus-edge { stroke-width: 3.4; }
.focus-map .is-sim-wave .focus-edge { stroke-dasharray: 10 6; animation: wave 0.9s linear infinite; }
.focus-map .is-sim-source .focus-node-box { stroke: var(--acc); stroke-width: 4; }
.focus-map .is-sim-weakens .focus-node-box { stroke: var(--warn-dot); stroke-width: 2.8; }
.focus-map .is-sim-strengthens .focus-node-box { stroke: var(--ok-dot); stroke-width: 2.8; }
.focus-map .is-sim-mixed .focus-node-box { stroke: var(--warn-dot); stroke-width: 2.8; stroke-dasharray: 7 4; }
.focus-map .is-sim-review .focus-node-box { stroke: var(--mut); stroke-width: 2.4; stroke-dasharray: 2 3; }

/* ripple rings travel outwards hop by hop */
.node-ripple { fill: none; stroke: transparent; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.is-sim-source .node-ripple { stroke: var(--acc); animation: ripple 1.5s ease-out infinite; }
.is-sim-weakens .node-ripple, .is-sim-mixed .node-ripple { stroke: var(--warn-dot); animation: ripple 1.5s ease-out 3; }
.is-sim-strengthens .node-ripple { stroke: var(--ok-dot); animation: ripple 1.5s ease-out 3; }
.is-sim-review .node-ripple { stroke: var(--mut); animation: ripple 1.5s ease-out 3; }
.is-sim-hop-1 .node-ripple { animation-delay: 0.25s; }
.is-sim-hop-2 .node-ripple { animation-delay: 0.6s; }
.is-sim-hop-3 .node-ripple { animation-delay: 0.95s; }

@keyframes ripple { 0% { opacity: 0.85; transform: scale(1); } 100% { opacity: 0; transform: scale(1.12, 1.34); } }
@keyframes wave { from { stroke-dashoffset: 32; } to { stroke-dashoffset: 0; } }
@keyframes pulse { 0% { transform: scale(0.75); opacity: 0.7; } 100% { transform: scale(1.65); opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* inspector drawer */
.drawer {
  display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; max-height: 72vh; overflow-y: auto;
  padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--acc-line); border-radius: 10px;
  animation: slide-in 0.22s ease-out;
}
.drawer > * { flex: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.drawer-state { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--mut); font-size: 0.8rem; }
.drawer-close { min-width: 32px; min-height: 32px; border: 0; border-radius: 999px; background: transparent; font-size: 1.2rem; }
.drawer-close:hover { background: var(--hover); }
.drawer h2 { font-size: 1rem; }
.drawer h3 { color: var(--mut); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.drawer-meta { color: var(--mut); font-size: 0.78rem; }
.drawer-why { color: var(--fg-2); font-size: 0.85rem; }
.drawer section { display: flex; flex-direction: column; gap: 0.4rem; }
.drawer ul { display: flex; flex-direction: column; gap: 0.4rem; padding: 0; list-style: none; }
.drawer li { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.83rem; line-height: 1.45; }
.drawer li.is-bearing, .drawer li.is-stressed, .drawer li.tone-bad, .drawer li.tone-warn {
  padding: 0.4rem 0.55rem; border-left: 3px solid var(--line-2); background: var(--sunken); border-radius: 4px;
}
.drawer li.tone-warn, .drawer li.is-bearing { border-left-color: var(--warn-dot); }
.drawer li.tone-bad, .drawer li.is-stressed { border-left-color: var(--bad-dot); }
.drawer li.is-stressed { background: var(--bad-soft); }
.drawer li.stress-owner { margin-top: 0.25rem; font-weight: 700; }
.tag { align-self: flex-start; color: var(--mut); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.tag-weakens, .tag-mixed { color: var(--warn); }
.tag-strengthens { color: var(--ok); }
.item-extra { color: var(--mut); font-size: 0.78rem; }
.impact {
  display: flex; flex-direction: column; gap: 0.2rem; width: 100%; padding: 0.45rem 0.55rem; text-align: left;
  border: 1px solid var(--line); border-radius: 6px; background: var(--sunken);
}
.impact:hover { border-color: var(--acc); }
.impact-delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.shock-box {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.7rem 0.8rem; background: var(--sunken);
  border: 1px solid var(--line); border-radius: 8px;
}
.shock-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem; }
.shock-head output { color: var(--acc); font-weight: 700; font-variant-numeric: tabular-nums; }
.slider-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; color: var(--mut); }
.slider-row input { flex: 1; min-width: 0; min-height: 28px; accent-color: var(--acc); cursor: pointer; }
.shock-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.stage-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; padding: 0; list-style: none; color: var(--mut); font-size: 0.78rem; }
.legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.line { display: inline-block; width: 22px; border-top: 2px solid var(--line-2); }
.line-supports { border-top-color: var(--ok-dot); }
.line-contradicts { border-top: 2px dashed var(--warn-dot); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 999px; }
.dot-ok { background: var(--ok-dot); }
.dot-warn { background: var(--warn-dot); }
.dot-bad { background: var(--bad-dot); }

/* briefings */
.briefings { display: flex; flex-direction: column; gap: 0.9rem; }
.brief-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.brief-tabs button {
  min-height: 38px; padding: 0.35rem 0.95rem; border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; font-size: 0.85rem; font-weight: 600;
}
.brief-tabs button[aria-selected="true"] { background: var(--acc-soft); border-color: var(--acc-line); color: var(--acc); }
.brief {
  display: flex; flex-direction: column; gap: 0.7rem; padding: 1.25rem 1.5rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
}
.brief > * { max-width: 92ch; }
.brief h3 { margin-top: 0.4rem; font-size: 1.05rem; }
.brief h4 { margin-top: 0.5rem; font-size: 0.98rem; }
.brief h5, .brief h6 { font-size: 0.9rem; }
.brief ul, .brief ol { display: flex; flex-direction: column; gap: 0.35rem; padding-left: 1.2rem; }
.brief code { padding: 0.05rem 0.3rem; background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; font-size: 0.85em; }
.cite-ev, .cite-rule { text-decoration: underline dotted var(--mut); text-underline-offset: 3px; cursor: help; }
.cite-node {
  margin: 0.08rem 0; padding: 0 0.5rem; border: 1px solid var(--acc-line); border-radius: 9px;
  background: var(--acc-soft); color: var(--acc); font-size: 0.86em; font-weight: 600; line-height: 1.5;
  text-align: left;
}
.cite-node:hover { border-color: var(--acc); }
.audit {
  align-self: flex-start; padding: 0.15rem 0.65rem; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 0.76rem; font-weight: 600;
}
.audit-clean { color: var(--ok); border-color: var(--ok-dot); background: var(--ok-soft); }
.audit-warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.benchmark-note {
  padding: 0.55rem 0.8rem; border: 1px solid var(--warn-line); border-radius: 8px; background: var(--warn-soft);
  color: var(--fg-2); font-size: 0.83rem;
}
.trust-strip {
  padding: 0.65rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--fg-2); font-size: 0.85rem; font-weight: 600; text-align: center;
}

#hub-cta { scroll-margin-top: 0.75rem; }
.cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 1.15rem 1.5rem; border: 1px solid var(--acc-line); border-radius: 14px; background: var(--acc-soft);
  color: var(--fg-2); font-size: 0.9rem;
}
.cta-title { color: var(--fg); font-size: 1.05rem; }
.cta p { flex: 1 1 30rem; min-width: 0; }
.cta-button {
  padding: 0.5rem 1.1rem; border-radius: 999px; background: var(--acc); color: var(--on-acc);
  font-weight: 700; text-decoration: none;
}

@media (min-width: 1200px) {
  .hub-head, .sector-tabs { flex-wrap: nowrap; }
  .sector-tabs { flex: 0 1 auto; min-width: 0; }
  .sector-tab {
    min-width: 0; padding: 0.25rem 0.6rem; overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand, .head-actions { flex: none; }
  .hub-head:has(.sector-tabs:not([hidden])) .brand span { display: none; }
}
@media (max-width: 960px) {
  .stage.has-drawer { grid-template-columns: minmax(0, 1fr); }
  .map-viewport { display: block; overflow-x: auto; cursor: auto; }
  .focus-map { min-width: 760px; max-height: none; }
  .drawer {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; max-height: 62vh; border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 32px rgb(0 0 0 / 0.45); animation-name: slide-up;
  }
  .stage-panel:has(.drawer:not([hidden])) { margin-bottom: 45vh; }
}
@media (max-width: 520px) {
  .hub-head, .hub { padding-left: 0.65rem; padding-right: 0.65rem; }
  h1 { font-size: 1.25rem; }
  .stage-panel { padding: 0.65rem; }
  .brief, .cta { padding: 0.85rem; }
  .head-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
