:root {
  color-scheme: dark;
  --ink: #f5edd7;
  --ink-dim: #bdb39f;
  --ink-faint: #7f796f;
  --void: #060808;
  --deep: #09100f;
  --panel: rgba(13, 19, 18, 0.94);
  --panel-soft: rgba(17, 25, 23, 0.76);
  --panel-raised: rgba(24, 32, 28, 0.96);
  --line: rgba(228, 191, 111, 0.18);
  --line-strong: rgba(228, 191, 111, 0.38);
  --gold: #e4bf6f;
  --gold-soft: #9e7d42;
  --cyan: #6ed5d4;
  --cyan-soft: #285e5c;
  --violet: #a896e8;
  --ember: #e58757;
  --green: #86cfa7;
  --danger: #e67c76;
  --radius-xs: 7px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --rail-width: 268px;
  --drawer-width: 380px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--void); scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% 14%, rgba(33, 93, 89, 0.12), transparent 34rem),
    radial-gradient(circle at 15% 72%, rgba(94, 65, 119, 0.11), transparent 35rem),
    linear-gradient(145deg, #080b0a, #050606 60%, #090705);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
mark { color: var(--ink); background: rgba(228,191,111,.24); border-radius: 2px; }
code { color: var(--cyan); font-family: var(--mono); font-size: .9em; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  padding: 9px 14px;
  border-radius: 999px;
  color: #07100f;
  background: var(--cyan);
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { transform: none; }

.ambient-field { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.star-field { position: absolute; inset: -20%; opacity: .45; }
.star-field::before,
.star-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(228,191,111,.8) 0 1px, transparent 1.35px),
    radial-gradient(circle, rgba(110,213,212,.7) 0 1px, transparent 1.25px),
    radial-gradient(circle, rgba(255,255,255,.5) 0 .8px, transparent 1.2px);
  background-size: 127px 127px, 193px 193px, 83px 83px;
  background-position: 17px 31px, 83px 11px, 49px 72px;
}
.star-field--far { transform: rotate(7deg) scale(1.12); opacity: .24; }
.horizon-glow { position: absolute; left: 22%; right: 8%; top: 48%; height: 1px; box-shadow: 0 0 90px 26px rgba(77, 189, 183, 0.08); }

.app-shell { min-height: 100vh; min-height: 100dvh; }
.masthead {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 8, .84);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; text-decoration: none; }
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 24px);
  letter-spacing: .015em;
}
.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(228,191,111,.06), 0 0 26px rgba(110,213,212,.08);
}
.brand-mark::before,
.brand-mark::after,
.brand-mark i { content: ""; position: absolute; left: 50%; top: 50%; transform-origin: center; }
.brand-mark::before { width: 31px; height: 1px; transform: translate(-50%, -50%) rotate(45deg); background: var(--gold); }
.brand-mark::after { width: 31px; height: 1px; transform: translate(-50%, -50%) rotate(-45deg); background: var(--gold); }
.brand-mark i:nth-child(1) { width: 9px; height: 9px; transform: translate(-50%,-50%) rotate(45deg); background: var(--cyan); box-shadow: 0 0 12px rgba(110,213,212,.55); }
.brand-mark i:nth-child(2) { width: 1px; height: 31px; transform: translate(-50%,-50%); background: rgba(228,191,111,.55); }
.brand-mark i:nth-child(3) { width: 31px; height: 31px; transform: translate(-50%,-50%) rotate(45deg); border: 1px solid rgba(228,191,111,.34); }

.eyebrow {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.3;
  text-transform: uppercase;
}
.masthead-actions { display: flex; align-items: center; gap: 8px; }
.primary-button,
.quiet-button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
}
.primary-button,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .015em;
}
.primary-button { color: #07100f; background: var(--cyan); box-shadow: 0 0 24px rgba(110,213,212,.16); }
.primary-button:hover { background: #89e3df; }
.quiet-button { border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.quiet-button:hover { border-color: var(--line-strong); background: rgba(228,191,111,.06); }
.icon-button { width: 34px; height: 34px; border-radius: 50%; color: var(--ink-dim); background: rgba(255,255,255,.035); font-size: 22px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: rgba(255,255,255,.075); }
.text-button { padding: 2px; color: var(--cyan); background: none; font-size: 11px; }
.text-button:hover { color: #a5efea; text-decoration: underline; }
.mobile-filter-toggle, .rail-close { display: none; }

.view-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 7px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 12, .82);
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs a {
  flex: none;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.view-tabs a:hover { color: var(--ink); background: rgba(255,255,255,.035); }
.view-tabs a[aria-current="page"] { color: #06100f; background: var(--gold); }

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: calc(100vh - 129px);
  min-height: calc(100dvh - 129px);
}
.filter-rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - 129px);
  height: calc(100dvh - 129px);
  overflow: auto;
  padding: 20px 16px 16px;
  border-right: 1px solid var(--line);
  background: rgba(8, 12, 11, .87);
  scrollbar-color: rgba(228,191,111,.26) transparent;
}
.rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.rail-heading h2 { margin: 1px 0 0; font-family: var(--serif); font-size: 20px; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.028);
}
.search-box:focus-within { border-color: var(--cyan-soft); box-shadow: 0 0 0 3px rgba(110,213,212,.07); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: var(--ink-faint); }
.search-box kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-faint); background: rgba(0,0,0,.25); font: 10px var(--mono); }
.search-results {
  position: absolute;
  z-index: 20;
  top: 115px;
  left: 16px;
  right: 16px;
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #101513;
  box-shadow: var(--shadow);
}
.search-result {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.search-result:hover, .search-result[aria-selected="true"] { background: rgba(110,213,212,.08); }
.search-result small { color: var(--ink-faint); }
.rail-section { padding: 17px 0 14px; border-bottom: 1px solid var(--line); }
.rail-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rail-section h3 { margin: 0; color: var(--ink-dim); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.filter-list { display: grid; gap: 4px; }
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 7px;
  border-radius: 8px;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 12px;
}
.filter-row:hover { color: var(--ink); background: rgba(255,255,255,.03); }
.filter-row input { accent-color: var(--cyan); }
.filter-row .count { margin-left: auto; color: var(--ink-faint); font: 10px var(--mono); }
.filter-list--compact .filter-row { font-size: 11px; }
.rail-foot { display: flex; justify-content: space-between; gap: 10px; padding-top: 14px; color: var(--ink-faint); font-size: 11px; }

.main-stage { min-width: 0; padding: clamp(20px, 4vw, 48px); }
.stage-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.view-header-copy { max-width: 760px; }
.view-header h1 { margin: 4px 0 8px; font-family: var(--serif); font-size: clamp(32px, 5vw, 62px); font-weight: 600; line-height: .98; letter-spacing: -.035em; }
.view-header p { margin: 0; max-width: 68ch; color: var(--ink-dim); font-size: clamp(13px, 1.4vw, 16px); }
.view-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 30px 0 13px; }
.section-heading h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.section-heading p { margin: 3px 0 0; color: var(--ink-faint); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-card,
.surface-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(24,32,28,.8), rgba(10,14,13,.9));
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.metric-card { min-height: 116px; padding: 17px; }
.metric-card::after { content: ""; position: absolute; right: -20px; bottom: -36px; width: 90px; height: 90px; border: 1px solid var(--line); border-radius: 50%; }
.metric-card strong { display: block; margin-top: 10px; font-family: var(--serif); font-size: 30px; font-weight: 500; }
.metric-card span:last-child { color: var(--ink-dim); font-size: 11px; }

.portal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.portal-card { min-height: 184px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; text-decoration: none; transition: transform .2s ease, border-color .2s ease; }
.portal-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.portal-card h3 { margin: 11px 0 4px; font-family: var(--serif); font-size: 23px; font-weight: 500; }
.portal-card p { margin: 0; color: var(--ink-dim); font-size: 12px; }
.portal-card .arrow { align-self: end; color: var(--cyan); font-size: 20px; }
.orbital-mark { position: relative; width: 46px; height: 46px; border: 1px solid var(--line-strong); border-radius: 50%; }
.orbital-mark::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--cyan-soft); border-radius: 50% 12% 50% 12%; transform: rotate(35deg); }
.orbital-mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; transform: translate(-50%,-50%); border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold-soft); }

.signal-band { display: grid; grid-template-columns: 1.25fr .75fr; gap: 12px; }
.signal-card { min-height: 260px; padding: 22px; }
.signal-card--cover { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .48fr); align-items: stretch; gap: 20px; }
.signal-copy { position: relative; z-index: 1; align-self: center; }
.signal-card h2 { max-width: 15ch; margin: 8px 0 12px; font-family: var(--serif); font-size: clamp(28px, 4vw, 46px); font-weight: 500; line-height: 1; }
.signal-card p { max-width: 62ch; color: var(--ink-dim); }
.signal-card .constellation-lines { position: absolute; inset: 0; pointer-events: none; opacity: .35; background: radial-gradient(circle at 70% 40%, rgba(110,213,212,.15), transparent 22%), linear-gradient(122deg, transparent 0 67%, rgba(228,191,111,.22) 67.2% 67.4%, transparent 67.6%); }
.signal-cover { position: relative; z-index: 1; min-height: 218px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #060808; }
.signal-cover::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 34px rgba(0,0,0,.5); pointer-events: none; }
.signal-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.signal-cover figcaption { position: absolute; z-index: 1; right: 9px; bottom: 8px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-dim); background: rgba(4,7,7,.78); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.daily-card { padding: 20px; cursor: pointer; }
.daily-card:hover { border-color: var(--cyan-soft); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.control-select,
.control-input,
.story-control {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.028);
}
.control-select { padding: 0 32px 0 12px; }
.control-input { padding: 0 12px; }
.result-note { color: var(--ink-faint); font-size: 11px; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.oracle-tile {
  position: relative;
  min-height: 265px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #0c1211;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(0,0,0,.2);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.oracle-tile:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 22px 48px rgba(0,0,0,.35); }
.tile-art {
  position: relative;
  height: 160px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tile-accent, var(--cyan)) 20%, transparent), transparent 42%),
    radial-gradient(circle at 50% 50%, #16201e 0 36%, #080c0b 37% 100%);
}
.tile-art::before { content: ""; width: 104px; height: 104px; border: 1px solid color-mix(in srgb, var(--tile-accent, var(--gold)) 75%, transparent); border-radius: 50%; box-shadow: inset 0 0 0 6px #0a0e0d, inset 0 0 0 7px rgba(228,191,111,.34), 0 0 30px color-mix(in srgb, var(--tile-accent, var(--cyan)) 16%, transparent); }
.tile-art::after { content: attr(data-glyph); position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: var(--tile-accent, var(--gold)); font-family: var(--serif); font-size: 45px; text-shadow: 0 0 18px color-mix(in srgb, var(--tile-accent, var(--cyan)) 50%, transparent); }
.tile-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-copy { display: grid; gap: 5px; padding: 14px; }
.tile-copy h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.1; }
.tile-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--ink-dim); font-size: 11px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-faint); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.evidence-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--gold); }

.empty-state { display: grid; place-items: center; min-height: 280px; padding: 40px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-dim); text-align: center; }
.empty-state h2 { margin: 0 0 6px; color: var(--ink); font-family: var(--serif); }

.graph-shell { position: relative; min-height: min(720px, calc(100vh - 275px)); min-height: min(720px, calc(100dvh - 275px)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(circle at 50% 50%, rgba(32,70,66,.14), transparent 38%), rgba(4,7,7,.86); }
.graph-canvas { width: 100%; height: min(720px, calc(100vh - 275px)); height: min(720px, calc(100dvh - 275px)); min-height: 480px; display: block; touch-action: none; }
.graph-edge { stroke: rgba(117,142,134,.28); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graph-edge-hit { stroke: transparent; stroke-width: 14; vector-effect: non-scaling-stroke; cursor: pointer; pointer-events: stroke; }
.graph-edge-hit:hover, .graph-edge-hit:focus, .graph-edge-hit:focus-visible { stroke: rgba(110,213,212,.34); outline: none; }
.graph-edge.is-active { stroke: var(--gold); stroke-width: 1.7; }
.graph-edge--symbolic { stroke-dasharray: 5 5; }
.graph-edge--causal { stroke: rgba(229,135,87,.45); }
.graph-edge--historical { stroke: rgba(168,150,232,.42); }
.graph-node { cursor: pointer; }
.graph-node .graph-node-hit { fill: transparent; stroke: transparent; pointer-events: all; }
.graph-node .graph-node-mark { fill: #0c1412; stroke: var(--node-color, var(--gold)); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.graph-node:hover .graph-node-mark, .graph-node:focus .graph-node-mark { fill: #172522; stroke-width: 2.5; }
.graph-node.is-center .graph-node-mark { fill: #172725; filter: drop-shadow(0 0 12px rgba(110,213,212,.5)); }
.graph-node text { fill: var(--ink-dim); font: 10px var(--sans); pointer-events: none; text-anchor: middle; paint-order: stroke; stroke: #070908; stroke-width: 3px; }
.graph-legend { position: absolute; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; max-width: calc(100% - 28px); padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(8,12,11,.88); font-size: 9px; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-faint); }
.legend-line { width: 20px; height: 1px; background: var(--gold); }

.lineage-list { display: grid; gap: 14px; }
.lineage-card { padding: 20px; }
.lineage-card-header { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.lineage-card h2 { margin: 3px 0 5px; font-family: var(--serif); font-size: 25px; font-weight: 500; }
.lineage-card p { margin: 0; color: var(--ink-dim); }
.lineage-path { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 17px 2px 4px; }
.lineage-node { position: relative; min-width: 142px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); cursor: pointer; }
.lineage-node:hover { border-color: var(--cyan-soft); }
.lineage-node + .lineage-node { margin-left: 25px; }
.lineage-node + .lineage-node::before { content: "→"; position: absolute; left: -21px; color: var(--gold-soft); }
.lineage-node strong { display: block; font-family: var(--serif); font-size: 14px; }
.lineage-node small { color: var(--ink-faint); }

.oracle-table { width: 100%; border-collapse: collapse; }
.oracle-table th, .oracle-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.oracle-table th { color: var(--ink-faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.oracle-table tbody tr { cursor: pointer; }
.oracle-table tbody tr:hover { background: rgba(110,213,212,.035); }

.divination-stage { min-height: 500px; display: grid; place-items: center; padding: clamp(20px, 5vw, 56px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: radial-gradient(circle at center, rgba(110,213,212,.1), transparent 44%), rgba(7,10,10,.8); }
.draw-setup { width: min(620px, 100%); text-align: center; }
.draw-setup h2 { margin: 8px 0 10px; font-family: var(--serif); font-size: clamp(36px, 6vw, 64px); font-weight: 500; line-height: 1; }
.draw-setup p { color: var(--ink-dim); }
.draw-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 20px; }
.draw-controls input { min-width: min(290px, 100%); }
.draw-result { width: 100%; }
.draw-grid { display: grid; grid-template-columns: repeat(var(--draw-count, 3), minmax(0, 1fr)); gap: 14px; }
.draw-card { min-width: 0; padding: 18px; text-align: center; }
.draw-card .mini-sigil { margin: 0 auto 14px; }
.draw-card h3 { margin: 5px 0 5px; font-family: var(--serif); font-size: 24px; }
.draw-card p { color: var(--ink-dim); font-size: 12px; }
.draw-synthesis { margin-top: 14px; padding: 22px; border-left: 2px solid var(--cyan); background: rgba(110,213,212,.035); }
.draw-synthesis h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 21px; }

.mini-sigil { position: relative; width: 76px; height: 76px; display: grid; place-items: center; border: 1px solid var(--sigil-color, var(--gold)); border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.035), transparent 60%); box-shadow: inset 0 0 0 5px #0c1110, inset 0 0 0 6px var(--line), 0 0 22px rgba(110,213,212,.08); }
.mini-sigil::before { content: attr(data-glyph); color: var(--sigil-color, var(--gold)); font-family: var(--serif); font-size: 28px; }

.spread-grid, .game-grid, .visual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.spread-card, .game-card, .visual-card { padding: 18px; cursor: pointer; }
.spread-card:hover, .game-card:hover, .visual-card:hover { border-color: var(--line-strong); }
.spread-card h2, .game-card h2, .visual-card h2 { margin: 6px 0 6px; font-family: var(--serif); font-size: 23px; font-weight: 500; }
.spread-card p, .game-card p, .visual-card p { margin: 0; color: var(--ink-dim); font-size: 12px; }
.position-map { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.position-chip, .tag, .status-chip { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-dim); background: rgba(255,255,255,.02); font-size: 9px; }
.status-chip { color: var(--cyan); border-color: var(--cyan-soft); }

.story-workspace { display: grid; grid-template-columns: minmax(250px, .65fr) minmax(0, 1.35fr); gap: 14px; }
.story-controls, .story-output { padding: 20px; }
.story-controls { display: grid; align-content: start; gap: 14px; }
.story-control-group { display: grid; gap: 5px; }
.story-control-group label { color: var(--ink-dim); font-size: 11px; }
.story-control { width: 100%; min-height: 43px; padding: 0 11px; border-radius: 10px; }
.story-control[type="text"], textarea.story-control { padding: 11px; }
textarea.story-control { min-height: 92px; resize: vertical; }
.story-output h2 { margin: 4px 0 10px; font-family: var(--serif); font-size: 31px; font-weight: 500; }
.pool-status { margin: 12px 0; padding-left: 10px; border-left: 2px solid var(--cyan-soft); }
.pool-status strong { color: var(--ink-dim); }
.story-slot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-top: 16px; }
.story-slot { display: grid; gap: 3px; min-height: 104px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255,255,255,.02); text-align: left; cursor: pointer; }
.story-slot:hover { border-color: var(--cyan-soft); background: rgba(110,213,212,.04); }
.story-slot strong { font-family: var(--serif); font-size: 16px; }
.story-slot small { color: var(--ink-faint); font-size: 10px; }
.story-beats { display: grid; gap: 10px; margin-top: 17px; }
.story-beat { display: grid; grid-template-columns: 28px 1fr; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.story-beat-number { width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); font: 10px var(--mono); }
.story-beat h3 { margin: 0 0 3px; font-family: var(--serif); font-size: 18px; }
.story-beat p { margin: 0; color: var(--ink-dim); font-size: 12px; }

.research-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(250px, .8fr); gap: 14px; }
.research-panel { padding: 20px; }
.research-panel h2 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; }
.evidence-list { display: grid; gap: 8px; }
.evidence-card { padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.evidence-card strong { display: block; color: var(--gold); font-size: 12px; }
.evidence-card p { margin: 3px 0 0; color: var(--ink-dim); font-size: 11px; }

.visual-token { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.swatch { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--swatch); box-shadow: inset 0 0 12px rgba(255,255,255,.06); }
.sigil-showcase { position: relative; min-height: 220px; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); background: radial-gradient(circle, rgba(110,213,212,.13), transparent 55%); }
.sigil-showcase .mini-sigil { width: 130px; height: 130px; }
.sigil-showcase .mini-sigil::before { font-size: 50px; }

.download-list { display: grid; gap: 9px; }
.download-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 15px; padding: 14px 16px; text-decoration: none; }
.download-row:hover { border-color: var(--cyan-soft); }
.download-row strong { display: block; font-family: var(--serif); font-size: 17px; }
.download-row small { color: var(--ink-faint); }
.download-row span:last-child { color: var(--cyan); }

.context-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  width: min(var(--drawer-width), calc(100vw - 28px));
  height: 100vh;
  height: 100dvh;
  overflow: auto;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line-strong);
  background: rgba(10,15,14,.975);
  box-shadow: -28px 0 80px rgba(0,0,0,.5);
  transform: translateX(105%);
  transition: transform .24s ease;
  scrollbar-color: rgba(228,191,111,.26) transparent;
}
.context-drawer.is-open { transform: none; }
.drawer-handle { width: 36px; height: 3px; display: none; margin: -8px auto 12px; border-radius: 999px; background: var(--line-strong); }
.drawer-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.drawer-hero { display: grid; justify-items: center; gap: 11px; padding: 14px 0 20px; border-bottom: 1px solid var(--line); text-align: center; }
.drawer-hero h2 { margin: 0; font-family: var(--serif); font-size: 31px; font-weight: 500; line-height: 1; }
.drawer-hero p { margin: 0; color: var(--ink-dim); font-size: 12px; }
.drawer-section { padding: 17px 0; border-bottom: 1px solid var(--line); }
.drawer-section h3 { margin: 0 0 8px; color: var(--gold); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.drawer-section p { margin: 0 0 9px; color: var(--ink-dim); font-size: 12px; }
.drawer-section p:last-child { margin-bottom: 0; }
.drawer-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.drawer-list button, .drawer-list a { width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-dim); background: rgba(255,255,255,.02); text-align: left; text-decoration: none; cursor: pointer; }
.drawer-list button:hover, .drawer-list a:hover { color: var(--ink); border-color: var(--cyan-soft); }
.provenance-row { display: grid; grid-template-columns: 10px 1fr; gap: 8px; align-items: start; }
.provenance-row i { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--gold); }
.provenance-row strong { display: block; font-size: 11px; }
.provenance-row span { display: block; color: var(--ink-faint); font-size: 10px; }

.command-hint { position: fixed; z-index: 300; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: #101513; box-shadow: var(--shadow); color: var(--ink-dim); font-size: 11px; }
.noscript-message { position: fixed; z-index: 999; inset: auto 20px 20px; padding: 16px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: #20110f; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .portal-grid { grid-template-columns: repeat(2, 1fr); }
  .signal-band { grid-template-columns: 1fr; }
  .story-workspace, .research-layout { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --rail-width: 300px; }
  .mobile-filter-toggle, .rail-close { display: inline-flex; }
  .workspace { grid-template-columns: 1fr; }
  .filter-rail { position: fixed; z-index: 120; top: 0; left: 0; width: min(var(--rail-width), calc(100vw - 28px)); height: 100vh; height: 100dvh; padding-bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .24s ease; box-shadow: 24px 0 70px rgba(0,0,0,.55); }
  .filter-rail.is-open { transform: none; }
  .search-results { top: 115px; }
  .main-stage { padding: 24px 18px 42px; }
  .view-header { align-items: start; flex-direction: column; }
  .view-actions { justify-content: flex-start; }
  .draw-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

@media (max-width: 600px) {
  .masthead { min-height: 67px; padding: max(10px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right)) 10px max(13px, env(safe-area-inset-left)); }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy .eyebrow { display: none; }
  .masthead-actions .quiet-button:not(.mobile-filter-toggle) { display: none; }
  .masthead-actions > .primary-button { display: none; }
  .workspace { min-height: calc(100vh - 118px); min-height: calc(100dvh - 118px); }
  .portal-grid, .metric-grid, .spread-grid, .game-grid, .visual-grid { grid-template-columns: 1fr; }
  .signal-card--cover { grid-template-columns: 1fr; }
  .signal-cover { min-height: 190px; }
  .tile-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .oracle-tile { min-height: 218px; }
  .tile-art { height: 126px; }
  .tile-art::before { width: 82px; height: 82px; }
  .tile-art::after { font-size: 34px; }
  .tile-copy { padding: 11px; }
  .tile-copy h3 { font-size: 15px; }
  .tile-copy p { display: none; }
  .lineage-card { padding: 15px; }
  .draw-grid { grid-template-columns: 1fr; }
  .graph-shell { overflow-x: auto; overscroll-behavior-inline: contain; }
  .graph-canvas { width: 540px; min-width: 540px; touch-action: pan-x pan-y; }
  .context-drawer { top: auto; bottom: 0; width: 100%; max-height: 88vh; max-height: 88dvh; height: auto; min-height: 55vh; min-height: 55dvh; border: 1px solid var(--line-strong); border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .context-drawer.is-open { transform: none; }
  .drawer-handle { display: block; }
  .oracle-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .star-field { display: none; }
}

@media print {
  .ambient-field, .masthead-actions, .view-tabs, .filter-rail, .context-drawer { display: none !important; }
  body { color: #111; background: #fff; }
  .workspace { display: block; }
  .main-stage { padding: 0; }
  .surface-card, .metric-card, .oracle-tile { color: #111; background: #fff; box-shadow: none; break-inside: avoid; }
}
