@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Sora:wght@400;500;600;700&display=swap');

:root {
  --bg: #09110e;
  --bg-2: #10201a;
  --panel: #14261f;
  --panel-2: #1b3228;
  --line: #2c463b;
  --text: #e7f6ee;
  --muted: #93b3a4;
  --green: #3ddc84;
  --green-deep: #137a45;
  --red: #ff5d5d;
  --orange: #ffb020;
  --blue: #69b2ff;
  --brass: #e6c36a;
  --grey: #6d7f76;
  --danger: #c83e3e;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  font-family: Sora, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(61, 220, 132, 0.08), transparent 28%),
    linear-gradient(180deg, #0c1612 0%, var(--bg) 40%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brass); }

.boot, .gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}
.gate { max-width: 440px; margin: 0 auto; }
.gate h1, .page-head h1, .auth-copy h1 { font-size: clamp(32px, 4vw, 52px); line-height: 1.05; margin: 0; letter-spacing: -0.04em; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 8px 0; }
p { color: var(--muted); }

.kicker {
  margin: 0 0 8px;
  color: var(--brass);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.mono, .room-id, .link-copy {
  font-family: "IBM Plex Mono", monospace;
}
.room-id, .link-copy {
  border: 0;
  background: transparent;
  color: var(--brass);
  padding: 0;
  text-align: left;
}

.shell { min-height: 100vh; }
.topbar, .room-top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 17, 14, 0.9);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.04em; font-size: 22px; }
.brand-mark {
  width: 16px; height: 16px; border-radius: 99px; background: var(--green);
  box-shadow: 0 0 0 6px rgba(61, 220, 132, 0.15);
}
.nav-links { display: flex; gap: 8px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; }
.nav-links a.active { color: var(--text); background: var(--panel); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 64px; }
.page-head, .button-row, .meta-row, .roster-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head { margin-bottom: 22px; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #062214; border-color: transparent; font-weight: 700; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: #ffd0d0; border-color: var(--danger); }
.stack { display: grid; gap: 14px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.field input, .field select, .field textarea, .table select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0c1914;
  border-radius: 12px;
  padding: 12px 12px;
  outline: none;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); }
.form-error { color: #ffb4b4; margin: 0; }
.banner { border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; }
.banner-bad { background: rgba(200, 62, 62, 0.16); color: #ffd4d4; }
.banner-info { background: rgba(105, 178, 255, 0.12); color: #d7ebff; }
.unlock { width: 100%; text-align: left; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; }
.auth-copy, .auth-card { padding: 48px; }
.auth-copy { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.auth-copy ul { padding-left: 18px; color: var(--muted); }
.auth-card { background: rgba(20, 38, 31, 0.92); border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.lede { margin-top: 0; }
.auth-footer { margin-top: 8px; }
.demo-card { margin-top: 22px; padding: 14px; border-radius: 16px; background: #0c1914; border: 1px dashed var(--line); }
.demo-card p { margin: 4px 0; font-family: "IBM Plex Mono", monospace; font-size: 13px; }

.join-panel {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  margin-bottom: 18px;
}
.join-error { grid-column: 1 / -1; }
.search-field { max-width: 320px; margin: 8px 0 18px; }
.section { margin-top: 18px; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 16px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.room-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 8px;
  border-top: 3px solid var(--green);
}
.room-card.access-private { border-top-color: var(--brass); }
.room-card.access-invitation { border-top-color: var(--blue); }
.room-card.is-disabled { opacity: 0.7; }
.room-desc { min-height: 40px; margin: 0; }
.meta-line { margin: 0; font-size: 13px; }
.badge { border-radius: 999px; padding: 3px 8px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); text-transform: capitalize; }
.badge-public, .badge-live { color: #b9ffd6; border-color: rgba(61, 220, 132, 0.4); }
.badge-private { color: var(--brass); }
.badge-invitation { color: #c5e2ff; }
.badge-off { color: #ffd0d0; }
.badge-busy { color: var(--orange); border-color: rgba(255, 176, 32, 0.45); }

.modal-root { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal-card { width: min(560px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 30; width: min(360px, calc(100% - 32px)); }
.toast { background: #24180f; color: #ffe7c2; border: 1px solid rgba(255, 176, 32, 0.4); border-radius: 14px; padding: 12px 14px; }

.room-app { min-height: 100vh; display: flex; flex-direction: column; }
.room-title { display: grid; }
.room-title span { color: var(--brass); font-size: 13px; }
.switcher { min-width: 180px; }
.link-dot { margin-left: auto; color: var(--orange); font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.link-dot.is-on { color: var(--green); }
.room-main { flex: 1; display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.roster { border-right: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 12px; background: rgba(16, 32, 26, 0.55); }
.roster ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.roster li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(12, 25, 20, 0.7); }
.roster li.is-speaking { outline: 1px solid rgba(255, 93, 93, 0.7); }
.roster li.is-offline { opacity: 0.55; }
.person-name, .person-meta { display: block; }
.person-meta { color: var(--muted); font-size: 12px; }
.led { width: 10px; height: 10px; border-radius: 99px; background: var(--grey); flex: none; }
.led-on { background: var(--green); }
.led-talk { background: var(--red); box-shadow: 0 0 10px var(--red); }
.device-box { margin-top: auto; display: grid; gap: 10px; }

.stage { display: grid; align-content: center; justify-items: center; gap: 14px; padding: 28px 18px 40px; text-align: center; }
.channel {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  font-size: clamp(16px, 2vw, 22px);
}
.channel-idle { color: var(--green); }
.channel-tx { color: var(--red); }
.channel-busy { color: var(--orange); }
.channel-wait { color: var(--blue); }
.channel-off { color: var(--grey); }
.timer, .hint { margin: 0; }
.ptt {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  border: 10px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.16), transparent 36%), var(--green-deep);
  box-shadow: 0 0 0 calc(12px + var(--level, 0) * 28px) rgba(61, 220, 132, 0.16), var(--shadow);
  touch-action: none;
  user-select: none;
}
.ptt-core { display: grid; gap: 4px; }
.ptt-kicker { font-size: 28px; font-weight: 700; letter-spacing: 0.08em; }
.ptt-caption { font-size: 13px; opacity: 0.85; }
.ptt-idle { background-color: #14884a; }
.ptt-transmitting { background: #a61f1f; box-shadow: 0 0 0 calc(16px + var(--level, 0) * 34px) rgba(255, 93, 93, 0.2); }
.ptt-busy { background: #a86a10; }
.ptt-requesting, .ptt-releasing { background: #1d4f86; }
.ptt-disabled { background: #3e4943; color: #c5d1cb; }
.ptt-transmitting { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.98); } }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 6px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { font-size: 28px; }
.admin-grid { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.admin-list { display: grid; gap: 8px; }
.admin-list button, .table { width: 100%; text-align: left; }
.admin-list button { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 4px; }
.admin-list button span { color: var(--muted); font-size: 12px; }
.admin-list button.is-selected { border-color: var(--green); }
.admin-detail { background: rgba(20, 38, 31, 0.45); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.table-wrap { overflow-x: auto; }
.table { border-collapse: collapse; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; text-align: left; }
.plain-list { list-style: none; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

@media (max-width: 900px) {
  .auth-layout, .room-main, .admin-grid, .join-panel, .stats { grid-template-columns: 1fr; }
  .auth-card { border-left: 0; border-top: 1px solid var(--line); }
  .auth-copy, .auth-card { padding: 28px 20px; }
  .topbar, .room-top { flex-wrap: wrap; }
  .link-dot, .nav-actions { margin-left: 0; }
  .room-main { display: flex; flex-direction: column-reverse; }
  .roster { border-right: 0; border-top: 1px solid var(--line); }
  .stage { padding-bottom: 28px; }
  .ptt { width: 180px; height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .ptt-transmitting { animation: none; }
}
