* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg2: #12121a;
  --bg3: #1a1a26;
  --surface: rgba(255, 255, 255, 0.04);
  --surface2: rgba(255, 255, 255, 0.07);
  --surface3: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.12);
  --text: #e8e8ef;
  --text2: #8b8b9e;
  --text3: #5a5a6e;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.25);
  --green: #00b894;
  --red: #ff6b6b;
  --orange: #fdcb6e;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --participants-panel-width: 280px;
  --font: "Outfit", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --focus-ring: 0 0 0 3px var(--accent-glow);
  --app-height: 100dvh;
  --topbar-height: 52px;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  margin: 0;
}

.call-view *,
.stage-panel *,
.stage-grid *,
.call-layout * {
  min-width: 0;
  min-height: 0;
}

svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

[hidden] {
  display: none !important;
}

.app {
  height: var(--app-height);
  min-height: var(--app-height);
}

.app:not(.in-call) {
  display: grid;
}

.app.in-call {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.topbar {
  height: 52px;
  min-height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.app:not(.in-call) .topbar {
  display: none;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
}

.topbar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.topbar-room {
  min-width: 0;
  max-width: 220px;
  padding: 4px 12px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text2);
  font-size: 12px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer {
  flex: 1;
}

.topbar-timer,
.hud-timer {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text2);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn,
.icon-btn,
.stage-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: background 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.topbar-btn:hover,
.icon-btn:hover,
.stage-icon-btn:hover,
.preview-btn:hover,
.dock-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.topbar-btn:active,
.icon-btn:active,
.stage-icon-btn:active,
.preview-btn:active,
.dock-btn:active,
.btn:active,
.join-btn:active {
  transform: translateY(1px);
}

#lockButton svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#lockButton.is-locked {
  background: rgba(108, 92, 231, 0.14);
  border-color: rgba(162, 155, 254, 0.35);
  color: var(--accent2);
}

#lockButton.is-readonly {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text3);
}

.leave-btn {
  width: auto;
  padding: 0 14px;
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.1);
  color: var(--red);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.leave-btn:hover {
  background: rgba(255, 107, 107, 0.2);
}

.hidden-utility,
.status,
#themeButton,
.lang-wrap {
  display: none !important;
}

.mockup-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mockup-container::before {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}

.prejoin-view {
  height: 100%;
}

.prejoin-card {
  position: relative;
  z-index: 1;
  width: 420px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg2);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5);
}

.prejoin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 28px 0;
}

.prejoin-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.prejoin-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.prejoin-title span {
  color: var(--accent2);
  font-weight: 800;
}

.prejoin-preview {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  margin: 20px 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.prejoin-camera {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg);
}

.prejoin-camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

.prejoin-preview-controls {
  position: absolute;
  bottom: 12px;
  display: flex;
  gap: 8px;
}

.preview-btn,
.prejoin-media-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: background 160ms ease-out, color 160ms ease-out, transform 160ms ease-out, border-color 160ms ease-out;
}

.preview-btn.active,
.preview-btn.is-on,
.prejoin-media-btn.is-on {
  background: rgba(0, 184, 148, 0.15);
  border-color: rgba(0, 184, 148, 0.5);
  color: #fff;
}

.preview-btn.off,
.preview-btn:not(.is-on),
.prejoin-media-btn:not(.is-on) {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.35);
  color: var(--red);
}

.prejoin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 24px 24px;
}

.advanced-field {
  display: none;
}

.field {
  display: block;
}

.field-label,
.label {
  display: block;
  margin-bottom: 4px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.field-input,
.input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out, background 160ms ease-out;
}

.field-input:hover,
.input:hover {
  background: var(--surface2);
}

.field-input:focus,
.input:focus,
.field-input:focus-visible,
.input:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field-input::placeholder,
.input::placeholder {
  color: var(--text3);
}

select.field-input,
select.input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235a5a6e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Keep Windows Chromium select popups aligned with the dark UI system. */
select.field-input option,
select.input option,
select.field-input optgroup,
select.input optgroup {
  background: #171824 !important;
  background-color: #171824 !important;
  color: #f4f4fb !important;
  font-family: var(--font) !important;
  font-size: 14px;
  font-weight: 600;
}

select.field-input option:checked,
select.input option:checked {
  background: rgba(124, 108, 240, 0.32) !important;
  background-color: rgba(124, 108, 240, 0.32) !important;
  color: #ffffff !important;
}

select.field-input option:disabled,
select.input option:disabled {
  color: rgba(244, 244, 251, 0.42) !important;
}

.join-btn,
.btn.primary {
  border: none;
  background: linear-gradient(135deg, var(--accent), #7c6cf0);
  color: #fff;
}

.join-btn {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 160ms ease-out, filter 160ms ease-out, box-shadow 160ms ease-out;
}

.join-btn:hover,
.btn.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn {
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease-out, transform 160ms ease-out, box-shadow 160ms ease-out;
}

.btn:hover {
  background: var(--surface2);
}

.call-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.call-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--participants-panel-width);
  overflow: hidden;
}

.call-main {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.call-stage-wrap {
  position: relative;
  display: none;
  min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
}

.call-view.has-stage .call-stage-wrap {
  display: block;
}

.call-view.has-stage .voice-grid {
  display: none;
}

.voice-grid {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: auto;
}

.voice-grid[hidden] {
  display: none;
}

.voice-grid-inner {
  width: 100%;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(var(--voice-cols, 1), minmax(0, var(--voice-tile-width, 320px)));
  justify-content: center;
  align-content: center;
}

.voice-card {
  --voice-fit-scale: 1;
  --voice-card-side-padding: clamp(10px, calc(var(--voice-tile-width, 320px) * 0.056 * var(--voice-fit-scale)), calc(20px * var(--voice-fit-scale)));
  --voice-card-top-padding: clamp(10px, calc(var(--voice-tile-width, 320px) * 0.042 * var(--voice-fit-scale)), calc(16px * var(--voice-fit-scale)));
  --voice-card-bottom-padding: clamp(16px, calc(var(--voice-tile-width, 320px) * 0.078 * var(--voice-fit-scale)), calc(30px * var(--voice-fit-scale)));
  --voice-card-gap: clamp(6px, calc(var(--voice-tile-width, 320px) * 0.03 * var(--voice-fit-scale)), calc(14px * var(--voice-fit-scale)));
  --voice-avatar-size: clamp(60px, calc(var(--voice-tile-width, 320px) * 0.255 * var(--voice-fit-scale)), calc(110px * var(--voice-fit-scale)));
  --voice-name-size: clamp(13px, calc(var(--voice-tile-width, 320px) * 0.05), 19px);
  --voice-badge-size: clamp(10px, calc(var(--voice-tile-width, 320px) * 0.036), 13px);
  --voice-control-width: clamp(132px, calc(var(--voice-tile-width, 320px) * 0.74), calc(220px * var(--voice-fit-scale)));
  position: relative;
  width: var(--voice-tile-width, 320px);
  max-width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--voice-card-gap);
  padding: var(--voice-card-top-padding) var(--voice-card-side-padding) var(--voice-card-bottom-padding);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}

.voice-card.has-video {
  display: block;
  padding: 0;
  background: #000;
}

.voice-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000;
}

.voice-card:fullscreen,
.voice-card:-webkit-full-screen,
.tile:fullscreen,
.tile:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  border: none;
  background: #000;
}

.voice-card:fullscreen .voice-video,
.voice-card:-webkit-full-screen .voice-video,
.tile:fullscreen video,
.tile:-webkit-full-screen video,
.voice-video:fullscreen,
.voice-video:-webkit-full-screen,
.tile video:fullscreen,
.tile video:-webkit-full-screen {
  width: 100% !important;
  height: 100% !important;
  left: 0 !important;
  top: 0 !important;
  object-fit: contain !important;
  background: #000;
}

.voice-avatar {
  width: min(32%, calc(var(--voice-avatar-size) * 0.88));
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: clamp(12px, calc(var(--voice-avatar-size) * 0.16), 18px);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: clamp(20px, calc(var(--voice-avatar-size) * 0.305), 35px);
  font-weight: 600;
}

.voice-content {
  width: min(100%, calc(var(--voice-tile-width, 320px) - (var(--voice-card-side-padding) * 2)));
  display: grid;
  justify-items: center;
  gap: clamp(4px, calc(var(--voice-tile-width, 320px) * 0.02 * var(--voice-fit-scale)), calc(8px * var(--voice-fit-scale)));
}

.voice-card.has-video .voice-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  justify-items: start;
  gap: 4px;
  padding: clamp(18px, calc(var(--voice-tile-width, 320px) * 0.08), 28px) 12px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.72) 100%);
}

.voice-name {
  display: -webkit-box;
  width: min(100%, calc(var(--voice-tile-width, 320px) * 0.88));
  color: var(--text);
  font-size: var(--voice-name-size);
  font-weight: 600;
  line-height: 1.18;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-height: calc((2 * 1.18em) + 0.22em);
  padding-bottom: 0.24em;
  text-rendering: optimizeLegibility;
}

.voice-card.has-video .voice-name {
  width: 100%;
  text-align: left;
  text-wrap: pretty;
}

.voice-badge {
  display: block;
  color: var(--text2);
  font-size: var(--voice-badge-size);
  font-weight: 500;
  line-height: 1.28;
  padding-bottom: 0.14em;
}

.voice-badge.muted {
  color: var(--red);
}

.voice-meter {
  width: min(var(--voice-control-width), 88%);
  height: clamp(2px, calc(3px * var(--voice-fit-scale)), 3px);
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface2);
}

.voice-level {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--green), var(--accent2));
  transition: width 120ms linear;
}

.voice-volume {
  width: min(var(--voice-control-width), 88%);
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, calc(8px * var(--voice-fit-scale)), 8px);
}

.voice-volume-icon {
  display: inline-flex;
  align-items: center;
  color: var(--text2);
}

.voice-volume-icon svg {
  width: clamp(12px, calc(14px * var(--voice-fit-scale)), 14px);
  height: clamp(12px, calc(14px * var(--voice-fit-scale)), 14px);
}

.voice-volume-slider,
.slider-row input[type="range"] {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
}

.voice-volume-slider::-webkit-slider-thumb,
.slider-row input[type="range"]::-webkit-slider-thumb,
.participant-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: clamp(10px, calc(12px * var(--voice-fit-scale)), 12px);
  height: clamp(10px, calc(12px * var(--voice-fit-scale)), 12px);
  border-radius: 50%;
  background: var(--accent2);
  cursor: pointer;
}

.voice-card.can-fullscreen,
.tile.can-fullscreen {
  cursor: zoom-in;
}

.stage-panel {
  position: absolute;
  inset: 0;
  padding: 0;
  overflow: hidden;
}

.stage-grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-panel[data-count="1"] .stage-grid {
  grid-template-columns: minmax(0, 1fr);
}

.stage-panel[data-count="2"] .stage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-panel[data-count="3"] .stage-grid,
.stage-panel[data-count="4"] .stage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-panel[data-count="5"] .stage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile {
  position: relative;
  min-height: 0;
  background: #000;
  overflow: hidden;
}

.tile.stage-tile {
  transition: opacity 100ms ease-out;
}

.stage-tile-removing {
  opacity: 0;
  pointer-events: none;
}

.tile video {
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  background: #000;
}

.stage-owner {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.stage-owner::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 2s infinite;
}

.stage-actions {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  gap: 6px;
}

.stage-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(8px);
}

.stage-icon-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.stage-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.stage-close {
  color: #fff;
}

.stage-empty {
  display: none !important;
}

.call-view.stage-focused .call-layout {
  grid-template-columns: 1fr;
}

.call-view.stage-focused .participants-panel,
.call-view.stage-focused .voice-grid {
  display: none;
}

.call-view.stage-focused .stage-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

.call-view.stage-focused .stage-grid .stage-tile {
  display: none;
}

.call-view.stage-focused .stage-grid .stage-tile.stage-focus-target {
  display: block;
}

.participants-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  isolation: isolate;
  contain: paint;
}

.participants-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.participant-count {
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 11px;
  font-weight: 500;
}

.participants-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.participants-list::-webkit-scrollbar {
  width: 4px;
}

.participants-list::-webkit-scrollbar-thumb {
  background: var(--surface3);
  border-radius: 2px;
}

.empty-state {
  margin: 8px;
  color: var(--text3);
  font-size: 12px;
  text-align: center;
  padding: 16px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 150ms ease-out;
}

.participant:hover {
  background: var(--surface);
}

.participant-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  position: relative;
}

.participant.speaking .participant-avatar {
  box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px var(--green);
}

.participant-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.participant-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.34;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 0.22em;
  text-rendering: optimizeLegibility;
}

.participant-status {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.28;
  padding-bottom: 0.14em;
}

.participant-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.participant-status-dot.live {
  background: var(--green);
}

.participant-status-dot.muted {
  background: var(--text3);
}

.participant-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.participant-badge.sharing {
  background: rgba(255, 107, 107, 0.15);
  color: var(--red);
}

.participant-badge.live {
  background: rgba(0, 184, 148, 0.15);
  color: var(--green);
}

.participant-badge.muted,
.participant-badge.connected {
  display: none;
}

.participant-volume {
  width: 100%;
  margin-top: 6px;
}

.participant-volume-slider {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
}

.control-dock {
  height: 68px;
  min-height: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 calc(16px + var(--participants-panel-width)) 0 16px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  isolation: isolate;
  contain: paint;
}

.call-view.stage-focused .control-dock {
  padding-right: 16px;
}

.dock-slot {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  text-align: center;
}

.dock-btn {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 160ms ease-out, transform 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.dock-btn svg {
  display: block;
  flex-shrink: 0;
}

.dock-icon-share {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.dock-btn.active {
  background: rgba(0, 184, 148, 0.12);
  border-color: rgba(0, 184, 148, 0.3);
  color: var(--green);
}

.dock-btn.is-off {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.25);
  color: var(--red);
}

.dock-btn.screen-on {
  background: rgba(108, 92, 231, 0.15);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--accent2);
}

.dock-label {
  display: block;
  width: 100%;
  margin-top: 0;
  color: var(--text3);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.hud-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.hint {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  max-width: min(90vw, 720px);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.92);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 25;
}

.hint:empty {
  display: none !important;
}

.invite-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(520px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  padding: 0;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.invite-dialog::backdrop {
  background: rgba(2, 4, 10, 0.72);
  backdrop-filter: blur(10px);
}

.invite-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(162, 155, 254, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(14, 15, 24, 0.98), rgba(10, 11, 18, 0.98));
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.58);
}

.invite-dialog-head,
.invite-dialog-brand,
.invite-dialog-actions {
  display: flex;
  align-items: center;
}

.invite-dialog-head {
  justify-content: space-between;
  gap: 12px;
}

.invite-dialog-brand {
  gap: 12px;
  min-width: 0;
}

.invite-dialog-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(124, 108, 240, 0.32);
}

.invite-dialog-copy {
  min-width: 0;
}

.invite-dialog-kicker {
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.invite-dialog-head h3 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.invite-dialog-subtitle {
  margin: 0;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.55;
}

.invite-dialog-field {
  gap: 8px;
}

.invite-dialog-field .field-input {
  height: 48px;
  padding-right: 14px;
}

.invite-dialog-actions {
  justify-content: flex-end;
  gap: 10px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(0, 0, 0, 0.48);
}

.drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  width: min(380px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--text);
  overflow-y: auto;
  box-shadow: 0 32px 60px rgba(0, 0, 0, 0.45);
}

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

.drawer-head h3,
.settings-group h4 {
  font-size: 16px;
  font-weight: 700;
}

.close-btn {
  flex-shrink: 0;
}

.settings-group,
.chat-messages,
.log {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
  padding: 12px;
}

.settings-group {
  display: grid;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 13px;
}

.toggle-row input {
  width: 16px;
  height: 16px;
}

.manual-gate-settings {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.manual-gate-title,
.slider-value {
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.log {
  min-height: 180px;
  color: var(--text);
  white-space: pre-wrap;
  overflow: auto;
}

.chat-drawer {
  gap: 10px;
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 220px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
}

.chat-empty {
  margin: auto 0;
  color: var(--text3);
  font-size: 12px;
  text-align: center;
}

.chat-message {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.chat-message.mine {
  border-color: rgba(108, 92, 231, 0.3);
  background: rgba(108, 92, 231, 0.12);
}

.chat-message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-author {
  font-size: 12px;
  font-weight: 800;
}

.chat-time {
  color: var(--text3);
  font-size: 11px;
  white-space: nowrap;
}

.chat-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mono {
  font-family: var(--mono);
}

.icon-btn:focus-visible,
.topbar-btn:focus-visible,
.preview-btn:focus-visible,
.dock-btn:focus-visible,
.stage-icon-btn:focus-visible,
.input:focus-visible,
.field-input:focus-visible,
.btn:focus-visible,
.join-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (max-width: 900px) {
  body,
  html {
    overflow-y: auto;
  }

  .app.in-call {
    min-height: var(--app-height);
  }

  .call-view {
    height: auto;
    min-height: max(0px, calc(var(--app-height) - var(--topbar-height)));
  }

  .call-layout {
    grid-template-columns: 1fr;
  }

  .participants-panel {
    border-top: 1px solid var(--border);
  }

  .control-dock {
    padding: 0 16px;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: nowrap;
    align-items: center;
    height: auto;
    min-height: 52px;
    gap: 6px;
    padding: 10px 12px;
  }

  .topbar-spacer {
    display: none;
  }

  .topbar-brand {
    min-width: 0;
    flex: 0 0 auto;
    font-size: 14px;
  }

  .topbar-room {
    order: 0;
    flex: 0 0 64px;
    max-width: 64px;
    min-width: 0;
    padding: 4px 7px;
    text-align: center;
  }

  .topbar-timer,
  .hud-timer {
    flex-shrink: 0;
    font-size: 12px;
  }

  .topbar-actions {
    margin-left: auto;
    flex-shrink: 0;
    gap: 6px;
  }

  .topbar-btn:not(.leave-btn),
  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .leave-btn {
    padding: 0 12px;
    font-size: 11px;
    white-space: nowrap;
  }

  .invite-dialog {
    width: calc(100vw - 16px);
  }

  .invite-dialog-card {
    gap: 14px;
    padding: 16px;
  }

  .invite-dialog-head h3 {
    font-size: 20px;
  }

  .prejoin-card {
    width: min(420px, calc(100vw - 16px));
  }

  .call-layout {
    min-height: 0;
  }

  .voice-grid {
    align-items: flex-start;
    justify-content: stretch;
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: none;
  }

  .voice-grid-inner {
    display: flex;
    flex-direction: column;
    align-content: stretch;
    justify-content: flex-start;
    gap: 12px;
  }

  .voice-card {
    width: 100%;
    aspect-ratio: auto;
    min-height: 220px;
  }

  .voice-card.has-video {
    aspect-ratio: 16 / 10;
    min-height: 0;
  }

  .call-view:not(.has-stage) .participants-panel {
    display: none;
  }

  .call-view.has-stage .participants-panel {
    position: relative;
    display: flex;
    max-height: min(36dvh, 280px);
  }

  .call-view.stage-focused .participants-panel {
    display: none;
  }

  .call-view.has-stage .participants-panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 22px;
    background: linear-gradient(180deg, rgba(18, 18, 26, 0) 0%, rgba(18, 18, 26, 1) 100%);
    pointer-events: none;
  }

  .call-view.has-stage .participants-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 12px 14px;
    background: var(--bg2);
  }

  .participants-list {
    display: grid;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 12px 16px;
  }

  .participant {
    min-width: 0;
    width: 100%;
    flex: none;
  }

  .control-dock {
    height: auto;
    min-height: 92px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    padding-bottom: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .dock-slot {
    flex: 1 1 0;
    gap: 7px;
    justify-content: flex-start;
  }

  .dock-label {
    font-size: 11px;
    line-height: 1.24;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 5px;
  }

  .topbar-brand {
    font-size: 13px;
  }

  .topbar-dot {
    width: 7px;
    height: 7px;
  }

  .topbar-room {
    display: block !important;
    flex-basis: 48px;
    max-width: 48px;
    padding: 4px 6px;
    font-size: 11px;
  }

  .topbar-timer,
  .hud-timer {
    font-size: 11px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-btn:not(.leave-btn),
  .icon-btn {
    width: 32px;
    height: 32px;
  }

  .leave-btn {
    padding: 0 8px;
    font-size: 11px;
  }

  .invite-dialog-card {
    padding: 14px;
  }

  .invite-dialog-brand {
    align-items: flex-start;
  }

  .invite-dialog-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .invite-dialog-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
