/* ==========================================================================
   SET ROULETTE — BROADCAST CONSOLE
   Flat steel panels, screen-printed labels, one hot lamp.
   ========================================================================== */

:root {
  /* Surfaces — warm graphite, not pure black */
  --void:        #0a0a0c;
  --steel-900:   #101114;
  --steel-800:   #16181c;
  --steel-700:   #1d2026;
  --steel-600:   #262a31;

  /* Hairlines */
  --line:        #23262c;
  --line-hot:    #343941;

  /* Ink */
  --ink:         #e8e4dc;
  --ink-dim:     #8b9098;
  --ink-faint:   #565c64;

  /* The one hot accent */
  --amber:       #ff5c00;
  --amber-lit:   #ff8534;
  --amber-wash:  rgba(255, 92, 0, 0.12);

  /* Channel colours — patch-cable coding, used at 2px and 10px only */
  --ch-hor:      #c6ff00;
  --ch-br:       #ff2e63;
  --ch-cercle:   #00e5c4;
  --ch-hush:     #a06bff;
  --ch-def:      #ffb000;
  --ch-space:    #48a7ff;
  --ch-nts:      #ff4500;
  --ch-dublab:   #9b51e0;
  --ch-mixmag:   #eb5757;
  --ch-hate:     #27ae60;
  --ch-dekmantel:#f2994a;

  --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono:    'Azeret Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --rail-h: 52px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
  font-family: var(--display);
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Analog Hardware Grain Overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

button, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* Screen-printed micro label, used everywhere a machine would have one */
.label-print,
.plate-label,
.rack-head h2,
.detail-label,
.rail-tab,
.slate-status-text,
.chip,
.spec dt {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ══ TOP RAIL ════════════════════════════════════════════════════════════ */

.rail {
  flex: none;
  height: var(--rail-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  background: var(--steel-900);
  border-bottom: 1px solid var(--line);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dice-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  background: transparent;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.dice-mark svg {
  display: block;
  width: 22px;
  height: 22px;
}

.rail-wordmark {
  font-size: 1.25rem;
  font-weight: 500;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1;
}

.rail-wordmark b {
  font-weight: 800;
  font-variation-settings: 'wdth' 125, 'wght' 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.rail-stat {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.rail-tabs {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--line);
}

.rail-tab {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 8px 20px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.rail-tab:last-child { border-right: none; }
.rail-tab:hover { color: var(--ink); background: var(--steel-800); }

.rail-tab.active {
  background: var(--amber);
  color: var(--void);
  font-weight: 700;
}

.rail-actions { display: flex; gap: 8px; }

.rail-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 7px 11px;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-decoration: none;
}

.rail-btn:hover { color: var(--ink); border-color: var(--line-hot); }

.rail-btn-accent {
  background: rgba(198, 255, 0, 0.08);
  border-color: #c6ff00;
  color: #c6ff00;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(198, 255, 0, 0.15);
}

.rail-btn-accent:hover {
  background: #c6ff00;
  color: var(--void);
  border-color: #c6ff00;
  box-shadow: 0 0 16px rgba(198, 255, 0, 0.45);
}

.rail-credit {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.rail-credit a {
  color: var(--ink-dim);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.rail-credit a:hover {
  color: var(--amber);
  text-decoration: underline;
}

.rail-num {
  color: var(--amber);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ══ VIEW SHELL ══════════════════════════════════════════════════════════ */

.view-section { flex: 1; min-height: 0; position: relative; }
.view-section.hidden { display: none !important; }
.view-section.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; pointer-events: none; }
.view-section.active { display: flex; flex-direction: column; }

/* ══ ROULETTE CONSOLE ════════════════════════════════════════════════════ */

.console {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
}

/* ── The rack (left) ── */

.rack {
  background: var(--steel-900);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.014) 0 1px,
    transparent 1px 4px
  );
}

.plate {
  position: relative;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--line);
}

.plate-label {
  display: block;
  color: var(--ink-faint);
  margin-bottom: 12px;
}

/* Primary set selector */
.lever {
  position: relative;
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  cursor: pointer;
  background: var(--amber);
  color: var(--void);
  border: 1px solid var(--amber-lit);
  box-shadow: 0 3px 0 #873100, 0 8px 18px rgba(0, 0, 0, 0.42);
  transition: background 0.15s linear, box-shadow 0.08s linear, transform 0.08s linear;
}

.lever:hover { background: var(--amber-lit); }

.lever:active,
.lever.lever-pressed,
body.is-spinning .lever {
  transform: translateY(3px);
  box-shadow: 0 0 0 #873100, inset 0 2px 6px rgba(77, 25, 0, 0.32);
}

.lever-word {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  color: currentColor;
}

.lever-lamp {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  flex: none;
  padding-left: 2px;
  background: var(--void);
  color: var(--amber);
  border: 1px solid var(--void);
  font-size: 0.68rem;
  transition: color 0.2s, transform 0.2s;
}

body.is-spinning .lever-lamp {
  color: var(--amber-lit);
  transform: scale(0.86);
}

.rack-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.rack-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rack-head h2 { color: var(--ink-dim); font-weight: 500; }

.rack-clear {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.rack-clear:hover { color: var(--amber); border-bottom-color: var(--amber); }

.chip-field {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 6px 9px;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}

.chip:hover { color: var(--ink); border-color: var(--line-hot); }

.chip.active {
  background: var(--amber-wash);
  border-color: var(--amber);
  color: var(--amber-lit);
  font-weight: 700;
}

/* Source chips carry their channel colour */
.source-field .chip { padding-left: 14px; position: relative; }

.source-field .chip::before {
  content: '';
  position: absolute;
  left: 5px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 11px;
  background: var(--ch, var(--ink-faint));
}

.source-field .chip.active {
  background: transparent;
  border-color: var(--ch);
  color: var(--ch);
}

.rack-readout {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  line-height: 1.5;
}

.rack-foot {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.pool { display: flex; align-items: baseline; gap: 10px; }

.pool-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pool-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-left: auto;
}

.rack-hint {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.rack-hint kbd {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--ink-dim);
  border: 1px solid var(--line-hot);
  padding: 1px 5px;
}

/* ── Transmission (right) ── */

.tx {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--void);
}

/* Signature: destination slate */
.slate {
  flex: none;
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 46px;
  background: var(--steel-900);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.slate-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  background: var(--steel-800);
}

.slate-lamp {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  transition: background 0.2s, box-shadow 0.2s;
}

.slate-status-text { color: var(--ink-dim); white-space: nowrap; }

body.is-spinning .slate-lamp,
body.is-live .slate-lamp {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

body.is-live .slate-lamp { animation: pulse 2.4s ease-in-out infinite; }

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

.slate-window {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.slate-artist {
  color: var(--ink);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slate-sep { color: var(--amber); flex: none; }

.slate-title {
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.slate-window.spinning {
  animation: reelSpinBlur 0.08s linear infinite;
}

@keyframes reelSpinBlur {
  0%   { opacity: 0.5; transform: translateY(-2px); filter: blur(1px); }
  50%  { opacity: 0.9; transform: translateY(0);    filter: blur(0px); }
  100% { opacity: 0.5; transform: translateY(2px);  filter: blur(1px); }
}

.slate-window.no-match .slate-artist { color: var(--amber); }

/* The monitor */
.screen-bay {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(255, 92, 0, 0.05), transparent 60%),
    var(--void);
}

.screen {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  margin: auto;
  background: #000;
  border: 1px solid var(--line);
}

.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.screen-loader {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(10, 10, 12, 0.94);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.screen-loader.active { opacity: 1; pointer-events: auto; }

.loader-bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }

.loader-bars i {
  width: 3px;
  height: 100%;
  background: var(--amber);
  transform-origin: bottom;
  animation: vu 0.7s ease-in-out infinite;
}

.loader-bars i:nth-child(2) { animation-delay: 0.1s; }
.loader-bars i:nth-child(3) { animation-delay: 0.22s; }
.loader-bars i:nth-child(4) { animation-delay: 0.34s; }
.loader-bars i:nth-child(5) { animation-delay: 0.46s; }

@keyframes vu {
  0%, 100% { transform: scaleY(0.18); }
  50%      { transform: scaleY(1); }
}

/* Set details */
.tx-meta {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px 18px;
  background: var(--steel-900);
  border-top: 1px solid var(--line);
}

.tx-meta-main { min-width: 0; }

.tx-title {
  font-size: 1.32rem;
  font-weight: 700;
  font-variation-settings: 'wdth' 108, 'wght' 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tx-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.spec {
  padding-right: 20px;
  margin-right: 20px;
  border-right: 1px solid var(--line);
}

.spec:last-child { border-right: none; margin-right: 0; padding-right: 0; }

.spec dt { color: var(--ink-faint); margin-bottom: 3px; }

.spec dd {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tx-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }

.set-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 3px 7px;
}

.tx-actions { display: flex; gap: 8px; flex: none; }

.tx-btn {
  background: transparent;
  border: 1px solid var(--line-hot);
  color: var(--ink);
  padding: 10px 15px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tx-btn:hover { background: var(--steel-700); }

.tx-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--void);
  font-weight: 700;
}

/* ══ MAP VIEW ════════════════════════════════════════════════════════════ */

#map {
  width: 100%;
  height: 100%;
  background: #0d0f12;
  z-index: 1;
}

.leaflet-container {
  background: #0d0f12 !important;
  font-family: var(--mono) !important;
}

.leaflet-tile-pane { filter: brightness(1.35) saturate(0.6) contrast(1.05); }

.leaflet-control-zoom a {
  background: var(--steel-900) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink-dim) !important;
  border-radius: 0 !important;
}

.leaflet-control-zoom a:hover { color: var(--amber) !important; }

.map-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0;
  height: 44px;
  background: var(--steel-900);
  border-bottom: 1px solid var(--line);
}

.search-box {
  position: relative;
  flex: none;
  width: 320px;
  height: 100%;
  border-right: 1px solid var(--line);
}

.search-box input {
  width: 100%;
  height: 100%;
  padding: 0 14px 0 36px;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.search-box input::placeholder { color: var(--ink-faint); }
.search-box:focus-within { background: var(--steel-800); }

.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}

.filter-bar {
  display: flex;
  align-items: stretch;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  position: relative;
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 0 18px;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.filter-chip:hover { color: var(--ink); background: var(--steel-800); }

.filter-chip.active { color: var(--ink); background: var(--steel-800); font-weight: 700; }

.filter-chip.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--ch, var(--amber));
}

/* ── Feed panel ── */

.drawer-panel {
  position: absolute;
  top: 44px; right: 0; bottom: 0;
  width: 372px;
  z-index: 10;
  background: var(--steel-900);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.drawer-panel.collapsed { transform: translateX(calc(100% - 34px)); }

.drawer-header {
  flex: none;
  height: 44px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.drawer-title-group { display: flex; align-items: baseline; gap: 10px; }

.drawer-title {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.set-count-badge {
  font-family: var(--mono);
  font-size: 0.63rem;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.drawer-controls { display: flex; align-items: center; gap: 8px; }

.density-toggle { display: flex; border: 1px solid var(--line); }

.density-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--ink-faint);
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.density-btn:last-child { border-right: none; }
.density-btn.active { background: var(--steel-700); color: var(--ink); }

.collapse-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  width: 26px;
  height: 26px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s, transform 0.3s;
}

.collapse-btn:hover { color: var(--amber); }
.drawer-panel.collapsed .collapse-btn { transform: rotate(180deg); }

.set-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.set-list::-webkit-scrollbar { width: 6px; }
.set-list::-webkit-scrollbar-track { background: var(--void); }
.set-list::-webkit-scrollbar-thumb { background: var(--steel-600); }

.list-empty {
  padding: 48px 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* List rows */
.compact-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px 9px 9px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.14s, border-left-color 0.14s;
}

.compact-item:hover { background: var(--steel-800); border-left-color: var(--ch, var(--line-hot)); }
.compact-item.active { background: var(--steel-700); border-left-color: var(--amber); }

.compact-thumb {
  width: 52px;
  height: 34px;
  background-size: cover;
  background-position: center;
  background-color: var(--void);
  flex: none;
  filter: grayscale(0.5) contrast(1.05);
}

.compact-item:hover .compact-thumb,
.compact-item.active .compact-thumb { filter: none; }

.compact-info { flex: 1; min-width: 0; }

.compact-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-sub {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  display: flex;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.compact-location { color: var(--ink-dim); }
.compact-dot { color: var(--ch, var(--ink-faint)); }

.broadcaster-tag-sm {
  flex: none;
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ch, var(--ink-faint));
}

/* Grid cards */
.set-list:not(.compact-mode) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  align-content: start;
}

.set-card {
  background: var(--steel-900);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: background 0.14s;
}

.set-card:hover { background: var(--steel-800); }
.set-card.active { background: var(--steel-700); }

.card-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: var(--void);
  filter: grayscale(0.45);
  transition: filter 0.2s;
}

.set-card:hover .card-thumbnail { filter: none; }

.thumbnail-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 10, 12, 0.9));
}

.broadcaster-badge {
  position: absolute;
  left: 0; bottom: 0;
  padding: 3px 7px;
  background: var(--void);
  color: var(--ch, var(--ink));
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-body { padding: 9px 10px 11px; }

.set-title {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-row {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}

.location-tag { color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; }

.load-more-btn {
  grid-column: 1 / -1;
  width: 100%;
  padding: 13px;
  background: var(--steel-900);
  border: none;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.load-more-btn:hover { color: var(--amber); background: var(--steel-800); }

/* ── Map markers ── */

.custom-leaflet-hub {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hub-circle {
  display: inline-flex;
  align-items: stretch;
  background: rgba(16, 17, 20, 0.94);
  border: 1px solid var(--line-hot);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.hub-circle::before {
  content: '';
  width: 3px;
  background: var(--amber);
  flex: none;
}

.hub-circle:hover { border-color: var(--amber); background: var(--void); z-index: 1000; }

.hub-node {
  width: 7px;
  height: 7px;
  background: var(--amber);
  border: 1px solid var(--void);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.hub-node:hover {
  transform: scale(1.8);
  box-shadow: 0 0 10px var(--amber);
}

.hub-circle.selected {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--void);
}

.hub-circle.selected::before { background: var(--void); }

.hub-name {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 7px;
}

.hub-count {
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 4px 7px;
  border-left: 1px solid var(--line-hot);
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.hub-circle.selected .hub-count { color: var(--void); border-left-color: rgba(0, 0, 0, 0.3); }

/* ══ SIDE DRAWER ═════════════════════════════════════════════════════════ */

.sidebar-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar-drawer.active { pointer-events: auto; opacity: 1; }

.drawer-overlay { position: absolute; inset: 0; background: rgba(6, 6, 8, 0.78); }

.drawer-content {
  position: absolute;
  top: 0; right: 0;
  width: 380px;
  max-width: 90vw;
  height: 100%;
  background: var(--steel-900);
  border-left: 1px solid var(--line-hot);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-drawer.active .drawer-content { transform: translateX(0); }

.drawer-top-header {
  flex: none;
  height: var(--rail-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-top-header h2 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.close-drawer-btn,
.close-modal-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  width: 26px;
  height: 26px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.close-drawer-btn:hover,
.close-modal-btn:hover { color: var(--amber); border-color: var(--amber); }

.drawer-body { flex: 1; overflow-y: auto; }

.drawer-history-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.14s, border-left-color 0.14s;
}

.drawer-history-item:hover { background: var(--steel-800); border-left-color: var(--ch, var(--amber)); }

.drawer-item-thumb {
  width: 52px;
  height: 34px;
  flex: none;
  background-size: cover;
  background-position: center;
  background-color: var(--void);
  filter: grayscale(0.5);
}

.drawer-history-item:hover .drawer-item-thumb { filter: none; }

.drawer-item-info { flex: 1; min-width: 0; }

.drawer-item-title {
  font-size: 0.79rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item-meta {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══ MODAL ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(6, 6, 8, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
  width: 100%;
  max-width: 880px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--steel-900);
  border: 1px solid var(--line-hot);
  border-top: 2px solid var(--amber);
}

.modal-header {
  height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-title {
  font-size: 0.92rem;
  font-weight: 700;
  font-variation-settings: 'wdth' 108, 'wght' 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.video-container iframe,
.video-container > div {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  border: none;
}

.modal-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.detail-box { background: var(--steel-900); padding: 12px 14px; }

.detail-label { color: var(--ink-faint); display: block; margin-bottom: 5px; }

.detail-value {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink);
}

/* ══ RESPONSIVE ══════════════════════════════════════════════════════════ */

@media (max-width: 1080px) {
  .console { grid-template-columns: 288px minmax(0, 1fr); }
  .drawer-panel { width: 320px; }
}

@media (max-width: 860px) {
  html, body { overflow: auto; }
  #app { height: auto; min-height: 100%; }

  .rail { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 12px; }
  .rail-tabs { margin-left: 0; order: 3; width: 100%; }
  .rail-tab { flex: 1; }
  .rail-actions { margin-left: auto; }
  .rail-stat { display: none; }

  .view-section.active { display: block; }

  .console { display: flex; flex-direction: column-reverse; }
  .rack { border-right: none; border-top: 1px solid var(--line); overflow: visible; padding-bottom: 78px; }

  /* Spin stays under the thumb instead of scrolling away */
  .plate {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    padding: 10px 12px;
    background: var(--steel-900);
    border-top: 1px solid var(--line-hot);
    border-bottom: none;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
  }

  .plate-label { display: none; }
  .lever { min-height: 56px; }
  .lever-word { font-size: 0.86rem; }
  .rack-foot { padding-bottom: 24px; }
  .screen-bay { padding: 0; }
  .screen { border-left: none; border-right: none; }
  .tx-meta { flex-direction: column; align-items: stretch; gap: 16px; }
  .tx-actions { flex-wrap: wrap; }
  .tx-btn { flex: 1; text-align: center; }

  .slate { height: auto; flex-direction: column; align-items: stretch; }
  .slate-status { border-right: none; border-bottom: 1px solid var(--line); padding: 8px 14px; }
  .slate-window { padding: 10px 14px; }
  .slate-artist { max-width: 100%; }

  #mapViewSection.active { display: flex; flex-direction: column; height: calc(100vh - 100px); }
  .map-bar { position: relative; flex-wrap: wrap; height: auto; }
  .search-box { width: 100%; height: 40px; border-right: none; border-bottom: 1px solid var(--line); }
  .filter-chip { padding: 12px 14px; }

  /* Map, bar and drawer are now in-flow flex siblings instead of an
     absolutely-positioned overlay — #map needs an explicit share of the
     remaining height or it collapses to 0 and Leaflet never gets a size. */
  #map { flex: 1 1 0; min-height: 160px; }
  .drawer-panel { position: relative; top: 0; width: 100%; height: 45vh; flex: none; border-left: none; border-top: 1px solid var(--line); }
  .drawer-panel.collapsed { transform: none; }
  .collapse-btn { display: none; }
}

/* ── Small phones (iPhone SE/mini and similar, ~360–430px) ── */
@media (max-width: 480px) {
  .rail-brand { gap: 8px; }
  .dice-mark svg { width: 18px; height: 18px; }
  .rail-wordmark { font-size: 0.92rem; }
  .rail-tab { padding: 8px 10px; font-size: 0.72rem; }
  .rail-btn { padding: 6px 8px; font-size: 0.66rem; }

  .rack { padding: 14px 12px 78px; }
  .chip-field { gap: 5px; }
  .chip { padding: 6px 9px; font-size: 0.7rem; }
  .plate { padding: 8px 10px; }

  .tx-meta { padding: 14px 14px 16px; }
  .tx-title { font-size: 1.1rem; }
  .tx-specs { gap: 10px 0; }
  .spec { padding-right: 12px; margin-right: 12px; }

  .slate-artist, .slate-title { font-size: 0.82rem; }

  .search-box { height: 38px; }
  .filter-chip { padding: 10px 12px; font-size: 0.7rem; }
  .drawer-header { padding: 0 10px; flex-wrap: wrap; height: auto; min-height: 44px; }
  .drawer-title-group { gap: 6px; }

  .modal-details { grid-template-columns: 1fr; }
  .detail-box { padding: 10px 14px; }

  .toast { left: 12px; right: 12px; bottom: 16px; text-align: center; }
}

/* ── Short viewports (landscape phones) — the fixed spin bar and the
   45vh map drawer both eat disproportionate space when height is tight ── */
@media (max-width: 860px) and (max-height: 480px) {
  .drawer-panel { height: 60vh; }
  .lever { min-height: 44px; }
  .rack-foot { display: none; }
}

/* ─── MAP MODE TOGGLE ────────────────────────────── */
.map-mode-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 0 8px;
  height: 48px;
}

.map-mode-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.map-mode-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.map-mode-btn.active {
  color: var(--void);
  background: var(--amber);
}

/* ─── TOAST NOTIFICATION ────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  background: var(--amber);
  color: var(--void);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── TRACKLIST BOX ─────────────────────────────── */
.tracklist-box {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
}

.tracklist-box.hidden {
  display: none;
}

.tracklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

.tracklist-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--amber);
}

.tracklist-count {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
}

.tracklist-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.track-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.track-time {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber);
  background: rgba(255, 176, 0, 0.12);
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.track-name {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ─── MINI-PLAYER (PERSISTENT PLAYBACK) ──────────── */
.mini-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--steel-800);
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  pointer-events: none;
}

.mini-player.active {
  transform: translateY(0);
  pointer-events: auto;
}

.mini-player-thumb {
  width: 44px;
  height: 44px;
  border-radius: 3px;
  background-size: cover;
  background-position: center;
  background-color: var(--steel-700);
  flex-shrink: 0;
}

.mini-player-info {
  flex: 1;
  min-width: 0;
}

.mini-player-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-artist {
  font-size: 0.7rem;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-back,
.mini-player-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.mini-player-back:hover,
.mini-player-close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.mini-player-back svg {
  display: block;
}

.mini-player-close {
  font-size: 0.85rem;
}
