/* OURAVOX · Council of Elders — Game Designer Studio & Configurable Wiki */
:root {
  --bg: #0a0c12;
  --bg-2: #0f131d;
  --card: #121622;
  --card-2: #171c2b;
  --card-glass: rgba(18, 22, 34, 0.84);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #eef1f8;
  --ink-2: #a5aec4;
  --muted: #768099;

  --gold: #f0cb58;
  --gold-dim: rgba(240, 203, 88, 0.16);
  --gold-line: rgba(240, 203, 88, 0.45);
  --cyan: #52d8f8;
  --cyan-dim: rgba(82, 216, 248, 0.14);
  --emerald: #58e28c;
  --emerald-dim: rgba(88, 226, 140, 0.15);
  --crimson: #f56a62;
  --crimson-dim: rgba(245, 106, 98, 0.16);
  --violet: #b08cff;

  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 16px;
  --topbar-h: 58px;
  --rail-w: 258px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-gold: 0 0 0 1px rgba(240, 203, 88, 0.45), 0 8px 26px rgba(240, 203, 88, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
.small { font-size: 12.5px; }
.muted { color: var(--ink-2); }

/* Ambient deep space backdrop */
.studio-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(960px 540px at 14% -8%, rgba(240, 203, 88, 0.085), transparent 60%),
    radial-gradient(840px 500px at 88% 8%, rgba(82, 216, 248, 0.08), transparent 58%),
    radial-gradient(700px 520px at 50% 108%, rgba(88, 226, 140, 0.05), transparent 62%),
    linear-gradient(180deg, #0a0c12 0%, #0b0e16 100%);
}

/* Custom sleek scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(240,203,88,0.45); border: 2px solid transparent; background-clip: content-box; }

/* ---------------- TOP BAR ---------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 16px;
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-center { flex: 1 1 360px; max-width: 520px; min-width: 180px; }

.studio-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}
.studio-brand:hover { text-decoration: none; }
.brand-cube { flex: none; filter: drop-shadow(0 0 8px rgba(240, 203, 88, 0.35)); }
.brand-text { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-title { letter-spacing: 0.09em; font-size: 14.5px; color: var(--gold); }
.brand-sep { color: var(--muted); }
.brand-sub { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.back-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.back-link:hover { color: var(--ink); border-color: var(--gold-line); background: var(--gold-dim); text-decoration: none; }

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.04);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge-pill.gold { color: var(--gold); border-color: var(--gold-line); background: var(--gold-dim); }
.badge-pill.cyan { color: var(--cyan); border-color: rgba(82,216,248,0.4); background: var(--cyan-dim); }
.badge-pill.emerald { color: var(--emerald); border-color: rgba(88,226,140,0.4); background: var(--emerald-dim); }
.badge-pill.crimson { color: var(--crimson); border-color: rgba(245,106,98,0.45); background: var(--crimson-dim); }

/* Global Search */
.search-wrap { position: relative; width: 100%; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#global-search {
  width: 100%;
  background: rgba(18, 22, 34, 0.92);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 34px 7px 34px;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#global-search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240, 203, 88, 0.14); }
.search-kbd {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 5px;
  line-height: 18px;
  pointer-events: none;
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  max-height: 410px;
  overflow-y: auto;
  background: #131826;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.65);
  z-index: 60;
  padding: 6px;
}
.search-hit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.search-hit:hover, .search-hit.active { background: rgba(240, 203, 88, 0.12); }
.search-hit-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.search-swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(255,255,255,0.25); }
.search-hit-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Status & Changes pills */
.status-pill, .changes-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, transform .12s;
}
.status-pill:hover, .changes-pill:hover { border-color: var(--gold-line); background: var(--card-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 8px currentColor; }
.status-dot.ready { background: var(--emerald); color: var(--emerald); }
.status-dot.warn { background: var(--gold); color: var(--gold); }
.status-dot.err { background: var(--crimson); color: var(--crimson); }

.changes-pill.has-changes {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(240,203,88,0.22), rgba(240,203,88,0.08));
  color: #fff4cc;
  box-shadow: 0 0 18px rgba(240, 203, 88, 0.22);
}
.changes-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
  font-size: 11.5px;
}
.changes-pill.has-changes .changes-count { background: var(--gold); color: #161104; font-weight: 800; }

.mobile-nav-toggle { display: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { border-color: var(--gold-line); color: var(--gold); }

/* ---------------- SHELL & LEFT NAV RAIL ---------------- */
.studio-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}
.nav-rail {
  position: fixed;
  top: var(--topbar-h);
  left: 0; bottom: 0;
  width: var(--rail-w);
  background: rgba(12, 15, 24, 0.92);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  z-index: 30;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 8px;
}
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item svg { flex: none; opacity: 0.78; }
.nav-item span:nth-child(2) { flex: 1; min-width: 0; }
.nav-item:hover { background: rgba(255,255,255,0.045); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(240, 203, 88, 0.17), rgba(240, 203, 88, 0.04));
  border-color: var(--gold-line);
  color: #fff6d6;
}
.nav-item.active svg { color: var(--gold); opacity: 1; }
.nav-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.nav-item.active .nav-count { background: rgba(240,203,88,0.22); color: var(--gold); }

.nav-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.nav-meta-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
}
.nav-meta-row { display: flex; justify-content: space-between; gap: 8px; }
.nav-quick-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------------- MAIN WORKSPACE ---------------- */
.workspace {
  margin-left: var(--rail-w);
  flex: 1;
  min-width: 0;
  padding: 22px 26px 48px;
  max-width: 1680px;
}
.view-section { animation: fadeSlide .18s ease-out; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.banner-notice {
  margin-bottom: 16px;
  padding: 11px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--gold-line);
  background: rgba(240, 203, 88, 0.1);
  color: #fff2c2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
h1 { margin: 0; font-size: clamp(22px, 2.3vw, 28px); letter-spacing: -0.015em; line-height: 1.18; }
h2 { margin: 0; font-size: 16.5px; letter-spacing: -0.01em; }
h3 { margin: 0; font-size: 14px; font-weight: 700; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.section-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Cards & Buttons */
.glass-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-head p { margin: 3px 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { border-color: var(--gold-line); background: #1e2538; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.xs { padding: 3px 7px; font-size: 11px; border-radius: 6px; }
.btn.full { width: 100%; }
.btn.primary {
  background: linear-gradient(135deg, #f0cb58, #d8a934);
  border-color: #f6dc84;
  color: #161103;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(240, 203, 88, 0.22);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn.cyan { border-color: rgba(82,216,248,0.45); background: var(--cyan-dim); color: #bff2ff; }
.btn.cyan:hover:not(:disabled) { background: rgba(82,216,248,0.22); }
.btn.gold { border-color: var(--gold-line); background: var(--gold-dim); color: #ffefc0; }
.btn.danger { border-color: rgba(245,106,98,0.5); background: var(--crimson-dim); color: #ffd4d1; }
.btn.danger:hover:not(:disabled) { background: rgba(245,106,98,0.26); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { color: var(--ink); background: rgba(255,255,255,0.04); }
.file-btn { position: relative; overflow: hidden; }

.segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--gold); color: #161103; }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill {
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.pill:hover { border-color: var(--line-strong); color: var(--ink); }
.pill.active { border-color: var(--gold); background: var(--gold-dim); color: #fff4cc; }

.inline-search, select, input[type="text"], input[type="number"], textarea {
  background: rgba(9, 11, 18, 0.9);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.inline-search:focus, select:focus, input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(240, 203, 88, 0.16);
}
.inline-search { min-width: 220px; }

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.12);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #121622;
  box-shadow: 0 0 8px rgba(240,203,88,0.5);
  transition: transform .1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.16); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #121622;
}

/* ---------------- 1. OVERVIEW ---------------- */
.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 280px);
  gap: 20px;
  align-items: center;
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gold-line);
  background:
    radial-gradient(560px 260px at 92% 18%, rgba(240, 203, 88, 0.16), transparent 65%),
    radial-gradient(480px 260px at 14% 100%, rgba(82, 216, 248, 0.12), transparent 65%),
    linear-gradient(145deg, #151a2a 0%, #0f1320 100%);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.hero-lead { color: var(--ink-2); max-width: 66ch; margin: 10px 0 18px; font-size: 14px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.hero-emblem { display: grid; place-items: center; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 11px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.kpi-card:hover { border-color: var(--gold-line); transform: translateY(-2px); background: var(--card-2); }
.kpi-val { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.kpi-lbl { font-size: 11.5px; color: var(--ink-2); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: 16px;
}
.quick-jump-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.qj-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.qj-card:hover { border-color: var(--cyan); background: rgba(82,216,248,0.07); transform: translateY(-2px); }
.qj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qj-title { font-weight: 700; font-size: 13.5px; }
.qj-desc { font-size: 12px; color: var(--ink-2); line-height: 1.4; }

.overrides-mini-list { display: flex; flex-direction: column; gap: 7px; max-height: 310px; overflow-y: auto; }
.override-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--gold-line);
  background: rgba(240,203,88,0.06);
  font-size: 12px;
}

/* ---------------- 2. CRAFTING TREES & WORKBENCHES ---------------- */
.workbench-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.wb-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card-glass);
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.wb-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.wb-card.active { border-color: var(--gold); box-shadow: var(--shadow-gold); background: linear-gradient(135deg, rgba(240,203,88,0.14), rgba(18,22,34,0.92)); }
.wb-icon { flex: none; width: 46px; height: 46px; }
.wb-body { min-width: 0; flex: 1; }
.wb-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-spec { font-size: 11px; color: var(--cyan); margin-top: 1px; }
.wb-bonus { font-size: 11px; color: var(--ink-2); margin-top: 3px; line-height: 1.3; }

.crafting-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 15px;
  margin-bottom: 14px;
}
.crafting-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: 7px; }
.field-lbl { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.zoom-bar { display: inline-flex; align-items: center; gap: 5px; }
.zoom-readout { min-width: 44px; text-align: center; font-size: 12px; color: var(--ink-2); }

.crafting-split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 430px);
  gap: 14px;
  align-items: start;
}
.dag-stage-card { padding: 12px 14px; }
.dag-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.dag-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.legend-dot.raw { background: var(--emerald); }
.legend-dot.mid { background: var(--cyan); }
.legend-dot.end { background: var(--gold); }
.legend-line { width: 16px; height: 2.5px; border-radius: 2px; }
.legend-line.up { background: var(--cyan); }
.legend-line.down { background: var(--gold); }

.dag-viewport {
  position: relative;
  height: 590px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0),
    linear-gradient(180deg, #0b0e17 0%, #090c13 100%);
  background-size: 24px 24px, 100% 100%;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.dag-viewport:active { cursor: grabbing; }
.dag-svg { width: 100%; height: 100%; display: block; }
.dag-node { cursor: pointer; transition: opacity .15s; }
.dag-node.dimmed { opacity: 0.24; }
.dag-edge { fill: none; transition: opacity .15s, stroke-width .15s; }
.dag-edge.dimmed { opacity: 0.14; }
.stage-caption { margin: 8px 0 0; }

.recipe-inspector {
  max-height: 670px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.inspector-hero { display: flex; align-items: center; gap: 13px; }
.inspector-icon { width: 58px; height: 58px; flex: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.035);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.item-chip:hover { border-color: var(--gold); background: var(--gold-dim); }
.item-chip .swatch-dot { width: 8px; height: 8px; border-radius: 2px; }

.stat-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.stat-mini {
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.bom-box, .editor-box {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 16, 0.55);
}
.editor-box.modified { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(240,203,88,0.2); }
.editor-row { display: grid; grid-template-columns: minmax(0, 1fr) 68px 28px; gap: 6px; align-items: center; margin-top: 6px; }
.editor-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 9px; }
.editor-field label { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; cursor: pointer; }
.check-inline input { width: auto; accent-color: var(--gold); }

/* ---------------- 3. RACES & STATURE ATLAS ---------------- */
.titan-stage-card { margin-bottom: 16px; }
.titan-svg-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0b0f1b 0%, #0f1423 72%, #131828 100%);
}
.titan-svg { display: block; min-width: 980px; width: 100%; height: 420px; }
.race-col { cursor: pointer; }
.race-col:hover .race-aura { opacity: 0.32; }

.race-inspector-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}
.budget-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.budget-box {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
}
.budget-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.bar-track { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .2s ease; }
.bar-fill.ok { background: linear-gradient(90deg, var(--emerald), #8cf5b4); }
.bar-fill.gold { background: linear-gradient(90deg, var(--gold), #ffe082); }
.bar-fill.cyan { background: linear-gradient(90deg, var(--cyan), #9ce8ff); }
.bar-fill.over { background: linear-gradient(90deg, var(--crimson), #ff948d); }

.flora-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  margin-top: 10px;
  flex-wrap: wrap;
}
.swatch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.swatch-box { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.28); }

.stature-sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.slider-card {
  padding: 10px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  transition: border-color .15s;
}
.slider-card.modified { border-color: var(--gold); background: rgba(240,203,88,0.07); }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 12px; }

.mods-tuner-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.mod-tuner-row {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.mod-tuner-row.modified { border-color: var(--gold); background: rgba(240,203,88,0.07); }
.mod-tuner-head { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; margin-bottom: 5px; }
.mod-val-pos { color: var(--emerald); font-weight: 700; }
.mod-val-neg { color: var(--crimson); font-weight: 700; }
.mod-val-zero { color: var(--muted); }

/* ---------------- 4. MATERIALS, ELEMENTS & METALLURGY ---------------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 15px;
  margin-bottom: 14px;
}
.voxel-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 12px;
}
.voxel-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s, transform .14s;
}
.voxel-card:hover { border-color: var(--gold-line); transform: translateY(-2px); }
.voxel-top { display: flex; align-items: center; gap: 12px; }
.voxel-svg { width: 58px; height: 58px; flex: none; }
.voxel-bars { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.mini-bar-row { display: grid; grid-template-columns: 64px 1fr 40px; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-2); }

.periodic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 9px;
}
.el-tile {
  position: relative;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-glass);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform .13s, border-color .15s;
}
.el-tile:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.el-tile.exotic {
  border-color: rgba(82, 216, 248, 0.55);
  box-shadow: inset 0 0 22px rgba(82, 216, 248, 0.12), 0 0 14px rgba(82, 216, 248, 0.14);
}
.el-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.el-sym { font-size: 24px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.el-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el-meta { font-size: 10.5px; color: var(--ink-2); }

.mineral-grid, .alloy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.zone-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.zone-col { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; color: var(--ink-2); }
.zone-track { width: 100%; height: 42px; border-radius: 5px; background: rgba(255,255,255,0.05); display: flex; align-items: flex-end; overflow: hidden; }
.zone-fill { width: 100%; border-radius: 4px 4px 0 0; }

/* ---------------- 5. WORLDGEN V3 & BIOMES LAB ---------------- */
.worldgen-split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 380px);
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}
.canvas-stage {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #080b12;
}
#worldgen-canvas { width: 100%; height: 390px; display: block; cursor: crosshair; }
.canvas-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-2); }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend-swatch.crust { background: #58b863; }
.legend-swatch.cliff { background: #7b8494; }
.legend-swatch.water { background: rgba(82,216,248,0.65); }
.legend-swatch.cave { background: #f0cb58; border: 1px dashed #fff; }

.slider-stack { display: flex; flex-direction: column; gap: 9px; max-height: 450px; overflow-y: auto; padding-right: 3px; }
.biomes-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
}
.biome-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, transform .12s;
}
.biome-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.biome-card.active { border-color: var(--gold); box-shadow: var(--shadow-gold); }
.weather-bar {
  display: flex;
  height: 11px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  margin: 10px 0 6px;
}
.weather-seg { height: 100%; }
.weather-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--ink-2); }

/* ---------------- 6. FAUNA, SETTLEMENTS, SHIPS & LORE ---------------- */
.fauna-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 12px;
}
.fauna-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.fauna-head { display: flex; align-items: center; gap: 11px; }
.fauna-svg { width: 58px; height: 48px; flex: none; border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }

.settlements-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; }
.tier-list { display: flex; flex-direction: column; gap: 9px; }
.tier-row { padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.025); }
.arch-chart { display: flex; flex-direction: column; gap: 7px; max-height: 410px; overflow-y: auto; }
.arch-row { display: grid; grid-template-columns: 112px 1fr 50px; align-items: center; gap: 8px; font-size: 12px; }
.npc-roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 9px; }
.npc-role-card { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,0.025); }

.ship-grid, .invader-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.ship-card, .invader-card {
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.xp-chart-wrap { overflow-x: auto; }
.xp-curve-svg { width: 100%; min-width: 620px; height: 260px; display: block; }
.chapters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }
.chapter-card {
  background: var(--card-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.chapter-card summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chapter-card summary::-webkit-details-marker { display: none; }
.task-list { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }

/* ---------------- 7. SETTINGS & CONTROLS ---------------- */
.settings-groups { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.setting-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 10px;
}
.setting-card {
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color .15s, background .15s;
}
.setting-card.modified { border-color: var(--gold); background: rgba(240, 203, 88, 0.08); box-shadow: inset 0 0 0 1px rgba(240,203,88,0.18); }
.setting-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.setting-controls { display: flex; align-items: center; gap: 8px; }
.setting-num { width: 84px; text-align: right; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.toggle-switch input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 38px; height: 21px;
  border-radius: 99px;
  background: rgba(255,255,255,0.14);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background .16s, border-color .16s;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform .16s;
}
.toggle-switch input:checked + .toggle-track { background: var(--gold); border-color: var(--gold); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(17px); background: #140f03; }

.controls-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.control-cat-box {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.055);
}
.control-row:last-child { border-bottom: 0; }
.control-row.modified .keycap-input { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
.keycap-input {
  width: 96px;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  background: #171c2b;
  color: var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,0.45);
}

/* ---------------- DIFF & PUBLISH DRAWER ---------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.7);
  backdrop-filter: blur(4px);
  z-index: 80;
}
.diff-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 96vw);
  background: #101420;
  border-left: 1px solid var(--gold-line);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.65);
  z-index: 90;
  display: flex;
  flex-direction: column;
}
.drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.elder-publish-card, .export-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.elder-publish-card { border-color: var(--gold-line); background: linear-gradient(155deg, rgba(240,203,88,0.11), rgba(18,22,34,0.8)); }
.elder-meta { padding: 7px 9px; border-radius: 7px; background: rgba(0,0,0,0.34); color: var(--cyan); overflow-wrap: anywhere; }
.drawer-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.diff-entries-list { display: flex; flex-direction: column; gap: 8px; }
.diff-entry {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.025);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.diff-vals { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 11.5px; }
.diff-old { color: var(--crimson); text-decoration: line-through; opacity: 0.85; }
.diff-new { color: var(--emerald); font-weight: 700; }

/* Toasts */
.toast-stack {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--gold-line);
  background: rgba(16, 20, 32, 0.96);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  animation: fadeSlide .16s ease-out;
}
.toast.ok { border-color: rgba(88,226,140,0.55); }
.toast.err { border-color: rgba(245,106,98,0.65); }
.empty-state { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1180px) {
  .crafting-split, .race-inspector-grid, .worldgen-split, .overview-grid, .settlements-grid {
    grid-template-columns: 1fr;
  }
  .dag-viewport { height: 480px; }
  .recipe-inspector { max-height: none; }
}
@media (max-width: 920px) {
  .mobile-nav-toggle { display: inline-grid; }
  .brand-sub, .brand-sep, .back-link { display: none; }
  .nav-rail {
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 16px 0 42px rgba(0,0,0,0.65);
  }
  .nav-rail.open { transform: translateX(0); }
  .workspace { margin-left: 0; padding: 16px 14px 40px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-emblem { display: none; }
  .mods-tuner-list, .stature-sliders, .export-grid { grid-template-columns: 1fr; }
}
