:root {
  --chrome-hi: #4d6283;
  --chrome-mid: #26354c;
  --chrome-lo: #0d1420;
  --edge: #070b12;
  --accent: #5fa8ff;
  --accent-deep: #1d5fb8;
  --text: #e3eaf5;
  --muted: #8d9db6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--text);
  font: 13px/1.4 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  overflow: hidden;
}

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

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: linear-gradient(var(--chrome-mid), var(--chrome-lo));
}

/* ---------- title bar ---------- */
.titlebar {
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  background: linear-gradient(#55698a, var(--chrome-mid) 55%, #1b2738);
  border-bottom: 1px solid var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
  user-select: none;
  white-space: nowrap;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .2px; }

.orb {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d9ecff, #4f9cff 45%, #0c3f8f 80%);
  box-shadow: 0 0 6px rgba(95, 168, 255, .7);
}

.tabs { display: flex; gap: 2px; margin-left: 8px; }
.tab {
  padding: 4px 14px;
  border-radius: 3px 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.tab.active {
  color: #fff;
  background: linear-gradient(rgba(255, 255, 255, .18), rgba(255, 255, 255, .04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}

.viz-label { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px 6px 0;
  background: #000;
  border: 1px solid var(--edge);
  overflow: hidden;
}

#viz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.viz-name {
  position: absolute;
  left: 18px;
  top: 14px;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, .9), 0 1px 2px #000;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.viz-name.show { opacity: 1; transition-duration: .15s; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(10, 20, 40, .85), rgba(0, 0, 0, .92));
  overflow: auto;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(560px, 100%);
  padding: 24px 28px;
  background: linear-gradient(rgba(40, 55, 80, .85), rgba(14, 20, 32, .95));
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.panel h1 { margin: 0 0 6px; font-size: 24px; font-weight: 300; }
.panel p { margin: 0 0 16px; color: var(--muted); }
.panel .hint { margin: 14px 0 0; min-height: 1.4em; color: #ffb4a8; }
.panel .hint:empty { display: none; }

.sources { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sources button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  background: linear-gradient(rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  cursor: pointer;
}
.sources button:hover { background: linear-gradient(rgba(95, 168, 255, .35), rgba(95, 168, 255, .12)); border-color: var(--accent); }
.sources button strong { font-size: 14px; }
.sources button span { color: var(--muted); font-size: 12px; }

.drop-hint {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  color: #fff;
  background: rgba(29, 95, 184, .55);
  border: 3px dashed rgba(255, 255, 255, .6);
  pointer-events: none;
}
.app.dragging .drop-hint { display: flex; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: 90%;
  padding: 10px 16px;
  background: rgba(20, 28, 44, .95);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { border-color: #ff7b6b; color: #ffd0c8; }

/* ---------- controls ---------- */
.controls {
  flex: 0 0 92px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(#34455f, #1a2536 45%, var(--chrome-lo));
  border-top: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  user-select: none;
}

.controls-left, .controls-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls-right { justify-content: flex-end; }
.controls-center { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 300px; }

.group { display: flex; align-items: center; gap: 4px; }

.icon-btn, .source-buttons button {
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  background: linear-gradient(rgba(255, 255, 255, .16), rgba(255, 255, 255, .03));
  border: 1px solid rgba(0, 0, 0, .6);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
  cursor: pointer;
}
.icon-btn:hover, .source-buttons button:hover { background: linear-gradient(rgba(255, 255, 255, .28), rgba(255, 255, 255, .08)); }
.icon-btn:active, .source-buttons button:active { background: rgba(0, 0, 0, .3); }
.source-buttons button.active { background: linear-gradient(#6fb3ff, var(--accent-deep)); color: #fff; border-color: #0b2d5e; }

select {
  height: 26px;
  padding: 0 6px;
  background: #121a28;
  border: 1px solid rgba(0, 0, 0, .7);
  border-radius: 4px;
  color: var(--text);
}
#vizSelect { min-width: 150px; }
#micDevices { max-width: 190px; }

.check { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }

.transport { display: flex; align-items: center; gap: 14px; }

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #06223f;
  background: radial-gradient(circle at 50% 28%, #bfe0ff, #3d8ff0 40%, #0f4a9c 75%, #082b5c);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .7), inset 0 1px 1px rgba(255, 255, 255, .6);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.play-btn:hover { filter: brightness(1.15); }
.play-btn:active { transform: translateY(1px); }
.play-btn:disabled { opacity: .55; cursor: default; filter: none; transform: none; }

.seek-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.seek-row input { flex: 1; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 11px; min-width: 34px; text-align: center; }

.status { color: var(--muted); font-size: 11px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.volume { display: flex; align-items: center; gap: 4px; }
.volume input { width: 90px; }

input[type="range"] { accent-color: var(--accent); height: 20px; margin: 0; }

/* ---------- full screen ---------- */
.app.fullscreen { background: #000; }
.app.fullscreen .stage { position: absolute; inset: 0; margin: 0; border: 0; }
.app.fullscreen .titlebar,
.app.fullscreen .controls {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  transition: opacity .35s;
}
.app.fullscreen .titlebar { top: 0; background: linear-gradient(rgba(60, 78, 105, .92), rgba(20, 30, 45, .85)); }
.app.fullscreen .controls { bottom: 0; background: linear-gradient(rgba(40, 55, 80, .9), rgba(10, 16, 26, .95)); }
.app.fullscreen.idle .titlebar,
.app.fullscreen.idle .controls { opacity: 0; pointer-events: none; }
.app.fullscreen.idle { cursor: none; }

@media (max-width: 720px) {
  .tabs { display: none; }
  .controls { grid-template-columns: 1fr; height: auto; flex-basis: auto; gap: 6px; }
  .controls-center { min-width: 0; width: 100%; }
  .controls-right { justify-content: flex-start; }
  .sources { grid-template-columns: 1fr; }
}

/* ---------- about / noscript ---------- */
.about { margin-top: 16px; color: var(--muted); font-size: 12px; }
.about summary { cursor: pointer; color: var(--text); }
.about p { margin: 8px 0 0; color: var(--muted); }
.about strong { color: var(--text); font-weight: 600; }
.about .fine { font-size: 11px; opacity: .8; }
.noscript { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: #000; color: #e3eaf5; text-align: center; font-size: 16px; }
