/* ═══════════════════════════════════════════════════════════════════════════
   WOBBS VAULT — styles.css
   LCARS palette (TNG-style): thelcars.com/colors.php — Classic Theme
   Dark + light themes via html[data-theme]
   ═══════════════════════════════════════════════════════════════════════════ */

/* Shared layout + LCARS dark theme defaults (thelcars.com Classic) */
:root {
  color-scheme: dark;
  --font-head: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius:    8px;
  --radius-lcars: 4px 20px 20px 4px;
  --card-tile-h: 36px;
  --card-col-min: 160px;
  --bg:        #05060a;
  --surface:   #0e1018;
  --surface2:  #141824;
  --surface3:  #1c2030;
  --border:    #2a2d42;
  --border2:   #3a3d58;
  --text:      #f5f6fa;
  --text2:     #a8a8c4;
  --text3:     #666688;
  --accent:    #ffaa00;
  --accent2:   #ff9900;
  --accent-soft: #8899ff;
  --green:     #99cc66;
  --green2:    #999933;
  --gold:      #ffaa00;
  --gold2:     #ffcc99;
  --red:       #cc4444;
  --cyan:      #99ccff;
  /* LCARS navy / midnight panel — distinct from page bg, not flat black */
  --header-bg: linear-gradient(
    105deg,
    #1a2234 0%,
    #1e2840 42%,
    #182238 100%
  );
  --header-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --body-bg-image:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(85, 102, 255, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(255, 170, 0, 0.03), transparent 45%);
  --series-header-bg: rgba(0, 0, 0, 0.2);
  --card-hover-bg: rgba(85, 102, 255, 0.08);
  --modal-overlay-bg: rgba(0, 0, 0, 0.72);
  --stat-val-shadow: 0 0 12px rgba(153, 204, 255, 0.25);
  --logo-span-shadow: 0 0 20px rgba(255, 170, 0, 0.35);
  --decor-layer-opacity: 0.38;
  /* Fine horizontal scan (same rhythm as .theme-transporter__scan), very subtle on controls */
  --ctrl-scan-fine: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 4px,
    rgba(255, 230, 190, 0.055) 4px,
    rgba(255, 230, 190, 0.055) 5px
  );
  --ctrl-inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  /* Align header logo, sidebar labels, and nav rows to one vertical rhythm (matches .nav-btn padding-left). */
  --content-align-left: 9px;
}

/* ── LCARS light theme — space-white field, panels, same accent family (gold / blue / gray) ── */
html[data-theme="light"] {
  color-scheme: light;
  --bg:        #eef0f6;
  --surface:   #ffffff;
  --surface2:  #f2f4fb;
  --surface3:  #e8ecf6;
  --border:    #c8ccdc;
  --border2:   #b0b6cc;
  --text:      #1a1d2a;
  --text2:     #3d4a62;
  --text3:     #666688;
  --accent:    #ff9900;
  --accent2:   #ff8800;
  --accent-soft: #5566ff;
  --green:     #5a8822;
  --green2:    #6b7a33;
  --gold:      #ff9900;
  --gold2:     #cc6600;
  --red:       #cc3333;
  --cyan:      #2a5a9e;
  /* LCARS ice / pale blue panel — not plain white */
  --header-bg: linear-gradient(
    180deg,
    #e4eaf4 0%,
    #d8e3f2 55%,
    #cfd9ec 100%
  );
  --header-shadow: 0 2px 20px rgba(26, 40, 72, 0.12);
  --body-bg-image:
    radial-gradient(ellipse 100% 70% at 0% 0%, rgba(255, 170, 0, 0.09), transparent 52%),
    radial-gradient(ellipse 90% 60% at 100% 100%, rgba(85, 102, 255, 0.07), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(153, 204, 255, 0.06), transparent 45%);
  --series-header-bg: rgba(0, 40, 80, 0.04);
  --card-hover-bg: rgba(85, 102, 255, 0.1);
  --modal-overlay-bg: rgba(20, 24, 38, 0.45);
  --stat-val-shadow: none;
  --logo-span-shadow: none;
  --decor-layer-opacity: 0.32;
  --ctrl-scan-fine: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 4px,
    rgba(255, 255, 255, 0.5) 4px,
    rgba(255, 255, 255, 0.5) 5px
  );
  --ctrl-inset-top: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* ── RESET ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
body {
  background: var(--bg);
  background-image: var(--body-bg-image);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.35s ease, color 0.2s ease;
}

/* Soft corner gradients — LCARS palette (gold / ice / blue), no hard edges */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-decor-corner {
  position: absolute;
  opacity: var(--decor-layer-opacity);
}
.bg-decor-tl {
  top: 0;
  left: 0;
  width: min(58vmin, 520px);
  height: min(58vmin, 520px);
  background:
    radial-gradient(
      ellipse 95% 95% at 0% 0%,
      rgba(255, 185, 90, 0.42) 0%,
      rgba(255, 170, 0, 0.14) 45%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 75% 75% at 8% 10%,
      rgba(100, 125, 255, 0.2) 0%,
      rgba(136, 153, 255, 0.06) 52%,
      transparent 70%
    );
}
.bg-decor-tr {
  top: 0;
  right: 0;
  width: min(52vmin, 460px);
  height: min(44vmin, 400px);
  background: radial-gradient(
    ellipse 110% 95% at 100% 0%,
    rgba(130, 155, 255, 0.38) 0%,
    rgba(153, 204, 255, 0.12) 48%,
    transparent 76%
  );
}
.bg-decor-bl {
  bottom: 0;
  left: 0;
  width: min(50vmin, 440px);
  height: min(44vmin, 400px);
  background: radial-gradient(
    ellipse 105% 100% at 0% 100%,
    rgba(140, 205, 255, 0.34) 0%,
    rgba(153, 204, 255, 0.09) 52%,
    transparent 78%
  );
}
.bg-decor-br {
  bottom: 0;
  right: 0;
  width: min(56vmin, 500px);
  height: min(56vmin, 500px);
  background:
    radial-gradient(
      ellipse 100% 100% at 100% 100%,
      rgba(255, 175, 75, 0.38) 0%,
      rgba(255, 170, 0, 0.1) 48%,
      transparent 74%
    ),
    radial-gradient(
      ellipse 72% 72% at 94% 94%,
      rgba(136, 153, 255, 0.22) 0%,
      transparent 68%
    );
}

/* ── Theme transporter (~1s) — TNG-style beam + scan on light/dark switch ── */
.theme-transporter {
  position: fixed;
  inset: 0;
  z-index: 30000;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
}
.theme-transporter.theme-transporter--active {
  visibility: visible;
  animation: tp-overlay 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes tp-overlay {
  0% { opacity: 0; }
  6% { opacity: 1; }
  88% { opacity: 1; }
  100% { opacity: 0; }
}

.theme-transporter__wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 90% 55% at 50% 45%, rgba(255, 210, 130, 0.4) 0%, transparent 58%),
    radial-gradient(ellipse 70% 45% at 50% 110%, rgba(120, 180, 255, 0.22) 0%, transparent 55%);
  mix-blend-mode: screen;
}

.theme-transporter__scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 4px,
    rgba(255, 230, 190, 0.07) 4px,
    rgba(255, 230, 190, 0.07) 5px
  );
  mix-blend-mode: overlay;
  opacity: 0.55;
}
.theme-transporter--active .theme-transporter__scan {
  animation: tp-scan-drift 0.28s linear infinite;
}
@keyframes tp-scan-drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(5px); }
}

/* Beam band: starts fully above viewport, ends fully below — full screen travel */
.theme-transporter__beam {
  position: absolute;
  left: -8%;
  right: -8%;
  top: 0;
  height: 34vh;
  min-height: 140px;
  max-height: 420px;
  z-index: 3;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 235, 180, 0.08) 16%,
    rgba(255, 220, 140, 0.62) 48%,
    rgba(255, 235, 180, 0.08) 84%,
    transparent 100%
  );
  filter: blur(1.5px);
  mix-blend-mode: screen;
  opacity: 0;
  will-change: transform;
}
.theme-transporter--active .theme-transporter__beam {
  animation: tp-beam 0.88s cubic-bezier(0.42, 0, 0.2, 1) 0.05s forwards;
}
@keyframes tp-beam {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  100% {
    /* Top edge: from above viewport (-100%) to bottom edge (100vh) — full-height sweep */
    transform: translateY(100vh);
    opacity: 0.92;
  }
}

.theme-transporter__spark {
  position: absolute;
  inset: 0;
  z-index: 4;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.5) 0%, transparent 0.15%),
    radial-gradient(circle at 88% 22%, rgba(200, 235, 255, 0.55) 0%, transparent 0.12%),
    radial-gradient(circle at 40% 75%, rgba(255, 255, 255, 0.45) 0%, transparent 0.1%),
    radial-gradient(circle at 72% 68%, rgba(255, 220, 160, 0.5) 0%, transparent 0.14%),
    radial-gradient(circle at 55% 40%, rgba(255, 255, 255, 0.35) 0%, transparent 0.08%);
  background-size: 100% 100%;
  mix-blend-mode: screen;
  opacity: 0.35;
}
.theme-transporter--active .theme-transporter__spark {
  animation: tp-spark-twinkle 0.12s steps(2) infinite;
}

@keyframes tp-spark-twinkle {
  0% { opacity: 0.28; }
  100% { opacity: 0.42; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-transporter.theme-transporter--active {
    animation: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
  .theme-transporter--active .theme-transporter__beam,
  .theme-transporter--active .theme-transporter__scan,
  .theme-transporter--active .theme-transporter__spark {
    animation: none !important;
  }
}

/* Theme toggle — compact LCARS-style switch */
.theme-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 4px;
}
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.theme-switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background-color: var(--surface3);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border);
  box-shadow: var(--ctrl-inset-top);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text3);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.theme-switch input:checked + .theme-switch-track {
  background-color: rgba(255, 170, 0, 0.2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border-color: var(--accent);
}
.theme-switch input:checked + .theme-switch-track .theme-switch-thumb {
  transform: translateX(20px);
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 170, 0, 0.35);
}
.theme-switch input:focus-visible + .theme-switch-track {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
.theme-hint {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  min-width: 2.75rem;
}
.vault-loading,
.vault-error {
  padding: 2rem;
  text-align: center;
  color: var(--text2);
  font-size: 0.95rem;
}
.vault-error { color: var(--red); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── HEADER ── */
header {
  background: var(--header-bg);
  border-bottom: 2px solid var(--accent);
  box-shadow: var(--header-shadow);
  position: sticky; top: 0; z-index: 200;
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; gap: 20px;
}
.logo {
  font-family: var(--font-head);
  font-size: 28px; letter-spacing: 2px;
  color: var(--text);
  flex-shrink: 0;
  display: flex; align-items: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
  transition: opacity 0.15s ease;
  padding-left: var(--content-align-left);
}
.logo:hover { opacity: 0.9; }
.logo:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 4px;
}
/* Wordmark: SLAB · icon · LESS — do not style .logo-mark via a bare .logo span. */
.logo-text {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 0.2em;
}
.logo-word {
  color: var(--text);
}
.logo-title-accent {
  color: var(--accent);
  text-shadow: var(--logo-span-shadow);
}
.logo-mark {
  display: block;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  position: relative;
}
.logo-img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lcars);
  object-fit: contain;
  display: block;
}
.header-stats {
  display: flex; gap: 16px; margin-left: auto; align-items: center;
}
.stat-pill {
  display: flex; align-items: center; gap: 8px;
  background-color: var(--surface2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lcars);
  padding: 6px 14px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--ctrl-inset-top);
}
.stat-pill .val { color: var(--cyan); font-family: var(--font-mono); font-size: 14px; text-shadow: var(--stat-val-shadow); }
.stat-pill .lbl { color: var(--text2); font-size: 11px; letter-spacing: 0.5px; }
.stat-pill-subtle .val { color: var(--green2); font-size: 13px; }
.stat-pill-subtle .lbl { font-size: 10px; letter-spacing: 0.35px; }
/* ── GOOGLE SIGN-IN ── */
.google-auth-wrap {
  display: flex; align-items: center; flex-shrink: 0;
  min-height: 40px;
}
/* Only one control visible: signed-in vs Google button (iframe can ignore [hidden] in some cases) */
.google-auth-wrap.signed-in .google-signin-host {
  display: none !important;
  visibility: hidden;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.google-auth-wrap:not(.signed-in) #google-account-btn {
  display: none !important;
}
.google-signin-host iframe {
  border-radius: var(--radius);
}
.google-btn {
  display: flex; align-items: center; gap: 8px;
  background-color: var(--surface2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 7px 14px;
  color: var(--text);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap; flex-shrink: 0;
  box-shadow: var(--ctrl-inset-top);
}
.google-btn:hover {
  border-color: var(--accent);
  background-color: var(--surface3);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--accent);
}
.google-btn.signed-in {
  border-color: var(--green2);
  color: var(--text);
}
.google-btn.signed-in:hover {
  border-color: var(--red);
  background-color: rgba(204, 68, 68, 0.12);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--red);
}
.google-btn.signed-in:hover .g-sign-out-label {
  color: var(--red);
}
.google-btn.signed-in:hover .g-user-name {
  color: var(--text2);
}
.google-account-text {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.google-btn .g-user-name {
  color: var(--green);
  font-weight: 600;
}
.google-btn .g-sign-out-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: none;
  letter-spacing: 0.02em;
}
.google-btn img.g-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  object-fit: cover;
}
.google-btn .g-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface3);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Firebase setup banner (catalog still usable below) ── */
.auth-gate {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px 0;
  min-height: unset;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.auth-gate[hidden] { display: none !important; }
.auth-gate-inner {
  max-width: 640px;
  text-align: center;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  box-shadow: var(--header-shadow);
}
.auth-gate-title {
  font-family: var(--font-head);
  font-size: 28px;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  color: var(--text);
}
.auth-gate-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.55;
}
.auth-gate-text a {
  color: var(--cyan);
  text-decoration: underline;
}
.auth-gate-text code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.vault-sync-hint {
  margin: 0 0 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.vault-sync-hint[hidden] {
  display: none !important;
}

/* ── LAYOUT ── */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding: 24px;
  display: grid; grid-template-columns: 240px 1fr; gap: 24px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── SIDEBAR ── */
.sidebar { position: sticky; top: 88px; height: calc(100vh - 100px); overflow-y: auto; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--text3); text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 4px 0 var(--content-align-left);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 9px;
  border: none;
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text2); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
  transition: all 0.15s;
}
.nav-btn:hover, .nav-btn.active {
  background-color: var(--surface2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--text);
  border-left-color: var(--accent);
  box-shadow: var(--ctrl-inset-top);
}
.nav-btn .nav-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text3);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.nav-btn .nav-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.universe-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.universe-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.nav-universe-logo {
  width: 22px;
  height: 22px;
}
.sidebar-actions { display: flex; flex-direction: column; gap: 6px; }
.action-btn {
  padding: 8px 12px 8px var(--content-align-left); border-radius: 6px;
  border: 1px solid var(--border);
  background-color: rgba(14, 16, 24, 0.22);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--text2);
  font-family: var(--font-body); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; text-align: left;
  box-shadow: var(--ctrl-inset-top);
}
html[data-theme="light"] .action-btn {
  background-color: rgba(255, 255, 255, 0.55);
}
.action-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background-color: rgba(255, 170, 0, 0.1);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
}
.action-btn.danger:hover {
  border-color: var(--red); color: var(--red);
  background-color: rgba(204, 68, 68, 0.1);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
}

/* ── MAIN ── */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.search-wrap {
  flex: 1 1 0;
  min-width: min(100%, 200px);
  position: relative;
}
.search-wrap input {
  width: 100%;
  background-color: var(--surface);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px 10px 38px;
  color: var(--text);
  font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color 0.2s;
  box-shadow: var(--ctrl-inset-top);
}
.search-wrap.search-has-value input {
  padding-right: 40px;
}
.search-wrap input::placeholder { color: var(--text3); }
.search-wrap input:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(136, 153, 255, 0.25), var(--ctrl-inset-top);
}
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 16px; pointer-events: none; }
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.search-clear:hover {
  color: var(--text);
  background: rgba(128, 128, 160, 0.12);
}
.search-clear:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
.top-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .top-bar { align-items: stretch; }
  .top-btns {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
}
.sm-btn {
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--text2); font-family: var(--font-body); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
  box-shadow: var(--ctrl-inset-top);
}
.sm-btn:hover { border-color: var(--accent-soft); color: var(--cyan); }
.add-set-btn {
  background-image: var(--ctrl-scan-fine), linear-gradient(180deg, #ffbb33 0%, var(--accent) 50%, var(--accent2) 100%);
  background-blend-mode: overlay, normal;
  border-color: var(--accent2);
  color: #0a0a0c;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(255, 170, 0, 0.3), var(--ctrl-inset-top);
}
.add-set-btn:hover { filter: brightness(1.08); border-color: var(--accent); color: #0a0a0c; }

/* ── UNIVERSE SECTION ── */
/* Isolate layout/paint so expanding one universe doesn’t reflow the whole main column */
.universe-block { margin-bottom: 8px; contain: layout; }
.series-block { contain: layout; }
.set-block { contain: layout; }
.universe-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background-color: var(--surface);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border);
  /* border-left width/style here; color is set inline per universe (not global orange). */
  border-left-width: 4px;
  border-left-style: solid;
  border-radius: var(--radius);
  cursor: pointer; user-select: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, filter 0.2s;
  box-shadow: var(--ctrl-inset-top);
}
.universe-header:hover:not([data-banner]) {
  border-color: var(--border2);
  background-color: var(--surface2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
}

.universe-header[data-banner] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--surface);
  /* Base .universe-header uses ctrl-scan-fine; clear it so the photo reads clearly. */
  background-image: none;
  background-blend-mode: normal;
}

/* Fills the row edge-to-edge (same behavior as background-size: cover). */
.universe-banner-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.universe-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.universe-banner-fade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(8, 10, 18, 0.88) 0%,
    rgba(8, 10, 18, 0.5) 52%,
    rgba(8, 10, 18, 0.22) 100%
  );
}

html[data-theme="light"] .universe-header[data-banner] .universe-banner-fade {
  background: linear-gradient(
    90deg,
    rgba(238, 240, 248, 0.92) 0%,
    rgba(238, 240, 248, 0.58) 52%,
    rgba(238, 240, 248, 0.22) 100%
  );
}

.universe-header[data-banner] > *:not(.universe-banner-wrap):not(.universe-banner-fade) {
  position: relative;
  z-index: 2;
}

.universe-header[data-banner]:hover {
  border-color: var(--border2);
  filter: brightness(1.06);
}

.universe-header[data-banner] .universe-name {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 18px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] .universe-header[data-banner] .universe-name {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9), 0 0 14px rgba(255, 255, 255, 0.45);
}

.universe-header[data-banner] .universe-chevron {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] .universe-header[data-banner] .universe-chevron {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
}

/* Readable stats on busy banners: pill behind count + progress bar */
.universe-stats-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.universe-header[data-banner] .universe-stats-wrap {
  padding: 5px 10px 6px;
  border-radius: 8px;
  background: rgba(6, 8, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
html[data-theme="light"] .universe-header[data-banner] .universe-stats-wrap {
  background: rgba(236, 238, 246, 0.94);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.universe-header[data-banner] .universe-stats-wrap .universe-count {
  color: var(--text);
  text-shadow: none;
}

.universe-header[data-banner] .universe-logo {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

html[data-theme="light"] .universe-header[data-banner] .universe-logo {
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.65));
}

.universe-block.open .universe-header {
  border-radius: var(--radius) var(--radius) 0 0;
  border-color: var(--border2);
  box-shadow: inset 0 0 0 1px rgba(255, 170, 0, 0.12), var(--ctrl-inset-top);
}
.universe-chevron { color: var(--text3); font-size: 11px; transition: transform 0.25s ease; flex-shrink: 0; }
.universe-block.open .universe-chevron { transform: rotate(90deg); }
.universe-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.universe-name { font-family: var(--font-head); font-size: 18px; letter-spacing: 1px; flex: 1; color: var(--text); }
.universe-meta { display: flex; align-items: center; gap: 12px; }
.complete-badge {
  background: rgba(255, 170, 0, 0.12);
  border: 1px solid var(--gold);
  color: var(--gold2);
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  padding: 2px 8px; border-radius: 4px;
  display: none;
}
.complete-badge.show { display: inline-block; }
.universe-count { font-family: var(--font-mono); font-size: 12px; color: var(--text2); white-space: nowrap; }
.mini-bar { width: 80px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.mini-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }

/* ── SETS CONTAINER ── */
.universe-sets {
  display: none;
  border: 1px solid var(--border2); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.universe-block.open .universe-sets { display: block; }

/* ── SERIES (within a universe) ── */
.series-block {
  border-bottom: 1px solid var(--border);
}
.series-block:last-child { border-bottom: none; }
.series-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px 10px 22px;
  background: var(--series-header-bg);
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.series-header:hover { background: var(--surface3); }
.series-block.open .series-header { background: var(--surface3); }
.series-chevron {
  color: var(--text3); font-size: 10px; transition: transform 0.2s ease; flex-shrink: 0;
}
.series-block.open .series-chevron { transform: rotate(90deg); }
.series-name {
  font-size: 13px; font-weight: 600; flex: 1; color: var(--text);
  letter-spacing: 0.02em;
}
.series-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--text2); white-space: nowrap;
}
.series-mini { width: 64px; flex-shrink: 0; }
.series-sets {
  display: none;
  background: var(--bg);
}
.series-block.open .series-sets { display: block; }

/* ── SET BLOCK ── */
.set-block { border-bottom: 1px solid var(--border); }
.set-block:last-child { border-bottom: none; }
.set-header {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px 11px 40px;
  background: var(--surface2);
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.set-header:hover { background: var(--surface3); }
.set-block.open .set-header { background: var(--surface3); }
.set-chevron { color: var(--text3); font-size: 9px; transition: transform 0.2s; flex-shrink: 0; }
.set-block.open .set-chevron { transform: rotate(90deg); }
.set-name-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-width: 0;
}
.set-name-wrap .set-name { font-size: 13px; font-weight: 500; color: var(--text); }
.set-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 4px;
  flex-shrink: 0; line-height: 1.2;
}
.set-badge.full {
  background: rgba(153, 204, 102, 0.12); color: var(--green);
  border: 1px solid rgba(153, 204, 102, 0.4);
}
.set-badge.partial {
  background: rgba(255, 170, 0, 0.1); color: var(--accent2);
  border: 1px solid rgba(255, 170, 0, 0.4);
}
.set-actions { display: flex; align-items: center; gap: 8px; }
.set-sel-btn {
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--text3); cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.set-sel-btn:hover { border-color: var(--green); color: var(--green); }
.set-sel-btn.base-only:hover { border-color: var(--accent-soft); color: var(--cyan); }
.set-sel-btn.desel:hover { border-color: var(--red); color: var(--red); }
.set-prog-text { font-family: var(--font-mono); font-size: 11px; color: var(--green); min-width: 52px; text-align: right; }
.set-bar { width: 60px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.set-bar-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width 0.3s; }
.custom-del-btn {
  background: none; border: none; color: var(--text3); cursor: pointer;
  font-size: 14px; padding: 2px 4px; transition: color 0.15s; flex-shrink: 0;
}
.custom-del-btn:hover { color: var(--red); }

/* ── CARDS GRID ── */
.set-cards {
  display: none;
  padding: 14px 18px 18px 40px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.set-block.open .set-cards { display: block; }
.card-subgroup { margin-bottom: 14px; }
.card-subgroup:last-child { margin-bottom: 0; }
.card-subgroup-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 8px;
}
/* Grid items must be allowed to shrink below content width so columns stay equal-width */
.card-item {
  min-width: 0;
  max-width: 100%;
}
.cards-grid {
  display: grid;
  /* Equal-width columns; min track size caps how narrow a column gets */
  grid-template-columns: repeat(auto-fill, minmax(var(--card-col-min), 1fr));
  gap: 6px;
  align-items: stretch;
}
.card-cb { display: none; }
.card-label {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: var(--card-tile-h);
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text2); cursor: pointer;
  transition: all 0.12s; user-select: none;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--ctrl-inset-top);
}
.card-label:hover {
  border-color: var(--accent-soft); color: var(--cyan);
  background-color: var(--card-hover-bg);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
}
.card-cb:checked + .card-label {
  background-color: rgba(153, 204, 102, 0.18);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border-color: var(--green2); color: var(--green); font-weight: 500;
}

/* ── ADD SET MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: var(--modal-overlay-bg);
  z-index: 500; display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 12px; padding: 28px; width: 440px; max-width: calc(100vw - 32px);
}
.modal h2 { font-family: var(--font-head); font-size: 22px; letter-spacing: 1px; margin-bottom: 4px; }
.modal p { font-size: 13px; color: var(--text2); margin-bottom: 20px; }
.modal label { font-size: 12px; font-weight: 600; color: var(--text2); letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.modal input, .modal select {
  width: 100%;
  background-color: var(--bg);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  font-family: var(--font-body); font-size: 13px; outline: none; margin-bottom: 14px;
  transition: border-color 0.2s;
  box-shadow: var(--ctrl-inset-top);
}
.modal input:focus, .modal select:focus { border-color: var(--accent-soft); }
.modal select option { background: var(--surface2); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.modal-cancel {
  padding: 9px 18px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--surface2);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
  color: var(--text2); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  box-shadow: var(--ctrl-inset-top);
}
.modal-cancel:hover {
  border-color: var(--border2); color: var(--text);
  background-color: var(--surface3);
  background-image: var(--ctrl-scan-fine);
  background-blend-mode: overlay;
}
.modal-confirm {
  padding: 9px 18px; border-radius: var(--radius-lcars);
  border: none;
  background-image: var(--ctrl-scan-fine), linear-gradient(180deg, #ffbb33 0%, var(--accent) 50%, var(--accent2) 100%);
  background-blend-mode: overlay, normal;
  color: #0a0a0c; font-family: var(--font-body); font-size: 13px; font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer; transition: filter 0.2s;
  box-shadow: 0 2px 8px rgba(255, 170, 0, 0.35), var(--ctrl-inset-top);
}
.modal-confirm:hover { filter: brightness(1.08); }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface2);
  border: 1px solid var(--green2);
  border-left: 4px solid var(--green2);
  color: var(--green);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 1px;
  padding: 10px 18px; border-radius: var(--radius-lcars);
  opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
#toast.show { opacity: 1; }

/* ── HIDDEN ── */
.hidden { display: none !important; }
