/* /flywheel вЂ” scoped styles. The page keeps the site's tokens and type; the
   story is HTML (readable at any width), the full map is a pannable Cytoscape
   canvas, and status/scope badges are the same five tones as /system. */

.fw { max-width: 1280px; margin: 0 auto; padding: 0 24px 64px; }
.fw-title {
  font-size: clamp(28px, 4vw, 40px); line-height: 1.12; font-weight: 650;
  letter-spacing: -0.03em; margin: 44px 0 10px; color: var(--foreground);
}
.fw-lead { color: var(--muted-foreground); max-width: 760px; font-size: 16px; line-height: 1.6; }
.fw-lead b { color: var(--foreground); font-weight: 600; }
.fw-lead .fw-promise { display: block; color: var(--foreground); font-weight: 600; margin-bottom: 4px; }
.fw-lead .fw-honest { display: block; margin-top: 6px; font-size: 13px; color: var(--muted-foreground); }

.fw-card {
  margin: 26px 0; padding: 20px 18px 18px; border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px); background: var(--card);
}
.fw-card > h2 {
  margin: 0 0 4px; font-size: 17px; line-height: 1.3; color: var(--foreground);
}
.fw-card > .fw-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted-foreground); }
.fw-note { margin: 12px 0 0; font-size: 12px; line-height: 1.55; color: var(--muted-foreground); }
.fw-err { color: var(--destructive); font-size: 13px; }

/* ---- badges: the five statuses, plus scope ---- */
.fw-badge {
  display: inline-block; border: 1px solid currentColor; border-radius: 999px;
  padding: 0 7px; font: 600 10px/16px var(--font-mono); letter-spacing: 0.02em;
  white-space: nowrap; vertical-align: middle;
}
.fw-badge + .fw-badge { margin-left: 6px; }
.fw-st-live { color: #4ade80; }
.fw-st-testnet { color: #38bdf8; }
.fw-st-code { color: #a78bfa; }
.fw-st-hypo { color: #fbbf24; }
.fw-st-nobuild { color: #94a3b8; }
.fw-scope { color: var(--muted-foreground); }
.fw-scope-external { border-style: dashed; }
.fw-scope-candidate { border-style: dashed; color: #fbbf24; }

/* ---- the six-stop story ---- */
.fw-entry {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
  color: var(--muted-foreground);
}
.fw-entry b { color: var(--foreground); }
.fw-story {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; counter-reset: station;
}
.fw-station {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  text-align: left; min-width: 0; cursor: pointer; font: inherit;
  color: var(--foreground); background: color-mix(in oklab, var(--card) 80%, transparent);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 14px 12px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.fw-station:hover { border-color: color-mix(in oklab, var(--primary) 55%, var(--border)); }
.fw-station[aria-pressed="true"] {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 10%, var(--card));
}
.fw-station[data-conditional="1"] { border-style: dashed; }
.fw-station-num { font: 700 12px var(--font-mono); color: var(--primary); }
.fw-station-title { font-size: 15px; font-weight: 650; line-height: 1.3; }
.fw-station-text { font-size: 12.5px; line-height: 1.5; color: var(--muted-foreground); }
.fw-station-next { margin-top: auto; font: 11px var(--font-mono); color: var(--muted-foreground); }
.fw-station[data-conditional="1"] .fw-station-next { color: #fbbf24; }

/* ---- detail panel ---- */
.fw-workbench {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px; align-items: start; margin: 26px 0;
}
.fw-workbench > .fw-card { margin: 0; min-width: 0; }
.fw-workbench > .fw-wide { grid-column: 1 / -1; }
.fw-panel-card { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.fw-panel { min-height: 130px; }
.fw-panel-card .fw-kv { grid-template-columns: 96px minmax(0, 1fr); }
.fw-panel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.fw-panel-head h3 { margin: 0; font-size: 16px; }
.fw-panel p { font-size: 13px; line-height: 1.55; margin: 0 0 8px; color: var(--muted-foreground); }
.fw-kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 5px 12px; font-size: 12.5px; }
.fw-kv dt { color: var(--muted-foreground); font-family: var(--font-mono); font-size: 11px; padding-top: 2px; }
.fw-kv dd { margin: 0; color: var(--foreground); line-height: 1.5; overflow-wrap: anywhere; }
.fw-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fw-chip-btn {
  font: 12px var(--font-mono); color: var(--foreground); background: transparent;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer;
}
.fw-chip-btn:hover { border-color: var(--primary); }

/* ---- split view ---- */
.fw-split-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.fw-split-seg { display: flex; align-items: center; justify-content: center; min-width: 0; }
.fw-split-seg span { font: 700 11px var(--font-mono); color: #0a0a0e; }
.fw-split-protocol { background: #94a3b8; }
.fw-split-mind { background: #a78bfa; }
.fw-split-creator { background: #fbbf24; }
.fw-split-sxsi { background: #4ade80; }
.fw-split-legend { list-style: none; display: grid; gap: 6px; margin: 12px 0 0; font-size: 12.5px; }
.fw-split-legend b { font-family: var(--font-mono); font-weight: 600; }

/* ---- map ---- */
.fw-map-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.fw-map-scroll {
  position: relative; overflow: auto; min-width: 0; max-width: 100%; border: 1px solid var(--border); border-radius: 10px;
  background: var(--background); height: 640px;
}
.fw-map { position: relative; }
.fw-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font: 11px var(--font-mono); color: var(--muted-foreground); }
.fw-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid currentColor; margin-right: 6px; vertical-align: middle; }
.fw-legend .mv-money { color: #e2e8f0; }
.fw-legend .mv-permission { color: #14b8a6; border-top-style: solid; }
.fw-legend .mv-info { color: #94a3b8; border-top-style: dotted; }
.fw-legend .mv-adoption { color: #fbbf24; border-top-style: dashed; }

/* ---- tabs, tables ---- */
.fw-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fw-tab {
  border: 1px solid var(--border); background: transparent; color: var(--muted-foreground);
  padding: 5px 12px; border-radius: 8px; cursor: pointer; font: 12.5px var(--font-sans);
}
.fw-tab[aria-pressed="true"] {
  color: var(--foreground); border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 12%, transparent);
}
.fw-table-wrap { overflow-x: auto; }
.fw-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 12.5px; }
.fw-table th {
  text-align: left; color: var(--muted-foreground); font-weight: 600; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.fw-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.45; }
.fw-table tr.is-selected td { background: color-mix(in oklab, var(--primary) 9%, transparent); }
.fw-mod-btn {
  font: inherit; font-weight: 600; color: var(--foreground); background: none; border: 0;
  padding: 0; cursor: pointer; text-align: left;
}
.fw-mod-btn:hover { color: var(--primary); }
.fw-muted { color: var(--muted-foreground); font-size: 11.5px; }
.fw-table.fw-loops { min-width: 1120px; }
.fw-loops td { font-size: 12px; }
.fw-loops .fw-loop-name { font-weight: 600; white-space: nowrap; }
.fw-chart { width: 100%; height: 520px; }

@media (max-width: 1120px) {
  .fw-workbench { grid-template-columns: minmax(0, 1fr); }
  .fw-panel-card { position: static; max-height: none; }
  .fw-workbench > .fw-wide { grid-column: auto; }
}
@media (max-width: 980px) {
  .fw-story { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fw-kv { grid-template-columns: 120px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .fw { padding: 0 16px 48px; }
  .fw-story { grid-template-columns: 1fr; }
  .fw-map-scroll { height: 460px; }
  .fw-chart { height: 420px; }
  .fw-title { margin-top: 28px; }
  .fw-kv { grid-template-columns: 1fr; gap: 2px; }
  .fw-kv dt { padding-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .fw *, .fw *::before, .fw *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
