@font-face { font-family: "Archivo"; src: url("/fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("/fonts/martian-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --ink: #0B0D12;
  --muted: #5A6170;
  --rule: #D3D7DE;
  --accent: #2F6BFF;        /* rare: your next step */
  --accent-text: #2251D1;
  --hot: #F08A1C;           /* legendary: strongest path */
  --hot-text: #A55500;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-sans: "Archivo", system-ui, sans-serif;
  --font-mono: "Martian Mono", ui-monospace, monospace;
  --font-serif: var(--font-display);
}
[data-theme="dark"] {
  --bg: #0B0D12;
  --surface: #12151C;
  --ink: #ECEEF2;
  --muted: #949BA9;
  --rule: #2A303C;
  --accent: #4C74FF;
  --accent-text: #8EA6FF;
  --hot-text: #FFAE55;
}
.disp { font-family: var(--font-display); font-weight: 800; font-stretch: 72%; font-variation-settings: "wdth" 72; text-transform: uppercase; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
body { background-image: linear-gradient(color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px); background-size: 44px 44px; }
body { font: 15px/1.45 var(--font-sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 3px; }
.serif { font-family: var(--font-display); font-weight: 800; font-stretch: 72%; font-variation-settings: "wdth" 72; text-transform: uppercase; }
.mono { font-family: var(--font-mono); font-size: 0.85em; }

.bar {
  position: fixed; inset: 0 0 auto; z-index: 2;
  display: flex; align-items: center; gap: 16px;
  padding: 10px clamp(12px, 3vw, 28px);
  background: linear-gradient(var(--bg) 60%, transparent);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.home { color: inherit; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-size: 18px; }
.home:hover { color: var(--accent-text); }
.bar h1 { font-size: 22px; margin: 0 auto 0 0; color: var(--accent-text); }
.lang { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; min-height: 36px; padding: 0 10px; font-size: 11px; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#map.dragging { cursor: grabbing; }

/* edges */
.e { fill: none; stroke: var(--rule); stroke-width: 1.5; }
.e.on { stroke: var(--muted); }
.e.lit { stroke: var(--ink); stroke-width: 2; }
.e.hot { stroke: var(--hot); }
.hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; }

/* nodes */
.nd { cursor: pointer; }
.nd circle.c { fill: var(--bg); stroke: var(--rule); stroke-width: 2; }
.nd.on circle.c { stroke: var(--ink); }
.nd .half { fill: var(--ink); }
.nd.done circle.c { fill: var(--ink); stroke: var(--ink); }
.nd .ring { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; }
.nd.next .ring { opacity: 1; }
.nd.sel circle.c { stroke: var(--accent); stroke-width: 3; }
.nd:focus { outline: none; }
.nd:focus-visible circle.c { stroke: var(--accent-text); stroke-width: 3; }
.nd text { fill: var(--muted); font-size: 15px; pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 5px; stroke-linejoin: round; }
.nd.on text { fill: var(--ink); }
.hub circle.c { stroke-width: 2.5; }
.hub text.n { font-weight: 800; font-size: 19px; font-stretch: 75%; font-variation-settings: "wdth" 75; text-transform: uppercase; }
.hub text.p { font-family: var(--font-mono); font-size: 13px; fill: var(--muted); }
.hub.top text.n, .hub.top text.p { fill: var(--hot-text); }
.core circle.c { fill: var(--ink); stroke: var(--ink); }
.core text { fill: var(--bg) !important; stroke: none; font-family: var(--font-display); font-weight: 800; font-stretch: 72%; font-variation-settings: "wdth" 72; text-transform: uppercase; font-size: 24px; }

/* detail card */
.card {
  position: fixed; z-index: 3; left: clamp(12px, 3vw, 28px); bottom: clamp(12px, 3vw, 28px);
  width: min(360px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  padding: 18px 18px 16px; box-shadow: 0 10px 30px rgb(0 0 0 / .12);
}
.card .k { font: 10px var(--font-mono); color: var(--accent-text); margin: 0 32px 6px 0; }
.card h2 { font: 800 32px/0.95 var(--font-display); font-stretch: 72%; font-variation-settings: "wdth" 72; text-transform: uppercase; margin: 0 32px 10px 0; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card .x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none; font-size: 22px; line-height: 1; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: none; min-height: 44px; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.act { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 4px; min-height: 44px; padding: 0 16px; font: 800 14px var(--font-display); font-stretch: 85%; font-variation-settings: "wdth" 85; text-transform: uppercase; }
.act.ghost { border-color: var(--rule); }
.act.ghost { background: none; color: var(--ink); }
.card .row { display: flex; flex-wrap: wrap; gap: 8px; }
.card ul { list-style: none; margin: 0 0 12px; padding: 0; }
.card li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--rule); }
.card li b { font: 500 11px var(--font-mono); }
.card li .tag { color: var(--hot-text); font: 10px var(--font-mono); margin-left: 6px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }

.zoom { position: fixed; z-index: 2; right: clamp(12px, 3vw, 28px); bottom: clamp(12px, 3vw, 28px); display: grid; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); overflow: hidden; }
.zoom button { width: 44px; height: 44px; border: 0; background: none; font-size: 20px; }
.zoom button + button { border-top: 1px solid var(--rule); }
.hint { position: fixed; z-index: 1; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; font-size: 10px; color: var(--muted); white-space: nowrap; pointer-events: none; }

@media (max-width: 640px) {
  .bar h1 { display: none; }
  .home { margin-right: auto; }
  .card { bottom: 12px; right: 68px; width: auto; }
  .hint { display: none; }
}
