@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&display=swap");

:root {
  color-scheme: dark;
  --ink: #f6f0df;
  --muted: #a69e8e;
  --paper: #11100e;
  --panel: #1a1814;
  --line: #3d382e;
  --gold: #f4b942;
  --red: #e0523f;
  --cyan: #71d1c6;
  --green: #93c572;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% -10%, rgba(244, 185, 66, .13), transparent 32rem),
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 100% 4px, auto;
  font-family: "Noto Sans JP", sans-serif;
}
button, select { font: inherit; }
button { cursor: pointer; }
.hero, main, footer { width: min(1480px, calc(100% - 40px)); margin-inline: auto; }
.hero { min-height: 44vh; display: grid; align-content: end; padding: 72px 0 48px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 8px 0 14px; font: 400 clamp(4.5rem, 12vw, 10rem)/.76 "Bebas Neue", sans-serif; letter-spacing: -.02em; text-transform: uppercase; }
.lede { max-width: 680px; margin: 0; color: #d5cebe; font-size: clamp(1rem, 2vw, 1.3rem); line-height: 1.8; }
.eyebrow { margin: 0; color: var(--gold); font: 500 .72rem/1.2 "IBM Plex Mono", monospace; letter-spacing: .17em; text-transform: uppercase; }
.stats { color: var(--muted); font: .8rem "IBM Plex Mono", monospace; }
.control-deck { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(260px, .8fr) auto 2fr; gap: 18px; padding: 18px 0; background: rgba(17, 16, 14, .94); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.start-control, #filters { display: flex; gap: 8px; align-items: end; }
.start-control label, #filters label { color: var(--muted); font: .68rem "IBM Plex Mono", monospace; text-transform: uppercase; }
.start-control label { display: none; }
#filters { justify-content: flex-end; flex-wrap: wrap; }
#filters label { display: grid; gap: 4px; }
select, .start-control button { min-height: 39px; color: var(--ink); background: #211f1a; border: 1px solid var(--line); border-radius: 2px; padding: 7px 9px; }
.start-control select { flex: 1; min-width: 0; }
.start-control button { color: var(--paper); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.test-data-controls { display: flex; align-items: center; gap: 6px; }
.test-data-controls button { min-height: 39px; padding: 7px 9px; color: var(--ink); background: #211f1a; border: 1px solid var(--line); }
#io-status { max-width: 180px; color: var(--muted); font: .62rem/1.4 "IBM Plex Mono", monospace; }
.checkbox { display: flex !important; align-items: center; min-height: 39px; padding-top: 16px; }
.checkbox input { accent-color: var(--gold); }
section { padding: 42px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2 { margin: 4px 0 0; font: 400 clamp(2.4rem, 5vw, 4.4rem)/1 "Bebas Neue", sans-serif; letter-spacing: .02em; }
.section-heading > p { max-width: 480px; margin: 0; color: var(--muted); font-size: .8rem; }
.current-route { display: flex; gap: 14px; align-items: stretch; margin: 0; padding: 0 0 14px; list-style: none; overflow-x: auto; }
.route-step { position: relative; display: flex; flex: 0 0 220px; }
.route-step:not(:first-child)::before { content: ""; position: absolute; top: 50%; left: -14px; width: 14px; border-top: 1px solid var(--gold); }
.route-node { width: 100%; min-height: 132px; display: grid; align-content: end; gap: 5px; padding: 16px; color: var(--ink); text-align: left; background: linear-gradient(145deg, #24211b, #171612); border: 1px solid var(--line); border-top: 3px solid var(--gold); }
.route-node:hover { border-color: var(--gold); }
.route-node.backlog { border-top-color: var(--red); }
.route-node strong { font-size: 1.05rem; }
.route-node span, .route-node small { color: var(--muted); font: .7rem "IBM Plex Mono", monospace; }
.route-connector { position: absolute; z-index: 2; left: -24px; top: calc(50% - 12px); width: 22px; height: 22px; padding: 0; color: var(--paper); background: var(--gold); border: 0; border-radius: 50%; }
.branch-memory { margin-top: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.branch-memory summary { width: max-content; padding: 12px 0; cursor: pointer; color: var(--cyan); font: .68rem "IBM Plex Mono", monospace; text-transform: uppercase; }
.branch-memory ul { display: flex; gap: 8px; margin: 0; padding: 0 0 10px; overflow-x: auto; list-style: none; }
.branch-memory li { display: flex; flex: 0 0 auto; border: 1px solid var(--line); }
.branch-memory li > button { padding: 8px 10px; color: var(--ink); text-align: left; background: #1c1a16; border: 0; }
.branch-memory li > button span { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.branch-memory li > button small { color: var(--muted); font: .6rem "IBM Plex Mono", monospace; }
.branch-memory .forget-branch { color: var(--muted); border-left: 1px solid var(--line); }
.branch-memory .no-history { padding: 9px; color: var(--muted); border-style: dashed; font: .65rem "IBM Plex Mono", monospace; }
.branches-section { border-top: 1px solid var(--line); }
.next-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.edge-card { display: grid; grid-template-rows: 1fr auto auto; min-height: 370px; background: var(--panel); border: 1px solid var(--line); transition: transform .16s, opacity .16s, border-color .16s; }
.edge-card:hover { transform: translateY(-3px); border-color: #746b5a; }
.edge-card.is-rejected { opacity: .34; }
.edge-choice { display: grid; align-content: start; gap: 12px; padding: 22px; color: var(--ink); text-align: left; background: transparent; border: 0; }
.edge-kicker { min-height: 2.3em; display: flex; align-items: start; justify-content: space-between; gap: 8px; color: var(--gold); font: 500 .66rem/1.4 "IBM Plex Mono", monospace; text-transform: uppercase; }
.edge-kicker em { flex: 0 0 auto; padding: 3px 5px; color: var(--cyan); border: 1px solid var(--cyan); font-size: .58rem; font-style: normal; }
.edge-choice h3 { margin: 4px 0 0; font: 400 clamp(2.1rem, 4vw, 3.5rem)/.9 "Bebas Neue", sans-serif; }
.edge-choice p { margin: 0; color: #c8c0b0; font-size: .82rem; line-height: 1.7; }
.edge-choice .port-label { color: var(--muted); font: .7rem "IBM Plex Mono", monospace; }
.ratings { display: flex; gap: 7px; margin-top: auto; padding-top: 14px; }
.rating { display: flex; align-items: center; gap: 4px; color: var(--muted); font: .65rem "IBM Plex Mono", monospace; }
.rating i { display: grid; place-items: center; width: 27px; height: 27px; color: var(--ink); background: color-mix(in srgb, var(--gold) calc(var(--score) * 15%), #25221c); border: 1px solid #4b4437; border-radius: 50%; font-style: normal; }
.edge-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font: .62rem "IBM Plex Mono", monospace; }
.confidence { padding: 5px 7px; border: 1px solid currentColor; }
.confidence-verified { color: var(--green); }
.confidence-strong { color: var(--cyan); }
.confidence-hypothesis { color: var(--gold); }
.confidence-experimental { color: var(--red); }
.evidence { padding: 0 14px; color: var(--muted); background: #171511; border-top: 1px solid var(--line); font-size: .72rem; line-height: 1.6; }
.evidence summary { padding: 10px 0; color: #cfc6b6; cursor: pointer; font: .65rem "IBM Plex Mono", monospace; text-transform: uppercase; }
.evidence p { margin: 6px 0; }
.evidence ul { margin: 8px 0 13px; padding-left: 18px; }
.evidence a { color: var(--cyan); }
.status-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; color: var(--muted); background: #12110f; border-top: 1px solid var(--line); font: .67rem "IBM Plex Mono", monospace; text-transform: uppercase; }
.status-control select { min-height: 31px; padding: 4px 7px; font-size: .7rem; }
.empty { padding: 50px 24px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.empty h3 { color: var(--ink); }
.fatal { padding: 80px 0; color: var(--red); }
footer { padding: 40px 0 70px; color: var(--muted); border-top: 1px solid var(--line); font: .7rem/1.7 "IBM Plex Mono", monospace; }

@media (max-width: 1100px) {
  .control-deck { grid-template-columns: 1fr auto; }
  #filters { grid-column: 1 / -1; }
  #filters { justify-content: flex-start; }
  .next-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .hero, main, footer { width: min(100% - 24px, 1480px); }
  .hero { min-height: 36vh; padding-top: 44px; }
  .hero h1 { font-size: 4.15rem; }
  .control-deck { position: static; }
  .control-deck { grid-template-columns: 1fr; }
  .test-data-controls { flex-wrap: wrap; }
  #filters { grid-column: auto; }
  #filters label { width: calc(50% - 4px); }
  #filters select { width: 100%; }
  .checkbox { width: 100% !important; }
  .section-heading { align-items: start; flex-direction: column; }
  .next-grid { grid-template-columns: 1fr; }
  .edge-card { min-height: 330px; }
}
