@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Manrope:wght@400;500;700&display=swap');

:root {
  --bg-0: #07121b;
  --bg-1: #0d1f2b;
  --bg-2: #143047;
  --card: rgba(10, 22, 31, 0.72);
  --card-border: rgba(145, 180, 199, 0.24);
  --ink: #e8f5fc;
  --ink-dim: #9bb5c4;
  --brand: #50d5ff;
  --brand-2: #56ffb7;
  --warn: #ffc56b;
  --danger: #ff6674;
  --ok: #61ffa7;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.34);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 12%, rgba(80, 213, 255, 0.16), transparent 34%),
    radial-gradient(circle at 82% 18%, rgba(86, 255, 183, 0.12), transparent 30%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1) 35%, var(--bg-2));
}

a {
  color: var(--brand);
}

.shell {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, rgba(17, 45, 60, 0.9), rgba(12, 27, 39, 0.88));
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), #78f0ff 45%, var(--brand-2));
  box-shadow: 0 0 24px rgba(80, 213, 255, 0.6);
}

.brand h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.28rem;
  margin: 0;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.85rem;
}

.status-chip {
  border: 1px solid rgba(120, 245, 255, 0.35);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  background: rgba(12, 34, 46, 0.8);
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  min-height: calc(100vh - 112px);
}

@media (min-width: 1121px) {
  .layout.layout-single-column {
    grid-template-columns: minmax(420px, 680px);
    justify-content: center;
    min-height: auto;
  }
}

.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

#roomSection {
  order: 1;
}

#connectSection {
  order: 2;
}

#ultrasonicSection {
  order: 3;
}

.main {
  min-height: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h2,
.card h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.01em;
  line-height: 1.28;
}

.card h2 {
  font-size: 1rem;
}

.card h3 {
  font-size: 0.92rem;
  color: var(--ink-dim);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.compact-stack {
  gap: 8px;
}

.compact-stack h2,
.compact-stack h3,
.compact-stack p {
  margin: 0;
}

.section-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #85d7f0;
  font-weight: 700;
}

.small {
  font-size: 0.83rem;
  color: var(--ink-dim);
  line-height: 1.42;
}

.card p,
.card label,
.card .small {
  line-height: 1.45;
}

label.small {
  display: block;
  margin-bottom: 4px;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stage-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.session-slab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.9fr);
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(110, 173, 203, 0.22);
  background:
    radial-gradient(circle at 100% 0%, rgba(80, 213, 255, 0.12), transparent 34%),
    rgba(7, 21, 31, 0.82);
}

.session-code {
  display: grid;
  gap: 8px;
  align-content: start;
}

.session-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meta-stat {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(117, 169, 195, 0.22);
  background: rgba(11, 31, 43, 0.78);
  display: grid;
  gap: 5px;
}

.meta-stat strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
}

.utility-disclosure {
  border: 1px solid rgba(110, 173, 203, 0.22);
  border-radius: 14px;
  background: rgba(8, 22, 33, 0.78);
  overflow: hidden;
}

.utility-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.utility-disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure-copy {
  display: grid;
  gap: 4px;
}

.disclosure-copy strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
}

.utility-disclosure[open] summary .tag {
  color: var(--ok);
  border-color: rgba(97, 255, 167, 0.2);
}

.utility-body {
  padding: 0 16px 16px;
}

.stage-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stage-subtab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(123, 176, 204, 0.34);
  background: rgba(10, 25, 35, 0.76);
  color: var(--ink-dim);
  text-align: center;
}

.stage-subtab.active {
  border-color: rgba(80, 213, 255, 0.5);
  background: linear-gradient(135deg, rgba(31, 95, 126, 0.9), rgba(13, 43, 62, 0.94));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(80, 213, 255, 0.14);
}

.stage-subpanel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(110, 173, 203, 0.18);
  background: rgba(7, 21, 31, 0.56);
}

.stage-inline-disclosure {
  background: rgba(7, 21, 31, 0.68);
}

.flow-step-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.flow-toggle-btn {
  padding: 7px 10px;
  font-size: 0.74rem;
  white-space: nowrap;
}

.flow-step-grid button {
  pointer-events: none;
  cursor: default;
}

.mobile-flow-nav {
  position: sticky;
  top: 8px;
  z-index: 80;
  padding: 14px;
  gap: 8px;
}

.mobile-flow-nav button {
  text-align: left;
}

.mobile-flow-nav .small {
  margin-top: 6px;
}

input,
textarea,
select,
button,
[contenteditable="true"] {
  font: inherit;
  line-height: 1.35;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(146, 186, 207, 0.34);
  background: rgba(10, 24, 36, 0.92);
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: #245d82;
  color: var(--ink);
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-brand {
  background: linear-gradient(135deg, #1790c2, #29b8e8);
  color: #042135;
}

.btn-accent {
  background: linear-gradient(135deg, #2cbf7a, #6ee890);
  color: #072915;
}

.btn-warn {
  background: linear-gradient(135deg, #e3a238, #ffd277);
  color: #382202;
}

.btn-danger {
  background: linear-gradient(135deg, #be4254, #ff7382);
  color: #2f0710;
}

.btn-ghost {
  border-color: rgba(123, 176, 204, 0.44);
  background: rgba(11, 31, 43, 0.86);
}

.room-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(80, 213, 255, 0.46);
  background: rgba(3, 28, 44, 0.9);
}

.peer-list,
.cached-list,
.offline-log {
  max-height: 150px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(139, 182, 208, 0.24);
  background: rgba(6, 17, 25, 0.66);
  padding: 12px;
}

.cached-list {
  min-height: 72px;
}

.peer-item,
.cached-item,
.log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: rgba(15, 35, 48, 0.68);
  line-height: 1.42;
}

.peer-item:last-child,
.cached-item:last-child,
.log-item:last-child {
  margin-bottom: 0;
}

.saved-peer-item .row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-ok { background: rgba(97, 255, 167, 0.18); color: var(--ok); }
.badge-warn { background: rgba(255, 197, 107, 0.18); color: var(--warn); }
.badge-danger { background: rgba(255, 102, 116, 0.2); color: var(--danger); }
.badge-muted { background: rgba(128, 155, 170, 0.17); color: #a9c0cc; }
.badge-signal {
  background: rgba(80, 213, 255, 0.22);
  color: #9feeff;
  box-shadow: 0 0 12px rgba(80, 213, 255, 0.22);
}
.badge-noise {
  background: rgba(255, 102, 116, 0.24);
  color: #ffb2bc;
  box-shadow: 0 0 12px rgba(223, 63, 86, 0.2);
}

.chat-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "media media"
    "chat ptt";
  height: 100%;
  min-height: calc(100vh - 128px);
  gap: 14px;
}

.media-section {
  grid-area: media;
}

.chat-section {
  grid-area: chat;
  min-height: 0;
}

.ptt-section {
  grid-area: ptt;
  min-height: 0;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 16px;
  min-height: calc(100vh - 128px);
}

.workspace-shell > .media-section,
.workspace-shell > .chat-section,
.workspace-shell > .ptt-section {
  grid-area: auto;
}

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 2px;
  width: 100%;
  justify-self: stretch;
}

.workspace-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(123, 176, 204, 0.34);
  background: rgba(10, 25, 35, 0.76);
  color: var(--ink-dim);
  text-align: center;
}

.workspace-tab.active {
  border-color: rgba(80, 213, 255, 0.5);
  background: linear-gradient(135deg, rgba(31, 95, 126, 0.9), rgba(13, 43, 62, 0.94));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(80, 213, 255, 0.14);
}

.workspace-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  width: 100%;
  justify-self: stretch;
}

.workspace-disclosure {
  background: rgba(7, 21, 31, 0.68);
  width: 100%;
}

.workspace-disclosure summary {
  align-items: flex-start;
  flex-wrap: wrap;
}

.workspace-disclosure .disclosure-copy {
  flex: 1 1 220px;
  min-width: 0;
}

.workspace-disclosure summary .tag {
  margin-left: auto;
}

.workspace-disclosure .utility-body {
  display: grid;
  gap: 12px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.video-box {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(126, 171, 194, 0.33);
  background: rgba(5, 16, 24, 0.86);
  min-height: 142px;
}

.video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-box.screen-mode video,
.screen-frame-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(2, 8, 12, 0.92);
}

.screen-frame-box img {
  display: block;
  min-height: 142px;
}

.video-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 0.72rem;
}

.video-box.video-muted::after {
  content: "Camera off";
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.62);
  color: #d2e4ef;
}

.messages {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(122, 169, 194, 0.32);
  padding: 14px;
  background: rgba(5, 16, 24, 0.72);
  min-height: 180px;
}

#chatMessages {
  max-height: 44vh;
}

#pttTranscriptMessages {
  max-height: 34vh;
}

.msg {
  border: 1px solid rgba(130, 172, 194, 0.24);
  background: rgba(14, 35, 48, 0.74);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.msg.self {
  border-color: rgba(95, 215, 255, 0.42);
  background: rgba(18, 53, 73, 0.8);
}

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 0.78rem;
  color: var(--ink-dim);
}

.msg-body img,
.msg-body video {
  max-width: min(360px, 100%);
  border-radius: 10px;
  border: 1px solid rgba(132, 175, 197, 0.35);
  margin-top: 7px;
}

.msg-body a.file-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  margin-top: 7px;
  background: rgba(18, 46, 62, 0.85);
  border: 1px solid rgba(104, 165, 198, 0.35);
  text-decoration: none;
}

.clipboard-card {
  display: grid;
  gap: 8px;
}

.clipboard-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  color: #dcecf5;
}

.msg-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.msg-actions .small {
  margin: 0;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.offline-chat-section .messages {
  max-height: 32vh;
  min-height: 220px;
}

.pending-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: rgba(15, 35, 48, 0.68);
  line-height: 1.42;
}

.pending-file-item:last-child {
  margin-bottom: 0;
}

.pending-file-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.pending-file-meta strong,
.pending-file-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.toolbar button {
  min-width: 34px;
  padding: 6px 8px;
  font-family: "Space Grotesk", sans-serif;
}

.composer {
  min-height: 92px;
  border-radius: 12px;
  border: 1px solid rgba(129, 172, 196, 0.34);
  background: rgba(7, 20, 29, 0.88);
  padding: 10px;
  overflow: auto;
}

.composer:empty::before {
  content: attr(data-placeholder);
  color: #7f9cab;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-actions input[type="file"] {
  max-width: 260px;
}

.chat-actions .btn-ghost {
  white-space: nowrap;
}

.clipboard-send-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(124, 184, 209, 0.28);
  background: rgba(8, 22, 33, 0.7);
}

.clipboard-send-panel textarea {
  min-height: 70px;
  resize: vertical;
}

.voice-composer-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(124, 184, 209, 0.34);
  background: linear-gradient(180deg, rgba(14, 32, 43, 0.92), rgba(8, 20, 28, 0.96));
}

.voice-composer-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.voice-transcript-preview {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(80, 146, 188, 0.12);
  border: 1px solid rgba(121, 187, 220, 0.22);
  color: #dcecf5;
  line-height: 1.45;
  white-space: pre-wrap;
}

.voice-chat-actions {
  gap: 8px;
}

.voice-chat-actions .btn-brand,
.voice-chat-actions .btn-ghost {
  min-width: 132px;
}

.ptt {
  min-width: 160px;
  background: linear-gradient(135deg, #cb6449, #ff9a67);
  color: #3a1306;
}

.ptt.live {
  box-shadow: 0 0 18px rgba(255, 153, 111, 0.72);
}

.scan-video {
  width: 100%;
  border-radius: 10px;
  margin-top: 8px;
  border: 1px solid rgba(125, 172, 197, 0.32);
  background: #000;
  max-height: 180px;
  object-fit: cover;
}

.qr-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(119, 177, 205, 0.46);
  border-radius: 12px;
  min-height: 150px;
  background: rgba(8, 23, 33, 0.72);
}

.qr-wrap canvas {
  max-width: 100%;
  height: auto;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #000;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.flash-overlay.active {
  display: flex;
}

.profile-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(128, 172, 197, 0.33);
  background: rgba(9, 25, 35, 0.84);
}

.profile-card img {
  width: 68px;
  height: 68px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(125, 176, 201, 0.4);
}

.notice {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 197, 107, 0.45);
  background: rgba(255, 189, 86, 0.12);
  color: #ffe2ad;
  font-size: 0.84rem;
}

.tx-volume-notice {
  margin-top: 10px;
}

.sound-monitor {
  border: 1px solid rgba(122, 177, 205, 0.34);
  border-radius: 12px;
  padding: 14px;
  background: rgba(10, 25, 35, 0.84);
}

.sound-monitor .row {
  margin-bottom: 10px;
}

.sound-monitor .small {
  margin-top: 6px;
}

.sound-range-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sound-range-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.sound-range-presets.is-disabled {
  opacity: 0.78;
}

.sound-range-preset {
  position: relative;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(108, 168, 197, 0.32);
  background:
    linear-gradient(180deg, rgba(17, 39, 52, 0.94), rgba(8, 21, 31, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.sound-range-preset::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(105, 145, 164, 0.5);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.sound-range-preset::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(80, 213, 255, 0.18), rgba(86, 255, 183, 0.16));
  transition: background 120ms ease, box-shadow 120ms ease;
}

.sound-range-preset:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(122, 198, 229, 0.52);
  box-shadow:
    0 14px 24px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sound-range-preset:disabled {
  opacity: 1;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.sound-range-preset:focus-visible {
  outline: none;
  border-color: rgba(115, 230, 255, 0.9);
  box-shadow:
    0 0 0 2px rgba(78, 214, 255, 0.24),
    0 14px 28px rgba(0, 0, 0, 0.28);
}

.sound-range-preset[aria-checked="true"] {
  border-color: rgba(108, 230, 255, 0.88);
  background:
    linear-gradient(180deg, rgba(28, 76, 98, 0.96), rgba(12, 34, 47, 0.98));
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sound-range-preset[aria-checked="true"]::before {
  background: var(--brand-2);
  box-shadow: 0 0 14px rgba(86, 255, 183, 0.46);
}

.sound-range-preset[aria-checked="true"]::after {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 14px rgba(86, 255, 183, 0.24);
}

.sound-range-preset-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--ink);
  padding-right: 18px;
}

.sound-range-preset-distance {
  font-size: 0.74rem;
  color: #a4c3d3;
}

.sound-range-preset[aria-checked="true"] .sound-range-preset-distance {
  color: #dffbff;
}

.sound-range-summary {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(101, 171, 203, 0.28);
  background: rgba(9, 24, 34, 0.84);
}

.sound-range-summary-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}

.sound-range-summary-head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.sound-range-summary .small {
  margin: 0;
}

#soundLevelText {
  display: none;
}

.tx-indicator {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(80, 213, 255, 0.48);
  background: rgba(32, 114, 146, 0.28);
  color: #c7efff;
  font-size: 0.82rem;
  font-weight: 700;
  animation: txPulse 1.15s ease-in-out infinite;
}

@keyframes txPulse {
  0% { opacity: 0.56; }
  50% { opacity: 1; }
  100% { opacity: 0.56; }
}

.sound-meter-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(10, 20, 28, 0.95);
  border: 1px solid rgba(108, 167, 198, 0.32);
  overflow: hidden;
  margin: 10px 0 8px;
}

.sound-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3aa2cf, #5de0ff 55%, #64ffb5);
  box-shadow: 0 0 10px rgba(93, 224, 255, 0.5);
  transition: width 120ms linear;
}

.diag-status {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(115, 165, 193, 0.35);
  background: rgba(10, 24, 34, 0.85);
  font-size: 0.79rem;
  color: #b7d2df;
}

.diag-inline {
  font-size: 0.78rem;
  color: #9ab7c7;
  word-break: break-all;
}

.pico-rx-dialog {
  position: fixed;
  inset: 0;
  z-index: 12150;
  display: grid;
  place-items: center;
  padding: 16px;
}

.pico-rx-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 9, 14, 0.92);
  backdrop-filter: blur(8px);
}

.pico-rx-panel {
  position: relative;
  width: min(420px, calc(100vw - 24px));
  border-radius: 18px;
  border: 1px solid rgba(124, 186, 219, 0.38);
  background: #0a1d2b;
  box-shadow: 0 28px 66px rgba(0, 0, 0, 0.56);
  padding: 18px;
}

.pico-rx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pico-rx-kicker {
  margin-bottom: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7df1ff;
}

.pico-rx-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.18rem;
  color: #f0fff9;
}

.pico-rx-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(124, 186, 219, 0.34);
  border-radius: 999px;
  background: #102737;
  color: #cfe9f5;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.pico-rx-close:hover,
.pico-rx-close:focus-visible {
  border-color: rgba(125, 241, 255, 0.72);
  color: #ffffff;
  outline: none;
}

.pico-rx-copy {
  margin: 0 0 12px;
  color: #9ec0d2;
  font-size: 0.92rem;
}

.pico-rx-message {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.44rem;
  letter-spacing: 0.22em;
  color: #f0fff9;
  word-break: break-word;
}

.pico-connect-dialog {
  position: fixed;
  inset: 0;
  z-index: 12100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.pico-connect-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 9, 14, 0.9);
  backdrop-filter: blur(8px);
}

.pico-connect-panel {
  position: relative;
  width: min(420px, calc(100vw - 24px));
  border-radius: 18px;
  border: 1px solid rgba(124, 186, 219, 0.38);
  background: #0a1d2b;
  box-shadow: 0 28px 66px rgba(0, 0, 0, 0.56);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.pico-connect-head h2,
.pico-connect-message {
  margin: 0;
}

.pico-connect-kicker {
  margin-bottom: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7df1ff;
}

.pico-connect-head h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.18rem;
  color: #f0fff9;
}

.pico-connect-message {
  color: #f0fff9;
  line-height: 1.5;
}

.pico-connect-meta {
  display: grid;
  gap: 8px;
  color: #9ec0d2;
  font-size: 0.88rem;
}

.pico-connect-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.spectrogram-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 16px;
}

.spectrogram-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 116, 52, 0.24), transparent 32%),
    radial-gradient(circle at 80% 20%, rgba(69, 241, 255, 0.2), transparent 30%),
    radial-gradient(circle at 50% 85%, rgba(166, 255, 88, 0.17), transparent 38%),
    rgba(2, 9, 14, 0.72);
  backdrop-filter: blur(8px);
}

.spectrogram-panel {
  position: relative;
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(124, 186, 219, 0.38);
  background:
    linear-gradient(145deg, rgba(11, 30, 45, 0.97), rgba(8, 23, 36, 0.96)),
    radial-gradient(circle at 82% 12%, rgba(255, 113, 41, 0.14), transparent 33%),
    radial-gradient(circle at 14% 82%, rgba(62, 255, 190, 0.13), transparent 36%);
  box-shadow: 0 28px 66px rgba(0, 0, 0, 0.56);
  padding: 16px;
}

.spectrogram-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.spectrogram-head h2 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.18rem;
}

.spectrogram-head p {
  margin: 0;
  color: #9ec0d2;
  font-size: 0.86rem;
}

.spectrogram-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(115, 178, 212, 0.32);
  background: rgba(8, 23, 34, 0.78);
  font-size: 0.83rem;
  color: #a7c8db;
}

.spectrogram-stats strong {
  color: #d8f7ff;
}

.spectrogram-canvas-wrap {
  border-radius: 14px;
  border: 1px solid rgba(126, 192, 224, 0.38);
  background: linear-gradient(180deg, rgba(7, 20, 32, 0.95), rgba(5, 14, 24, 0.98));
  padding: 10px;
}

.spectrogram-canvas-wrap canvas {
  width: 100%;
  height: 360px;
  display: block;
  border-radius: 10px;
  background: #000;
}

.spectrogram-hint {
  margin-top: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: #9bc3d9;
}

.spectrogram-table-wrap {
  border-radius: 12px;
  border: 1px solid rgba(110, 177, 210, 0.32);
  background: rgba(8, 22, 32, 0.8);
  overflow: auto;
  max-height: 280px;
}

.spectrogram-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.spectrogram-table th,
.spectrogram-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(109, 167, 198, 0.2);
  text-align: left;
  font-size: 0.8rem;
}

.spectrogram-table th {
  position: sticky;
  top: 0;
  background: rgba(11, 35, 52, 0.96);
  color: #cdefff;
  z-index: 1;
}

.spectrogram-table td {
  color: #d4edf9;
}

.spectrogram-table tbody tr:nth-child(odd) {
  background: rgba(14, 39, 55, 0.35);
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .session-slab {
    grid-template-columns: 1fr;
  }

  .workspace-shell {
    min-height: 74vh;
  }

  .chat-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "media"
      "chat"
      "ptt";
    min-height: 74vh;
  }

  #chatMessages,
  #pttTranscriptMessages {
    max-height: 40vh;
  }
}

@media (max-width: 900px) {
  .shell {
    padding: 18px;
    gap: 16px;
  }

  .topbar {
    padding: 18px 20px;
  }

  .layout {
    gap: 14px;
    min-height: auto;
  }

  .side {
    gap: 14px;
  }

  .card {
    padding: 18px;
  }

  .card h2,
  .card h3 {
    margin-bottom: 14px;
  }

  .card h2 {
    font-size: 1.06rem;
  }

  .card h3 {
    font-size: 0.95rem;
  }

  .small {
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .stack {
    gap: 14px;
  }

  .row {
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
  }

  .grid-2 {
    gap: 12px;
  }

  .workspace-head {
    flex-direction: column;
    align-items: stretch;
  }

  .stage-subtabs {
    width: 100%;
  }

  .stage-subtab {
    flex: 1 1 160px;
    justify-content: center;
  }

  .workspace-tabs {
    width: 100%;
  }

  .workspace-tab {
    flex: 1 1 160px;
    justify-content: center;
  }

  .peer-list,
  .cached-list,
  .offline-log {
    padding: 14px;
    max-height: 180px;
  }

  .peer-item,
  .cached-item,
  .log-item {
    padding: 11px 12px;
  }

  .messages {
    padding: 16px;
  }

  .msg {
    padding: 12px 13px;
    margin-bottom: 12px;
  }

  .composer {
    padding: 13px;
  }

  .sound-monitor {
    padding: 16px;
  }

  .sound-range-preset {
    min-height: 88px;
  }

  .sound-meter-track {
    margin: 13px 0 11px;
  }
}

@media (max-width: 740px) {
  .shell {
    padding: 16px;
    gap: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
    gap: 14px;
  }

  .status-chip {
    width: 100%;
    text-align: center;
  }

  .layout {
    gap: 14px;
    min-height: auto;
  }

  .side {
    gap: 14px;
  }

  .card {
    padding: 18px;
  }

  .small {
    font-size: 0.87rem;
    line-height: 1.52;
  }

  .row {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
  }

  .stack {
    gap: 14px;
  }

  .room-pill {
    min-width: 112px;
    font-size: 1rem;
  }

  .session-meta {
    grid-template-columns: 1fr;
  }

  input,
  textarea,
  select {
    padding: 11px 12px;
  }

  button {
    padding: 12px 14px;
  }

  .sound-monitor {
    padding: 15px;
  }

  .sound-range-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sound-range-preset {
    min-height: 80px;
  }

  .peer-list,
  .cached-list,
  .offline-log {
    padding: 13px;
    max-height: 200px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .chat-actions input[type="file"] {
    max-width: 100%;
  }

  .workspace-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stage-subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-tab,
  .stage-subtab {
    min-height: 56px;
    padding: 10px 12px;
    line-height: 1.18;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .workspace-shell {
    min-height: 68vh;
  }

  #soundLevelText {
    font-size: 0.8rem;
  }

  .spectrogram-panel {
    width: calc(100vw - 14px);
    max-height: calc(100vh - 14px);
    padding: 12px;
  }

  .spectrogram-head {
    flex-direction: column;
  }

  .spectrogram-canvas-wrap canvas {
    height: 280px;
  }
}
