:root {
  --bg: #121212;
  --bg-2: #232323;
  --ink: #ffd84a;
  --muted: #d2ba62;
  --card: rgba(33, 33, 30, 0.94);
  --line: rgba(255, 216, 74, 0.22);
  --accent: #ffcc00;
  --accent-2: #d6a800;
  --accent-soft: rgba(255, 204, 0, 0.12);
  --warn: #5c4808;
  --danger: #dc2626;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 204, 0, 0.18), transparent 22%),
    radial-gradient(circle at bottom right, rgba(255, 204, 0, 0.12), transparent 18%),
    linear-gradient(180deg, #1a1a1a 0%, #111111 58%, #090909 100%);
  color: var(--ink);
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

.shell {
  position: relative;
  width: min(460px, calc(100% - 20px));
  margin: 0 auto;
  padding: 10px 0 18px;
  height: 100dvh;
}
.shell-narrow { width: min(460px, calc(100% - 20px)); }
.shell-admin {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

.app-frame {
  position: relative;
  height: 100dvh;
  overflow: hidden;
  background: transparent;
}

.app-frame-admin {
  height: 100dvh;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: linear-gradient(180deg, #1a1a1a 0%, #101010 100%);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  background: rgba(18, 18, 18, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(242, 209, 91, 0.12);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-screen {
  height: calc(100dvh - 94px);
  overflow-y: auto;
  padding: 10px 10px 18px;
}

body.app-mode-live .app-screen {
  overflow: hidden;
  display: grid;
}

.app-title {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #ffcc00;
  font-size: 0.72rem;
  font-weight: 800;
  margin: 0 0 6px;
}
.lede, .muted, #locationState, #locationStateB {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.card {
  background: var(--card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.auth-stack { display: grid; gap: 14px; }
.admin-flow { display: grid; gap: 14px; }
.screen-intro { display: grid; gap: 4px; margin-bottom: 2px; }
.auth-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.auth-switch button.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: rgba(31, 31, 27, 0.92);
  box-shadow: var(--shadow-soft);
}
.stack { display: grid; gap: 10px; }
.topbar, .inline-head, .record-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.topbar-app {
  flex-wrap: nowrap;
  gap: 8px;
  padding: 0 2px;
  min-height: 34px;
}
.user-eyebrow {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inline-head-tight {
  gap: 8px;
  flex-wrap: nowrap;
}

h2, h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

input, select, button {
  width: 100%;
  border-radius: 3px;
  border: 1px solid var(--line);
  padding: 13px 14px;
  font: inherit;
}
input, select {
  background: rgba(255, 220, 120, 0.08);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input:focus, select:focus {
  border-color: rgba(255, 204, 0, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.12);
}
button {
  cursor: pointer;
  background: var(--accent);
  color: #141414;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
button:hover {
  transform: translateY(-1px);
  background: #ffd84a;
}
button.ghost {
  background: rgba(255, 204, 0, 0.08);
  color: #ffd84a;
  border: 1px solid var(--line);
  box-shadow: none;
}
button.ghost:hover { background: rgba(255, 204, 0, 0.16); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hidden { display: none !important; }
.hint, .message-card { color: var(--muted); }
.hint { font-size: 0.92rem; line-height: 1.5; }
.admin-link { color: var(--accent); font-weight: 700; text-decoration-thickness: 2px; }
.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 10px 14px;
  border-radius: 4px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid var(--line);
  color: #ffd84a;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.stack .header-link {
  width: 100%;
}
.header-corner-btn {
  width: auto;
  min-width: 82px;
  padding-inline: 16px;
  border-radius: 4px;
  flex: 0 0 auto;
}
.header-menu-btn {
  width: auto;
  min-width: 72px;
  padding-inline: 12px;
  box-shadow: none;
}
.chips { display: flex; gap: 12px; flex-wrap: wrap; }
.pill, .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 204, 0, 0.2);
  border-radius: 4px;
  padding: 8px 12px;
  background: rgba(255, 204, 0, 0.14);
  color: #ffd84a;
  font-size: 0.9rem;
  font-weight: 600;
}
.chip strong { color: var(--ink); }
.warn {
  background: var(--warn);
  border-color: #fdba74;
}
.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  width: auto;
  padding: 8px 12px;
  background: rgba(255, 204, 0, 0.08);
  border-radius: 4px;
  border: 1px solid var(--line);
}
.toggle input { width: auto; }
.mini-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.mini-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  font-size: 0.82rem;
  text-transform: uppercase;
}
.mini-btn.ghost {
  background: rgba(255, 204, 0, 0.08);
}
.status-orb {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 84, 0.22);
  background:
    radial-gradient(circle at 30% 30%, #ffe68d 0%, #d5a61f 34%, #5a4100 74%, #16120c 100%);
  color: #141414;
  font-size: 0.72rem;
  font-weight: 800;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.18),
    inset 0 -6px 10px rgba(0,0,0,0.26);
}
.mini-square-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: none;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(255, 204, 0, 0.95);
  color: #141414;
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  z-index: 60;
}
.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.55;
  z-index: -1;
}
.bg-shape-a { width: 260px; height: 260px; background: #93c5fd; top: 42px; right: 36px; }
.bg-shape-a { width: 260px; height: 260px; background: rgba(255, 204, 0, 0.28); top: 42px; right: 36px; }
.bg-shape-b { width: 320px; height: 320px; background: rgba(255, 204, 0, 0.12); bottom: 8px; left: 6px; }

audio { width: 100%; margin-top: 12px; }
.record-row button { width: auto; min-width: 120px; }
.message-card + .message-card { margin-top: 6px; }
.press-talk-wrap {
  display: grid;
  gap: 12px;
}
.press-talk-btn {
  min-height: 68px;
  border-radius: 4px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.hero-talk {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px 0;
}
.talk-stage {
  min-height: 248px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0 10px;
}

.radio-user-shell {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 214, 84, 0.22);
  background:
    linear-gradient(180deg, rgba(50, 44, 31, 0.98) 0%, rgba(18, 18, 16, 0.98) 100%);
  box-shadow:
    0 20px 36px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 235, 156, 0.1);
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

.radio-user-top {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 72px;
}

.radio-user-antenna {
  width: 18px;
  height: 68px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #454440 0%, #171717 100%);
  border: 1px solid rgba(255, 214, 84, 0.14);
}

.radio-user-speaker {
  flex: 1;
  min-height: 78px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 214, 84, 0.16);
  background: linear-gradient(180deg, rgba(14, 14, 14, 0.84), rgba(44, 36, 15, 0.96));
}

.radio-user-speaker span {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 214, 84, 0.16), rgba(255, 214, 84, 0.04));
}

.radio-user-display {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 214, 84, 0.16);
  background:
    linear-gradient(180deg, rgba(24, 39, 25, 0.98) 0%, rgba(9, 17, 10, 0.98) 100%);
  box-shadow:
    inset 0 0 16px rgba(114, 255, 138, 0.08),
    inset 0 0 0 1px rgba(173, 255, 186, 0.04);
  position: relative;
  z-index: 1;
}

.radio-user-shell .talk-stage {
  min-height: 230px;
  padding: 2px 0 6px;
  position: relative;
  z-index: 2;
}

.talk-stage-radio {
  margin-top: 2px;
  margin-bottom: 2px;
}

.radio-user-display-bottom,
.radio-user-display-shell {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.radio-user-display-shell {
  min-height: 180px;
}

.radio-inline-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.radio-chat-strip {
  display: grid;
  gap: 8px;
}
.talk-dock {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 228px;
  padding: 6px 0 0;
}

.talk-dock .press-talk-btn-main {
  position: static;
}
.hero-talk-compact {
  padding-top: 0;
}
.press-talk-btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 212px;
  height: 212px;
  max-width: 100%;
  border-radius: 999px;
  padding: 24px;
  border: 1px solid rgba(255, 216, 74, 0.36);
  background:
    radial-gradient(circle at 30% 30%, #ffe27a 0%, #ffcf24 34%, #c48b00 72%, #4f3a00 100%);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.24),
    inset 0 -10px 22px rgba(79, 58, 0, 0.38);
  color: #151515;
  overflow: hidden;
}
.press-talk-btn-main:hover {
  background:
    radial-gradient(circle at 30% 30%, #ffec9e 0%, #ffd84a 34%, #cf9800 72%, #584000 100%);
}
.press-talk-btn-main::before {
  content: "";
  position: absolute;
  width: 186px;
  height: 186px;
  border-radius: 999px;
  border: 1px dashed rgba(21, 21, 21, 0.16);
  inset: 0;
  margin: auto;
}
.press-talk-btn-main {
  text-align: center;
  text-wrap: balance;
  line-height: 1.18;
  font-size: 1.05rem;
  font-weight: 800;
}
.press-talk-btn.recording {
  background: var(--danger);
  box-shadow: 0 14px 28px rgba(220, 38, 38, 0.22);
}
.press-talk-btn-main.recording {
  background:
    radial-gradient(circle at 30% 30%, #ffb5a8 0%, #f04d2d 34%, #9f1f10 72%, #4f0904 100%);
  color: #fff3f0;
  border-color: rgba(255, 194, 182, 0.42);
  box-shadow:
    0 28px 52px rgba(78, 7, 2, 0.44),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -12px 26px rgba(79, 9, 4, 0.5);
}
.play-once-btn {
  min-height: 48px;
  border-radius: 3px;
}
.split-action {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.split-action button {
  border-radius: 0;
  min-height: 56px;
  box-shadow: none;
}
.split-action button:first-child {
  border-right: 1px solid var(--line);
}

#appCard,
#adminAppCard {
  display: grid;
  gap: 18px;
}
#appCard {
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  align-content: start;
}
#adminAppCard {
  height: 100%;
  min-height: 0;
}

#roleAPanel,
#roleBPanel {
  min-height: 0;
  overflow: hidden;
}

.admin-layout {
  display: block;
  position: relative;
  height: 100%;
  min-height: 0;
}

.admin-content {
  display: grid;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 50%) minmax(0, 50%);
  overflow: hidden;
}

.radio-admin-shell {
  display: grid;
  gap: 10px;
  padding: 16px 14px 12px;
  border: 1px solid rgba(255, 214, 84, 0.22);
  background:
    linear-gradient(180deg, rgba(56, 50, 34, 0.96) 0%, rgba(21, 20, 17, 0.98) 100%);
  box-shadow:
    0 22px 38px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 236, 166, 0.12);
  min-height: 0;
  overflow: hidden;
}

.radio-admin-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
}

.radio-admin-antenna {
  width: 16px;
  height: 64px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #3c3c39 0%, #121212 100%);
  border: 1px solid rgba(255, 214, 84, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.radio-admin-speaker {
  flex: 1;
  min-height: 72px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 214, 84, 0.16);
  background: linear-gradient(180deg, rgba(13, 13, 13, 0.84), rgba(39, 33, 15, 0.95));
}

.radio-admin-speaker span {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 214, 84, 0.18), rgba(255, 214, 84, 0.04));
}

.radio-admin-body {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.radio-admin-knobs {
  display: grid;
  gap: 10px;
}

.radio-knob {
  min-height: 68px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, #ffe68d 0%, #dbac1f 28%, #6a4c00 72%, #1e1a11 100%);
  color: #111;
  border: 1px solid rgba(255, 214, 84, 0.28);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.22),
    inset 0 -8px 14px rgba(0,0,0,0.32);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.radio-knob.is-active {
  background:
    radial-gradient(circle at 30% 30%, #fff0aa 0%, #ffd84a 28%, #9b7000 72%, #231c0c 100%);
}

.radio-admin-display {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 214, 84, 0.18);
  background:
    linear-gradient(180deg, rgba(24, 41, 24, 0.98) 0%, rgba(10, 20, 11, 0.98) 100%);
  box-shadow:
    inset 0 0 18px rgba(120, 255, 132, 0.08),
    inset 0 0 0 1px rgba(173, 255, 186, 0.04);
}

.radio-display-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: "Courier New", monospace;
  color: #9af7a7;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.radio-display-screen {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  font-family: "Courier New", monospace;
  color: #9af7a7;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-y: auto;
}

.radio-display-line {
  border-bottom: 1px dashed rgba(154, 247, 167, 0.16);
  padding-bottom: 4px;
}

.admin-list-section {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.admin-list-head {
  display: grid;
  gap: 4px;
}

.admin-list-scroll {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}

.codes-column {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.code-row button {
  width: auto;
  min-width: 88px;
}

#usersList .panel,
#messagesA .panel,
#messagesB .panel {
  border-radius: 4px;
}

@media (max-width: 800px) {
  .grid.two { grid-template-columns: 1fr; }
  .shell { width: min(100% - 8px, 460px); padding-top: 4px; }
  .shell-admin { width: 100%; padding: 0; }
  .card { padding: 14px; border-radius: 4px; }
  .panel { padding: 10px; border-radius: 4px; }
  .record-row button { width: 100%; }
  .split-action { grid-template-columns: 1fr 1fr; }
  .app-frame { height: 100vh; }
  .press-talk-btn-main {
    width: 176px;
    height: 176px;
    padding: 18px;
  }
  .talk-stage {
    min-height: 204px;
    padding: 4px 0 8px;
  }
  .radio-user-display .radio-display-screen {
    font-size: 0.76rem;
  }
  .radio-user-display-bottom {
    min-height: 0;
  }
  .radio-user-display-shell {
    min-height: 144px;
  }
  .talk-dock {
    min-height: 190px;
    padding: 4px 0 0;
  }
  .press-talk-btn-main::before {
    width: 146px;
    height: 146px;
  }
  .press-talk-btn-main {
    font-size: 0.9rem;
  }
  .app-screen {
    height: calc(100dvh - 82px);
    padding: 8px 8px 14px;
  }
  .app-header {
    padding: 14px 14px 12px;
  }
  .app-frame-admin {
    height: 100dvh;
    border-radius: 0;
  }
  .radio-admin-body {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
  }
  .radio-knob {
    min-height: 58px;
    font-size: 0.7rem;
  }
  .radio-display-screen {
    min-height: 112px;
    font-size: 0.76rem;
  }
}
