:root {
  --bg-page: #06497a;
  --bg-page-alt: #042b4d;
  --bg-page-deep: #02203a;
  --topbar-bg: #03233f;
  --topbar-border: #0b3a61;
  --topbar-text: #eaf2ff;
  --chip-bg: #0b385f;
  --chip-border: #1d507e;
  --chip-text: #d8eaff;
  --icon-btn-bg: #0a355a;
  --icon-btn-border: #1b4b78;
  --icon-btn-text: #e4efff;
  --icon-btn-hover: #134771;
  --danger: #e43f45;
  --danger-hover: #c9363b;
  --panel-shadow: 0 18px 42px rgba(1, 9, 18, 0.38);
  --room-tile-bg: rgba(33, 45, 61, 0.9);
  --room-tile-border: rgba(22, 32, 46, 0.82);
  --room-tile-text: #d7e8ff;
  --room-tile-muted: #a3b8d6;
  --stage-bg: rgba(7, 18, 34, 0.92);
  --stage-border: rgba(31, 70, 115, 0.95);
  --drawer-bg: #f7fbff;
  --drawer-text: #1d2a42;
  --drawer-border: #d6e4fa;
  --focus-ring: 0 0 0 3px rgba(74, 142, 235, 0.34);
}

[data-theme="light"] {
  --bg-page: #d7e2f2;
  --bg-page-alt: #c6d8f0;
  --bg-page-deep: #b8cce8;
  --topbar-bg: rgba(255, 255, 255, 0.92);
  --topbar-border: #c7d9f5;
  --topbar-text: #172744;
  --chip-bg: #eef5ff;
  --chip-border: #ccdcf6;
  --chip-text: #253f66;
  --icon-btn-bg: #edf5ff;
  --icon-btn-border: #cbdcf8;
  --icon-btn-text: #29466e;
  --icon-btn-hover: #d7e9ff;
  --room-tile-bg: #e6edf7;
  --room-tile-border: #c8d6eb;
  --room-tile-text: #223652;
  --room-tile-muted: #4c6488;
  --stage-bg: #f7fbff;
  --stage-border: #cadef9;
  --drawer-bg: #ffffff;
  --drawer-text: #1d2a42;
  --drawer-border: #d6e4fa;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--topbar-text);
  background: radial-gradient(1200px 700px at 50% 50%, var(--bg-page), var(--bg-page-deep));
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(540px 340px at 2% 5%, rgba(19, 117, 214, 0.22), transparent 72%),
    radial-gradient(620px 340px at 98% 4%, rgba(5, 87, 166, 0.18), transparent 70%);
}

.app {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  padding: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.prejoin-view[hidden],
.call-view[hidden] {
  display: none !important;
}

.topbar {
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--topbar-border);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
}

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

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

.brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #ecf5ff;
  background: linear-gradient(180deg, #3b7ff2, #1f58ad);
}

.brand h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.brand p {
  margin: 2px 0 0;
  font-size: 10px;
  color: color-mix(in srgb, var(--topbar-text) 75%, #7fa3d0 25%);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status {
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.hud-btn[hidden],
.hud-timer[hidden] {
  display: none;
}

.icon-btn {
  cursor: pointer;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  border: 1px solid var(--icon-btn-border);
  background: var(--icon-btn-bg);
  color: var(--icon-btn-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

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

#chatButton {
  position: relative;
  overflow: visible;
}

.hud-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #d93a46;
  color: #fff7f8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.hud-badge[hidden] {
  display: none !important;
}

#themeButton,
#langButton {
  min-width: 64px;
}

.app.in-call #themeLabel,
.app.in-call #langLabel {
  display: none;
}

.app.in-call #themeButton,
.app.in-call #langButton,
.app.in-call .hud-btn {
  min-width: 28px;
  width: 28px;
  padding: 0;
}

.lang-wrap {
  position: relative;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  width: 136px;
  z-index: 24;
  border-radius: 8px;
  border: 1px solid var(--icon-btn-border);
  background: var(--topbar-bg);
  box-shadow: 0 12px 28px rgba(2, 10, 22, 0.42);
  padding: 4px;
  display: grid;
  gap: 3px;
}

.lang-menu[hidden] {
  display: none;
}

.lang-menu button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--topbar-text);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
}

.lang-menu button:hover {
  background: rgba(78, 132, 212, 0.24);
}

.hud-timer {
  height: 28px;
  min-width: 52px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.exit-btn {
  cursor: pointer;
  height: 28px;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--danger) 78%, #ffffff 22%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 88%, #ff8d90 12%), var(--danger));
  color: #fff7f8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0 10px;
  transition: background 0.2s ease;
}

.exit-btn:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger-hover) 86%, #ff8d90 14%), var(--danger-hover));
}

.exit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.prejoin-view {
  min-height: 0;
  width: 100%;
  max-width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
}

.prejoin-card {
  width: min(460px, 100%);
  max-width: 100%;
  margin-inline: auto;
  border-radius: 6px;
  border: 1px solid #cfd9e8;
  background: #f5f7fb;
  color: #1d2839;
  box-shadow: var(--panel-shadow);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.prejoin-card,
.prejoin-form,
.field {
  min-width: 0;
}

.prejoin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 4px;
}

.prejoin-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.prejoin-brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 52% 50%, #ffd45f 0 30%, #8f2fc4 31% 60%, #8f2fc4 61%);
  box-shadow: 0 0 0 2px rgba(143, 47, 196, 0.24);
}

.prejoin-brand-text {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #26364e;
  text-transform: lowercase;
}

.prejoin-brand-text span {
  color: #f1a617;
}

.prejoin-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  min-height: 250px;
  border: 1px solid #c8d5e8;
  background: linear-gradient(130deg, #1f405f, #1f6f93);
}

.prejoin-camera {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: cover;
  display: block;
  background: #111f31;
}

.prejoin-camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #f0f6ff;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.prejoin-camera-fallback[hidden] {
  display: none !important;
}

.prejoin-media-controls {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 10px;
  z-index: 5;
}

.prejoin-media-btn {
  cursor: pointer;
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(216, 226, 238, 0.95);
  background: rgba(255, 255, 255, 0.95);
  color: #25324a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.2s ease;
}

.prejoin-media-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.prejoin-media-btn:not(.is-on) {
  background: rgba(19, 32, 49, 0.92);
  border-color: rgba(82, 120, 178, 0.8);
  color: #d6e6ff;
}

.prejoin-media-btn:not(.is-on)::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: #ff6f79;
  transform: rotate(-45deg);
}

.prejoin-media-btn:hover {
  transform: translateY(1px);
}

.prejoin-form {
  display: grid;
  gap: 8px;
}

.prejoin-form input[type="hidden"] {
  display: none;
}

.field {
  display: grid;
  gap: 4px;
}

.label {
  font-size: 10px;
  font-weight: 700;
  color: #6f829d;
  letter-spacing: 0.02em;
}

.input {
  width: 100%;
  height: 40px;
  border-radius: 4px;
  border: 1px solid #c7d4e8;
  background: #fbfdff;
  color: #1f2d42;
  padding: 0 12px;
  font-size: 14px;
}

select.input {
  cursor: pointer;
}

.prejoin-actions {
  display: flex;
  justify-content: flex-end;
}

.btn {
  cursor: pointer;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #c7d4e8;
  background: #edf4ff;
  color: #1c2e49;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.12s ease, background 0.2s ease;
}

.btn:hover {
  background: #dcecff;
}

.btn:active,
.dock-btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.dock-btn:disabled,
.stage-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  border-color: #2c7de3;
  background: linear-gradient(180deg, #3091ff, #216fd5);
  color: #f4f9ff;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #2b85ee, #1d64bf);
}

.prejoin-join {
  min-width: 88px;
  height: 32px;
  font-size: 12px;
}

.call-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.call-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.call-stage-wrap {
  min-height: 0;
  display: none;
  border-radius: 8px;
  border: 1px solid var(--stage-border);
  background: var(--stage-bg);
  overflow: hidden;
}

.call-view.has-stage .call-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 270px);
}

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

.voice-grid {
  --voice-cols: 1;
  --voice-rows: 1;
  --voice-gap: 8px;
  --voice-tile-width: min(68vw, 1600px);
  min-height: 0;
  border-radius: 8px;
  border: 1px solid rgba(16, 56, 92, 0.9);
  background: rgba(7, 67, 112, 0.68);
  padding: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.voice-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--room-tile-border);
  background: var(--room-tile-bg);
  width: var(--voice-tile-width);
  max-width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.voice-card.has-video {
  display: block;
  height: auto;
  padding: 0;
  background: #050f1d;
}

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

.voice-card.speaking {
  border-color: #5ea4ff;
  box-shadow: 0 0 0 2px rgba(94, 164, 255, 0.25);
}

.voice-avatar {
  width: min(34%, 180px);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 1px solid rgba(48, 68, 95, 0.92);
  background: radial-gradient(circle at 48% 35%, #2f3f56 0 32%, #172233 66%);
  color: #e7f0ff;
  display: grid;
  place-items: center;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 800;
  text-transform: uppercase;
}

.voice-content {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
}

.voice-card:not(.has-video) .voice-content {
  padding: 0 12px 8px;
}

.voice-card.has-video .voice-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  justify-items: start;
  gap: 4px;
  padding: 28px 12px 10px;
  background: linear-gradient(180deg, rgba(2, 6, 12, 0) 0%, rgba(2, 6, 12, 0.72) 58%, rgba(2, 6, 12, 0.9) 100%);
}

.voice-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--room-tile-text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-card.has-video .voice-name {
  color: #eef4ff;
}

.voice-badge {
  font-size: 11px;
  color: var(--room-tile-muted);
  font-weight: 700;
}

.voice-card.has-video .voice-badge {
  color: #d2e2ff;
}

.voice-badge.muted {
  color: #ffafb8;
}

.voice-meter {
  width: min(220px, 88%);
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(157, 184, 221, 0.25);
}

.voice-card.has-video .voice-meter {
  width: min(200px, 72%);
}

.voice-volume {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: min(220px, 88%);
}

.voice-card.has-video .voice-volume {
  width: min(200px, 72%);
}

.voice-volume-icon {
  font-size: 12px;
  opacity: 0.88;
}

.voice-volume-slider {
  width: 100%;
  accent-color: #41a2ff;
}

.voice-level {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4f95ff, #2cd8b2, #4f95ff);
  background-size: 28px 100%;
  transition: width 0.12s linear;
}

.call-view.has-stage .voice-grid {
  background: transparent;
  border: none;
  padding: 0;
  overflow: auto;
  display: block;
}

.call-view.has-stage .voice-grid-inner {
  width: 100%;
  min-height: 0;
  grid-template-columns: repeat(var(--voice-cols), minmax(0, 1fr));
  align-content: start;
  justify-content: stretch;
}

.call-view.has-stage .voice-card {
  min-height: 0;
  padding: 8px;
  width: 100%;
  background: rgba(38, 51, 68, 0.86);
  border-color: rgba(46, 67, 95, 0.92);
}

.call-view.has-stage .voice-card.has-video {
  height: auto;
  padding: 0;
}

.call-view.has-stage .voice-card.has-video .voice-content {
  padding: 24px 9px 8px;
}

.call-view.has-stage .voice-card.has-video .voice-meter {
  width: min(140px, 82%);
}

.call-view.has-stage .voice-card.has-video .voice-volume {
  width: min(140px, 82%);
}

.call-view.has-stage .voice-avatar {
  width: min(34%, 76px);
  height: auto;
  font-size: 24px;
}

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

.stage-panel {
  width: 100%;
  height: 100%;
  padding: 8px;
  display: grid;
}

.stage-panel[hidden] {
  display: none;
}

.stage-grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 8px;
  align-content: center;
  justify-content: center;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

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

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

.call-view.stage-focused .stage-panel {
  padding: 0;
}

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

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

.call-view.stage-focused .stage-grid .stage-tile.stage-focus-target {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
}

.call-view.stage-focused .stage-grid .stage-tile.stage-focus-target video {
  object-fit: contain;
}

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

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

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

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

.tile {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(58, 84, 118, 0.94);
  background: #060f1c;
  aspect-ratio: 16 / 9;
  max-height: 58vh;
}

.stage-panel[data-count="1"] .tile {
  max-height: 74vh;
}

.stage-panel[data-count="4"] .tile,
.stage-panel[data-count="5"] .tile {
  max-height: 34vh;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050d18;
}

.stage-tile.mobile-stage-inactive {
  cursor: pointer;
  border-color: rgba(109, 136, 174, 0.75);
}

.stage-tile.mobile-stage-inactive video {
  opacity: 0.22;
}

.stage-owner {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 92px);
  border-radius: 999px;
  border: 1px solid rgba(138, 170, 226, 0.78);
  background: rgba(7, 16, 30, 0.72);
  color: #eef6ff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.stage-icon-btn {
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(191, 214, 252, 0.7);
  background: rgba(6, 18, 34, 0.68);
  color: #dce9ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.stage-icon-btn:hover {
  background: rgba(22, 46, 78, 0.82);
}

.stage-close {
  border-color: rgba(238, 138, 148, 0.72);
  color: #ffd2d6;
}

.stage-close:hover {
  background: rgba(130, 32, 49, 0.75);
}

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

.participants-panel {
  display: none;
}

.participants-list {
  display: grid;
  gap: 8px;
}

.participant {
  border-radius: 8px;
  border: 1px solid rgba(67, 98, 143, 0.92);
  background: rgba(17, 38, 62, 0.9);
  padding: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.participant-name {
  font-size: 13px;
  font-weight: 700;
}

.participant-meta {
  font-size: 11px;
  color: #9cb6da;
}

.participant-badge {
  border-radius: 999px;
  border: 1px solid rgba(82, 113, 160, 0.88);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
}

.participant-badge.muted {
  color: #ffbac1;
  border-color: rgba(226, 103, 118, 0.7);
}

.control-dock {
  margin: 0 auto;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(25, 69, 112, 0.95);
  background: rgba(2, 69, 116, 0.93);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app.in-call .control-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 26;
}

.app.in-call .call-view {
  padding-bottom: 70px;
}

.dock-btn {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(185, 205, 236, 0.82);
  background: #e9f1fb;
  color: #1a3151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease;
}

.dock-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.dock-btn:hover {
  background: #dce8f8;
}

.dock-btn.is-off:not(:disabled) {
  border-color: rgba(74, 96, 127, 0.9);
  background: rgba(13, 27, 45, 0.9);
  color: #89a3c6;
}

.dock-btn.is-off::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: #ff6672;
  transform: translate(-50%, -50%) rotate(-45deg);
  box-shadow: 0 0 6px rgba(255, 93, 112, 0.35);
}

.dock-danger:not(:disabled) {
  border-color: rgba(221, 84, 95, 0.9);
  background: linear-gradient(180deg, #ef5a60, #d33f45);
  color: #fff3f4;
}

.hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 25;
  min-width: 220px;
  max-width: min(90vw, 720px);
  border-radius: 999px;
  border: 1px solid rgba(130, 160, 204, 0.75);
  background: rgba(7, 20, 38, 0.84);
  color: #d6e8ff;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
}

.hint:empty {
  display: none;
}

.app:not(.in-call) .hint {
  display: none !important;
}

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

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(390px, 95vw);
  z-index: 40;
  background: var(--drawer-bg);
  color: var(--drawer-text);
  border-left: 1px solid var(--drawer-border);
  box-shadow: -18px 0 38px rgba(2, 9, 18, 0.46);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.drawer[hidden] {
  display: none;
}

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

.drawer-head h3 {
  margin: 0;
  font-size: 16px;
}

.close-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
}

.settings-group {
  border-radius: 10px;
  border: 1px solid var(--drawer-border);
  background: #f3f7ff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.settings-group h4 {
  margin: 0;
  font-size: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: 13px;
}

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

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

.manual-gate-settings[hidden] {
  display: none !important;
}

.chat-drawer {
  gap: 10px;
}

.chat-messages {
  flex: 1 1 auto;
  min-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--drawer-border);
  background: #f3f7ff;
  padding: 10px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 8px;
}

[data-theme="dark"] .chat-messages {
  background: #0b1b33;
  border-color: #2a486d;
}

.chat-empty {
  margin: auto 0;
  text-align: center;
  font-size: 12px;
  color: #627a9e;
}

[data-theme="dark"] .chat-empty {
  color: #9db3d1;
}

.chat-message {
  border-radius: 8px;
  border: 1px solid #d2def1;
  background: #ffffff;
  padding: 8px;
  display: grid;
  gap: 4px;
}

[data-theme="dark"] .chat-message {
  border-color: #2c4768;
  background: #112842;
}

.chat-message.mine {
  border-color: #b9dbff;
  background: #eef6ff;
}

[data-theme="dark"] .chat-message.mine {
  border-color: #1f5f9f;
  background: #0f3557;
}

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

.chat-author {
  font-size: 12px;
  font-weight: 800;
  color: #2a486d;
}

[data-theme="dark"] .chat-author {
  color: #c8ddff;
}

.chat-time {
  font-size: 11px;
  color: #6f88aa;
  white-space: nowrap;
}

[data-theme="dark"] .chat-time {
  color: #9ab4d6;
}

.chat-text {
  font-size: 13px;
  line-height: 1.35;
  color: #1b2b43;
  white-space: pre-wrap;
  word-break: break-word;
}

[data-theme="dark"] .chat-text {
  color: #e6f0ff;
}

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

.chat-form .btn {
  min-width: 104px;
}

.manual-gate-title {
  font-size: 12px;
  font-weight: 700;
  color: #4f6583;
}

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

.slider-row input[type="range"] {
  width: 100%;
  accent-color: #2d8cff;
}

.slider-value {
  min-width: 74px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #334f73;
}

.log {
  margin: 0;
  border-radius: 10px;
  border: 1px solid #c7dbf7;
  background: #081a33;
  color: #d6e7ff;
  padding: 10px;
  min-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

@media (max-width: 1200px) {
  .call-view.has-stage .call-layout {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 240px);
  }

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

@media (max-width: 880px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app {
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .call-view.has-stage .call-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 1fr) auto;
  }

  .call-view.has-stage .voice-grid {
    max-height: 220px;
  }

  .stage-grid,
  .stage-panel[data-count="1"] .stage-grid,
  .stage-panel[data-count="2"] .stage-grid,
  .stage-panel[data-count="3"] .stage-grid,
  .stage-panel[data-count="4"] .stage-grid,
  .stage-panel[data-count="5"] .stage-grid {
    grid-template-columns: 1fr;
  }

  .tile,
  .stage-panel[data-count="1"] .tile {
    max-height: 46vh;
  }

  .stage-actions {
    right: 6px;
    top: 6px;
    gap: 8px;
  }

  .stage-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 17px;
  }
}

@media (max-width: 680px) {
  .app {
    padding: 6px;
    gap: 6px;
  }

  .prejoin-view {
    padding: 10px;
  }

  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding-bottom: 6px;
  }

  .brand {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .prejoin-card {
    width: min(460px, 100%);
    max-width: 100%;
    padding: 8px;
  }

  .prejoin-preview,
  .prejoin-camera {
    min-height: 210px;
  }

  .prejoin-brand-text {
    font-size: 27px;
  }

  .control-dock {
    position: sticky;
    bottom: 8px;
  }
}

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