:root {
  --bg: #0B0B0D;
  --panel: #151518;
  --panel-2: #1C1C21;
  --line: #2A2A31;
  --text: #F2F2F5;
  --muted: #9A9AA6;
  --red: #FF453A;
  --red-dim: rgba(255, 69, 58, 0.16);
  --green: #32D74B;
  --amber: #FFB340;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.muted { color: var(--muted); }
.small-text { font-size: 12.5px; }
.error { color: var(--red); min-height: 1.2em; }
svg { width: 20px; height: 20px; flex: none; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 18px; }
.brand.big { font-size: 24px; margin-bottom: 6px; }
.brand-sub { font-weight: 500; color: var(--muted); }
.logo-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); }
.beta { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--red);
  border: 1px solid var(--red); border-radius: 999px; padding: 1px 7px; }
.beta.small { font-size: 10px; padding: 0 6px; margin-left: 4px; vertical-align: middle; }

.btn { font: inherit; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 14px; cursor: pointer; }
.btn:hover { border-color: #3a3a44; }
.btn:focus-visible, .ptt:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 650; }
.btn.danger { color: var(--red); border-color: rgba(255, 69, 58, 0.5); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; width: 100%; }
label { display: grid; gap: 6px; font-size: 13.5px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { width: min(400px, 100%); display: grid; gap: 14px; }

.topbar { display: flex; align-items: center; gap: 18px; padding: 12px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(11, 11, 13, 0.92); backdrop-filter: blur(10px); z-index: 5; flex-wrap: wrap; }
.space-pick { display: flex; align-items: center; gap: 8px; }
.space-pick select { width: auto; min-width: 180px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.pill.ok { color: var(--green); border-color: rgba(50, 215, 75, 0.4); }
.pill.bad { color: var(--red); border-color: rgba(255, 69, 58, 0.4); }
.pill.live { color: #fff; background: var(--red); border-color: var(--red); }
.pill.warn { color: var(--amber); border-color: rgba(255, 179, 64, 0.4); }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 18px 0;
  padding: 10px 14px; border-radius: 12px; background: var(--red-dim); border: 1px solid rgba(255, 69, 58, 0.35); }
.banner.warn { margin: 12px 0 0; background: rgba(255, 179, 64, 0.12); border-color: rgba(255, 179, 64, 0.4); color: var(--amber); }

.layout { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.6fr) minmax(260px, 1.1fr);
  gap: 16px; padding: 16px 18px 28px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }

.room-list, .roster, .bridge-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.room { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent;
  background: var(--panel-2); cursor: pointer; }
.room.selected { border-color: var(--red); }
.room.talking { box-shadow: inset 3px 0 0 var(--red); }
.room-main { min-width: 0; flex: 1; }
.room-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-sub.live { color: var(--red); font-weight: 600; }
.mon { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 9px; padding: 6px; cursor: pointer; display: grid; place-items: center; }
.mon.on { color: #fff; border-color: var(--red); background: var(--red-dim); }

.talk-panel { display: flex; flex-direction: column; min-height: 520px; }
.talk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.floor-line { margin: 4px 0 0; }
.floor-line.live { color: var(--red); font-weight: 650; }
.roster { margin-top: 16px; }
.person { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #26262d; color: var(--muted); flex: none; position: relative; }
.person.talking .avatar { color: #fff; background: var(--red); box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.6); animation: pulse 1.2s infinite; }
.person.radio .avatar { color: var(--amber); }
.person.radio.talking .avatar { color: #fff; }
.person-main { flex: 1; min-width: 0; }
.person-name { font-weight: 600; }
.person-sub { font-size: 12.5px; color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: #26262d; color: var(--muted); }
.tag.live { background: var(--red); color: #fff; }
.tag.radio { color: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.55); } 100% { box-shadow: 0 0 0 12px rgba(255, 69, 58, 0); } }

.ptt-wrap { margin-top: auto; padding-top: 22px; display: grid; justify-items: center; gap: 10px; text-align: center; }
.ptt { width: min(260px, 70vw); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: radial-gradient(circle at 50% 35%, #ff6a61, var(--red) 55%, #c9261d); display: grid; place-content: center; justify-items: center; gap: 8px;
  font: 700 18px/1.2 inherit; letter-spacing: 0.02em; box-shadow: 0 10px 40px rgba(255, 69, 58, 0.25); touch-action: none; user-select: none; -webkit-user-select: none; transition: transform 0.08s; }
.ptt svg { width: 48px; height: 48px; }
.ptt:active, .ptt.live { transform: scale(0.97); }
.ptt.live { box-shadow: 0 0 0 10px rgba(255, 69, 58, 0.25), 0 0 60px rgba(255, 69, 58, 0.6); }
.ptt.busy { background: #3a3a42; box-shadow: none; }
.ptt:disabled { background: #2a2a30; box-shadow: none; cursor: default; color: var(--muted); }
.notice { min-height: 1.3em; margin: 0; color: var(--amber); }

.note { font-size: 13.5px; color: var(--muted); background: var(--panel-2); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.bridge { padding: 12px; border-radius: 12px; background: var(--panel-2); display: grid; gap: 8px; }
.bridge-top { display: flex; align-items: center; gap: 10px; }
.bridge-name { font-weight: 650; flex: 1; min-width: 0; }
.bridge-meta { font-size: 12.5px; color: var(--muted); }
.bridge-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.bridge-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bridge-form, .token-box { margin-top: 12px; display: grid; gap: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check input { width: auto; accent-color: var(--red); }
.token { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
pre.token { white-space: pre-wrap; margin: 0; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 2px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(200px, 1fr) minmax(300px, 1.6fr); }
  .radio-panel { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .talk-panel { order: -1; min-height: 0; }
  .topbar { gap: 10px; padding: 10px 12px; }
  .top-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .space-pick select { min-width: 0; }
  .ptt { width: min(220px, 64vw); }
}
