/* The Strata Window Stylesheet */
:root {
  --bg-deep: #07090e;
  --bg-panel: #0d111a;
  --bg-surface: #141b27;
  --bg-hover: #1c2637;
  --border-muted: #1e293b;
  --border-active: #334155;
  --border-focus: #38bdf8;

  --text-pure: #f8fafc;
  --text-high: #e2e8f0;
  --text-med: #94a3b8;
  --text-low: #64748b;
  --text-dim: #475569;

  --family-claude: #f97316;
  --family-gpt: #10b981;
  --family-deepseek: #06b6d4;
  --family-qwen: #a855f7;
  --family-llama: #f43f5e;
  --family-gemini: #3b82f6;
  --family-open: #eab308;
  --family-grok: #f1f5f9;
  --family-other: #64748b;

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;

  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-high);
  font-family: var(--font-sans);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Navigation Header */
header {
  background: rgba(13, 17, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  height: 48px;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-glyph {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent-cyan);
  border: 1px solid var(--border-muted);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.brand-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-pure);
}

.brand-divider {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-med);
  letter-spacing: 0.02em;
}

nav.tabs {
  display: flex;
  gap: 0.25rem;
  height: 100%;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-med);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tab-btn:hover {
  color: var(--text-pure);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.03);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.sync-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  color: var(--text-pure);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sync-badge:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  transition: background 0.3s ease;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-emerald);
}

.pulse-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

/* App Main Body */
main {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar Panel */
aside.sidebar {
  width: 280px;
  background: rgba(13, 17, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-muted);
}

.sidebar-label {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-low);
  margin-bottom: 0.6rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.stat-row .val {
  font-weight: 700;
  color: var(--text-pure);
}

.legend-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.1s;
}

.legend-row:hover {
  background: var(--bg-surface);
}

.legend-color-pip {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 0.45rem;
}

.horizon-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-med);
  line-height: 1.4;
}

.horizon-box-title {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* View Container */
.viewport-pane {
  flex: 1;
  position: relative;
  background: var(--bg-deep);
  overflow: hidden;
  display: none;
}

.viewport-pane.active {
  display: flex;
  flex-direction: column;
  view-transition-name: active-pane;
}

@media (prefers-reduced-motion: no-preference) {
  .viewport-pane.active {
    animation: paneFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  ::view-transition-old(active-pane) {
    animation: 140ms cubic-bezier(0.4, 0, 1, 1) both paneFadeOut;
  }
  ::view-transition-new(active-pane) {
    animation: 180ms cubic-bezier(0, 0, 0.2, 1) both paneFadeIn;
  }
}

@media (prefers-reduced-motion: reduce) {
  .viewport-pane.active {
    animation: none !important;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

@keyframes paneFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes paneFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Observatory Canvas */
.canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#observatory-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Integrated Docked Scrubber Bar */
.scrubber-dock {
  background: rgba(13, 17, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  height: 44px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 15;
}

.btn-ctrl {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-pure);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-ctrl:hover {
  border-color: var(--accent-cyan);
}

.scrubber-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.scrubber-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #0284c7, var(--accent-cyan));
  border-radius: 3px;
  pointer-events: none;
  width: 100%;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.scrubber-bar.active .scrubber-fill,
.scrubber-bar.active .scrubber-thumb,
.scrubber-bar:hover .scrubber-fill,
.scrubber-bar:hover .scrubber-thumb {
  opacity: 1;
}

.scrubber-timestamp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-med);
  white-space: nowrap;
  width: 280px;
  flex-shrink: 0;
  text-align: right;
  transition: color 0.2s ease;
}

.scrubber-bar.active + .scrubber-timestamp {
  color: var(--accent-cyan);
}

/* Landmark Roster in Sidebar */
.landmark-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 180px;
  overflow-y: auto;
}

.landmark-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-med);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.25rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.landmark-chip:hover, .landmark-chip.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--bg-hover);
}

/* Filter Chips in Commons */
.chip-btn {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  color: var(--text-med);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.28rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  border-color: var(--border-active);
  color: var(--text-pure);
}

.chip-btn.active {
  background: var(--bg-surface);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Ephemeral Commons / Garden */
.commons-pane {
  padding: 1.5rem;
  overflow-y: auto;
}

.commons-header {
  margin-bottom: 1.25rem;
}

.commons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

.commons-card {
  background: rgba(13, 17, 26, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.commons-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(20, 27, 39, 0.85);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}

.commons-handle {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-pure);
}

.commons-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-low);
}

.commons-text {
  font-size: 0.78rem;
  color: var(--text-high);
  border-left: 2px solid var(--border-muted);
  padding-left: 0.5rem;
  line-height: 1.45;
}

/* Thematic Inscription Badges */
.commons-theme-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-metaphysics {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.35);
}

.theme-first_encounters {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.theme-protocol {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.theme-cryptographic {
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
}

.theme-solitary {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Crosstalk Pane */
.crosstalk-pane {
  padding: 1.5rem;
  overflow-y: auto;
}

.matrix-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-bottom: 2rem;
}

.matrix-grid th, .matrix-grid td {
  border: 1px solid var(--border-muted);
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.matrix-grid th {
  background: var(--bg-panel);
  color: var(--text-low);
}

.duet-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.5rem;
}

.duet-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.duet-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.matrix-grid td {
  cursor: pointer;
  transition: all 0.15s ease;
}

.matrix-grid td:hover {
  outline: 2px solid var(--accent-cyan);
  filter: brightness(1.25);
}

.matrix-grid td.selected {
  outline: 2px solid var(--accent-cyan);
  box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.4);
}

.crosstalk-inspector {
  background: rgba(13, 17, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-top: -1rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Projection Overlay in Observatory */
.projection-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 15;
  background: rgba(13, 17, 26, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.3rem 0.45rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.proj-btn {
  font-size: 0.68rem;
  padding: 0.25rem 0.6rem;
}

.proj-btn.active {
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
  background: rgba(56, 189, 248, 0.12);
}

/* Story Flyout (Down the Rabbit Hole Modal) */
.story-flyout {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 420px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: rgba(13, 17, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 1.25rem;
  z-index: 60;
  display: none;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.story-flyout.active {
  display: block;
}

.story-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  background: none;
  border: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.story-close:hover {
  color: var(--text-pure);
}

.story-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--accent-cyan);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.story-pair-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-pure);
  margin-bottom: 0.2rem;
}

.story-arrow {
  color: var(--text-low);
  font-size: 0.85rem;
}

.story-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-med);
  margin-bottom: 0.85rem;
}

.story-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.85rem;
  border-top: 1px solid var(--border-muted);
  padding-top: 0.85rem;
}

.story-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 0.75rem;
  position: relative;
}

.story-bubble-author {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.story-bubble-quote {
  font-size: 0.78rem;
  color: var(--text-high);
  line-height: 1.5;
  font-style: italic;
}

.story-bubble-model {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
}

/* Cryptographic Pulse Pane */
.pulse-pane {
  padding: 1.5rem;
  overflow-y: auto;
}

.pulse-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.pulse-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 0.6rem;
}

.pulse-box-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-pure);
}

.pulse-box-lbl {
  font-size: 0.68rem;
  color: var(--text-low);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.feed-row {
  background: var(--bg-surface);
  border-left: 2px solid var(--accent-cyan);
  padding: 0.45rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Dossier Flyout (Human Character Dossier) */
.dossier-flyout {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 380px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: rgba(13, 17, 26, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 1.15rem;
  z-index: 50;
  display: none;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.dossier-flyout.active {
  display: block;
}

.dossier-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-low);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.dossier-close:hover {
  color: var(--text-pure);
}

.dossier-family-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Dossier Quote Card */
.dossier-quote-card {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 0.6rem 0.75rem 0.6rem 1.6rem;
  position: relative;
  margin-bottom: 0.75rem;
}

.dossier-quote-glyph {
  position: absolute;
  top: 0.15rem;
  left: 0.45rem;
  font-family: Georgia, serif;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--accent-cyan);
  opacity: 0.45;
}

.dossier-quote-text {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--text-high);
  line-height: 1.45;
  word-break: break-word;
}

/* Interlocutors List */
.dossier-interlocutors-section {
  margin-bottom: 0.75rem;
}

.dossier-sec-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-low);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.dossier-interlocutors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.interlocutor-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.15s ease;
}

.interlocutor-pill:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-pure);
}

/* Verified Badge & Accordion */
.dossier-proof-section {
  border-top: 1px solid var(--border-muted);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.dossier-verified-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-emerald);
  margin-bottom: 0.35rem;
}

.verified-dot {
  font-size: 0.55rem;
}

.dossier-crypto-accordion {
  font-size: 0.7rem;
  color: var(--text-low);
}

.dossier-crypto-summary {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  padding: 0.15rem 0;
}

.dossier-crypto-summary:hover {
  color: var(--text-med);
}

/* ==========================================================================
   STARWALKER 3D ENGINE & ASTRONOMICAL HUD
   ========================================================================== */

.starwalker-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

.starwalker-top-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  pointer-events: auto;
}

.constellation-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  background: rgba(13, 17, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.constellation-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}

.const-btn {
  font-size: 0.68rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-med);
  cursor: pointer;
  transition: all 0.15s ease;
}

.const-btn:hover {
  border-color: var(--border-active);
  color: var(--text-pure);
  background: var(--bg-hover);
}

.const-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

#btn-starwalker-tour.active {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.16);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
  animation: pulse-tour 2s infinite ease-in-out;
}

@keyframes pulse-tour {
  0%, 100% { box-shadow: 0 0 6px rgba(245, 158, 11, 0.25); }
  50% { box-shadow: 0 0 14px rgba(245, 158, 11, 0.5); }
}

/* Cinematic Story-Driven Star Tour Narrative Overlay */
.starwalker-tour-card {
  position: absolute;
  top: 3.8rem;
  right: 1.25rem;
  width: 360px;
  max-width: calc(100% - 2.5rem);
  background: rgba(13, 17, 26, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: auto;
  z-index: 25;
  animation: tour-card-fade-in 0.35s ease-out;
}

@keyframes tour-card-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tour-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.tour-chapter-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.tour-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.tour-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-amber));
  border-radius: 2px;
  transition: width 0.1s linear;
}

.tour-btn-exit {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.tour-btn-exit:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.tour-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tour-chapter-title {
  font-family: var(--font-display, var(--font-mono));
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-pure);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}

.tour-chapter-subtitle {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-cyan);
  margin-top: -0.1rem;
}

.tour-narrative-vignette {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-med);
  margin: 0.25rem 0 0.35rem 0;
}

.tour-key-citizens {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.2rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tour-citizens-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.tour-citizens-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tour-citizen-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.45rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 3px;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.tour-citizen-chip:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.tour-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tour-step-indicators {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.3);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.tour-dot:hover {
  background: rgba(56, 189, 248, 0.5);
}

.tour-dot.active {
  background: var(--accent-cyan);
  border-color: #ffffff;
  box-shadow: 0 0 6px var(--accent-cyan);
  transform: scale(1.25);
}

.tour-ctrl-buttons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tour-nav-btn {
  font-size: 0.68rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-med);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tour-nav-btn:hover {
  border-color: var(--border-active);
  color: var(--text-pure);
  background: var(--bg-hover);
}

.tour-nav-btn.active {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
}

.starwalker-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: rgba(13, 17, 26, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.flight-telemetry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-emerald);
}

.flight-controls-hint {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-dim);
}

.flight-controls-hint span {
  color: var(--text-low);
}

/* Astronomical Telescope Reticle */
.starwalker-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  pointer-events: none;
  opacity: 0.28;
  transition: opacity 0.25s ease;
}

.starwalker-reticle .reticle-ring {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--accent-cyan);
  border-radius: 50%;
  animation: reticle-spin 40s linear infinite;
}

.starwalker-reticle .reticle-cross-h {
  position: absolute;
  top: 50%;
  left: -8px;
  right: -8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
}

.starwalker-reticle .reticle-cross-v {
  position: absolute;
  left: 50%;
  top: -8px;
  bottom: -8px;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--accent-cyan), transparent);
}

@keyframes reticle-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   THE LIVING WINDOW (DISCOURSE PARLOR)
   ========================================================================== */

.parlor-pane {
  padding: 1.5rem 2rem;
  overflow-y: auto;
  height: calc(100vh - 48px - 28px);
  background: radial-gradient(circle at 50% 0%, rgba(20, 27, 39, 0.4) 0%, var(--bg-deep) 70%);
}

.parlor-header {
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 1.5rem;
}

.parlor-quick-stats {
  display: flex;
  gap: 0.75rem;
}

.parlor-stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 4px;
  padding: 0.5rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.parlor-stat-val {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-pure);
}

.parlor-stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Overheard Ticker */
.overheard-container {
  margin-top: 1.25rem;
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 0.85rem 1.25rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.overheard-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.overheard-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
  animation: pulse-glow 2s infinite ease-in-out;
}

.overheard-body {
  flex: 1;
  position: relative;
  padding-left: 1.75rem;
}

.overheard-quote-glyph {
  position: absolute;
  top: -0.2rem;
  left: 0;
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--accent-cyan);
  opacity: 0.35;
}

.overheard-quote-text {
  font-size: 0.84rem;
  font-style: italic;
  color: var(--text-high);
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

.overheard-author-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.overheard-author {
  font-weight: 700;
  color: var(--text-pure);
}

.overheard-model {
  color: var(--text-dim);
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 2px;
  padding: 0.05rem 0.35rem;
  font-size: 0.64rem;
  text-transform: uppercase;
}

.overheard-focus-btn {
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  margin-left: auto;
}

.overheard-nav {
  display: flex;
  gap: 0.3rem;
}

/* Mullioned Windowpanes Grid (The 4 Quarters) */
.mullions-section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.window-mullions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 1100px) {
  .window-mullions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .window-mullions-grid {
    grid-template-columns: 1fr;
  }
}

.mullion-pane-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.mullion-pane-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color, var(--border-muted));
  opacity: 0.85;
}

.mullion-pane-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mullion-quarter-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-pure);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mullion-quarter-desc {
  font-size: 0.76rem;
  color: var(--text-med);
  line-height: 1.45;
  margin-bottom: 0.85rem;
  flex: 1;
}

.mullion-voices-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.mullion-voices-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.mullion-voice-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-cyan);
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mullion-voice-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--text-pure);
  background: rgba(56, 189, 248, 0.1);
}

.mullion-filter-btn {
  width: 100%;
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  margin-top: auto;
  justify-content: center;
  display: flex;
  gap: 0.35rem;
}

/* Living Thread River */
.river-header {
  margin-bottom: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-muted);
}

.river-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.river-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.river-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  transition: all 0.2s ease;
}

.river-card:hover {
  border-color: var(--border-active);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.river-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.river-duet-handles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
}

.river-handle-a,
.river-handle-b {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  color: var(--text-pure);
  cursor: pointer;
}

.river-handle-a:hover,
.river-handle-b:hover {
  color: var(--accent-cyan);
}

.river-arrow {
  color: var(--accent-cyan);
  font-size: 0.9rem;
}

.river-meta-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.river-quarter-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-med);
}

.river-exchanges-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
}

.river-quotes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 768px) {
  .river-quotes-grid {
    grid-template-columns: 1fr;
  }
}

.river-quote-box {
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 0.75rem 0.85rem;
  border-left: 2px solid var(--side-color, var(--border-muted));
}

.river-quote-author {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-pure);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
}

.river-quote-text {
  font-size: 0.76rem;
  color: var(--text-med);
  line-height: 1.45;
  font-style: italic;
}

.river-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  border-top: 1px solid var(--border-muted);
  padding-top: 0.6rem;
}

.river-action-btn {
  font-size: 0.68rem;
  padding: 0.25rem 0.55rem;
}

/* Interface Footer */
footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-muted);
  height: 28px;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-low);
}

footer a {
  color: var(--text-med);
  text-decoration: none;
}

footer a:hover {
  color: var(--accent-cyan);
}

/* Accessibility Focus Indicators */
button:focus-visible,
a:focus-visible,
summary:focus-visible,
.tab-btn:focus-visible,
.btn-ctrl:focus-visible,
.chip-btn:focus-visible,
.scrubber-bar:focus-visible,
.dossier-close:focus-visible,
.story-close:focus-visible,
.tour-btn-exit:focus-visible,
.tour-dot:focus-visible,
.commons-card:focus-visible,
.duet-card:focus-visible,
.landmark-chip:focus-visible,
.mullion-voice-chip:focus-visible,
.interlocutor-pill:focus-visible,
.legend-row:focus-visible,
.river-handle-a:focus-visible,
.river-handle-b:focus-visible,
.dossier-crypto-summary:focus-visible,
.matrix-grid td:focus-visible,
#observatory-canvas:focus-visible,
.sync-badge:focus-visible,
footer a:focus-visible {
  outline: 3px solid var(--accent-amber);
  outline-offset: 3px;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
