@font-face {
  font-family: "Inter";
  src: url("/vendor/inter/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/vendor/inter/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-024F, U+1E00-1EFF;
}

:root {
  --bg: #090b10;
  --card: rgba(21, 25, 35, 0.72);
  --card-solid: #141821;
  --raised: rgba(255, 255, 255, 0.05);
  --raised-2: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f3f5fa;
  --muted: #98a1b3;
  --faint: #6b7488;
  --accent: #6d8bff;
  --accent-2: #a77bff;
  --grad: linear-gradient(135deg, #6d8bff 0%, #9b7bff 100%);
  --ok: #34d399;
  --danger: #f46b6b;
  --warn: #f5b84b;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font: 15px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
body {
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(109, 139, 255, 0.2), transparent 62%),
    radial-gradient(900px 640px at 108% 8%, rgba(167, 123, 255, 0.14), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(52, 211, 153, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body:has(canvas) { overflow: hidden; background: var(--bg); }
canvas { display: block; touch-action: none; }

a { color: #a9bbff; text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.15; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 620; }
p { margin: 0; }
code {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.35);
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  word-break: break-all;
}
.icon { flex: none; }

/* --------------------------------------------------------------- layout */

#app[hidden] { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 20px 24px 64px; display: grid; gap: 28px; }
.card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.card-title h3 { color: var(--text); }
.card-title .icon { color: var(--accent); }
.card.danger { border-color: rgba(244, 107, 107, 0.28); background: linear-gradient(180deg, rgba(244, 107, 107, 0.06), transparent 60%), var(--card); }
.card.danger .card-title .icon { color: var(--danger); }
.card.narrow { width: min(520px, 100%); }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.row > input { flex: 1; min-width: 180px; }
form { display: grid; gap: 14px; }
form.row { display: flex; }

.topbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 17, 24, 0.72);
  backdrop-filter: blur(18px) saturate(1.3);
}
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.brand { color: inherit; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 750; letter-spacing: -0.03em; }
.wordmark b {
  font-weight: inherit;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo { display: block; filter: drop-shadow(0 6px 14px rgba(109, 139, 255, 0.35)); }

.page-head { display: grid; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; width: fit-content; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }

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

/* ---------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(109, 139, 255, 0.22), transparent 70%),
    radial-gradient(500px 240px at 100% 100%, rgba(167, 123, 255, 0.16), transparent 70%),
    var(--card);
  box-shadow: var(--shadow);
}
.hero-portrait {
  width: 92px;
  height: 104px;
  object-fit: cover;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(109, 139, 255, 0.35), rgba(167, 123, 255, 0.2));
  border: 1px solid var(--line-strong);
}
.hero h1 { font-size: 34px; }
.hero-actions { display: flex; gap: 10px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
@media (max-width: 720px) {
  .hero { grid-template-columns: auto 1fr; }
  .hero-actions { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------- room cards */

.room-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.room-card { padding: 0; gap: 0; overflow: hidden; transition: transform 0.25s var(--ease), border-color 0.25s; }
.room-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.room-art {
  position: relative;
  height: 112px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  padding: 12px;
  background:
    radial-gradient(120px 90px at 78% 72%, hsla(calc(var(--hue) + 40), 90%, 70%, 0.55), transparent 70%),
    radial-gradient(160px 120px at 20% 10%, hsla(var(--hue), 85%, 62%, 0.65), transparent 70%),
    linear-gradient(135deg, hsl(var(--hue) 45% 22%), hsl(calc(var(--hue) + 60) 45% 16%));
}
.room-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, #000 70%);
  pointer-events: none;
}
.room-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(8, 10, 15, 0.55);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 550;
  color: #e6eaf3;
}
.room-chip.warn { color: var(--warn); }
.room-chip.live { color: #a7f3d0; }
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
.room-body { display: grid; gap: 2px; padding: 16px 18px 6px; }
.room-body .muted { font-size: 13px; }
.room-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 14px 14px; }
.empty { justify-items: center; text-align: center; padding: 40px 24px; color: var(--muted); }
.empty .icon { color: var(--accent); }

/* ---------------------------------------------------------- auth pages */

.auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; padding: 24px 16px; }
.auth-card { width: min(440px, 100%); padding: 32px; gap: 18px; }
.auth-card .wordmark { font-size: 26px; }
.auth-foot { color: var(--faint); font-size: 13px; text-align: center; }
.pair-code {
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: rgba(0, 0, 0, 0.35);
  font: 700 46px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.14em;
  text-align: center;
  background-image: linear-gradient(135deg, rgba(109, 139, 255, 0.12), rgba(167, 123, 255, 0.08));
}
.steps { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.steps strong { color: var(--text); }

/* --------------------------------------------------------------- text */

.sub { color: var(--muted); }
.hint { color: var(--faint); font-size: 13px; }
.muted { color: var(--muted); }
.error { color: #ff9b94; font-size: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(244, 107, 107, 0.1); border: 1px solid rgba(244, 107, 107, 0.25); }
.success { color: #86efc0; font-size: 14px; }
.error[hidden], .success[hidden] { display: none; }

/* --------------------------------------------------------------- forms */

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 500; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; font-weight: 400; }
.color-row { grid-template-columns: 1fr auto; align-items: center; }

input:not([type="color"]):not([type="checkbox"]), select {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: rgba(255, 255, 255, 0.22); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(109, 139, 255, 0.2); background: rgba(0, 0, 0, 0.45); }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a1b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="color"] { width: 46px; height: 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 10px; background: none; cursor: pointer; }
.code-input { height: 60px !important; font: 600 26px ui-monospace, "SF Mono", Menlo, monospace !important; letter-spacing: 0.16em; text-transform: uppercase; text-align: center; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--raised);
  color: var(--text);
  font: 550 14px "Inter", system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--ease), box-shadow 0.2s;
}
button:hover, .btn:hover { background: var(--raised-2); border-color: rgba(255, 255, 255, 0.22); }
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button:focus-visible, .btn:focus-within, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button.primary {
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(109, 139, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
button.primary:hover { filter: brightness(1.08); background: var(--grad); }
form > button.primary { height: 46px; font-size: 15px; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover, button.ghost[aria-current="page"] { background: var(--raised); color: var(--text); }
button.danger { background: rgba(244, 107, 107, 0.14); border-color: rgba(244, 107, 107, 0.35); color: #ffb4ae; }
button.danger:hover { background: rgba(244, 107, 107, 0.24); }
button.small { height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12px; }
button.icon-only { width: 40px; padding: 0; }
button.me { height: 40px; padding: 0 14px 0 4px; border-radius: 999px; gap: 10px; background: var(--raised); }
button.me[aria-current="page"] { border-color: var(--accent); }
.me-portrait { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: center 20%; background: var(--raised-2); }

/* --------------------------------------------------------------- lists */

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.list li.muted { justify-content: flex-start; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 550; background: var(--raised-2); color: var(--muted); }
.badge.warn { background: rgba(245, 184, 75, 0.14); color: var(--warn); }
.badge.live { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.new-link { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.25); }
.new-link button { justify-self: start; }
.saved { align-self: center; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button { height: 32px; padding: 0 12px; font-size: 13px; margin-left: 6px; }
.card:has(table) { overflow-x: auto; }

/* ------------------------------------------------------------- avatars */

.avatar-field { border: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.avatar-field legend { color: var(--muted); font-size: 13px; font-weight: 500; padding: 0; margin-bottom: 8px; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-choice {
  height: auto;
  aspect-ratio: 8 / 9;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  color: var(--faint);
  background: linear-gradient(170deg, rgba(109, 139, 255, 0.14), rgba(255, 255, 255, 0.02));
}
.avatar-choice img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s var(--ease); }
.avatar-choice:hover img { transform: scale(1.06); }
.avatar-choice.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 139, 255, 0.35); background: linear-gradient(170deg, rgba(109, 139, 255, 0.4), rgba(167, 123, 255, 0.15)); }

/* ----------------------------------------------------------------- HUD */

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-top {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none !important;
}
.hud-top > * { pointer-events: auto; }
.room-pill, .hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.62);
  backdrop-filter: blur(16px) saturate(1.3);
  font-weight: 600;
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.8);
}
.hud-chip { font-variant-numeric: tabular-nums; }
.hud-chip[aria-expanded="true"] { border-color: var(--accent); }

.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(16px);
  color: var(--text);
  font-size: 14px;
  text-align: center;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
  animation: toast-in 0.35s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

.drawer {
  position: absolute;
  top: 66px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: rgba(12, 14, 21, 0.82);
  backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  animation: drawer-in 0.3s var(--ease);
}
@keyframes drawer-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.drawer-head .icon { transform: rotate(45deg); }
.drawer-head button { width: 34px; height: 34px; }

#people-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
#people-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
#people-list li:hover { background: var(--raised); }
.person-face { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; object-position: center 20%; background: var(--raised-2); flex: none; }
.person-main { flex: 1; min-width: 0; display: grid; }
.person-main .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.person-meta { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; }
.mic-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.mic-dot.off { background: var(--danger); }
.person-actions { display: flex; gap: 4px; flex: none; }
.person-actions button { width: 32px; height: 32px; padding: 0; border-radius: 9px; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; align-items: center; }
.keys dt { color: var(--muted); font-size: 13px; white-space: nowrap; }
.keys dd { margin: 0; font-size: 14px; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  margin-right: 3px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: var(--raised);
  color: var(--text);
  font: 600 12px "Inter", system-ui, sans-serif;
}

.dock {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: rgba(10, 12, 18, 0.7);
  backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.dock-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 68px;
  height: 60px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: #dfe4ef;
  font-size: 11.5px;
  font-weight: 560;
  cursor: pointer;
}
.dock-btn .icon { width: 22px; height: 22px; }
.dock-btn:hover { background: var(--raised-2); border-color: transparent; }
.dock-btn .ic { display: contents; }
.dock-btn .ic-off { display: none; }
.dock-btn.off .ic-on { display: none; }
.dock-btn.off .ic-off { display: contents; }
.dock-btn.off { background: rgba(244, 107, 107, 0.16); color: #ffb4ae; }
.dock-btn.active { background: rgba(52, 211, 153, 0.16); color: #a7f3d0; }
.dock-btn.accent { background: var(--grad); color: #fff; }
.dock-btn.danger { background: rgba(244, 107, 107, 0.16); color: #ffb4ae; }
.dock-btn.danger:hover { background: rgba(244, 107, 107, 0.28); }
.dock-btn[aria-expanded="true"] { background: var(--raised-2); color: #fff; }
.dock-sep { width: 1px; height: 34px; margin: 0 4px; background: var(--line-strong); flex: none; }
@media (max-width: 640px) {
  .dock-btn { min-width: 54px; height: 54px; padding: 0 6px; font-size: 10.5px; }
}

/* Admin: add a person, one-time login details */
.add-person .row > label { flex: 1; min-width: 180px; }
.credentials .cred { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: center; }
.credentials dt { color: var(--muted); font-size: 13px; }
.credentials dd { margin: 0; }
.credentials code { display: inline-block; padding: 6px 10px; font-size: 14px; }

/* Live microphone level under the Mute button */
#mic-btn { position: relative; }
#mic-btn::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 5px;
  height: 3px;
  border-radius: 2px;
  background: var(--ok);
  transform: scaleX(var(--level, 0));
  transform-origin: left;
  transition: transform 80ms linear;
}
#mic-btn.off::after { display: none; }
