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

:root {
  --bg-color: #04060a;
  --text-color: #e0e0e0;
  --text-soft: rgba(224,224,224,0.82);
  --text-subtle: rgba(224,224,224,0.6);
  --surface-overlay: rgba(4, 6, 10, 0.85);
  --panel-overlay: rgba(10, 12, 20, 0.95);
  --textbox-bg: rgba(10, 12, 20, 0.95);
  --button-bg: rgba(207, 155, 84, 0.16);
  --button-text: #cf9b54;
  --input-text: #e6e3da;
  --glass-03: rgba(255,255,255,0.03);
  --glass-04: rgba(255,255,255,0.04);
  --glass-08: rgba(255,255,255,0.08);
  --glass-14: rgba(255,255,255,0.14);
  --overlay-backdrop: rgba(0,0,0,0.75);
  --panel-edge: rgba(255,255,255,0.12);
  --shadow-sm: rgba(0,0,0,0.4);
  --shadow-md: rgba(0,0,0,0.5);
  --shadow-lg: rgba(0,0,0,0.55);
  --shadow-xl: rgba(0,0,0,0.7);
  --accent-mid: rgba(207,155,84,0.3);
  --accent-strong: rgba(207,155,84,0.4);
  --accent-faint: rgba(207,155,84,0.12);
  --accent-bright: rgba(207,155,84,0.85);
  --danger-soft: rgba(200,50,50,0.15);
  --danger-soft-hover: rgba(200,50,50,0.35);
  --danger-border: rgba(248,113,113,0.5);
  --text-weak: rgba(230,227,218,0.4);
  --text-muted: rgba(230,227,218,0.55);
  --text-muted-2: rgba(230,227,218,0.5);
  --text-mid: rgba(230,227,218,0.65);
  --text-strong: #e6e3da;
  --text-strong-2: #d8d2c4;
  --surface-black: #000;
  --focus-color: #ffd966;
  --muted-color: rgba(255,255,255,0.75);
  --accent: #cf9b54;          /* warm amber — primary accent */
  --accent-soft: rgba(207, 155, 84, 0.16);
  --accent-line: rgba(207, 155, 84, 0.5);
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --hover-dock-top: 68px;
  --hover-dock-height: clamp(380px, 62vh, 760px);
  --hover-dock-gap: 12px;
  --hover-scene-top: calc(var(--hover-dock-top) + var(--hover-dock-height) + var(--hover-dock-gap));
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#topBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface-overlay);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

#bottomBar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: var(--surface-overlay);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--hairline);
}
#bottomBar.hidden { display: none; }

#bottomBarImages {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#bottomBarImages:empty { display: none; }
#bottomBarImages img {
  max-height: 32px;
  max-width: 80px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

#bottomBarLinks {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
#bottomBarLinks a {
  color: var(--muted-color);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: color 0.15s;
}
#bottomBarLinks a:hover { color: var(--text-color); }

#menuToggle {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--button-bg);
  border: 1px solid var(--hairline-strong);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 700;
}

#menuDropdown {
  position: fixed;
  top: 60px;
  right: 18px;
  width: 260px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  background: var(--panel-overlay);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  box-shadow: 0 18px 44px var(--shadow-md);
  padding: 14px;
  backdrop-filter: blur(14px);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.menu-dropdown.hidden {
  display: none;
}

.menu-tab-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.menu-tab {
  flex: 1;
  border: 1px solid var(--hairline-strong);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: var(--panel-overlay);
  color: var(--text-soft);
  padding: 6px 8px;
  font-size: 0.78rem;
  cursor: pointer;
}

.menu-tab.active {
  background: var(--accent-soft);
  color: var(--text-color);
  border-color: var(--accent-line);
}

.menu-tab-panel {
  display: none;
}

.menu-tab-panel.active {
  display: block;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 4px;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-color);
}

.menu-close {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

.menu-section {
  margin-bottom: 14px;
}

.atsi-main-summary {
  position: fixed;
  top: 76px;
  right: 16px;
  z-index: 140;
  width: min(92vw, 360px);
  pointer-events: none;
}

.atsi-main-summary.hidden {
  display: none;
}

.atsi-summary-panel {
  padding: 12px 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.atsi-home-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.atsi-home-summary__level {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
}

.atsi-home-summary__points {
  font-size: 0.92rem;
  color: #ffffff;
  font-weight: 700;
}

.atsi-home-summary__message {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #ffffff;
  opacity: 0.9;
}

.menu-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.menu-label input[type="range"] {
  width: 100%;
}

.menu-note {
  margin-top: 6px;
  font-size: 0.73rem;
  color: #ffffff;
}

.menu-button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.menu-button:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

#controlPanel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted-color);
}

.control-label input[type="range"] {
  width: 110px;
}

#universeCards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.universe-card {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--button-bg);
  border: 1px solid var(--hairline-strong);
  color: var(--button-text);
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.85rem;
}
.universe-card:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--button-text);
  transform: translateY(-1px);
}
.universe-card.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--button-text);
}
.universe-card .card-name { font-weight: 600; }
.universe-card .card-desc { font-size: 0.72rem; opacity: 0.7; margin-top: 2px; }

.nav-btn {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--button-bg);
  border: 1px solid var(--hairline-strong);
  color: var(--button-text);
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
  transition: all 0.2s;
}
.nav-btn:hover { background: var(--accent-soft); color: var(--button-text); }

.quality-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  background: var(--button-bg);
}

.quality-label {
  font-size: 0.74rem;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.quality-select {
  min-width: 112px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  background: #ffffff;
  color: #111111;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.quality-select option {
  color: #111111;
  background: #ffffff;
}

.quality-badge {
  font-size: 0.7rem;
  color: var(--text-soft);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: capitalize;
}

@media (max-width: 980px) {
  .quality-control {
    padding: 4px 8px;
    gap: 6px;
  }

  .quality-label,
  .quality-badge {
    display: none;
  }

  .quality-select {
    min-width: 96px;
    font-size: 0.74rem;
  }
}

#galaxyCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

body.hover-panel-open #galaxyCanvas {
  top: var(--hover-scene-top);
  height: calc(100vh - var(--hover-scene-top));
}

.tooltip {
  position: fixed;
  z-index: 200;
  padding: 8px 14px;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--text-color);
  pointer-events: none;
  max-width: 240px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px var(--shadow-md);
}
.tooltip .tt-name { font-weight: 700; margin-bottom: 2px; }
.tooltip .tt-type { font-size: 0.7rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.5px; }

#nodeHoverPanel.is-pinned {
  max-height: var(--hover-dock-height);
  overflow-y: auto;
}

#nodeHoverPanel {
  scrollbar-gutter: stable;
  pointer-events: auto;
  width: min(96vw, 760px);
  max-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto auto auto;
  gap: 10px 16px;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
}

#nodeHoverPanel #nodeHoverName {
  grid-column: 1;
  grid-row: 1;
}

#nodeHoverPanel #nodeHoverContent {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding-top: 30px;
}

#nodeHoverPanel #nodeHoverContent .artist-card {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

#nodeHoverPanel #nodeHoverContent .artist-card__header {
  padding-right: 136px;
}

#nodeHoverPanel #nodeHoverContent .artist-card__body {
  max-height: none;
}

#nodeHoverPanel #nodeHoverContent .artist-card__rail {
  margin-top: 2px;
}

#nodeHoverPanel #nodeHoverContent .artist-card__links a,
#nodeHoverPanel #nodeHoverContent .artist-card__rail a {
  word-break: break-word;
  overflow-wrap: anywhere;
}

#nodeHoverPanel #nodeHoverImageWrap {
  grid-column: 1;
  grid-row: 3;
  margin-bottom: 0;
  overflow: hidden;
  background: rgba(12,16,36,0.5);
  width: 100%;
  max-height: clamp(120px, 28vh, 260px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(100,140,220,0.2);
}

#nodeHoverPanel #nodeHoverBio {
  grid-column: 1;
  grid-row: 4;
  margin-bottom: 0;
  padding-bottom: 0;
  font-size: 12px;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#nodeHoverPanel #nodeHoverLinks {
  grid-column: 1;
  grid-row: 5;
  margin-top: 0;
  overflow: hidden;
}

#nodeHoverPanel #nodeHoverChildren {
  grid-column: 1;
  grid-row: 6;
  align-self: start;
  overflow: hidden;
}

#nodeHoverPanel #nodeHoverImage {
  display: block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: clamp(120px, 28vh, 260px);
  object-fit: contain;
  background: transparent;
}

#nodeHoverPanel #nodeHoverChildList {
  max-height: calc(var(--hover-dock-height) - 64px);
  overflow: auto;
}

@media (max-width: 980px) {
  #nodeHoverPanel {
    width: min(96vw, 760px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
  }

  #nodeHoverPanel #nodeHoverLinks {
    grid-column: 1;
    grid-row: 5;
  }

  #nodeHoverPanel #nodeHoverChildren {
    grid-column: 1;
    grid-row: 6;
  }

  #nodeHoverPanel #nodeHoverChildList {
    max-height: 110px;
  }
}

#nodeHoverPanel #nodeHoverPinBtn {
  pointer-events: auto;
}

#nodeHoverPanel.is-pinned #nodeHoverPinBtn {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text-color);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(6px);
}
.modal.hidden { display: none; }

/* Side-panel variant — used during focus mode so the 3D canvas stays visible */
.modal.modal--panel {
  inset: auto;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(92vw, 360px);
  max-width: 100vw;
  background: transparent;
  backdrop-filter: none;
  align-items: flex-start;
  justify-content: flex-end;
  pointer-events: none;
}
.modal.modal--panel .modal-inner {
  pointer-events: all;
  width: 100%;
  max-width: 100%;
  max-height: 100vh;
  height: 100%;
  border-radius: 0;
  border-left: 1px solid var(--panel-edge);
  border-top: none;
  border-right: none;
  border-bottom: none;
  box-shadow: -8px 0 40px var(--shadow-md);
  padding: 48px 18px 24px 18px; /* top padding leaves room for close button */
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}
.modal.modal--panel.modal--panel-wide {
  width: min(92vw, 360px);
}
.modal.modal--panel.modal--panel-wide .modal-inner {
  padding: 34px 22px 22px 22px;
}
/* Compact variant — sizes to content, sits in top-right corner */
.modal.modal--panel.modal--panel-compact {
  bottom: auto;
}
.modal.modal--panel.modal--panel-compact .modal-inner {
  height: auto;
  max-height: calc(100vh - 80px);
  border-radius: 0 0 0 12px;
  border-top: 1px solid var(--panel-edge);
  border-bottom: 1px solid var(--panel-edge);
}
.modal.modal--panel .info-box {
  width: 100%;
  box-sizing: border-box;
}
.modal.modal--panel .info-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
}
.modal.modal--panel .info-box h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  word-break: break-word;
}
.modal.modal--panel .info-desc {
  font-size: 0.88rem;
  line-height: 1.6;
}
.modal.modal--panel .info-meta {
  font-size: 0.78rem;
}

.modal-inner {
  position: relative;
  background: var(--textbox-bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 32px;
  max-width: 900px;
  width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px var(--shadow-lg);
}

/* Wider popup layout while in focus mode */
.modal.modal--focus .modal-inner {
  width: min(96vw, 760px);
  max-width: 760px;
}

.modal.modal--focus.modal--linkedfiles .modal-inner,
.modal.modal--focus.modal--info .modal-inner,
.modal.modal--focus.modal--quiz .modal-inner {
  width: min(96vw, 760px);
  max-width: 760px;
}

/* Linked-files modal override: keep dark info-style gutters/text even when textboxBg is light */
.modal.modal--linkedfiles .modal-inner {
  background: var(--panel-overlay);
  border-color: var(--hairline-strong);
  color: var(--text-color);
  width: min(92vw, 360px);
  max-width: 360px;
}

/* Info modal override: use the larger, scroll-friendly layout that matches focus mode */
.modal.modal--info .modal-inner {
  background: var(--panel-overlay);
  border-color: var(--hairline-strong);
  color: var(--text-color);
  width: min(96vw, 760px);
  max-width: 760px;
}

.modal.modal--info .artist-card,
.modal.modal--info .artist-card__desc,
.modal.modal--info .artist-card__meta {
  color: var(--text-soft);
}

.modal.modal--info .artist-card__name,
.modal.modal--info .artist-card__links a {
  color: var(--text-color);
}

/* Timeline modal override: keep dark popup treatment even when universe textboxBg is light */
.modal.modal--timeline .modal-inner {
  background: var(--panel-overlay);
  border-color: var(--hairline-strong);
  color: var(--text-color);
}

/* Quiz modal override: match info/linked-files dark popup palette */
.modal.modal--quiz .modal-inner {
  background: var(--panel-overlay);
  border-color: var(--hairline-strong);
  color: var(--text-color);
  width: min(92vw, 360px);
  max-width: 360px;
}

.modal.modal--quiz .quiz-box,
.modal.modal--quiz .quiz-q-para,
.modal.modal--quiz .quiz-outcome-msg {
  color: var(--text-soft);
}

.modal.modal--quiz .quiz-title,
.modal.modal--quiz .quiz-q-title,
.modal.modal--quiz .quiz-question,
.modal.modal--quiz .quiz-score-display {
  color: var(--text-color);
}

.modal.modal--quiz .quiz-progress,
.modal.modal--quiz .quiz-score-label {
  color: var(--text-muted);
}

.modal.modal--quiz .quiz-progress-bar,
.modal.modal--quiz .quiz-outcome-msg,
.modal.modal--quiz .quiz-option {
  background: var(--glass-03);
  border-color: var(--hairline-strong);
}

.modal.modal--quiz .quiz-option {
  color: var(--text-color);
}

.modal.modal--quiz .quiz-option:hover,
.modal.modal--quiz .quiz-btn-restart {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text-color);
}

.modal.modal--quiz .quiz-btn-restart:hover {
  background: var(--accent-mid);
}

.modal.modal--linkedfiles .artist-card,
.modal.modal--linkedfiles .artist-card__desc,
.modal.modal--linkedfiles .lf-card__desc,
.modal.modal--linkedfiles .lf-section-heading {
  color: var(--text-soft);
}

.modal.modal--linkedfiles .artist-card__name,
.modal.modal--linkedfiles .lf-card__name,
.modal.modal--linkedfiles .lf-pdf-title,
.modal.modal--linkedfiles .lf-card__open {
  color: var(--text-color);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(120,160,240,0.35);
  background: rgba(24,34,74,0.55);
  color: #c8d8ff;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.modal-close:hover {
  background: rgba(34,52,96,0.7);
  border-color: rgba(140,180,255,0.5);
  color: #dfe9ff;
}

/* Info — base (centred modal, not used in current flow but kept for safety) */
.info-box h2 { font-size: 1.6rem; margin-bottom: 12px; color: var(--text-color); }
.info-box .info-image { width: auto; max-width: 100%; height: auto; max-height: 320px; border-radius: 10px; margin-bottom: 16px; }
.info-box .info-desc { line-height: 1.7; color: var(--text-soft); font-size: 0.95rem; }
.info-box .info-meta { margin-top: 16px; font-size: 0.8rem; color: var(--text-subtle); }

/* ── Artist / Info card — scroll-friendly content layout ───────────── */
.artist-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  gap: 12px;
  box-sizing: border-box;
}
.artist-card--portrait {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 760px;
}
.artist-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}
.artist-card__titleBlock {
  min-width: 0;
  width: 100%;
}
.artist-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}
.artist-card__rail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--glass-03);
}
.artist-card__rail-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.artist-card__rail-empty {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.artist-card__hero {
  width: 100%;
  max-height: min(36vh, 260px);
  object-fit: contain;
  border-radius: 8px;
  display: block;
  background: var(--glass-04);
}
.artist-card__hero-placeholder {
  width: 100%;
  height: 120px;
  border-radius: 6px;
  background: var(--glass-04);
}
.artist-card__name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0 0 4px 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.artist-card__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.artist-card__desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-soft);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.artist-card__desc--main {
  margin: 0;
}
.artist-card__desc--empty {
  color: var(--text-muted);
}
.artist-card__links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.artist-card__links a {
  display: block;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  word-break: break-all;
  overflow-wrap: anywhere;
  transition: background 0.15s;
}
.artist-card__links a:hover {
  background: var(--accent-mid);
}

@media (max-width: 640px) {
  .artist-card {
    max-width: 100%;
  }

  .artist-card__header,
  .artist-card__body,
  .artist-card__rail {
    gap: 10px;
  }
}

/* Timeline */
.timeline-box { width: 100%; }
.tl-main-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}
.tl-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
  padding: 16px;
  background: var(--glass-03);
  border-radius: 8px;
  border: 1px solid var(--hairline);
}
.tl-header-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--shadow-sm);
}
.tl-header-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-color);
  margin-bottom: 6px;
}
.timeline-box .tl-desc {
  color: var(--muted-color);
  font-size: 0.82rem;
  line-height: 1.65;
}
.timeline-items {
  position: relative;
  padding-left: 0;
}
.timeline-items::before {
  content: '';
  position: absolute;
  left: 18px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, var(--accent-strong) 60%, rgba(0,0,0,0) 100%);
}
.tl-item {
  position: relative;
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.tl-marker {
  flex-shrink: 0;
  width: 38px;
  display: flex;
  justify-content: center;
  padding-top: 14px;
  position: relative;
  z-index: 1;
}
.tl-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--textbox-bg);
  box-shadow: 0 0 0 4px var(--accent-faint);
}
.tl-card {
  flex: 1;
  background: var(--glass-04);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent-line);
  border-radius: 8px;
  padding: 14px 18px;
  transition: background 0.2s, border-left-color 0.2s, transform 0.2s;
}
.tl-card:hover {
  background: var(--glass-08);
  border-left-color: var(--accent);
  transform: translateX(4px);
}
.tl-item .tl-year {
  display: inline-block;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.tl-item .tl-name { font-weight: 700; font-size: 1rem; color: var(--text-color); margin-bottom: 7px; }
.tl-item .tl-detail { font-size: 0.84rem; color: var(--muted-color); line-height: 1.65; }
.tl-item .tl-img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 12px;
  box-shadow: 0 4px 16px var(--shadow-sm);
}
.tl-item .tl-video { margin-top: 12px; }
.tl-item .tl-video iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 8px; }
.tl-yt-thumb {
  display: block;
  position: relative;
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 4px 16px var(--shadow-md);
}
.tl-yt-thumb img {
  display: block;
  width: 100%;
  border-radius: 8px;
  transition: filter 0.2s;
}
.tl-yt-thumb:hover img { filter: brightness(0.75); }
.tl-yt-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  background: var(--danger-color);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  color: var(--text-color);
  pointer-events: none;
  transition: background 0.2s, transform 0.2s;
}
.tl-yt-thumb:hover .tl-yt-play { background: var(--danger-color); transform: translate(-50%, -50%) scale(1.1); }

/* Gallery */
.gallery-box h2 { font-size: 1.4rem; margin-bottom: 16px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.gallery-item img { width: 100%; border-radius: 10px; cursor: pointer; transition: transform 0.2s; }
.gallery-item img:hover { transform: scale(1.03); }
.gallery-item .gi-title { font-weight: 600; margin-top: 6px; font-size: 0.85rem; }
.gallery-item .gi-desc { font-size: 0.75rem; color: var(--text-subtle); margin-top: 2px; }

/* Embed */
.embed-box h2 { font-size: 1.4rem; margin-bottom: 12px; }
.embed-box .embed-desc { color: var(--text-subtle); margin-bottom: 16px; font-size: 0.9rem; }
.embed-box .video-container { position: relative; padding-bottom: 56.25%; height: 0; }
.embed-box .video-container iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  border: none; border-radius: 10px;
}

.yt-player-wrap {
  position: relative;
  padding-bottom: 0;
  height: auto;
  margin-top: 10px;
}

.yt-player-wrap iframe {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.yt-player-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.yt-toggle-btn {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}

.yt-toggle-btn:hover {
  background: var(--accent-mid);
  border-color: var(--accent-bright);
}

/* Story */
.story-box { font-size: 1rem; }
.story-box h2 { font-size: 1.6rem; margin-bottom: 20px; }

/* ── Template color alignment (match Info popup palette) ─────────────── */
.project-box,
.community-box,
.story-box,
.timeline-box,
.gallery-box,
.embed-box,
.quiz-box {
  color: var(--text-soft);
}

.project-box h2,
.community-box h2,
.story-box h2,
.timeline-box h2,
.gallery-box h2,
.embed-box h2,
.quiz-box h2 {
  color: var(--text-color);
}

.project-description,
.community-box .project-description,
.project-field-value,
.timeline-box .tl-desc,
.tl-item .tl-detail,
.embed-box .embed-desc {
  color: var(--text-soft);
}

.project-field-label,
.lf-section-heading,
.quiz-progress,
.quiz-score-label {
  color: var(--text-muted);
}

/* ── Project template ─────────────────────────────────────────────────── */
.project-box { font-size: 1rem; }
.project-box h2 { font-size: 1.6rem; margin-bottom: 8px; color: var(--text-color); }
.project-description { color: var(--muted-color); line-height: 1.7; margin-bottom: 20px; font-size: 0.95rem; }
.project-field { margin-bottom: 18px; }
.project-field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.project-field-value { color: var(--text-strong-2); line-height: 1.7; font-size: 0.92rem; white-space: pre-line; }
.project-links { display: flex; flex-direction: column; gap: 6px; }
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 5px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  transition: background .15s;
  width: fit-content;
}
.project-link:hover { background: var(--accent-mid); }

/* ── Community template ─────────────────────────────────────────────────── */
.community-box { font-size: 1rem; }
.community-box h2 { font-size: 1.6rem; margin-bottom: 8px; color: var(--text-color); }
.community-box .project-description { color: var(--muted-color); }

/* Linked Files */
.lf-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.artist-card--linkedfiles .lf-list { margin-top: 0; }
.lf-card {
  display: flex;
  flex-direction: column;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  overflow: hidden;
}
.lf-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 14px;
  background: var(--glass-03);
}
.lf-card__info { flex: 1; min-width: 0; }
.lf-card__name { font-weight: 600; color: var(--text-color); font-size: 0.9rem; margin-bottom: 3px; word-break: break-word; }
.lf-card__desc { font-size: 0.82rem; color: var(--text-soft); line-height: 1.55; }
.lf-card__open {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-color);
  padding: 6px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 5px;
  background: var(--accent-soft);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.lf-card__open:hover { background: var(--accent-mid); color: var(--text-color); }
.lf-empty { color: var(--text-subtle); font-size: 0.85rem; font-style: italic; }

/* Linked Files – per-file inline PDF preview */
.lf-pdf-wrap {
  width: 100%;
  border-bottom: 1px solid var(--hairline-strong);
  background: var(--glass-03);
  padding: 14px;
}
.lf-pdf-title {
  padding: 8px 14px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-color);
  background: var(--glass-04);
  border-bottom: 1px solid var(--hairline);
  letter-spacing: 0.01em;
}
.lf-section-heading {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-2);
  margin: 0 0 6px 0;
}
.lf-pdf-frame {
  display: block;
  width: 100%;
  height: 500px;
  max-height: min(500px, 60vh);
  border: none;
}
.lf-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 14px 14px;
  border-top: 2px solid var(--hairline);
  margin-top: 2px;
}

.story-section { margin-bottom: 32px; }
.story-section h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--text-color); }
.story-section p { line-height: 1.8; color: var(--text-soft); }
.story-section img { max-width: 100%; border-radius: 10px; margin-top: 12px; }
.story-section .story-video { margin-top: 12px; }
.story-section .story-video iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 10px; }
.story-downloads { margin-top: 12px; }
.story-downloads a {
  display: inline-block;
  padding: 8px 14px;
  margin: 4px 6px 4px 0;
  background: var(--glass-03);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  color: var(--text-strong-2);
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.story-downloads a:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-color); }

.story-links { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.story-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--glass-03);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  color: var(--text-strong-2);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.story-links a:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text-color); }

/* Video container used in timeline/story */
.video-container { position: relative; padding-bottom: 56.25%; height: 0; margin-top: 10px; }
.video-container iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  border: none; border-radius: 8px;
}

.hidden { display: none !important; }

.modal-inner::-webkit-scrollbar { width: 6px; }
.modal-inner::-webkit-scrollbar-track { background: transparent; }
.modal-inner::-webkit-scrollbar-thumb { background: var(--panel-edge); border-radius: 3px; }

/* ── Quiz display type ──────────────────────────────────────────── */
.quiz-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 24px;
  min-height: 300px;
  color: var(--text-color);
}
.quiz-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
  margin-bottom: 18px;
}
.quiz-progress {
  font-size: 0.82rem;
  color: var(--text-subtle);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.quiz-progress-bar {
  width: 100%;
  max-width: 1040px;
  height: 4px;
  background: var(--glass-14);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.quiz-q-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.2px;
}
.quiz-q-para {
  font-size: 0.9rem;
  color: var(--muted-color);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 1040px;
}
.quiz-question {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-color);
  margin-bottom: 28px;
  max-width: 1080px;
  line-height: 1.5;
}
.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 1080px;
}
.quiz-option {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--hairline-strong);
  background: var(--glass-03);
  color: var(--text-strong-2);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, border-color 0.18s;
  width: 100%;
  text-align: center;
}
.quiz-option:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text-color);
  transform: translateY(-2px);
}
.quiz-option:active { transform: translateY(0); }
.quiz-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.quiz-score-display {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.quiz-score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: -8px;
}
.quiz-outcome-msg {
  font-size: 1.05rem;
  color: var(--text-strong);
  text-align: center;
  max-width: 1040px;
  line-height: 1.6;
  background: var(--glass-03);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px 20px;
}
.quiz-btn-restart {
  padding: 10px 24px;
  border-radius: 6px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text-strong);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.18s;
}
.quiz-btn-restart:hover { background: var(--accent-mid); color: var(--text-color); }

/* ── Camera info overlay (press I) ──────────────────────────────────────────── */
.cam-info-overlay {
  position: fixed;
  top: 70px; right: 18px;
  z-index: 600;
}
.cam-info-overlay.hidden { display: none; }
.cam-info-box {
  background: var(--panel-overlay);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  padding: 16px 20px 14px;
  min-width: 260px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px var(--shadow-md);
  color: var(--text-strong);
  font-family: inherit;
}
.cam-info-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.cam-info-close {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 1rem; padding: 0 2px; line-height: 1;
}
.cam-info-close:hover { color: var(--text-color); }
.cam-info-hint { font-size: 0.76rem; color: var(--muted-color); margin: 0 0 12px; line-height: 1.45; }
.cam-info-rows { display: flex; flex-direction: column; gap: 8px; }
.cam-info-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--glass-04); border-radius: 6px; padding: 8px 12px;
}
.cam-info-label { font-size: 0.8rem; color: var(--muted-color); }
.cam-info-val {
  font-size: 1rem; font-weight: 700; color: var(--text-color);
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft); border-radius: 5px; padding: 1px 8px;
  min-width: 52px; text-align: center;
}
.cam-info-box kbd {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--accent-line); font-size: 0.78rem;
  color: var(--accent); background: var(--accent-soft);
}

/* ── Landing page overlay ───────────────────────────────────────────────────── */
.landing-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.landing-overlay.hidden { display: none; }
.landing-popup {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(92vw, 720px);
  max-height: calc(100vh - 80px);
  background: var(--textbox-bg);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow: 0 24px 80px var(--shadow-xl);
  overflow: hidden;
}
.landing-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  background: var(--panel-overlay);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.landing-overlay-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
.landing-overlay-close {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(120,160,240,0.35);
  background: rgba(24,34,74,0.55);
  color: #c8d8ff;
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.landing-overlay-close:hover {
  background: rgba(34,52,96,0.7);
  border-color: rgba(140,180,255,0.5);
  color: #dfe9ff;
}
.landing-frame {
  border: none;
  width: 100%;
  display: block;
  overflow-y: auto;
  /* height is set dynamically by JS; falls back to a comfortable default */
  min-height: 120px;
  max-height: calc(100vh - 160px);
}

/* ── Focus mode bar ─────────────────────────────────────────────────────────── */
.focus-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline-strong);
  border-radius: 8px;
  padding: 10px 22px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px var(--shadow-md);
  transition: opacity 0.25s;
}
.focus-bar.hidden { display: none; }
.focus-label {
  color: var(--text-strong);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.focus-return-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.focus-return-btn:hover {
  background: var(--accent-mid);
  color: var(--text-color);
  border-color: var(--accent);
}

/* ── Node search floating bar ───────────────────────────────────────────── */
.node-search-bar {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px var(--shadow-md);
  width: min(calc(100vw - 40px), 480px);
}
.node-search-bar.hidden { display: none; }

.node-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.node-search-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.6;
}
#nodeSearchBarInput {
  flex: 1;
  background: var(--glass-08);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--input-text);
  font-size: 0.9rem;
  outline: none;
  min-width: 0;
}
#nodeSearchBarInput::placeholder { color: var(--text-weak); }
#nodeSearchBarInput:focus { border-color: var(--accent-line); }

.node-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.node-search-clear:hover { color: var(--text-color); background: var(--glass-14); }

.node-search-results {
  margin-top: 8px;
  max-height: 320px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--panel-overlay);
}
.node-search-results.hidden { display: none; }

.node-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.12s;
}
.node-search-result:last-child { border-bottom: none; }
.node-search-result:hover { background: var(--glass-08); }
.node-search-result__name {
  font-size: 0.88rem;
  color: var(--text-strong);
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-search-result__meta {
  font-size: 0.75rem;
  color: var(--text-muted-2);
  white-space: nowrap;
  flex-shrink: 0;
}
.node-search-result__match {
  font-size: 0.75rem;
  color: var(--accent-bright);
  white-space: nowrap;
  flex-shrink: 0;
}
.node-search-empty {
  padding: 14px;
  font-size: 0.85rem;
  color: var(--text-weak);
  text-align: center;
}

/* ── Tag filter search bar ──────────────────────────────────────────────── */
.tag-search-bar {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 14px;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px var(--shadow-md);
  min-width: 300px;
  max-width: 480px;
  width: calc(100vw - 40px);
  position: fixed; /* override relative from transforms context */
}
.tag-search-bar.hidden { display: none; }

.tag-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
#tagSearchInput {
  flex: 1;
  background: var(--glass-08);
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--input-text);
  font-size: 0.88rem;
  outline: none;
}
#tagSearchInput::placeholder { color: var(--text-weak); }
#tagSearchInput:focus { border-color: var(--accent-line); }

.tag-search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.tag-search-clear:hover { color: var(--text-color); background: var(--glass-14); }

.tag-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.tag-search-chips:empty { display: none; }

.tag-chip-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--accent);
}
.tag-chip-active button {
  background: none;
  border: none;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 2px;
}
.tag-chip-active button:hover { color: var(--text-color); }

.tag-search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--panel-overlay);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
  z-index: 301;
  box-shadow: 0 4px 16px var(--shadow-md);
}
.tag-search-suggestions.hidden { display: none; }

.tag-suggestion {
  padding: 7px 14px;
  font-size: 0.85rem;
  color: var(--text-strong-2);
  cursor: pointer;
  border-bottom: 1px solid var(--hairline);
}
.tag-suggestion:last-child { border-bottom: none; }
.tag-suggestion:hover { background: var(--accent-soft); color: var(--text-color); }

