/* style.css — DECK cosmos frontend */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', Courier, monospace;
}

#graph-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ─── HUD ──────────────────────────────────────────────────────────────── */

#hud {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 100;
  color: #4fe3ff;
  font-size: 11px;
  line-height: 1.7;
  pointer-events: none;
  user-select: none;
  text-shadow: 0 0 8px #4fe3ffaa;
}

#hud-title {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.12em;
  color: #7ff8ff;
  text-shadow: 0 0 14px #4fe3ffcc, 0 0 30px #4fe3ff44;
  margin-bottom: 6px;
}

#hud-status {
  color: #4fe3ff;
  margin-bottom: 8px;
  min-height: 1.4em;
}

#hud-status.scanning::after {
  content: ' ◉';
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

#hud-counts {
  margin-bottom: 8px;
}

.hud-count-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1px;
}

.hud-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hud-type-label {
  color: #6ecfdf;
  width: 64px;
  display: inline-block;
}

.hud-count-val {
  color: #c8f6ff;
  min-width: 20px;
  text-align: right;
}

#hud-tiers {
  border-top: 1px solid #4fe3ff22;
  padding-top: 6px;
  margin-top: 4px;
  color: #4fe3ff99;
}

.hud-tier-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.hud-tier-row .tier-name {
  color: #4fe3ff77;
}

.hud-tier-row .tier-ms {
  color: #4fe3ffcc;
}

/* ─── Direction legend (access channel) ────────────────────────────────── */

#hud-direction-legend {
  border-top: 1px solid #4fe3ff22;
  padding-top: 6px;
  margin-top: 4px;
}

.hud-dir-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 1px;
}

.hud-dir-label {
  color: #6ecfdf;
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* ─── Data-mode badge ───────────────────────────────────────────────────── */

#deck-data-mode {
  position: fixed;
  bottom: 14px;
  right: 16px;
  z-index: 300;
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 99px;
  pointer-events: none;
  user-select: none;
  border: 1px solid currentColor;
  opacity: 0.85;
}

#deck-data-mode.live {
  color: #39ff7a;
  background: rgba(0, 30, 10, 0.72);
  text-shadow: 0 0 8px #39ff7acc;
  border-color: #39ff7a66;
}

#deck-data-mode.demo {
  color: #ffb347;
  background: rgba(28, 14, 0, 0.72);
  text-shadow: 0 0 8px #ffb34799;
  border-color: #ffb34766;
}

/* ─── Nav bar ───────────────────────────────────────────────────────────── */

#deck-nav {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
}

#deck-target {
  width: 220px;
  background: rgba(0, 20, 40, 0.72);
  border: 1px solid #4fe3ff44;
  border-radius: 3px;
  color: #4fe3ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  padding: 5px 9px;
  outline: none;
  text-shadow: 0 0 6px #4fe3ff88;
  transition: border-color 0.18s, box-shadow 0.18s;
}

#deck-target::placeholder {
  color: #4fe3ff44;
}

#deck-target:focus {
  border-color: #4fe3ffcc;
  box-shadow: 0 0 8px #4fe3ff44;
}

#deck-go {
  background: transparent;
  border: 1px solid #4fe3ff88;
  border-radius: 3px;
  color: #4fe3ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  cursor: pointer;
  text-shadow: 0 0 6px #4fe3ff88;
  transition: border-color 0.18s, box-shadow 0.18s, color 0.18s;
}

#deck-go:hover {
  border-color: #4fe3ff;
  box-shadow: 0 0 10px #4fe3ff66;
  color: #c8f6ff;
}

#deck-go:active {
  box-shadow: 0 0 16px #4fe3ffaa;
}

/* ─── Warp-active body hook ─────────────────────────────────────────────── */

body.warp-active #deck-nav {
  pointer-events: none;
  opacity: 0.4;
  transition: opacity 0.3s;
}

body.warp-active::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  background: radial-gradient(
    ellipse 100% 100% at 50% 50%,
    transparent 30%,
    rgba(0, 10, 30, 0.55) 100%
  );
}

/* ─── Tooltip ───────────────────────────────────────────────────────────── */

#node-tooltip {
  position: fixed;
  z-index: 200;
  background: rgba(0, 8, 16, 0.82);
  border: 1px solid #4fe3ff44;
  color: #c8f6ff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 8px 12px;
  border-radius: 4px;
  pointer-events: none;
  max-width: 260px;
  text-shadow: 0 0 6px #4fe3ff55;
  display: none;
}

/* ═══ INFO CARD (inspector) — left rail, opens on click, live-updates ═══════ */

#deck-inspector {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 360px;
  max-width: 86vw;
  z-index: 400;
  --accent: #4fe3ff;
  background: rgba(6, 10, 16, 0.92);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  border-right: 1px solid var(--accent);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6), inset -1px 0 18px rgba(79, 227, 255, 0.12);
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  flex-direction: column;
  transform: translateX(-112%);
  transition: transform 0.32s cubic-bezier(.22, .61, .36, 1);
}
#deck-inspector.open { transform: translateX(0); }
#deck-inspector[hidden] { display: none; }

.insp-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(79, 227, 255, 0.14);
}
.insp-ico { width: 40px; height: 40px; flex: 0 0 auto; }
.insp-id { flex: 1 1 auto; min-width: 0; }
.insp-label {
  color: #eafcff; font-size: 15px; font-weight: bold; letter-spacing: 0.02em;
  word-break: break-all; line-height: 1.2; text-shadow: 0 0 10px var(--accent);
}
.insp-type {
  color: var(--accent); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.14em; margin-top: 3px;
}
.insp-type .al-up { color: #39ff7a; }
.insp-type .al-dn { color: #ff5b5b; }
.insp-x {
  flex: 0 0 auto; width: 24px; height: 24px;
  background: transparent; border: 1px solid rgba(79, 227, 255, 0.3);
  border-radius: 4px; color: #9fd6e6; cursor: pointer; font-size: 15px; line-height: 1;
}
.insp-x:hover { border-color: var(--accent); box-shadow: 0 0 10px rgba(79, 227, 255, 0.4); color: #eafcff; }
.insp-idline { padding: 6px 14px 0; }
.insp-idline code { color: #7fb6c8; font-size: 10px; word-break: break-all; }
.insp-note { padding: 6px 14px 0; color: #8fb6c4; font-size: 10.5px; line-height: 1.5; font-style: italic; }

.insp-hero { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 4px; }
.hero-cell {
  --hc: var(--accent); flex: 1 1 64px; min-width: 62px;
  background: rgba(79, 227, 255, 0.05);
  border: 1px solid rgba(79, 227, 255, 0.16); border-left: 2px solid var(--hc);
  border-radius: 3px; padding: 6px 8px;
}
.hero-v { color: #eafcff; font-size: 14px; font-weight: bold; word-break: break-all; }
.hero-k { color: #7fa6b4; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

.insp-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 12px 12px; }
.insp-body::-webkit-scrollbar { width: 7px; }
.insp-body::-webkit-scrollbar-thumb { background: rgba(79, 227, 255, 0.22); border-radius: 4px; }
#deck-inspector details {
  border: 1px solid rgba(79, 227, 255, 0.1); border-radius: 4px;
  margin-top: 6px; background: rgba(0, 12, 20, 0.35);
}
#deck-inspector summary {
  cursor: pointer; padding: 6px 10px; color: var(--accent);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  list-style: none; user-select: none;
}
#deck-inspector summary::-webkit-details-marker { display: none; }
#deck-inspector summary:hover { color: #cdf6ff; }
.kv { padding: 2px 10px 8px; }
.kv-row { display: flex; gap: 10px; padding: 2px 0; border-bottom: 1px dashed rgba(79, 227, 255, 0.06); }
.kv-k { color: #79a4b2; font-size: 10.5px; flex: 0 0 38%; word-break: break-word; }
.kv-v { color: #d8f6ff; font-size: 10.5px; flex: 1 1 auto; word-break: break-word; text-align: right; }
.edges { padding: 2px 10px 8px; }
.edge { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-size: 10.5px; }
.edge-rel { color: #6fb0a0; flex: 0 0 34%; word-break: break-word; }
.edge-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 5px currentColor; }
.edge-to { color: #cfeefa; word-break: break-all; }

.insp-actions { border-top: 1px solid rgba(79, 227, 255, 0.14); padding: 10px 12px; }
.insp-fly {
  width: 100%; background: transparent; border: 1px solid var(--accent);
  border-radius: 4px; color: var(--accent); font-family: inherit; font-weight: bold;
  letter-spacing: 0.1em; padding: 7px; cursor: pointer; text-shadow: 0 0 6px var(--accent);
}
.insp-fly:hover { box-shadow: 0 0 14px rgba(79, 227, 255, 0.4); color: #eafcff; }
.insp-cmds { margin-top: 8px; }
.cmd-list { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 10px 8px; }
.cmd-b {
  background: rgba(79, 227, 255, 0.06); border: 1px solid rgba(79, 227, 255, 0.22);
  border-radius: 3px; color: #bfe9f6; font-family: inherit; font-size: 10px;
  padding: 4px 7px; cursor: pointer;
}
.cmd-b:hover { border-color: var(--accent); color: #eafcff; }
.cmd-b.agg { border-color: rgba(255, 120, 80, 0.4); color: #ffb38f; }
.cmd-b.agg:hover { border-color: #ff7a4d; box-shadow: 0 0 8px rgba(255, 120, 80, 0.4); }

/* push the left-side furniture aside when the rail opens */
#hud, #deck-codex-toggle, #deck-codex-panel { transition: transform 0.32s cubic-bezier(.22, .61, .36, 1); }
body.inspector-open #hud,
body.inspector-open #deck-codex-toggle,
body.inspector-open #deck-codex-panel { transform: translateX(372px); }

/* ═══ SYMBOL SOURCEBOOK (codex) — the mini-game ════════════════════════════ */

#deck-codex-toggle {
  position: fixed; left: 16px; bottom: 14px; z-index: 320;
  background: rgba(6, 12, 20, 0.82); border: 1px solid #4fe3ff55; border-radius: 99px;
  color: #9fe8ff; font-family: 'Courier New', Courier, monospace; font-size: 11px;
  letter-spacing: 0.06em; padding: 5px 12px; cursor: pointer; text-shadow: 0 0 8px #4fe3ff88;
}
#deck-codex-toggle b { color: #eafcff; }
#deck-codex-toggle:hover, #deck-codex-toggle.active {
  border-color: #4fe3ff; box-shadow: 0 0 14px #4fe3ff55; color: #eafcff;
}

#deck-codex-panel {
  position: fixed; left: 16px; bottom: 46px; z-index: 319;
  width: 330px; max-width: 86vw; max-height: 62vh; overflow-y: auto;
  background: rgba(6, 10, 16, 0.94);
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  border: 1px solid #4fe3ff44; border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 22px rgba(79, 227, 255, 0.12);
  padding: 12px;
}
#deck-codex-panel[hidden] { display: none; }
#deck-codex-panel::-webkit-scrollbar { width: 7px; }
#deck-codex-panel::-webkit-scrollbar-thumb { background: rgba(79, 227, 255, 0.22); border-radius: 4px; }
.codex-head {
  color: #7ff8ff; font-size: 12px; font-weight: bold; letter-spacing: 0.12em;
  text-shadow: 0 0 12px #4fe3ff88; display: flex; justify-content: space-between; align-items: baseline;
}
.codex-prog { color: #9fe8ff; font-size: 10px; letter-spacing: 0.06em; }
.codex-sub { color: #6f93a2; font-size: 9.5px; margin: 4px 0 10px; line-height: 1.4; }
.codex-grid { display: flex; flex-direction: column; gap: 5px; }
.codex-row {
  display: flex; align-items: center; gap: 9px; padding: 5px 6px;
  border: 1px solid rgba(79, 227, 255, 0.1); border-radius: 5px; background: rgba(0, 12, 20, 0.4);
}
.codex-row.locked { opacity: 0.5; }
.codex-ico { width: 34px; height: 34px; flex: 0 0 auto; }
.codex-meta { min-width: 0; }
.codex-name {
  color: #eafcff; font-size: 11px; font-weight: bold; text-transform: uppercase;
  letter-spacing: 0.06em; display: flex; align-items: baseline; gap: 6px;
}
.codex-row.locked .codex-name { color: #5f6b7e; }
.codex-fam { color: #5f93a2; font-size: 8px; letter-spacing: 0.1em; }
.codex-desc { color: #8fb0bd; font-size: 9.5px; line-height: 1.35; margin-top: 1px; }
.codex-row.locked .codex-desc { color: #566570; }

#deck-codex-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 500;
  --accent: #4fe3ff; display: flex; align-items: center; gap: 10px;
  background: rgba(6, 12, 20, 0.94); border: 1px solid var(--accent); border-radius: 8px;
  padding: 9px 14px 9px 10px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6), 0 0 22px var(--accent);
  opacity: 0; pointer-events: none; max-width: 90vw;
  transition: opacity 0.35s, transform 0.35s;
}
#deck-codex-toast.show { opacity: 1; transform: translate(-50%, 0); }
#deck-codex-toast canvas { width: 30px; height: 30px; flex: 0 0 auto; }
.toast-tag { color: var(--accent); font-size: 8.5px; letter-spacing: 0.16em; text-transform: uppercase; }
.toast-name { color: #eafcff; font-size: 13px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.04em; }
.toast-desc { color: #8fb0bd; font-size: 9.5px; margin-top: 1px; }
