:root {
  --bg: #0e1116;
  --panel: #171b22;
  --panel-2: #1f242d;
  --line: #2a303b;
  --text: #e8ebf0;
  --muted: #9aa4b2;
  --accent: #ffb14e;
  --accent-2: #4ea1ff;
  --danger: #ff5d6c;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: rgba(14, 17, 22, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.brand strong { color: var(--accent); }
.logo { font-size: 24px; }

.search {
  display: flex;
  flex: 1;
  max-width: 640px;
  margin-left: auto;
}
.search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search button {
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent);
  color: #201400;
  font-weight: 600;
  cursor: pointer;
}
.search button:hover { filter: brightness(1.05); }

/* ---------- Warning ---------- */
.warning {
  margin: 16px 20px 0;
  padding: 12px 16px;
  border: 1px solid #6b4b12;
  background: #2a2110;
  border-radius: var(--radius);
  color: #ffd79a;
}
.warning code {
  background: #00000040;
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}
.sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar h2 { margin: 0 0 4px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.saved-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.saved-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.saved-item:hover { border-color: var(--accent); }
.saved-item { align-items: flex-start; }
.saved-item img,
.saved-item .thumb-fallback {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.saved-item .meta { flex: 1; min-width: 0; }
.saved-item .meta .name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  /* Wrap up to 2 lines instead of truncating on one — long names stay readable
     in the narrow sidebar; the full name is also in the title tooltip. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.saved-item .meta .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.saved-item .remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}
.saved-item .remove:hover { color: var(--danger); }
.saved-empty { color: var(--muted); font-size: 13px; }

.thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  font-size: 16px;
}

/* ---------- Content ---------- */
.content { min-height: 60vh; min-width: 0; }
.welcome h1 { font-size: 30px; margin: 8px 0 12px; }
.welcome p { color: var(--muted); max-width: 640px; font-size: 16px; }
.welcome em { color: var(--text); font-style: normal; font-weight: 600; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 28px; }
.pill {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

.connection-tool {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  max-width: 720px;
}
.connection-tool h3 { margin: 0 0 4px; }
.connect-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.connect-row input {
  flex: 1;
  min-width: 160px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}
.connect-row input:focus { border-color: var(--accent); }
.connect-row span { color: var(--muted); }
.connect-row button {
  padding: 9px 16px;
  border: 1px solid var(--accent-2);
  background: var(--accent-2);
  color: #04121f;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
#connectResult { margin-top: 14px; }

/* ---------- Search results ---------- */
.section-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 24px 0 12px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card .poster {
  aspect-ratio: 2 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}
.card .poster-fallback {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--panel-2);
  color: var(--muted);
}
.card .card-body { padding: 10px 12px; }
.card .card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .card-sub { font-size: 12px; color: var(--muted); }
.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.badge.person { background: #163b2a; color: #6ee7a8; }
.badge.movie { background: #16273b; color: #7dc0ff; }

/* ---------- Detail view ---------- */
.detail-head {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.detail-head .backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.14;
  filter: saturate(1.2);
  z-index: 0;
}
.detail-head > * { position: relative; z-index: 1; }
.detail-poster {
  width: 160px;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  object-fit: cover;
  background: var(--panel-2);
  flex-shrink: 0;
}
.detail-info { flex: 1; min-width: 240px; }
.detail-info h1 { margin: 0 0 6px; font-size: 26px; }
.detail-meta { color: var(--muted); margin-bottom: 10px; font-size: 14px; }
.detail-meta span + span::before { content: "·"; margin: 0 8px; color: var(--line); }
.detail-overview { max-width: 640px; color: #cbd3de; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.save-btn {
  margin-top: 14px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.save-btn.saved { background: var(--accent); color: #201400; }

.people-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.person-card {
  text-align: center;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.person-card:hover { border-color: var(--accent); }
.person-card img,
.person-card .avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 8px;
  display: block;
  background: var(--panel-2);
}
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--muted);
}
.person-card .pname { font-size: 13px; font-weight: 600; }
.person-card .prole { font-size: 11px; color: var(--muted); }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 14px;
  font-size: 14px;
}
.crumb:hover { color: var(--accent); }

.shared-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
}
.shared-item:hover { border-color: var(--accent); }
.shared-item img,
.shared-item .thumb-fallback { width: 46px; height: 68px; border-radius: 6px; object-fit: cover; }
.shared-item .roles { font-size: 12px; color: var(--muted); }

.empty-note {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ---------- Autocomplete ---------- */
.ac-wrap { position: relative; display: flex; flex: 1; min-width: 0; }
.ac-wrap > input { width: 100%; }
.ac-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden auto;
  max-height: 360px;
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: none; }
.ac-item.active,
.ac-item:hover { background: var(--panel-2); }
.ac-item img,
.ac-item .ac-thumb {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ac-item .ac-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ac-item .ac-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item .ac-sub { font-size: 12px; color: var(--muted); }

/* ---------- Detail actions ---------- */
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.detail-actions .save-btn { margin-top: 0; }
.collab-btn {
  padding: 9px 16px;
  border: 1px solid var(--accent-2);
  background: transparent;
  color: var(--accent-2);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.collab-btn:hover { background: var(--accent-2); color: #04121f; }

.aka { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.aka span { color: var(--text); font-weight: 600; }

/* ---------- Movie financials & facts ---------- */
.title-year { color: var(--muted); font-weight: 400; }
.fin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.fin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.fin-card .fin-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.fin-card .fin-value { font-size: 22px; font-weight: 700; }
.fin-card.pos { border-color: #2c6b47; background: #12261b; }
.fin-card.pos .fin-value { color: #6ee7a8; }
.fin-card.neg { border-color: #7a2f38; background: #2a1518; }
.fin-card.neg .fin-value { color: #ff8a97; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px 24px;
  margin: 0;
}
.facts .fact {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; text-align: right; font-size: 13px; }

/* ---------- Collaborator table filter ---------- */
.table-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.table-filter input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}
.table-filter input[type="text"]:focus { border-color: var(--accent); }
.table-filter select,
.table-filter .minfilms input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}
.table-filter .minfilms {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.table-filter .minfilms input { width: 64px; }
.table-count { color: var(--muted); font-size: 13px; margin-left: auto; }

.links-btn {
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.links-btn:hover,
.links-btn.on { border-color: var(--accent); color: var(--accent); }

.links-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.link-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.link-chip .link-icon { font-size: 16px; }
.link-chip .link-out { color: var(--muted); font-size: 12px; }
.link-chip:hover .link-out { color: var(--accent); }

/* ---------- Collaborators view ---------- */
.collab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.collab-head h2 { margin: 0; }
.view-toggle { display: flex; gap: 6px; }
.view-toggle .tg {
  padding: 7px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.view-toggle .tg.on { border-color: var(--accent); color: var(--accent); }

.graph-wrap {
  background: radial-gradient(circle at 50% 45%, #12202b 0%, var(--panel) 70%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  overflow-x: auto;
}
.collab-svg { width: 100%; height: auto; display: block; min-width: 520px; }
.g-label { fill: var(--text); font-size: 14px; font-weight: 500; }
.g-count { fill: #0e1116; font-size: 14px; font-weight: 700; }
.g-node:hover circle { fill-opacity: 1; stroke: var(--accent); }
.g-center { fill: #201400; font-size: 15px; font-weight: 700; }
.g-center-sub { fill: #4a3410; font-size: 11px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.collab-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.collab-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.collab-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.collab-table tbody tr { cursor: pointer; }
.collab-table tbody tr:hover { background: var(--panel-2); }
.collab-table tbody tr:last-child td { border-bottom: none; }
.collab-table .rank { color: var(--muted); width: 36px; }
.collab-table .who { display: flex; align-items: center; gap: 10px; }
.collab-table .who img,
.collab-table .avatar-fallback.sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
  flex-shrink: 0;
}
.collab-table .who span { display: flex; flex-direction: column; }
.collab-table .who-name { font-weight: 600; }
.collab-table .who-dept { font-size: 12px; }
.collab-table .count-pill {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #201400;
  font-weight: 700;
}
.collab-table .roles,
.collab-table .films { font-size: 13px; color: var(--muted); }

/* ---------- Favorites map ---------- */
.map-btn {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--accent-2);
  background: transparent;
  color: var(--accent-2);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.map-btn:hover { background: var(--accent-2); color: #04121f; }

.map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.map-head h2 { margin: 0; }
.map-counts { color: var(--muted); font-size: 13px; }

.map-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 14px;
  margin-top: 12px;
}
.map-filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  align-self: start;
}
.flt-group { margin-bottom: 16px; }
.flt-group:last-child { margin-bottom: 0; }
.flt-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}
.flt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
}
.flt input { accent-color: var(--accent); }
.flt .sw {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.flt-scroll { max-height: 220px; overflow-y: auto; }

.map-canvas {
  height: 620px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  z-index: 1;
  background: #0b1620;
}

.unresolved {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.unresolved summary { cursor: pointer; }
.unresolved ul { margin: 8px 0 0; padding-left: 18px; }
.unresolved li span { color: var(--text); }

/* Leaflet popup theming */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip { background: var(--panel-2); color: var(--text); }
.leaflet-popup-content { margin: 12px 14px; }
.map-popup .pp-name { font-weight: 700; font-size: 14px; }
.map-popup .pp-role { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.map-popup .pp-place { font-size: 13px; }
.map-popup .pp-extra { font-size: 12px; color: var(--muted); margin-top: 2px; }
.map-popup .pp-via { font-size: 12px; color: var(--muted); margin-top: 2px; }
.map-popup .popup-open {
  margin-top: 8px;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #201400;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 720px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-canvas { height: 460px; }
}

/* ---------- Loading ---------- */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 17, 22, 0.5);
  z-index: 50;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; order: 2; }
  .topbar { flex-wrap: wrap; }
  .search { max-width: none; width: 100%; }
}

/* ========================================================================= */
/* Reel Talk Studio — retro tape-deck theme (scoped under .studio)           */
/* ========================================================================= */
@keyframes vu { 0%,100% { height: 22%; } 50% { height: 92%; } }
@keyframes onair { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.studio-btn-nav {
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 12px;
  border: 1px solid #B85C38;
  background: transparent;
  color: #d98a5f;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.studio-btn-nav:hover { background: #B85C38; color: #fff; }

.studio {
  --rt-dark: #2A251D;
  --rt-cream: #EFE7D2;
  --rt-accent: #B85C38;
  --rt-gold: #E4A72E;
  --rt-panel: #F3ECD8;
  --rt-line: #C9BB98;
  --rt-active: #FBF4E1;
  --rt-muted: #8A7C5E;
  --rt-red: #E5493A;
  background: #E7DDC4 radial-gradient(rgba(42,37,29,.05) 1px, transparent 1px) 0 0/16px 16px;
  color: var(--rt-dark);
  font-family: "Archivo", -apple-system, sans-serif;
  border: 1px solid var(--rt-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.studio button { font-family: "Oswald", sans-serif; }
.studio input, .studio textarea { font-family: "Archivo", sans-serif; }
.studio .st-kicker, .studio .st-brand-sub { font-family: "Space Mono", monospace; }

/* topbar */
.st-topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px; height: 60px;
  background: var(--rt-dark); color: var(--rt-cream);
  border-bottom: 3px solid var(--rt-accent);
}
.st-brand { display: flex; align-items: center; gap: 10px; }
.st-reels { display: flex; gap: 4px; }
.st-reels i {
  width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--rt-gold);
  position: relative; animation: spin 6s linear infinite;
}
.st-reels i::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--rt-gold); }
.st-brand-name { font-family: "Oswald", sans-serif; font-weight: 700; font-size: 17px; letter-spacing: 1.5px; display: block; line-height: 1; }
.st-brand-sub { font-size: 8px; letter-spacing: 2.5px; color: #B08A5A; display: block; }
.st-navgroup { display: flex; gap: 4px; }
.st-nav {
  font-weight: 500; letter-spacing: 1px; font-size: 13px; padding: 7px 14px;
  border: none; cursor: pointer; background: transparent; color: #C6B78F;
}
.st-nav.on { background: var(--rt-accent); color: #fff; }
.st-nav:disabled { opacity: .4; cursor: not-allowed; }
.st-topright { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.st-onair {
  display: flex; align-items: center; gap: 7px; font-family: "Oswald", sans-serif;
  font-weight: 600; letter-spacing: 2px; font-size: 12px; color: #F0C9C1;
}
.st-onair i { width: 10px; height: 10px; border-radius: 50%; background: var(--rt-red); box-shadow: 0 0 10px var(--rt-red); animation: onair 1.4s ease-in-out infinite; }
.st-exit { background: none; border: 1px solid #443b2d; color: #B08A5A; font-size: 11px; letter-spacing: 1px; padding: 6px 10px; cursor: pointer; border-radius: 4px; }
.st-exit:hover { color: var(--rt-cream); border-color: var(--rt-cream); }

/* generic buttons */
.st-btn-dark { font-weight: 600; letter-spacing: 1px; font-size: 13px; background: var(--rt-dark); color: var(--rt-cream); border: none; padding: 12px 18px; cursor: pointer; }
.st-btn-light { font-weight: 500; letter-spacing: 1px; font-size: 12px; background: #EDE3C9; border: 1.5px solid var(--rt-line); padding: 7px 12px; cursor: pointer; color: var(--rt-dark); }
.st-btn-light:hover { border-color: var(--rt-dark); }
.st-link { background: none; border: none; font-family: "Space Mono", monospace; font-size: 11px; letter-spacing: 2px; color: var(--rt-muted); cursor: pointer; padding: 0; }
.st-link:hover { color: var(--rt-accent); }

/* library */
.st-page { max-width: 1120px; margin: 0 auto; padding: 30px 24px 50px; }
.st-page-head { display: flex; align-items: flex-end; justify-content: space-between; border-bottom: 2px solid var(--rt-dark); padding-bottom: 14px; margin-bottom: 26px; }
.st-kicker { font-size: 11px; letter-spacing: 4px; color: var(--rt-muted); }
.st-h1 { font-family: "Oswald", sans-serif; font-weight: 700; font-size: 40px; margin: 4px 0 0; letter-spacing: .5px; }
.st-ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.st-ep-card { background: var(--rt-panel); border: 1.5px solid var(--rt-line); cursor: pointer; display: flex; flex-direction: column; transition: transform .12s, border-color .12s; }
.st-ep-card:hover { border-color: var(--rt-dark); transform: translateY(-3px); }
.st-ep-poster { height: 130px; background: repeating-linear-gradient(45deg,#DED0AF,#DED0AF 9px,#D6C7A2 9px,#D6C7A2 18px); display: flex; align-items: flex-start; justify-content: space-between; padding: 12px; border-bottom: 1.5px solid var(--rt-line); }
.st-ep-num { font-family: "Space Mono", monospace; font-size: 10px; letter-spacing: 2px; color: rgba(42,37,29,.55); }
.st-badge { font-family: "Oswald", sans-serif; font-size: 10px; letter-spacing: 1.5px; padding: 4px 9px; }
.st-badge.draft { background: var(--rt-gold); color: var(--rt-dark); }
.st-badge.pub { background: #3E6B63; color: #fff; }
.st-ep-body { padding: 14px 15px 15px; position: relative; }
.st-ep-title { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 18px; line-height: 1.15; min-height: 42px; }
.st-ep-foot { display: flex; justify-content: space-between; font-family: "Space Mono", monospace; font-size: 11px; color: var(--rt-muted); margin-top: 10px; border-top: 1px dashed var(--rt-line); padding-top: 9px; }
.st-ep-del { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border: 1px solid #d9b3a5; background: #f2dfd8; color: var(--rt-accent); cursor: pointer; font-size: 11px; opacity: 0; transition: opacity .12s; }
.st-ep-card:hover .st-ep-del { opacity: 1; }
.st-empty { color: var(--rt-muted); font-size: 15px; grid-column: 1/-1; padding: 30px; text-align: center; border: 1px dashed var(--rt-line); }

/* prep */
.st-prep { max-width: 1120px; margin: 0 auto; padding: 24px 24px 50px; display: grid; grid-template-columns: 1fr 300px; gap: 26px; align-items: start; }
.st-prep-crumb { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.st-prep-crumb span { font-family: "Space Mono", monospace; font-size: 11px; color: var(--rt-muted); }
.st-ep-title-input { width: 100%; font-family: "Oswald", sans-serif; font-weight: 700; font-size: 32px; border: none; background: transparent; border-bottom: 2px solid transparent; padding: 2px 0 6px; color: var(--rt-dark); outline: none; }
.st-ep-title-input:focus { border-bottom-color: var(--rt-accent); }
.st-prep-meta { display: flex; align-items: center; gap: 16px; margin: 14px 0 20px; font-family: "Space Mono", monospace; font-size: 12px; color: #5C5344; }
.st-sep { width: 1px; height: 14px; background: var(--rt-line); }
.st-prep-meta .st-btn-light { margin-left: auto; }
.st-blocks { display: flex; flex-direction: column; gap: 12px; }
.st-block { background: var(--rt-panel); border: 1.5px solid var(--rt-line); border-left: 5px solid var(--rt-line); padding: 13px 15px; }
.st-block-head { display: flex; align-items: center; gap: 9px; }
.st-grip { cursor: grab; color: #B7A278; font-size: 15px; }
.st-block-num { font-family: "Space Mono", monospace; font-size: 12px; color: var(--rt-muted); min-width: 24px; }
.st-block-title { flex: 1; font-family: "Oswald", sans-serif; font-weight: 600; font-size: 17px; border: none; background: transparent; outline: none; color: var(--rt-dark); }
.st-block-plan { width: 46px; font-family: "Space Mono", monospace; font-size: 12px; text-align: right; border: 1px solid var(--rt-line); background: #EDE3C9; padding: 4px 6px; outline: none; }
.st-min { font-family: "Space Mono", monospace; font-size: 11px; color: var(--rt-muted); }
.st-mini { width: 26px; height: 26px; border: 1px solid var(--rt-line); background: #EDE3C9; cursor: pointer; font-size: 12px; color: #5C5344; }
.st-mini.st-del { border-color: #d9b3a5; background: #f2dfd8; color: var(--rt-accent); }
.st-block-note { width: 100%; margin-top: 9px; font-size: 13.5px; line-height: 1.5; color: #5C5344; border: none; border-top: 1px dashed var(--rt-line); padding-top: 9px; background: transparent; resize: vertical; min-height: 42px; outline: none; }

.st-prep-side { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.st-btn-air { font-weight: 700; letter-spacing: 1.5px; font-size: 16px; background: var(--rt-red); color: #fff; border: none; padding: 15px; cursor: pointer; box-shadow: 0 4px 0 #a5301f; }
.st-btn-air:active { transform: translateY(2px); box-shadow: 0 2px 0 #a5301f; }
.st-pull { background: var(--rt-dark); color: var(--rt-cream); padding: 15px 16px; }
.st-pull-kicker { font-family: "Space Mono", monospace; font-size: 10px; letter-spacing: 2px; color: #B08A5A; }
.st-pull-title { font-family: "Oswald", sans-serif; font-size: 15px; margin: 3px 0 10px; }
.st-pull-search { width: 100%; padding: 8px 10px; background: #14110c; border: 1px solid #443b2d; color: var(--rt-cream); outline: none; font-size: 13px; }
.st-pull-search:focus { border-color: var(--rt-gold); }
.st-pull-results { margin-top: 8px; }
.st-pull-item { display: flex; align-items: center; gap: 10px; padding: 8px; cursor: pointer; border-top: 1px solid #443b2d; }
.st-pull-item:hover { background: #3a3225; }
.st-pull-ic { font-size: 15px; }
.st-pull-name { flex: 1; min-width: 0; font-family: "Oswald", sans-serif; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-pull-name span { display: block; font-family: "Space Mono", monospace; font-size: 10px; color: #B08A5A; }
.st-pull-add { color: var(--rt-gold); font-family: "Oswald", sans-serif; font-size: 18px; }
.st-pull-err { color: #F0C9C1; font-size: 12px; padding: 8px 0; }

/* record / on air */
.st-record { min-height: 60vh; }
.st-transport { position: sticky; top: 66px; z-index: 10; background: var(--rt-dark); color: var(--rt-cream); padding: 16px 24px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; border-bottom: 3px solid var(--rt-accent); }
.st-tp-kick { font-family: "Space Mono", monospace; font-size: 10px; letter-spacing: 3px; color: #B08A5A; }
.st-tp-title { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 20px; line-height: 1.1; max-width: 320px; }
.st-clockbox { background: #14110c; border: 2px solid #443b2d; padding: 6px 16px; display: flex; flex-direction: column; align-items: center; }
.st-clock-label { font-family: "Space Mono", monospace; font-size: 9px; letter-spacing: 2px; color: var(--rt-muted); }
.st-clock { font-family: "Space Mono", monospace; font-weight: 700; font-size: 30px; color: var(--rt-gold); letter-spacing: 2px; text-shadow: 0 0 12px rgba(228,167,46,.4); }
.st-vu { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.st-vu-bar { width: 5px; background: var(--rt-accent); border-radius: 2px; height: 30%; }
.st-tp-btns { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }
.st-rec { font-weight: 700; letter-spacing: 1px; font-size: 13px; border: none; cursor: pointer; padding: 0 18px; height: 40px; background: var(--rt-red); color: #fff; }
.st-rec.live { background: var(--rt-gold); color: var(--rt-dark); }
.st-next { font-weight: 600; letter-spacing: 1px; font-size: 13px; background: #3E6B63; color: #fff; border: none; padding: 0 16px; height: 40px; cursor: pointer; }
.st-finish { font-weight: 600; letter-spacing: 1px; font-size: 13px; background: transparent; color: var(--rt-cream); border: 1px solid #443b2d; padding: 0 14px; height: 40px; cursor: pointer; }
.st-finish:hover { border-color: var(--rt-cream); }
.st-runorder { padding: 24px; max-width: 1120px; margin: 0 auto; }
.st-runorder-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-family: "Space Mono", monospace; font-size: 11px; letter-spacing: 2px; color: var(--rt-muted); }
.st-rows { display: flex; flex-direction: column; gap: 11px; }
.st-row { background: var(--rt-panel); border: 1.5px solid var(--rt-line); border-left: 5px solid var(--rt-line); padding: 13px 15px; cursor: pointer; }
.st-row.done { background: #EBE2CB; border-left-color: #9DB0A9; }
.st-row.active { background: var(--rt-active); border-left-color: var(--rt-accent); box-shadow: 0 6px 22px rgba(184,92,56,.18); }
.st-row-head { display: flex; align-items: center; gap: 13px; }
.st-dot { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: "Oswald", sans-serif; font-size: 12px; background: #EDE3C9; color: var(--rt-muted); border: 1.5px solid var(--rt-line); }
.st-row.active .st-dot { background: var(--rt-accent); color: #fff; border-color: var(--rt-accent); }
.st-row.done .st-dot { background: #9DB0A9; color: #fff; border-color: #9DB0A9; }
.st-row-main { flex: 1; min-width: 0; }
.st-row-title { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 18px; }
.st-row-status { font-family: "Space Mono", monospace; font-size: 11px; color: var(--rt-muted); }
.st-row-timer { font-family: "Space Mono", monospace; font-weight: 700; font-size: 15px; letter-spacing: 1px; color: var(--rt-muted); padding: 2px 6px; }
.st-row.active .st-row-timer { font-size: 22px; background: var(--rt-dark); color: var(--rt-gold); padding: 6px 12px; }
.st-row-timer.over { color: var(--rt-red) !important; }
.st-live { margin-top: 12px; border-top: 1px dashed rgba(42,37,29,.25); padding-top: 11px; }
.st-live-label { font-family: "Space Mono", monospace; font-size: 10px; letter-spacing: 2px; color: var(--rt-muted); margin-bottom: 6px; }
.st-live-note { width: 100%; font-size: 14px; line-height: 1.55; color: var(--rt-dark); background: #FFFDF6; border: 1.5px solid var(--rt-line); padding: 10px 12px; resize: vertical; min-height: 64px; outline: none; }
.st-live-note:focus { border-color: var(--rt-accent); }
.st-prog { height: 6px; background: rgba(42,37,29,.12); margin-top: 11px; border-radius: 3px; overflow: hidden; }
.st-prog-bar { height: 100%; transition: width .5s; }

@media (max-width: 760px) {
  .st-prep { grid-template-columns: 1fr; }
  .st-prep-side { position: static; }
  .st-topbar { gap: 12px; padding: 0 12px; flex-wrap: wrap; height: auto; padding: 10px 12px; }
  .st-transport { top: 0; }
}
