/* ── Muse ─────────────────────────────────────────────────────────────
   Rights-intelligence aesthetic: the graph is the page, chrome floats over
   it in glass panels. Space Grotesk carries display type, IBM Plex Mono
   carries every number and label — figures are the substance here, so they
   get a face that lines up in columns.

   Three palettes, switched by data-theme on <html>. Values are duplicated
   rather than derived so each stays hand-tuned.
   ------------------------------------------------------------------- */

:root,
:root[data-theme="nebula"] {
  --bg-a:    #0a0e1f;
  --bg-b:    #05060c;
  --line:    rgba(130,150,255,.14);
  --line-2:  rgba(130,150,255,.30);
  --panel:   rgba(14,18,36,.72);
  --ink:     #e9ecff;
  --ink-2:   #8b93c0;
  --ink-3:   #626a94;
  --accent:  #7aa2ff;
  --accent-2:#c79bff;
  --node-owner:   #eaf0ff;
  --node-ip:      #c79bff;
  --node-channel: #8ea6d8;
}
:root[data-theme="terminal"] {
  --bg-a:    #071013;
  --bg-b:    #040709;
  --line:    rgba(80,255,170,.14);
  --line-2:  rgba(80,255,170,.30);
  --panel:   rgba(8,16,14,.78);
  --ink:     #dcf6e8;
  --ink-2:   #6f9384;
  --ink-3:   #52705f;
  --accent:  #35ffa8;
  --accent-2:#ffd24a;
  --node-owner:   #eafff4;
  --node-ip:      #ffd24a;
  --node-channel: #6fae9a;
}
:root[data-theme="aurora"] {
  --bg-a:    #0a1e22;
  --bg-b:    #050f11;
  --line:    rgba(150,240,220,.16);
  --line-2:  rgba(150,240,220,.32);
  --panel:   rgba(12,30,32,.66);
  --ink:     #ecfff9;
  --ink-2:   #88b5ac;
  --ink-3:   #62918a;
  --accent:  #57f2d0;
  --accent-2:#b18bff;
  --node-owner:   #f0fffb;
  --node-ip:      #b18bff;
  --node-channel: #7fb0a8;
}

:root {
  --radius: 16px;
  --shadow: 0 24px 60px -20px rgba(0,0,0,.7);
  --font: "Space Grotesk", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --glass: blur(16px);
}

* { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg-b);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

#stage { position: fixed; inset: 0; }

#canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  /* the canvas paints its own radial field and starfield */
}
#canvas.dragging { cursor: grabbing; }
#canvas.pointing  { cursor: pointer; }

/* Vignette sits above the canvas, below the chrome. */
#stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  box-shadow: inset 0 0 220px 40px rgba(0,0,0,.55);
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

@keyframes museSpin  { to { transform: rotate(360deg) } }
@keyframes museFade  { from { opacity: 0; transform: translateY(8px) } }
@keyframes musePanel { from { opacity: 0; transform: translateX(18px) } }
@keyframes musePulse { 0%,100% { opacity: .35 } 50% { opacity: .9 } }

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── top bar ─────────────────────────────────────────────────────── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 18px; z-index: 40;
  pointer-events: none;
  background: linear-gradient(180deg, var(--bg-b) 0%, transparent 100%);
}
#topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: conic-gradient(from 140deg, var(--accent), var(--accent-2),
                             var(--node-channel), var(--accent));
  box-shadow: 0 0 18px -2px var(--accent);
  animation: museSpin 18s linear infinite;
}
.brand h1 {
  margin: 0; font-size: 19px; font-weight: 700;
  letter-spacing: .16em; line-height: 1; color: var(--ink);
}
.brand .tag {
  margin: 3px 0 0; font-family: var(--mono);
  font-size: 9px; letter-spacing: .24em; color: var(--ink-2);
  white-space: nowrap;
}

#modes {
  display: flex; align-items: stretch; gap: 4px; padding: 4px;
  border-radius: 13px; background: var(--panel);
  border: 1px solid var(--line); backdrop-filter: var(--glass);
}
#modes button {
  appearance: none; border: 0; background: transparent;
  color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600;
  letter-spacing: .02em; padding: 8px 16px; border-radius: 10px;
  cursor: pointer; transition: background .2s, color .2s;
}
#modes button:hover { color: var(--ink); }
#modes button.on {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000));
  color: var(--bg-b);
  box-shadow: 0 6px 18px -6px var(--accent);
}
#modes button.home { display: inline-flex; align-items: center; gap: 7px; padding-left: 12px; }
#modes button.home .glyph {
  width: 12px; height: 12px; border-radius: 50%; flex: none; position: relative;
  border: 1.5px solid currentColor;
  transition: transform .3s cubic-bezier(.2,.7,.3,1);
}
#modes button.home .glyph::after {
  content: ''; position: absolute; inset: 2.5px;
  border-radius: 50%; background: currentColor;
}
#modes button.home:hover .glyph { transform: scale(1.18) rotate(90deg); }
#modes .divider { width: 1px; align-self: stretch; margin: 3px 4px; background: var(--line-2); }

.head-right { display: flex; align-items: center; gap: 10px; }

.readout {
  display: flex; align-items: baseline; gap: 7px;
  padding: 7px 13px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: var(--glass); white-space: nowrap;
}
.readout b {
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  color: var(--accent);
}
.readout span {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .14em; color: var(--ink-2);
}
.readout i { width: 1px; height: 14px; background: var(--line); margin: 0 3px; }

.ghost-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em;
  font-weight: 600; color: var(--ink); padding: 10px 13px;
  border-radius: 11px; cursor: pointer; background: var(--panel);
  border: 1px solid var(--line); backdrop-filter: var(--glass);
  transition: border-color .18s, color .18s;
}
.ghost-btn:hover { border-color: var(--line-2); color: var(--accent); }
.ghost-btn.round {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: 13px;
}

.search { position: relative; width: min(240px, 22vw); }
.search input {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); font: inherit; font-size: 13px;
  backdrop-filter: var(--glass);
  transition: border-color .16s, box-shadow .16s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
  outline: none; border-color: var(--line-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.results {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0;
  max-height: 46vh; overflow-y: auto; padding: 5px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
}
.results .grp {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: .2em; color: var(--ink-2); padding: 9px 10px 5px;
}
.results button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.results button:hover, .results button.cursor {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.results .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.results .meta {
  margin-left: auto; color: var(--ink-2); font-family: var(--mono);
  font-size: 11px; flex: none;
}

.subtitle {
  position: absolute; top: 62px; left: 18px; right: 18px; margin: 0;
  z-index: 18; font-size: 11.5px; color: var(--ink-3);
  letter-spacing: .015em; pointer-events: none;
}

/* ── breadcrumb ──────────────────────────────────────────────────── */
.crumbs {
  position: absolute; top: 84px; left: 18px; z-index: 18;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 44vw;
}
.crumbs button {
  appearance: none; border: 1px solid var(--line); background: var(--panel);
  backdrop-filter: var(--glass); color: var(--ink-2); font: inherit;
  font-size: 12px; padding: 5px 11px; border-radius: 9px; cursor: pointer;
}
.crumbs button:hover { color: var(--ink); border-color: var(--line-2); }
.crumbs button.here { color: var(--ink); cursor: default; }
.crumbs .sep { color: var(--ink-3); font-size: 11px; }

/* ── left rail ───────────────────────────────────────────────────── */
#rail {
  position: absolute; left: 18px; top: 118px; bottom: 132px;
  width: 256px; z-index: 20;
  display: flex; flex-direction: column; gap: 18px;
  padding: 18px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
#rail section { display: flex; flex-direction: column; gap: 10px; }
#rail h2 {
  margin: 0; font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: .2em; color: var(--ink-2); text-transform: uppercase;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 20px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 500;
  cursor: pointer; user-select: none; transition: .18s;
}
.chip:hover { color: var(--ink); border-color: var(--line-2); }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; flex: none; transition: box-shadow .18s; }
.chip .n { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }

.chip.sel { color: var(--ink); }
.chip.sel .sw { box-shadow: 0 0 9px currentColor; }
.chip.sel .n { color: var(--ink-2); }
.chips.filtered .chip:not(.sel) { opacity: .42; }
.chips.filtered .chip:not(.sel):hover { opacity: .85; }

/* The deal-structure group reads as rows, matching the legend below it. */
#dealFilter { flex-direction: column; flex-wrap: nowrap; }
#dealFilter .chip {
  width: 100%; border-radius: 11px; padding: 9px 11px; gap: 10px;
}
#dealFilter .chip span:nth-child(2) { flex: 1; }

.hint { margin: 8px 0 0; font-size: 10.5px; line-height: 1.55; color: var(--ink-3); }

.reset {
  padding: 10px; border-radius: 11px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); font: inherit;
  font-size: 12px; font-weight: 500; cursor: pointer; flex: none;
}
.reset:hover { color: var(--ink); border-color: var(--line-2); }

/* ── link legend ─────────────────────────────────────────────────── */
.legend {
  position: absolute; left: 18px; bottom: 76px; z-index: 20;
  width: 256px;
  display: flex; flex-direction: column; gap: 8px; padding: 13px 15px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 13px; box-shadow: var(--shadow); backdrop-filter: var(--glass);
}
.legend-head {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  color: var(--ink-2); margin-bottom: 2px;
}
.legend-row { display: flex; align-items: center; gap: 9px; }
.legend-row i { width: 22px; height: 0; display: inline-block; flex: none; }
.legend-row span { font-size: 12px; color: var(--ink); }

/* ── zoom stack ──────────────────────────────────────────────────── */
.zoom {
  position: absolute; right: 18px; bottom: 20px; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom button {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  backdrop-filter: var(--glass); color: var(--ink);
  font-size: 20px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.zoom button.wide {
  height: 34px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; font-weight: 600; color: var(--ink-2);
}
.zoom button:hover { border-color: var(--line-2); color: var(--accent); }

/* ── detail panel ────────────────────────────────────────────────── */
.panel {
  position: absolute; z-index: 55; top: 84px; bottom: 20px; right: 18px;
  width: min(360px, 34vw); padding: 22px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
  animation: musePanel .3s ease;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.panel .close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-size: 13px; cursor: pointer; z-index: 2;
}
.panel .close:hover { color: var(--ink); border-color: var(--line-2); }
#panelBody { padding: 0; }

.p-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  font-weight: 600; margin-bottom: 8px; text-transform: uppercase;
  display: flex; align-items: center; gap: 7px; color: var(--accent-2);
}
.p-kicker .sw { width: 8px; height: 8px; border-radius: 50%; }
.p-title {
  margin: 0 0 7px; font-size: 26px; font-weight: 700; line-height: 1.05;
  letter-spacing: -.01em; padding-right: 30px;
}
.p-sub { margin: 0 0 20px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }

.p-figs { display: flex; gap: 8px; margin: 20px 0; }
.p-fig {
  flex: 1; padding: 12px 10px; border-radius: 12px; text-align: center;
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
}
.p-fig .v { font-size: 18px; font-weight: 600; color: var(--accent); }
.p-fig .k {
  font-family: var(--mono); font-size: 8px; letter-spacing: .14em;
  color: var(--ink-2); margin-top: 4px; text-transform: uppercase;
}

.p-sec {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  color: var(--ink-2); margin: 4px 0 11px; text-transform: uppercase;
}
.p-block { margin-bottom: 20px; }
.p-body { font-size: 13px; line-height: 1.6; color: var(--ink-2); margin: 0 0 10px; }
.p-body strong { color: var(--ink); font-weight: 600; }

.p-note {
  border-left: 2px solid var(--accent-2); padding: 2px 0 2px 12px;
  margin: 0 0 20px; font-size: 13px; line-height: 1.6; color: var(--ink-2);
}
.p-note b { color: var(--accent-2); font-weight: 600; }

.p-pn { display: grid; gap: 8px; margin-bottom: 20px; }
.p-pn div {
  font-size: 12.5px; line-height: 1.55; padding: 11px 12px;
  border-radius: 12px; border: 1px solid var(--line);
}
.p-pn .up { background: rgba(80,230,180,.05); border-color: rgba(80,230,180,.22); color: #b6ecd8; }
.p-pn .dn { background: rgba(255,110,140,.05); border-color: rgba(255,110,140,.22); color: #f3b6c2; }
.p-pn b {
  display: block; font-family: var(--mono); font-size: 9px;
  letter-spacing: .16em; opacity: .72; margin-bottom: 4px; text-transform: uppercase;
}

.p-list { display: flex; flex-direction: column; gap: 8px; }
.p-row {
  display: flex; gap: 11px; align-items: center; width: 100%;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.02); color: var(--ink);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: .15s;
}
.p-row:hover { border-color: var(--line-2); background: rgba(255,255,255,.05); }
.p-row .dot { width: 3px; align-self: stretch; border-radius: 3px; flex: none; min-height: 24px; }
.p-row .lbl {
  flex: 1; min-width: 0; font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-row .val {
  margin-left: auto; color: var(--ink); font-family: var(--mono);
  font-size: 13px; font-weight: 600; flex: none;
}

.tag {
  display: inline-block; padding: 4px 9px; border-radius: 20px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-2); margin: 0 5px 5px 0;
}
.tag.owned    { border-color: rgba(79,227,214,.4);  color: #4fe3d6; }
.tag.royalty  { border-color: rgba(255,176,87,.4);  color: #ffb057; }
.tag.licensed { border-color: rgba(142,166,255,.4); color: #8ea6ff; }
.tag.jv       { border-color: rgba(255,110,199,.4); color: #ff6ec7; }
.tag.pd       { border-color: var(--line-2); color: var(--ink-2); }

.p-src {
  font-size: 10.5px; color: var(--ink-3); line-height: 1.55;
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px;
}

/* ── tooltip ─────────────────────────────────────────────────────── */
.tooltip {
  position: absolute; z-index: 70; pointer-events: none; max-width: 290px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
  backdrop-filter: var(--glass); font-size: 12px; line-height: 1.45;
  transform: translate(12px, 12px);
}
.tooltip .t { font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.tooltip .s { color: var(--ink-2); font-size: 11.5px; }
.tooltip .m {
  color: var(--ink-3); font-size: 10.5px; margin-top: 5px; font-family: var(--mono);
}

/* ── status bar ──────────────────────────────────────────────────── */
#statusbar {
  position: absolute; left: 18px; bottom: 20px; z-index: 15;
  display: flex; align-items: center; gap: 14px;
}
#stats {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 11px; padding: 8px 13px; backdrop-filter: var(--glass);
}
#stats b { color: var(--accent); font-weight: 600; }

/* ── first-run guide ─────────────────────────────────────────────── */
.guide {
  position: absolute; left: 292px; bottom: 20px; z-index: 28;
  width: min(340px, calc(100vw - 36px)); padding: 18px 18px 16px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
  animation: museFade .3s cubic-bezier(.2,.7,.3,1);
}
.guide h2 { margin: 0 0 5px; font-size: 16px; font-weight: 700; }
.guide .lede { margin: 0 0 13px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.guide ol {
  margin: 0 0 13px; padding: 0; list-style: none;
  counter-reset: g; display: grid; gap: 9px;
}
.guide li {
  counter-increment: g; position: relative; padding-left: 26px;
  font-size: 12px; line-height: 1.5; color: var(--ink-2);
}
.guide li::before {
  content: counter(g); position: absolute; left: 0; top: 0;
  width: 18px; height: 18px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid var(--line-2); color: var(--accent);
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  display: grid; place-items: center;
}
.guide li b { color: var(--ink); font-weight: 600; }
.guide .foot {
  margin: 0 0 13px; font-size: 11px; line-height: 1.6; color: var(--ink-3);
  border-top: 1px solid var(--line); padding-top: 11px;
}
.guide .foot b { color: var(--ink-2); }
.guide kbd {
  font-family: var(--mono); font-size: 10px; padding: 1px 5px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line-2);
  border-radius: 4px; color: var(--ink-2);
}
.guide .go {
  width: 100%; padding: 10px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line-2); font: inherit; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #000));
  color: var(--bg-b); transition: filter .16s;
}
.guide .go:hover { filter: brightness(1.12); }
.guide .close {
  position: absolute; top: 11px; right: 12px;
  width: 24px; height: 24px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-3); font-size: 15px; line-height: 1; cursor: pointer;
}
.guide .close:hover { color: var(--ink); }

/* ── loading ─────────────────────────────────────────────────────── */
.loading {
  position: absolute; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 20px;
  background: var(--bg-b); transition: opacity .45s;
}
.loading.gone { opacity: 0; pointer-events: none; }
.load-ring-wrap {
  position: relative; width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
}
.load-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent); border-right-color: var(--accent-2);
  animation: museSpin 1s linear infinite;
}
.load-core {
  width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(from 90deg, var(--accent), var(--accent-2), var(--accent));
  box-shadow: 0 0 24px var(--accent);
}
.load-title { font-size: 22px; font-weight: 600; letter-spacing: .01em; }
.load-text {
  font-size: 13px; color: var(--ink-2);
  animation: musePulse 2s ease-in-out infinite;
}

/* ── responsive ──────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .legend { display: none; }
  #rail { bottom: 132px; }
  .search { width: 180px; }
}
@media (max-width: 1080px) {
  #rail { display: none; }
  .panel { width: min(400px, 88vw); }
  .subtitle { display: none; }
  .guide { left: 18px; }
}
@media (max-width: 860px) {
  .brand .tag, .readout, #modes .divider { display: none; }
  #modes button { padding: 8px 11px; font-size: 12px; }
  .search { width: 132px; }
  #themeBtn { display: none; }
  .panel {
    top: auto; bottom: 0; right: 0; left: 0; width: 100%;
    max-height: 62vh; border-radius: 22px 22px 0 0;
  }
  #statusbar { left: 12px; bottom: 12px; }
  #stats { font-size: 10px; gap: 10px; }
  .guide { bottom: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  .brand .mark, .load-ring { animation: none; }
  .guide, .panel { animation: none; }
  #modes button.home:hover .glyph { transform: none; }
}

/* ── news digest ─────────────────────────────────────────────────── */
#digestBtn { position: relative; }
#digestBtn .dot {
  position: absolute; top: 5px; right: 7px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2); box-shadow: 0 0 7px var(--accent-2);
}

/* A bare `display:` here beats the UA's [hidden] rule, which left the digest
   permanently open and empty. Anything the markup hides stays hidden. */
[hidden] { display: none !important; }

.digest {
  position: absolute; z-index: 58; top: 84px; bottom: 20px; right: 18px;
  width: min(440px, 40vw); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
  animation: musePanel .3s ease;
}
.digest .close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-size: 13px; cursor: pointer; z-index: 2;
}
.digest .close:hover { color: var(--ink); border-color: var(--line-2); }

.digest-head { padding: 22px 22px 14px; border-bottom: 1px solid var(--line); }
.digest-head h2 {
  margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.01em;
}
.digest-head p {
  margin: 0 0 12px; font-family: var(--mono);
  font-size: 10px; letter-spacing: .12em; color: var(--ink-2);
}

.digest-body {
  flex: 1; overflow-y: auto; padding: 14px 22px 22px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.digest-day {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  color: var(--ink-2); margin: 18px 0 10px; text-transform: uppercase;
}
.digest-day:first-child { margin-top: 0; }

.news {
  display: block; width: 100%; text-align: left; margin-bottom: 9px;
  padding: 13px 14px; border-radius: 13px; border: 1px solid var(--line);
  background: rgba(255,255,255,.02); color: var(--ink);
  font: inherit; cursor: pointer; transition: .15s;
}
.news:hover { border-color: var(--line-2); background: rgba(255,255,255,.05); }
.news-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.news-sig {
  font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  padding: 3px 8px; border-radius: 20px; border: 1px solid currentColor;
  text-transform: uppercase; flex: none;
}
.news-src {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3); flex: none;
}
.news-title {
  display: block; font-size: 13.5px; font-weight: 600; line-height: 1.45;
  color: var(--ink); text-decoration: none;
}
.news-title:hover { color: var(--accent); }
.news-links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.news-link {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--ink-2);
  background: transparent; cursor: pointer; font: inherit; font-size: 11px;
}
.news-link:hover { color: var(--ink); border-color: var(--line-2); }
.news-link.ip { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 34%, transparent); }

.digest-empty {
  padding: 28px 4px; text-align: center; color: var(--ink-2);
  font-size: 13px; line-height: 1.6;
}

@media (max-width: 1080px) { .digest { width: min(440px, 92vw); } }
@media (max-width: 860px) {
  .digest {
    top: auto; bottom: 0; right: 0; left: 0; width: 100%;
    max-height: 72vh; border-radius: 22px 22px 0 0;
  }
}
