:root {
  --bg-root: #09090b;
  --bg-elevated: #111114;
  --bg-panel: #18181c;
  --bg-card: #1c1c22;
  --bg-hover: #25252d;
  --bg-input: #0e0e11;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;
  --accent: #7c6cf0;
  --accent-hover: #9488f5;
  --accent-glow: rgba(124, 108, 240, 0.35);
  --accent-dim: rgba(124, 108, 240, 0.12);
  --success: #23a559;
  --success-dim: rgba(35, 165, 89, 0.15);
  --danger: #f23f43;
  --warning: #f0b232;
  --rail-w: 76px;
  --sidebar-w: 248px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px var(--accent-glow);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-root);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

#app-root {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.web-client .titlebar {
  display: none;
}

body.web-client #app-root {
  height: 100dvh;
}

body.web-client .web-only-hidden {
  display: none !important;
}

/* —— Custom title bar (frameless window) —— */
.titlebar {
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  user-select: none;
  -webkit-app-region: drag;
}
.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.titlebar-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}
.titlebar-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.titlebar-drag {
  flex: 1;
  min-width: 24px;
  height: 100%;
}
.titlebar-controls {
  display: flex;
  height: 100%;
  flex-shrink: 0;
}
.no-drag {
  -webkit-app-region: no-drag;
}
.tb-btn {
  width: 46px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.tb-btn svg {
  width: 11px;
  height: 11px;
}
.tb-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.tb-btn.tb-close:hover {
  background: #e81123;
  color: #fff;
}

.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view {
  flex: 1;
  min-height: 0;
  display: none;
  overflow: hidden;
}
.view-active { display: flex; }

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-hover) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

/* —— Login —— */
#view-login.view-active {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 100% 80% at 50% -30%, var(--accent-glow), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(35, 165, 89, 0.08), transparent),
    var(--bg-root);
}

.login-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 48px 28px;
  max-width: 440px;
  width: 100%;
}

.login-brand { text-align: center; }
.logo-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px var(--accent-glow);
}
.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.login-brand h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.login-tagline { margin: 0; color: var(--text-muted); font-size: 1rem; }

.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.login-card h2 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 700; }
.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; line-height: 1.5; }
.login-foot { margin: 20px 0 0; font-size: 0.8rem; text-align: center; }
.login-error {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: rgba(242, 63, 67, 0.12);
  border: 1px solid rgba(242, 63, 67, 0.25);
  border-radius: var(--radius-sm);
  color: #ff8a8c;
  font-size: 0.85rem;
}

/* —— Shell —— */
#view-app.view-active {
  display: grid;
  grid-template-columns: var(--rail-w) var(--sidebar-w) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Settings uses full width — hide narrow channel sidebar */
#view-app.settings-mode,
#view-app.account-mode,
#view-app.overlay-mode {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}
#view-app.settings-mode .sidebar,
#view-app.account-mode .sidebar,
#view-app.overlay-mode .sidebar {
  display: none;
}

.rail {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  justify-content: space-between;
}

.rail-top {
  padding-top: 10px;
}

.rail-top, .rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rail-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  transform: translateY(-1px);
}
.rail-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.rail-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  background: #000;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
}

.rail-user-wrap {
  position: relative;
}
.rail-user-wrap:hover .voice-details-popover:not(.hidden),
.rail-user-wrap:focus-within .voice-details-popover:not(.hidden),
.rail-user-wrap.vd-open .voice-details-popover:not(.hidden),
.voice-details-popover.vd-visible:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.voice-details-popover {
  position: absolute;
  left: calc(100% + 14px);
  bottom: 0;
  width: 300px;
  max-height: min(420px, calc(100vh - 24px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 16px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
  box-sizing: border-box;
}
.voice-details-popover.hidden {
  display: none !important;
}
.voice-details-popover:not(.hidden) {
  display: block;
}

/* Web: portal to body + fixed position (escapes overflow:hidden on .app-shell) */
body.web-client .voice-details-popover {
  position: fixed;
  left: auto;
  bottom: auto;
  right: auto;
  z-index: 100000;
  transform: none;
  transition: opacity 0.15s ease, visibility 0.15s;
}
body.web-client .voice-details-popover.vd-visible {
  transform: none;
}

.vd-voice-status {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 159, 67, 0.1);
  color: #ffb86c;
}
.vd-voice-status.hidden {
  display: none;
}
.vd-voice-status.rtc-disconnected,
.vd-voice-status.reconnect-failed {
  background: rgba(220, 80, 80, 0.15);
  color: #ff8a8a;
}
.vd-voice-status.reconnecting {
  background: rgba(255, 159, 67, 0.12);
  color: #ffb86c;
}

.vd-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.vd-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.vd-tab {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.vd-tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.vd-sparkline {
  display: block;
  width: 100%;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

.vd-conn-id {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
  margin-bottom: 6px;
  line-height: 1.35;
}

.vd-conn-backend {
  font-size: 0.68rem;
  color: var(--text-faint);
  word-break: break-all;
  margin-bottom: 12px;
  line-height: 1.35;
}

.rail-update-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px var(--bg-root);
}

/* —— Download (web) —— */
.download-page {
  max-width: 640px;
  padding: 28px 32px 48px;
}
.download-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.download-hero h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}
.download-icon {
  border-radius: 16px;
  flex-shrink: 0;
}
.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.download-status-msg {
  margin: 0 0 14px;
  font-weight: 600;
}
.download-meta {
  margin: 0 0 16px;
}
.download-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.download-meta-row:last-child {
  border-bottom: none;
}
.download-meta-row dt {
  color: var(--text-muted);
  margin: 0;
}
.download-meta-row dd {
  margin: 0;
  text-align: right;
  word-break: break-all;
}
.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.download-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.download-hash {
  margin: 14px 0 0;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}
.download-update-banner {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-bottom: 20px;
  font-size: 0.88rem;
}
.download-update-banner strong {
  display: block;
  margin-bottom: 4px;
  color: #fbbf24;
}
.download-others-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.download-others-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.download-other-name {
  display: block;
  font-weight: 600;
}
.download-other-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.vd-stats {
  margin: 0 0 12px;
  padding: 0;
}
.vd-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.vd-stat-row dt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.vd-stat-row dd {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.vd-hint {
  margin: 0 0 12px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-faint);
}

.vd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
}
.vd-secure {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 500;
}
.vd-lock {
  flex-shrink: 0;
  opacity: 0.95;
}
.vd-copy {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.vd-copy:hover {
  text-decoration: underline;
}

.rail-user {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--bg-hover);
  cursor: pointer;
  transition: border-color 0.2s;
}
.rail-user:hover { border-color: var(--accent); }
.rail-user.speaking {
  border-color: var(--success);
  box-shadow:
    0 0 0 2px var(--success-dim),
    0 0 18px rgba(35, 165, 89, 0.55);
}
.rail-user img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.rail-user:not(:has(img[src]))::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}
.rail-user-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-faint);
  border: 3px solid var(--bg-elevated);
}
.rail-user-dot.online { background: var(--success); }
.rail-user-dot.voice { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.rail-user-dot.speaking {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: speaking-pulse 1.2s ease-in-out infinite;
}

.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-head {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.sidebar-body { padding: 14px; flex: 1; }
.sidebar-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.45;
}

.btn-sidebar-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-sidebar-action:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.connected-server {
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.connected-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 8px;
  line-height: 1.35;
  word-break: break-word;
}
.connected-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse 120% 80% at 80% -40%, rgba(124, 108, 240, 0.06), transparent),
    var(--bg-root);
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 17, 20, 0.85);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.stage-title { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--text-muted); }
.stage-sub { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-faint); }

.conn-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.conn-badge.live {
  background: var(--success-dim);
  color: #57d97b;
  border: 1px solid rgba(35, 165, 89, 0.25);
}
.conn-badge.voice {
  background: var(--accent-dim);
  color: #c4baff;
  border: 1px solid rgba(124, 108, 240, 0.3);
  box-shadow: 0 0 20px rgba(124, 108, 240, 0.15);
}
.conn-badge.rtc-disconnected {
  background: rgba(220, 80, 80, 0.15);
  color: #ff8a8a;
  border: 1px solid rgba(220, 80, 80, 0.45);
  animation: conn-badge-pulse 1.4s ease-in-out infinite;
}
.conn-badge.reconnecting {
  background: rgba(255, 159, 67, 0.12);
  color: #ffb86c;
  border: 1px solid rgba(255, 159, 67, 0.35);
}
@keyframes conn-badge-pulse {
  0%,
  100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.panel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}
.panel.panel-active {
  display: flex !important;
  flex-direction: column;
}

/* —— Discovery —— */
.discovery-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 28px 8px;
  flex-shrink: 0;
}
.discovery-heading {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.discovery-lead {
  margin: 0;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.discovery-toolbar {
  padding: 8px 28px 16px;
  flex-shrink: 0;
}
.search-wrap {
  position: relative;
  max-width: 420px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input::placeholder { color: var(--text-faint); }
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.discovery-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 32px;
  min-height: 0;
}
.discovery-scroll.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 420px));
  gap: 20px;
  justify-content: start;
  align-content: start;
}

.server-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.server-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 108, 240, 0.4);
  box-shadow: var(--shadow-card), 0 0 32px rgba(124, 108, 240, 0.08);
}

.server-card-banner {
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--success), var(--accent));
  background-size: 200% 100%;
  opacity: 0.85;
}

.server-card-body { padding: 18px 20px 20px; }

.server-card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.server-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-dim), var(--bg-hover));
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-hover);
  flex-shrink: 0;
}

.server-card-titles { flex: 1; min-width: 0; }
.server-card-titles h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}
.server-tags {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.4;
}

.status-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #57d97b;
  flex-shrink: 0;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-live 2s ease infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.server-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}
.stat-chip svg { opacity: 0.7; }
.stat-chip-accent {
  background: var(--accent-dim);
  color: #c4baff;
  font-weight: 600;
}

.btn-join-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #2d9f5a 0%, var(--success) 100%);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(35, 165, 89, 0.35);
}
.btn-join-card:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(35, 165, 89, 0.45);
}
.btn-join-card:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 999px;
}
.pill-live { background: var(--success-dim); color: #57d97b; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 32px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}
.empty-illustration {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  border-radius: 16px;
  overflow: hidden;
  opacity: 0.55;
}
.empty-illustration img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.empty-state h3 { margin: 0 0 10px; font-size: 1.15rem; }

/* —— Voice —— */
.connecting-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(42, 46, 66, 0.7), rgba(7, 8, 14, 0.95));
  backdrop-filter: blur(4px);
  z-index: 20;
}
.connecting-overlay.hidden {
  display: none;
}
.connecting-card {
  min-width: 260px;
  padding: 20px 24px;
  border-radius: 16px;
  background: rgba(15, 17, 26, 0.95);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.connecting-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: #7a8bff;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.voice-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr min(320px, 32vw);
  min-height: 0;
}
.voice-members { padding: 24px 28px; overflow-y: auto; }
.voice-members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.voice-members-head .section-label {
  margin: 0;
}
.voice-others-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.section-label {
  margin: 0 0 14px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background 0.15s;
}
.member-list li:hover { background: var(--bg-hover); }
.member-list li.member-row-muted .member-name {
  color: var(--text-muted);
}
.member-info {
  flex: 1;
  min-width: 0;
}
.member-mute-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.member-mute-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.member-mute-btn.active {
  background: rgba(220, 80, 80, 0.18);
  color: #ff8a8a;
}
.member-mute-btn svg {
  width: 20px;
  height: 20px;
}

.member-vol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  width: 72px;
}
.member-vol-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.member-vol-slider {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}
.member-vol-val {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.account-profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 28px 32px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .account-profile-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.account-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.account-avatar-hint {
  margin: 0;
  text-align: center;
  max-width: 140px;
}
.account-remove-avatar {
  font-size: 0.8rem;
}
.account-avatar-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-dim);
  border: 3px solid var(--border-strong);
}
.account-avatar-upload {
  cursor: pointer;
  display: block;
}
.account-avatar-upload.disabled {
  pointer-events: none;
  opacity: 0.55;
  cursor: not-allowed;
}
.account-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.account-avatar-upload:not(.disabled):hover .account-avatar-overlay,
.account-avatar-upload:not(.disabled):focus-within .account-avatar-overlay {
  opacity: 1;
}
.account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.account-avatar-img:not([src]),
.account-avatar-img[src=''] {
  display: none;
}
.account-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-muted);
}
.account-avatar-wrap:has(.account-avatar-img[src]:not([src=''])) .account-avatar-fallback {
  display: none;
}
.account-fields .input {
  width: 100%;
  margin-bottom: 4px;
}
.account-fields .field-label {
  margin-top: 12px;
}
.account-fields .field-label:first-child {
  margin-top: 0;
}
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-hover);
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.member-avatar.hearing {
  border-color: rgba(124, 108, 240, 0.45);
}
.member-avatar.speaking {
  border-color: var(--success);
  box-shadow:
    0 0 0 2px var(--success-dim),
    0 0 14px rgba(35, 165, 89, 0.55);
  animation: speaking-pulse 1.2s ease-in-out infinite;
}
.member-name { font-weight: 600; }
.member-sub { font-size: 0.78rem; color: var(--text-muted); }

.voice-sidebar {
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 24px 20px;
  overflow-y: auto;
}
.voice-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px 14px;
  margin-top: 18px;
  padding: 16px;
  min-height: 72px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.voice-bar-meter {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.voice-input-meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  pointer-events: none;
}

.voice-input-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.05s linear;
}

.voice-bar-meter.speaking .voice-input-meter-fill {
  background: var(--success);
}

.voice-input-meter-threshold {
  position: absolute;
  top: -1px;
  bottom: -1px;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.voice-bar-meter.is-muted .voice-input-meter-fill {
  opacity: 0.45;
}

#voiceInputMeterWrap.hidden {
  display: none;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.range-row input[type='range'] {
  flex: 1;
  accent-color: var(--accent);
}
.range-value {
  min-width: 2ch;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-muted);
}
.self-voice-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  align-self: center;
}
.btn-mute-round {
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  aspect-ratio: 1;
  padding: 0;
  box-sizing: border-box;
  border-radius: 50%;
  border: none;
  background: var(--bg-hover);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.btn-mute-round:hover { transform: scale(1.04); }
.btn-mute-round.muted { background: var(--danger); color: #fff; }
.btn-mute-round.speaking:not(.muted) {
  background: var(--success);
  color: #fff;
  box-shadow: 0 0 20px rgba(35, 165, 89, 0.55);
  animation: speaking-pulse 1.2s ease-in-out infinite;
}
.btn-mute-round svg { width: 26px; height: 26px; }
.voice-bar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-deafen-round.deafened {
  background: var(--danger);
  color: #fff;
}
.self-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.self-status { font-size: 0.8rem; color: var(--text-muted); }

.meter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.meter-dot.speaking {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: speaking-pulse 1.2s ease-in-out infinite;
}

@keyframes speaking-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}
.meter-dot.hearing { background: var(--accent); }
.meter-dot.connecting {
  background: #f59e0b;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.meter-dot.muted { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* —— Settings —— */
#panel-settings.panel-active,
#panel-account.panel-active {
  display: flex !important;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}

.settings-page-head {
  padding: 8px 40px 24px;
  width: 100%;
  max-width: none;
  flex-shrink: 0;
  box-sizing: border-box;
}

.settings-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 40px 48px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.settings-page-head h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.settings-actions .btn-primary {
  flex: 1;
  min-width: 140px;
}

.settings-actions .btn-ghost {
  flex: 0 0 auto;
}

.settings-page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.settings-group {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.settings-group h3 {
  margin: 0 0 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.settings-row,
.account-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.account-row .btn-ghost {
  margin-left: auto;
}
.settings-row img,
.account-row img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
}
.account-name { font-weight: 700; font-size: 1.1rem; }
.check-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.log-panel {
  margin-top: 12px;
  max-height: 180px;
  overflow: auto;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* —— Buttons & inputs —— */
button { font-family: inherit; cursor: pointer; }
.btn-primary {
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  color: #fff;
  font-weight: 700;
  padding: 12px 20px;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: filter 0.15s, transform 0.15s;
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-lg {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-ghost {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger {
  border: none;
  background: var(--danger);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  width: 100%;
}
.field-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-faint);
  margin: 14px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.select, .input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
}
.select:focus, .input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.seg { display: flex; gap: 6px; padding: 4px; background: var(--bg-input); border-radius: var(--radius-sm); }
.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}
.seg-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.ptt-hint kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.error { border-color: rgba(242, 63, 67, 0.4); color: #ff9a9c; }

.session-end-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1200;
}
.session-end-modal.hidden { display: none; }
.session-end-modal-card {
  width: min(420px, 100%);
  background: rgba(15, 17, 26, 0.98);
  border: 1px solid rgba(242, 63, 67, 0.35);
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.65);
  padding: 22px 24px 20px;
  text-align: center;
}
.session-end-headline {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
  color: #ff9a9c;
}
.session-end-code-row {
  margin-bottom: 16px;
}
.session-end-code-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.session-end-code {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
}
.session-end-reason-block {
  text-align: left;
  margin-bottom: 18px;
}
.session-end-reason-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.session-end-reason {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}
.session-end-actions {
  display: flex;
  justify-content: center;
}
.session-end-actions .btn-primary {
  min-width: 120px;
}

.update-popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 16px 28px;
  background: rgba(0, 0, 0, 0.25);
  z-index: 1100;
}
.update-popup.hidden { display: none; }
.update-popup-card {
  width: min(620px, 100%);
  background: rgba(15, 17, 26, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.65);
  padding: 16px 18px;
}
.update-popup-title {
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.update-popup-msg {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.35;
  margin-bottom: 12px;
}
.update-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.settings-version { margin-top: 8px; }

.settings-voice .device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 20px;
}
@media (max-width: 720px) {
  .settings-voice .device-grid { grid-template-columns: 1fr; }
}
.field-block { min-width: 0; }

.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-of-type { border-bottom: none; }
.setting-row-main { flex: 1; min-width: 0; }
.setting-row-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.setting-row-desc {
  margin: 6px 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.input-meter {
  position: relative;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.input-meter-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.05s linear;
}
.settings-sensitivity-inline {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.settings-sensitivity-inline .field-label {
  margin-bottom: 6px;
}

.input-meter-threshold {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  margin-left: -1px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

#settingsMicSensitivityRow.hidden { display: none; }

.mic-test-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 20px;
}
.btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.btn-secondary:hover { filter: brightness(1.08); }
.btn-secondary.active {
  background: var(--danger);
}

.mic-test-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  height: 32px;
  min-width: 0;
}
.mic-test-bars .bar {
  flex: 1;
  max-width: 6px;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.05s, height 0.05s;
}
.mic-test-bars .bar.on {
  background: var(--accent);
}

.settings-subhead {
  margin: 20px 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.settings-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.settings-player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.settings-player-list .sp-name {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-player-list .sp-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.overlay-monitor-hint {
  margin: 0 0 10px;
}

.overlay-monitor-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  max-width: 560px;
}

/* Clickable monitor previews (same look as the position mockup) */
.overlay-desk {
  flex: 1 1 200px;
  min-width: 180px;
  max-width: 300px;
}

.overlay-desk-single {
  display: flex;
  justify-content: center;
}

.overlay-desk-single .overlay-monitor-pick {
  width: 100%;
  max-width: 260px;
}

.overlay-desk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  padding: 4px 0;
}

.overlay-desk-row .overlay-monitor-pick {
  flex: 0 1 auto;
  width: clamp(72px, 28%, 120px);
  aspect-ratio: var(--pick-aspect, 16 / 10);
}

.overlay-desk-map {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 140px;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: rgba(0, 0, 0, 0.15);
  padding: 8px;
  box-sizing: border-box;
}

.overlay-desk-map .overlay-monitor-pick {
  position: absolute;
  box-sizing: border-box;
  padding: 3px;
  min-width: 48px;
  min-height: 40px;
}

.overlay-monitor-pick {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.overlay-monitor-pick .overlay-monitor-frame {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 10;
  padding: 8px;
  border-radius: var(--radius);
  border: 2px solid var(--border-strong);
  background: linear-gradient(145deg, #1a1c22 0%, #0e0f12 100%);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.overlay-desk-map .overlay-monitor-pick .overlay-monitor-frame {
  aspect-ratio: unset;
  height: 100%;
  min-height: 0;
}

.overlay-monitor-pick:hover .overlay-monitor-frame {
  border-color: rgba(88, 101, 242, 0.55);
}

.overlay-monitor-pick.active .overlay-monitor-frame {
  border-color: var(--accent);
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.35),
    0 0 0 2px var(--accent-glow);
}

.overlay-monitor-pick-num {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.overlay-monitor-pick-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.overlay-desk-map .overlay-monitor-pick-label {
  display: none;
}

.overlay-monitor-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overlay-layout-picker .field-label {
  margin: 0 0 8px;
}

.overlay-layout-btns {
  display: flex;
  gap: 8px;
}

.overlay-layout-btn {
  width: 52px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.overlay-layout-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.overlay-layout-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.overlay-scale-block {
  margin-top: 18px;
  max-width: 320px;
}

.overlay-monitor-screen {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, #2b2d35 0%, #1e2028 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.overlay-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 6px;
}

.overlay-pos-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.overlay-pos-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.overlay-pos-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.overlay-radio-group {
  border: none;
  margin: 0 0 8px;
  padding: 0;
}

.overlay-radio-group .field-label {
  margin-top: 0;
}

.overlay-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.overlay-radio input {
  accent-color: var(--accent);
}
