:root {
  --ink: #061b31; --muted: #64748d; --line: #d6d9fc; --page: #f6f9fc; --brand: #533afd; --brand-dark: #1c1e54;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1480px; margin: 0 auto; padding: 28px 24px 40px; }
button, select, input { font: inherit; }

.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.heading { min-width: 0; }
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
h1 { margin: 4px 0 0; font-weight: 300; font-size: 30px; overflow-wrap: anywhere; }
.sources { margin: 4px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions select, .actions > button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); cursor: pointer; }
.actions .primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.actions button:disabled { opacity: .45; cursor: default; }
.toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.status { min-height: 18px; margin: 0 0 10px; color: var(--muted); font: 12px ui-monospace, monospace; overflow-wrap: anywhere; }
.error { padding: 10px 14px; border-radius: 6px; background: #fdeef1; color: #9b1c3a; font-size: 14px; }
.note { margin: 0 0 8px; padding: 8px 12px; border-radius: 6px; background: #fff7e6; color: #7a4b00; font-size: 13px; }

/* The universe panel brings its own button reset, so it looks the same anywhere. */
.panel button { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.panel { overflow: hidden; border-radius: 8px; color: #fff; background: radial-gradient(120% 95% at 50% 42%, #2a2d7a 0%, var(--brand-dark) 46%, #10123a 100%); box-shadow: rgba(50, 50, 93, .25) 0 30px 45px -30px, rgba(0, 0, 0, .1) 0 18px 36px -18px; }
.panel.expanded { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: 0; }
.panel.overlay { position: fixed; inset: 0; z-index: 70; height: 100dvh; }
.panel-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding: 20px 24px 0; }
.panel-eyebrow { margin: 0; color: #b9b9f9; font-size: 11px; letter-spacing: .12em; }
.panel-header h2 { margin: 4px 0 0; color: #fff; font-size: 26px; font-weight: 300; line-height: 1.15; letter-spacing: -.5px; overflow-wrap: anywhere; }
.stats { margin: 6px 0 0; color: #c9cbf2; font-size: 13px; font-variant-numeric: tabular-nums; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.shapes, .zoom { display: flex; flex-shrink: 0; align-items: center; border: 1px solid #ffffff26; border-radius: 6px; background: #ffffff0f; }
.shapes button { min-width: 44px; height: 40px; padding: 0 10px; border-radius: 5px; color: #c9cbf2; font-size: 13px; font-weight: 500; cursor: pointer; }
.shapes button[aria-pressed="true"] { background: #fff; color: var(--brand-dark); }
.shapes button:not([aria-pressed="true"]):hover { background: #ffffff1a; color: #fff; }
.zoom button { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 5px; color: #e6e7ff; cursor: pointer; }
.zoom button:hover { background: #ffffff1a; }
.zoom button:disabled { opacity: .35; cursor: default; }
.zoom svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#fullscreen .collapse, .expanded #fullscreen .expand { display: none; }
.expanded #fullscreen .collapse { display: block; }
.shapes button:focus-visible, .zoom button:focus-visible, .groups button:focus-visible { outline: 2px solid #b9b9f9; outline-offset: -2px; }
.zoom span { min-width: 42px; color: #c9cbf2; font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
.viewport { position: relative; width: 100%; height: 480px; }
.expanded .viewport { flex: 1; min-height: 0; height: auto; }
canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
.expanded canvas { touch-action: none; }

.caption { position: absolute; left: 24px; bottom: 16px; display: flex; max-width: min(460px, calc(100% - 48px)); flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid #ffffff26; border-radius: 6px; background: #11133acc; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.caption[hidden] { display: none; }
.caption-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: #c9cbf2; font-size: 11px; }
.caption i, .groups i { display: inline-block; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }
.caption strong { color: #fff; font-size: 15px; font-weight: 400; line-height: 1.35; overflow-wrap: anywhere; }
.details { display: grid; gap: 2px; margin-top: 2px; color: #c9cbf2; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }

.legend { display: flex; flex-direction: column; gap: 8px; padding: 4px 24px 18px; }
.groups { display: flex; flex-wrap: wrap; gap: 6px; }
.groups button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid #ffffff1f; border-radius: 6px; background: #ffffff0d; color: #e6e7ff; font-size: 12px; cursor: pointer; }
.groups button:hover, .groups button[aria-pressed="true"] { border-color: #ffffff59; background: #ffffff1a; }
.groups small { color: #a9abdc; font-size: 11px; font-variant-numeric: tabular-nums; }
.legend p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; color: #a9abdc; font-size: 11px; line-height: 1.5; }
.legend p > span[hidden] { display: none; }
#hollow-legend { display: inline-flex; align-items: center; gap: 8px; }
.solid, .dashed { display: inline-block; width: 22px; height: 0; border-top: 1.5px solid #ffffffb3; }
.dashed { margin-left: 8px; border-top: 1.5px dashed #b9b9f9; }
.hollow { display: inline-block; width: 9px; height: 9px; border: 1.5px solid #c9cbf2; border-radius: 50%; }
.legend p.hint { color: #8f92c9; }

.about { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.about p { margin: 0 0 6px; }
.about a { color: var(--brand); }
.link { padding: 0; border: 0; background: none; color: var(--brand); text-decoration: underline; cursor: pointer; }
.drop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(28, 30, 84, .82); color: #fff; font-size: 22px; font-weight: 300; text-align: center; }
.drop[hidden] { display: none; }

@media (max-width: 639px) {
  main { padding: 16px 16px 32px; }
  h1 { font-size: 24px; }
  .panel-header { padding: 16px 16px 0; }
  .panel-header h2 { font-size: 21px; }
  .viewport { height: 400px; }
  .shapes button { min-width: 40px; padding: 0 8px; }
  .zoom button { width: 36px; height: 40px; }
  .zoom span { display: none; }
  .caption { left: 12px; bottom: 12px; max-width: calc(100% - 24px); }
  .legend { padding: 4px 16px 14px; }
  .expanded .groups { flex-wrap: nowrap; overflow-x: auto; }
}
