:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(17, 24, 39, 0.9);
  --panel-2: rgba(31, 41, 55, 0.78);
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.22), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.13), transparent 30rem),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -0.06em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.status-pill {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.status-pill.connected {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.35);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.35);
}

.grid {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.card h2 {
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

input,
select {
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  font-size: 16px;
}

input:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #00111f;
  font-weight: 850;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

.btn {
  width: 100%;
  padding: 13px 15px;
}

button.secondary {
  background: rgba(31, 41, 55, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
}

button.danger {
  background: rgba(251, 113, 133, 0.16);
  color: #fecdd3;
  border: 1px solid rgba(251, 113, 133, 0.35);
}

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

.rooms {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.62);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.room:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(31, 41, 55, 0.9);
}

.room.selected {
  border-color: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08);
}

.room-name {
  font-weight: 850;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badge {
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.mode {
  padding: 16px;
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.58);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.mode-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mode-value {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.ptt-wrap {
  display: grid;
  place-items: center;
  margin: 18px 0;
}

.ptt {
  width: min(240px, 74vw);
  height: min(240px, 74vw);
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.32), transparent 22%),
    linear-gradient(135deg, #38bdf8, #0284c7);
  color: #00111f;
  box-shadow:
    0 18px 50px rgba(14, 165, 233, 0.35),
    inset 0 -14px 30px rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  touch-action: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.ptt .big {
  display: block;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.ptt .small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.8;
}

.ptt.talking {
  transform: scale(0.98);
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.36), transparent 22%),
    linear-gradient(135deg, #34d399, #059669);
  box-shadow:
    0 18px 55px rgba(52, 211, 153, 0.32),
    inset 0 -14px 30px rgba(0, 0, 0, 0.22);
}

.ptt.locked {
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.36), transparent 22%),
    linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow:
    0 18px 55px rgba(251, 191, 36, 0.3),
    inset 0 -14px 30px rgba(0, 0, 0, 0.22);
}

.vu {
  width: min(260px, 78vw);
  height: 14px;
  margin-top: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}

.vu-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #fbbf24, #fb7185);
  transition: width 0.06s linear;
}

.audio-options {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.45);
  border: 1px solid var(--border);
}

.audio-options h3 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  color: var(--text);
  font-size: 14px;
}

.check-row input {
  width: auto;
  margin: 0;
}

.audio-options input[type="range"] {
  margin-bottom: 4px;
}

.small-value {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.controls {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.users {
  display: grid;
  gap: 10px;
}

.user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.62);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.user:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(31, 41, 55, 0.9);
}

.user.private {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.08);
}

.user.talking {
  border-color: rgba(52, 211, 153, 0.85);
  background: rgba(6, 95, 70, 0.35);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.08);
}

.user.talking .avatar {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
}

.user.talking .badge {
  color: #bbf7d0;
  background: rgba(52, 211, 153, 0.14);
}

.user.self {
  cursor: default;
  opacity: 0.76;
}

.user.self:hover {
  transform: none;
  border-color: var(--border);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  font-weight: 950;
  flex: 0 0 auto;
}

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

.user-info {
  min-width: 0;
  flex: 1;
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.user-vu {
  width: 100%;
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-vu-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #fbbf24, #fb7185);
  transition: width 0.06s linear;
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  text-align: center;
}

.hint {
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
  margin-top: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
  }

  .status-pill {
    white-space: normal;
  }
}