@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..800&family=DM+Mono:wght@400;500&display=swap');

/* ==========================================================================
   Voice rooms — broadcast console.
   The room is a mixing desk: every person is a channel strip with a live
   LED meter on its rail, and the desk goes tungsten-warm when someone talks.
   Class names + JS hooks (--level, --hue, .speaking, .connecting) unchanged.
   ========================================================================== */
:root {
  --bg: #121010;
  --bg-deep: #0b0a09;
  --panel: #1b1817;
  --panel-2: #241f1d;
  --panel-3: #2d2724;
  --line: #3a322d;
  --line-soft: #2a2422;
  --text: #f4ede3;
  --dim: #a2958a;
  --faint: #6d635c;

  --accent: #ffa629;          /* tungsten — on air, primary action */
  --accent-ink: #1d1002;
  --live: #59e08e;            /* signal present */
  --peak: #ff6a4d;            /* meter peak */
  --danger: #ff4f45;
  --danger-ink: #2a0703;
  --warn: #ffc247;

  --font: Archivo, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* brushed-metal ruling used on desk surfaces */
  --brushed: repeating-linear-gradient(90deg,
              rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 166, 41, .13), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; line-height: 1.05; }
h1 { font-variation-settings: "wdth" 116, "wght" 700; letter-spacing: -0.015em; }
h2 { font-variation-settings: "wdth" 108, "wght" 700; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; }

.icon {
  width: 1.3em; height: 1.3em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---- Controls ---------------------------------------------------------- */
.field {
  width: 100%; height: 52px; padding: 0 15px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-top-color: #000;
  border-radius: var(--r-md);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--faint); }
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 166, 41, .2);
}
select.field {
  appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a2958a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 52px; padding: 0 22px;
  border-radius: var(--r-md); border: 1px solid transparent;
  font-variation-settings: "wdth" 106, "wght" 700;
  cursor: pointer; white-space: nowrap;
  transition: filter .15s, background .15s, border-color .15s, box-shadow .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.primary {
  background: linear-gradient(180deg, #ffbc55, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 8px 22px -10px rgba(255, 166, 41, .85);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.ghost {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--line); color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}
.btn.ghost:hover:not(:disabled) { background: var(--panel-3); border-color: #4a413a; }
.btn.danger {
  background: linear-gradient(180deg, #ff6e63, var(--danger));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .28) inset, 0 8px 22px -12px rgba(255, 79, 69, .9);
}
.btn.danger:hover:not(:disabled) { filter: brightness(1.07); }
.btn.sm { height: 38px; padding: 0 13px; font-size: .88rem; border-radius: var(--r-sm); }

.form-error {
  margin: 0; padding-left: 11px;
  border-left: 3px solid var(--danger);
  color: #ffb3ac; font-size: .94rem;
}

.center {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Cards (join / login / ended) --------------------------------------- */
.card {
  position: relative;
  width: min(440px, 100%);
  display: grid; gap: 14px;
  padding: 34px 30px 30px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .06) inset,
    0 40px 90px -40px rgba(0, 0, 0, .95);
}
/* rack screws */
.card::before, .card::after {
  content: ""; position: absolute; top: 13px;
  width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5b514a, #171412);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}
.card::before { left: 13px; }
.card::after { right: 13px; }
.card h1 {
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  font-variation-settings: "wdth" 120, "wght" 800;
  overflow-wrap: anywhere; margin-bottom: 8px;
}
.card .lead { margin: 0; color: var(--dim); max-width: 46ch; }

/* ---- Room ---------------------------------------------------------------- */
.room {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
}
.room-head {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  padding: calc(18px + env(safe-area-inset-top)) 26px 14px;
  background-image: var(--brushed);
  border-bottom: 1px solid var(--line-soft);
}
.room-head h1 {
  font-size: 1.4rem;
  font-variation-settings: "wdth" 118, "wght" 750;
  overflow-wrap: anywhere;
}
.count {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--dim); font: 500 .82rem/1 var(--mono);
}
/* tungsten pilot lamp */
.count::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 2px rgba(89, 224, 142, .16), 0 0 12px rgba(89, 224, 142, .8);
}
.conn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: var(--r-sm);
  font: 500 .78rem/1 var(--mono); letter-spacing: .02em;
  color: var(--warn);
  background: rgba(255, 194, 71, .1);
  border: 1px solid rgba(255, 194, 71, .38);
}
.conn::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 10px var(--warn);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

.grid {
  display: grid; gap: 14px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  padding: 20px 26px 30px;
}

/* ---- Channel strip ------------------------------------------------------- */
.tile {
  --level: 0;
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  padding: 22px 14px 14px 30px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 40px -28px #000;
  transition: opacity .2s, border-color .15s, box-shadow .2s;
}
.tile.connecting { opacity: .42; }
.tile.speaking {
  border-color: rgba(255, 166, 41, .45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 0 34px -12px rgba(255, 166, 41, .55);
}

/* LED ladder: dim rail + lit segments clipped to the live level */
.tile::before,
.tile::after {
  content: "";
  position: absolute; left: 13px; top: 24px; bottom: 24px; width: 6px;
  border-radius: 2px;
  -webkit-mask-image: repeating-linear-gradient(to top, #000 0 4px, transparent 4px 7px);
  mask-image: repeating-linear-gradient(to top, #000 0 4px, transparent 4px 7px);
}
.tile::before { background: #2f2925; }
.tile::after {
  background: linear-gradient(to top,
    var(--live) 0 58%, var(--accent) 58% 84%, var(--peak) 84% 100%);
  clip-path: inset(calc(100% - var(--level) * 100%) 0 0 0);
  filter: drop-shadow(0 0 5px rgba(255, 166, 41, .5));
  transition: clip-path .06s linear;
}

.avatar {
  position: relative; display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 22px;
  background:
    linear-gradient(180deg, hsl(var(--hue) 26% 26%), hsl(var(--hue) 30% 17%));
  border: 1px solid hsl(var(--hue) 24% 34%);
  color: hsl(var(--hue) 62% 82%);
  font-size: 2.2rem;
  font-variation-settings: "wdth" 112, "wght" 700;
  user-select: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 24px -16px #000;
  transition: box-shadow .09s linear, border-color .15s;
}
.tile.speaking .avatar {
  border-color: rgba(255, 166, 41, .75);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .1) inset,
    0 0 0 calc(2px + var(--level) * 7px) rgba(255, 166, 41, .18),
    0 0 calc(16px + var(--level) * 34px) rgba(255, 166, 41, .4);
}

.badge {
  position: absolute; right: -7px; bottom: -7px;
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--danger); color: #fff;
  border: 3px solid var(--panel);
  box-shadow: 0 0 14px rgba(255, 79, 69, .5);
}
.badge .icon { width: 13px; height: 13px; stroke-width: 2.5; }

.name {
  max-width: 100%; text-align: center;
  font-variation-settings: "wdth" 104, "wght" 600;
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0;
}
.name .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you {
  flex: none; padding: 2px 7px; border-radius: 4px;
  font: 500 .68rem/1.35 var(--mono);
  color: var(--accent-ink); background: var(--accent);
}
.ping {
  font: 500 .7rem/1 var(--mono);
  color: var(--dim);
}
.ping.warn { color: var(--warn); }
.ping.bad  { color: var(--danger); }
.vol {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding-top: 11px; border-top: 1px solid var(--line-soft);
  color: var(--faint);
}
.vol .icon { width: 15px; height: 15px; }
.vol .pct {
  width: 4ch; text-align: right;
  font: 500 .72rem/1 var(--mono); color: var(--dim);
}

/* faders */
input[type="range"] {
  flex: 1; min-width: 0; height: 22px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: #0d0b0a; box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
input[type="range"]::-moz-range-track {
  height: 3px; border-radius: 2px;
  background: #0d0b0a; box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 22px; margin-top: -9.5px;
  border-radius: 3px; border: 1px solid #0a0908;
  background: linear-gradient(180deg, #6a5f57 0 46%, #241f1d 46% 54%, #4a413b 54% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .7);
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 22px;
  border-radius: 3px; border: 1px solid #0a0908;
  background: linear-gradient(180deg, #6a5f57 0 46%, #241f1d 46% 54%, #4a413b 54% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .7);
}
input[type="range"]:focus-visible { outline-offset: 4px; border-radius: 4px; }

/* ---- Control dock -------------------------------------------------------- */
.dock {
  position: sticky; bottom: 0;
  display: flex; justify-content: center;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.dock-inner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px; padding: 9px;
  background-image: var(--brushed), linear-gradient(180deg, rgba(45, 39, 36, .96), rgba(22, 19, 18, .96));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .07) inset,
    0 26px 60px -24px #000;
}
.icon-btn {
  display: grid; place-items: center; width: 54px; height: 54px;
  border-radius: var(--r-md); cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, #3a322d, #221e1c);
  border: 1px solid #443b35;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 3px 0 #0f0d0c;
  transition: background .15s, color .15s, border-color .15s, box-shadow .1s, transform .06s;
}
.icon-btn .icon { width: 23px; height: 23px; }
.icon-btn:hover { background: linear-gradient(180deg, #443b35, #2a2422); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 1px 0 #0f0d0c; }
.icon-btn[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(180deg, #d93a30, #a5241c);
  border-color: #ff6a5f;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 0 22px -4px rgba(255, 79, 69, .75);
}
.leave { height: 54px; padding: 0 20px; border-radius: var(--r-md); }

/* ---- Settings dialog ----------------------------------------------------- */
dialog {
  width: min(440px, calc(100% - 32px)); padding: 26px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 50px 110px -30px #000;
}
dialog::backdrop { background: rgba(8, 6, 5, .74); backdrop-filter: blur(5px); }
dialog h2 { font-size: 1.25rem; margin-bottom: 20px; }
.setting { display: grid; gap: 7px; margin-bottom: 16px; }
.setting label { color: var(--dim); font: 500 .76rem/1 var(--mono); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 16px; border-radius: var(--r-md);
  font-size: .92rem; font-variation-settings: "wdth" 104, "wght" 600;
  background: linear-gradient(180deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  box-shadow: 0 20px 44px -18px #000;
  z-index: 10;
}
.toast.error { border-left-color: var(--danger); color: #ffb9b3; }

/* ---- Admin ---------------------------------------------------------------- */
.admin { width: min(840px, 100%); margin: 0 auto; padding: 44px 20px 96px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.admin-head h1 { font-size: 2rem; font-variation-settings: "wdth" 122, "wght" 800; }

.create { display: flex; gap: 10px; margin-bottom: 26px; }
.create .field { flex: 1; min-width: 0; }

.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.room-item {
  position: relative; overflow: hidden;
  display: grid; gap: 14px; padding: 18px 20px 18px 24px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}
/* rack rail — lights when the room is live */
.room-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #322b27;
}
.room-item:has(.live.on)::before {
  background: var(--live);
  box-shadow: 0 0 18px rgba(89, 224, 142, .7);
}
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-top h2 { font-size: 1.1rem; overflow-wrap: anywhere; }
.live {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--faint); font: 500 .76rem/1 var(--mono); white-space: nowrap;
}
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3d352f; }
.live.on { color: var(--live); }
.live.on::before { background: var(--live); box-shadow: 0 0 12px rgba(89, 224, 142, .85); }

.room-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.link {
  flex: 1 1 260px; min-width: 0; padding: 9px 12px;
  background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5);
  color: var(--dim); font: 400 .82rem/1.4 var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.actions { display: flex; gap: 8px; }
.empty {
  color: var(--dim); text-align: center; padding: 52px 20px;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  background: rgba(255, 255, 255, .012);
}

@media (max-width: 560px) {
  .card { padding: 26px 20px 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; padding: 14px 14px 24px; }
  .tile { padding-left: 26px; }
  .tile::before, .tile::after { left: 11px; width: 5px; }
  .avatar { width: 74px; height: 74px; font-size: 1.8rem; border-radius: 18px; }
  .room-head { padding-left: 16px; padding-right: 16px; }
  .create { flex-direction: column; }
  .admin { padding-top: 26px; }
  .icon-btn { width: 50px; height: 50px; }
  .leave { height: 50px; padding: 0 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Admin: rack front --------------------------------------------------- */
.admin-head { flex-wrap: wrap; row-gap: 12px; }
.desk {
  display: flex; align-items: stretch; gap: 8px;
  margin-left: auto;
}
.stat {
  display: flex; align-items: baseline; gap: 7px;
  padding: 7px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  color: var(--faint); font: 400 .74rem/1 var(--mono); white-space: nowrap;
}
.stat b {
  font: 500 1.02rem/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--dim);
}
.stat.on b { color: var(--accent); text-shadow: 0 0 14px rgba(255, 166, 41, .55); }

.create {
  padding: 12px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}

.room-item { transition: border-color .15s, background-color .15s; }
.room-item:hover { border-color: #4a413a; }
/* live rack rail breathes so a busy room is findable at a glance */
.room-item:has(.live.on)::before {
  background: linear-gradient(to bottom,
    rgba(89, 224, 142, .25) 0%, var(--live) 40%, var(--live) 60%, rgba(89, 224, 142, .25) 100%);
  background-size: 100% 220%;
  animation: rail 4.5s ease-in-out infinite alternate;
}
@keyframes rail { from { background-position: 0 0; } to { background-position: 0 100%; } }

.empty {
  background-image:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .02) 0 8px, transparent 8px 16px);
  max-width: 44ch; margin: 0 auto;
}

@media (max-width: 560px) {
  .desk { margin-left: 0; width: 100%; }
  .stat { flex: 1; justify-content: center; }
  .create { padding: 10px; }
}

/* ---- Room head: sticky desk header --------------------------------------- */
.room-head {
  position: sticky; top: 0; z-index: 5;
  background-color: rgba(18, 16, 16, .88);
  backdrop-filter: blur(12px);
}
/* session clock — the one number a host actually watches */
.clock {
  margin-left: auto;
  padding: 6px 11px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  color: var(--dim); font: 500 .85rem/1 var(--mono);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}

/* separates the transport buttons from the one that ends the call */
.dock-inner .sep {
  width: 1px; height: 32px; margin: 0 3px;
  background: linear-gradient(to bottom, transparent, var(--line) 20%, var(--line) 80%, transparent);
}

@media (max-width: 560px) {
  .clock { margin-left: 0; order: 3; }
  .dock-inner .sep { display: none; }
}@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..800&family=DM+Mono:wght@400;500&display=swap');

/* ==========================================================================
   Voice rooms — broadcast console.
   The room is a mixing desk: every person is a channel strip with a live
   LED meter on its rail, and the desk goes tungsten-warm when someone talks.
   Class names + JS hooks (--level, --hue, .speaking, .connecting) unchanged.
   ========================================================================== */
:root {
  --bg: #121010;
  --bg-deep: #0b0a09;
  --panel: #1b1817;
  --panel-2: #241f1d;
  --panel-3: #2d2724;
  --line: #3a322d;
  --line-soft: #2a2422;
  --text: #f4ede3;
  --dim: #a2958a;
  --faint: #6d635c;

  --accent: #ffa629;          /* tungsten — on air, primary action */
  --accent-ink: #1d1002;
  --live: #59e08e;            /* signal present */
  --peak: #ff6a4d;            /* meter peak */
  --danger: #ff4f45;
  --danger-ink: #2a0703;
  --warn: #ffc247;

  --font: Archivo, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* brushed-metal ruling used on desk surfaces */
  --brushed: repeating-linear-gradient(90deg,
              rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 166, 41, .13), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; line-height: 1.05; }
h1 { font-variation-settings: "wdth" 116, "wght" 700; letter-spacing: -0.015em; }
h2 { font-variation-settings: "wdth" 108, "wght" 700; letter-spacing: -0.01em; }
button, input, select { font: inherit; color: inherit; }

.icon {
  width: 1.3em; height: 1.3em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---- Controls ---------------------------------------------------------- */
.field {
  width: 100%; height: 52px; padding: 0 15px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-top-color: #000;
  border-radius: var(--r-md);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  transition: border-color .15s, box-shadow .15s;
}
.field::placeholder { color: var(--faint); }
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 166, 41, .2);
}
select.field {
  appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23a2958a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 52px; padding: 0 22px;
  border-radius: var(--r-md); border: 1px solid transparent;
  font-variation-settings: "wdth" 106, "wght" 700;
  cursor: pointer; white-space: nowrap;
  transition: filter .15s, background .15s, border-color .15s, box-shadow .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.primary {
  background: linear-gradient(180deg, #ffbc55, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 8px 22px -10px rgba(255, 166, 41, .85);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn.ghost {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-color: var(--line); color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}
.btn.ghost:hover:not(:disabled) { background: var(--panel-3); border-color: #4a413a; }
.btn.danger {
  background: linear-gradient(180deg, #ff6e63, var(--danger));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .28) inset, 0 8px 22px -12px rgba(255, 79, 69, .9);
}
.btn.danger:hover:not(:disabled) { filter: brightness(1.07); }
.btn.sm { height: 38px; padding: 0 13px; font-size: .88rem; border-radius: var(--r-sm); }

.form-error {
  margin: 0; padding-left: 11px;
  border-left: 3px solid var(--danger);
  color: #ffb3ac; font-size: .94rem;
}

.center {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Cards (join / login / ended) --------------------------------------- */
.card {
  position: relative;
  width: min(440px, 100%);
  display: grid; gap: 14px;
  padding: 34px 30px 30px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .06) inset,
    0 40px 90px -40px rgba(0, 0, 0, .95);
}
/* rack screws */
.card::before, .card::after {
  content: ""; position: absolute; top: 13px;
  width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5b514a, #171412);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}
.card::before { left: 13px; }
.card::after { right: 13px; }
.card h1 {
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  font-variation-settings: "wdth" 120, "wght" 800;
  overflow-wrap: anywhere; margin-bottom: 8px;
}
.card .lead { margin: 0; color: var(--dim); max-width: 46ch; }

/* ---- Room ---------------------------------------------------------------- */
.room {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
}
.room-head {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  padding: calc(18px + env(safe-area-inset-top)) 26px 14px;
  background-image: var(--brushed);
  border-bottom: 1px solid var(--line-soft);
}
.room-head h1 {
  font-size: 1.4rem;
  font-variation-settings: "wdth" 118, "wght" 750;
  overflow-wrap: anywhere;
}
.count {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--dim); font: 500 .82rem/1 var(--mono);
}
/* tungsten pilot lamp */
.count::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 2px rgba(89, 224, 142, .16), 0 0 12px rgba(89, 224, 142, .8);
}
.conn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: var(--r-sm);
  font: 500 .78rem/1 var(--mono); letter-spacing: .02em;
  color: var(--warn);
  background: rgba(255, 194, 71, .1);
  border: 1px solid rgba(255, 194, 71, .38);
}
.conn::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 10px var(--warn);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

.grid {
  display: grid; gap: 14px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(184px, 1fr));
  padding: 20px 26px 30px;
}

/* ---- Channel strip ------------------------------------------------------- */
.tile {
  --level: 0;
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 13px;
  padding: 22px 14px 14px 30px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 18px 40px -28px #000;
  transition: opacity .2s, border-color .15s, box-shadow .2s;
}
.tile.connecting { opacity: .42; }
.tile.speaking {
  border-color: rgba(255, 166, 41, .45);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 0 34px -12px rgba(255, 166, 41, .55);
}

/* LED ladder: dim rail + lit segments clipped to the live level */
.tile::before,
.tile::after {
  content: "";
  position: absolute; left: 13px; top: 24px; bottom: 24px; width: 6px;
  border-radius: 2px;
  -webkit-mask-image: repeating-linear-gradient(to top, #000 0 4px, transparent 4px 7px);
  mask-image: repeating-linear-gradient(to top, #000 0 4px, transparent 4px 7px);
}
.tile::before { background: #2f2925; }
.tile::after {
  background: linear-gradient(to top,
    var(--live) 0 58%, var(--accent) 58% 84%, var(--peak) 84% 100%);
  clip-path: inset(calc(100% - var(--level) * 100%) 0 0 0);
  filter: drop-shadow(0 0 5px rgba(255, 166, 41, .5));
  transition: clip-path .06s linear;
}

.avatar {
  position: relative; display: grid; place-items: center;
  width: 92px; height: 92px; border-radius: 22px;
  background:
    linear-gradient(180deg, hsl(var(--hue) 26% 26%), hsl(var(--hue) 30% 17%));
  border: 1px solid hsl(var(--hue) 24% 34%);
  color: hsl(var(--hue) 62% 82%);
  font-size: 2.2rem;
  font-variation-settings: "wdth" 112, "wght" 700;
  user-select: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 24px -16px #000;
  transition: box-shadow .09s linear, border-color .15s;
}
.tile.speaking .avatar {
  border-color: rgba(255, 166, 41, .75);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .1) inset,
    0 0 0 calc(2px + var(--level) * 7px) rgba(255, 166, 41, .18),
    0 0 calc(16px + var(--level) * 34px) rgba(255, 166, 41, .4);
}

.badge {
  position: absolute; right: -7px; bottom: -7px;
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--danger); color: #fff;
  border: 3px solid var(--panel);
  box-shadow: 0 0 14px rgba(255, 79, 69, .5);
}
.badge .icon { width: 13px; height: 13px; stroke-width: 2.5; }

.name {
  max-width: 100%; text-align: center;
  font-variation-settings: "wdth" 104, "wght" 600;
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0;
}
.name .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you {
  flex: none; padding: 2px 7px; border-radius: 4px;
  font: 500 .68rem/1.35 var(--mono);
  color: var(--accent-ink); background: var(--accent);
}

.vol {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding-top: 11px; border-top: 1px solid var(--line-soft);
  color: var(--faint);
}
.vol .icon { width: 15px; height: 15px; }
.vol .pct {
  width: 4ch; text-align: right;
  font: 500 .72rem/1 var(--mono); color: var(--dim);
}

/* faders */
input[type="range"] {
  flex: 1; min-width: 0; height: 22px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: #0d0b0a; box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
input[type="range"]::-moz-range-track {
  height: 3px; border-radius: 2px;
  background: #0d0b0a; box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 22px; margin-top: -9.5px;
  border-radius: 3px; border: 1px solid #0a0908;
  background: linear-gradient(180deg, #6a5f57 0 46%, #241f1d 46% 54%, #4a413b 54% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .7);
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 22px;
  border-radius: 3px; border: 1px solid #0a0908;
  background: linear-gradient(180deg, #6a5f57 0 46%, #241f1d 46% 54%, #4a413b 54% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .7);
}
input[type="range"]:focus-visible { outline-offset: 4px; border-radius: 4px; }

/* ---- Control dock -------------------------------------------------------- */
.dock {
  position: sticky; bottom: 0;
  display: flex; justify-content: center;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.dock-inner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 9px; padding: 9px;
  background-image: var(--brushed), linear-gradient(180deg, rgba(45, 39, 36, .96), rgba(22, 19, 18, .96));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .07) inset,
    0 26px 60px -24px #000;
}
.icon-btn {
  display: grid; place-items: center; width: 54px; height: 54px;
  border-radius: var(--r-md); cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, #3a322d, #221e1c);
  border: 1px solid #443b35;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 3px 0 #0f0d0c;
  transition: background .15s, color .15s, border-color .15s, box-shadow .1s, transform .06s;
}
.icon-btn .icon { width: 23px; height: 23px; }
.icon-btn:hover { background: linear-gradient(180deg, #443b35, #2a2422); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 1px 0 #0f0d0c; }
.icon-btn[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(180deg, #d93a30, #a5241c);
  border-color: #ff6a5f;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 0 22px -4px rgba(255, 79, 69, .75);
}
.leave { height: 54px; padding: 0 20px; border-radius: var(--r-md); }

/* ---- Settings dialog ----------------------------------------------------- */
dialog {
  width: min(440px, calc(100% - 32px)); padding: 26px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 50px 110px -30px #000;
}
dialog::backdrop { background: rgba(8, 6, 5, .74); backdrop-filter: blur(5px); }
dialog h2 { font-size: 1.25rem; margin-bottom: 20px; }
.setting { display: grid; gap: 7px; margin-bottom: 16px; }
.setting label { color: var(--dim); font: 500 .76rem/1 var(--mono); }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 16px; border-radius: var(--r-md);
  font-size: .92rem; font-variation-settings: "wdth" 104, "wght" 600;
  background: linear-gradient(180deg, var(--panel-3), var(--panel));
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  box-shadow: 0 20px 44px -18px #000;
  z-index: 10;
}
.toast.error { border-left-color: var(--danger); color: #ffb9b3; }

/* ---- Admin ---------------------------------------------------------------- */
.admin { width: min(840px, 100%); margin: 0 auto; padding: 44px 20px 96px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.admin-head h1 { font-size: 2rem; font-variation-settings: "wdth" 122, "wght" 800; }

.create { display: flex; gap: 10px; margin-bottom: 26px; }
.create .field { flex: 1; min-width: 0; }

.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.room-item {
  position: relative; overflow: hidden;
  display: grid; gap: 14px; padding: 18px 20px 18px 24px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}
/* rack rail — lights when the room is live */
.room-item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #322b27;
}
.room-item:has(.live.on)::before {
  background: var(--live);
  box-shadow: 0 0 18px rgba(89, 224, 142, .7);
}
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-top h2 { font-size: 1.1rem; overflow-wrap: anywhere; }
.live {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--faint); font: 500 .76rem/1 var(--mono); white-space: nowrap;
}
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3d352f; }
.live.on { color: var(--live); }
.live.on::before { background: var(--live); box-shadow: 0 0 12px rgba(89, 224, 142, .85); }

.room-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.link {
  flex: 1 1 260px; min-width: 0; padding: 9px 12px;
  background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5);
  color: var(--dim); font: 400 .82rem/1.4 var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.actions { display: flex; gap: 8px; }
.empty {
  color: var(--dim); text-align: center; padding: 52px 20px;
  border: 1px dashed var(--line); border-radius: var(--r-md);
  background: rgba(255, 255, 255, .012);
}

@media (max-width: 560px) {
  .card { padding: 26px 20px 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; padding: 14px 14px 24px; }
  .tile { padding-left: 26px; }
  .tile::before, .tile::after { left: 11px; width: 5px; }
  .avatar { width: 74px; height: 74px; font-size: 1.8rem; border-radius: 18px; }
  .room-head { padding-left: 16px; padding-right: 16px; }
  .create { flex-direction: column; }
  .admin { padding-top: 26px; }
  .icon-btn { width: 50px; height: 50px; }
  .leave { height: 50px; padding: 0 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Admin: rack front --------------------------------------------------- */
.admin-head { flex-wrap: wrap; row-gap: 12px; }
.desk {
  display: flex; align-items: stretch; gap: 8px;
  margin-left: auto;
}
.stat {
  display: flex; align-items: baseline; gap: 7px;
  padding: 7px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  color: var(--faint); font: 400 .74rem/1 var(--mono); white-space: nowrap;
}
.stat b {
  font: 500 1.02rem/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--dim);
}
.stat.on b { color: var(--accent); text-shadow: 0 0 14px rgba(255, 166, 41, .55); }

.create {
  padding: 12px;
  background-image: var(--brushed), linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset;
}

.room-item { transition: border-color .15s, background-color .15s; }
.room-item:hover { border-color: #4a413a; }
/* live rack rail breathes so a busy room is findable at a glance */
.room-item:has(.live.on)::before {
  background: linear-gradient(to bottom,
    rgba(89, 224, 142, .25) 0%, var(--live) 40%, var(--live) 60%, rgba(89, 224, 142, .25) 100%);
  background-size: 100% 220%;
  animation: rail 4.5s ease-in-out infinite alternate;
}
@keyframes rail { from { background-position: 0 0; } to { background-position: 0 100%; } }

.empty {
  background-image:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .02) 0 8px, transparent 8px 16px);
  max-width: 44ch; margin: 0 auto;
}

@media (max-width: 560px) {
  .desk { margin-left: 0; width: 100%; }
  .stat { flex: 1; justify-content: center; }
  .create { padding: 10px; }
}

/* ---- Room head: sticky desk header --------------------------------------- */
.room-head {
  position: sticky; top: 0; z-index: 5;
  background-color: rgba(18, 16, 16, .88);
  backdrop-filter: blur(12px);
}
/* session clock — the one number a host actually watches */
.clock {
  margin-left: auto;
  padding: 6px 11px;
  background: var(--bg-deep);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .55);
  color: var(--dim); font: 500 .85rem/1 var(--mono);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}

/* separates the transport buttons from the one that ends the call */
.dock-inner .sep {
  width: 1px; height: 32px; margin: 0 3px;
  background: linear-gradient(to bottom, transparent, var(--line) 20%, var(--line) 80%, transparent);
}

@media (max-width: 560px) {
  .clock { margin-left: 0; order: 3; }
  .dock-inner .sep { display: none; }
}