:root {
  --bg: #0a0a0f;
  --bg-elev: #16161f;
  --bg-input: #1f1f2b;
  --text: #f0f0f5;
  --text-dim: #8a8a99;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.18);
  --success: #4ade80;
  --danger: #ef4444;
  --border: #2a2a36;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  height: var(--app-h, 100%);
}

input, button, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

button {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.screen.active {
  display: flex;
}

/* ---- Home ---- */
.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 60px 24px calc(20px + var(--safe-bottom));
  gap: 28px;
}

.brand {
  text-align: center;
  margin-top: 40px;
}

.brand h1 {
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #7c5cff 0%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}

.brand-sub {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.home-footer span {
  color: #ef4444;
  opacity: 0.85;
}

/* ---- Buttons ---- */
.btn {
  height: 52px;
  min-height: 52px;
  border-radius: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.08s;
  user-select: none;
  -webkit-user-select: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px -8px rgba(124, 92, 255, 0.6);
}

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-large {
  height: 56px;
  font-size: 17px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
  opacity: 0.88;
}

.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text);
  border-radius: 10px;
  line-height: 1;
}

.btn-icon:active {
  background: var(--bg-elev);
}

/* ---- App header ---- */
.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-header h2 {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.app-header .spacer {
  width: 44px;
  display: inline-block;
}

/* ---- Create / Join pane ---- */
.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 40px 24px calc(40px + var(--safe-bottom));
  gap: 20px;
  overflow-y: auto;
}

.hint {
  color: var(--text-dim);
  font-size: 15px;
  text-align: center;
}

.invite-code {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color: var(--accent);
  padding: 28px 8px;
  background: var(--accent-soft);
  border-radius: 18px;
  text-align: center;
  user-select: all;
  -webkit-user-select: all;
}

.row {
  display: flex;
  gap: 12px;
}

.row .btn {
  flex: 1;
}

.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 14px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Join input ---- */
#input-code {
  width: 100%;
  height: 76px;
  padding: 0 16px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.18em;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  text-transform: uppercase;
}

#input-code:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}

.status-text {
  color: var(--danger);
  font-size: 14px;
  text-align: center;
  min-height: 18px;
}

/* ---- Room ---- */
.room-header {
  justify-content: space-between;
  padding: 0 12px;
}

.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  min-width: 80px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.2s, box-shadow 0.2s;
}

.dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.dot.disconnected {
  background: var(--danger);
}

.room-code {
  font-size: 13px;
  color: var(--text-dim);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.1em;
  flex: 1;
  text-align: center;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
  word-wrap: break-word;
  word-break: break-word;
  animation: pop-in 0.18s ease-out;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.mine {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg.theirs {
  align-self: flex-start;
  background: var(--bg-elev);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  padding: 2px 8px;
  max-width: 90%;
  text-align: center;
}

.msg-form {
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#msg-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-size: 16px;
  min-width: 0;
}

#msg-input:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-send {
  height: 44px;
  min-width: 64px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 22px;
  font-weight: 600;
  font-size: 15px;
  transition: opacity 0.15s;
}

.btn-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-send:active:not(:disabled) {
  opacity: 0.85;
}

/* ---- Mic button ---- */
.mic-btn {
  position: relative;
}

.mic-btn:disabled {
  opacity: 0.35;
}

.mic-btn.muted {
  color: var(--danger);
}

.mic-slash {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 2.5px;
  background: var(--danger);
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(-45deg);
  box-shadow: 0 0 0 2px var(--bg);
}

.mic-btn.muted .mic-slash {
  display: block;
}

/* ---- Voice activity ---- */
.voice-activity {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(22, 22, 31, 0.92);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--success);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.voice-activity.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.voice-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  transform: scale(calc(0.7 + var(--level, 0) * 1.8));
  box-shadow: 0 0 calc(2px + var(--level, 0) * 14px) rgba(74, 222, 128, 0.7);
  transition: transform 0.05s linear;
}

/* ---- Audio unlock overlay ---- */
.audio-unlock {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 14px 24px;
  border-radius: 16px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  display: none;
  min-height: 44px;
}

.audio-unlock.show {
  display: inline-flex;
  align-items: center;
}

.audio-unlock:active {
  opacity: 0.88;
}

/* ---- Mode toggle ---- */
.btn-mode {
  height: 44px;
  min-width: 56px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-mode.danmu {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-mode:active {
  opacity: 0.85;
}

/* ---- Danmu ---- */
.danmu-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.danmu-item {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 0;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
    -1px  0   0 #000,
     1px  0   0 #000,
     0   -1px 0 #000,
     0    1px 0 #000;
  will-change: transform;
  animation: danmu-fly 8s linear forwards;
}

@keyframes danmu-fly {
  from { transform: translate3d(100vw, 0, 0); }
  to   { transform: translate3d(-100%, 0, 0); }
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(30, 30, 40, 0.96);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 22px;
  font-size: 14px;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Install hint (home) ---- */
.install-hint {
  position: relative;
  margin-top: 24px;
  padding: 14px 36px 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
}

.install-title {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.install-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 18px;
  border-radius: 8px;
}

.kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

/* ---- Quality bars ---- */
.quality-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  margin-left: 2px;
}

.quality-bars[hidden] { display: none; }

.quality-bars .bar {
  width: 3px;
  background: var(--border);
  border-radius: 1px;
}

.quality-bars .bar:nth-child(1) { height: 4px; }
.quality-bars .bar:nth-child(2) { height: 8px; }
.quality-bars .bar:nth-child(3) { height: 12px; }

.quality-bars.lvl-weak .bar.lit { background: var(--danger); }
.quality-bars.lvl-medium .bar.lit { background: #fbbf24; }
.quality-bars.lvl-strong .bar.lit { background: var(--success); }

.quality-ms {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.quality-ms:empty { display: none; }

/* ---- Progress banner ---- */
.progress-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(124,92,255,0.18), rgba(192,132,252,0.08));
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}

.progress-banner[hidden] { display: none; }

.progress-icon {
  font-size: 14px;
}

.progress-banner > span:not(.progress-icon) {
  flex: 1;
}

.progress-dismiss {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-dim);
  border-radius: 8px;
  flex-shrink: 0;
}

/* ---- Panels (emoji + sync) ---- */
.panel {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  animation: panel-slide 0.2s ease-out;
}

.panel[hidden] { display: none; }

.panel::-webkit-scrollbar { display: none; }

@keyframes panel-slide {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.emoji-item {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 10px;
  transition: transform 0.08s;
}

.emoji-glyph {
  font-size: 28px;
  line-height: 1;
}

.emoji-label {
  font-size: 10px;
  line-height: 1;
}

.emoji-item:active {
  transform: scale(0.92);
  background: var(--accent-soft);
}

.sync-item {
  flex: 1;
  min-width: 0;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  transition: transform 0.08s, background 0.15s;
}

.sync-glyph {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.sync-label {
  font-size: 11px;
  color: var(--text-dim);
}

.sync-item:active {
  transform: scale(0.97);
  background: var(--accent-soft);
}

/* ---- Toolbar (above msg-form) ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.toolbar-spacer { flex: 1; }

.btn-tool {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-dim);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.btn-tool[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-tool:active {
  background: var(--bg-elev);
}

/* ---- Reactions ---- */
.reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}

.reaction-item {
  position: absolute;
  bottom: 96px;
  left: 50%;
  margin-left: -32px;
  width: 64px;
  height: 64px;
  font-size: 64px;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  will-change: transform, opacity;
  animation: reaction-float 2.5s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

@keyframes reaction-float {
  0%   { transform: translate(var(--x, 0), 0) scale(0.8); opacity: 1; }
  20%  { transform: translate(var(--x, 0), -10vh) scale(1.4); opacity: 1; }
  60%  { transform: translate(var(--x, 0), -38vh) scale(1.2); opacity: 0.9; }
  100% { transform: translate(var(--x, 0), -60vh) scale(1.2); opacity: 0; }
}

/* ---- Reconnect banner ---- */
.reconnect-banner {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 64px);
  transform: translateX(-50%);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--danger);
  border-radius: 14px;
  color: var(--danger);
  font-size: 13px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reconnect-banner[hidden] { display: none; }

.reconnect-banner .spinner {
  border-color: rgba(239, 68, 68, 0.3);
  border-top-color: var(--danger);
}

/* ---- Countdown overlay ---- */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.18s ease-out;
}

.countdown-overlay[hidden] { display: none; }

.countdown-num {
  font-size: 220px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  font-feature-settings: "tnum";
  text-shadow: 0 12px 60px rgba(124, 92, 255, 0.7);
  animation: countdown-pop 1s ease-out;
}

.countdown-hint {
  margin-top: 32px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  letter-spacing: 0.1em;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes countdown-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  20%  { transform: scale(1.2); opacity: 1; }
  80%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.15s ease-out;
}

.modal[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 320px;
  padding: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modal-pop 0.18s ease-out;
}

@keyframes modal-pop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-text {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  margin-bottom: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-error {
  min-height: 16px;
  margin-bottom: 10px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions .btn {
  flex: 1;
  height: 48px;
}

/* ---- Video container ---- */
.video-container {
  position: relative;
  width: 100%;
  background: #000;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  max-height: 56vh;
  overflow: hidden;
}

.video-container[hidden] { display: none; }

#local-video {
  width: 100%;
  max-height: 56vh;
  display: block;
  background: #000;
  outline: none;
}

.video-peer-status {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 11px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0.02em;
}

.video-peer-status[hidden] { display: none; }

.video-peer-status.synced {
  background: rgba(74, 222, 128, 0.25);
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.video-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-close:active {
  background: rgba(0, 0, 0, 0.8);
}

/* ---- Volume panel ---- */
.volume-panel {
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 14px;
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 32px;
}

.vol-label {
  width: 64px;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}

.vol-slider {
  flex: 1;
  height: 32px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.vol-slider:focus { outline: none; }

.vol-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  border: none;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: -9px;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.45);
  cursor: pointer;
  border: none;
}

.vol-slider::-moz-range-track {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
}

.vol-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.45);
  cursor: pointer;
}

.vol-num {
  width: 44px;
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.vol-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

/* ---- Remote screen share ---- */
.screen-container {
  position: relative;
  width: 100%;
  background: #000;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  max-height: 60vh;
  overflow: hidden;
}

.screen-container[hidden] { display: none; }

#remote-screen {
  width: 100%;
  max-height: 60vh;
  display: block;
  background: #000;
  outline: none;
}

.screen-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 11px;
  background: rgba(124, 92, 255, 0.85);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  letter-spacing: 0.02em;
}

/* When user is sharing their own screen, show a small banner */
.sharing-badge {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  padding: 6px 14px;
  background: rgba(124, 92, 255, 0.92);
  border-radius: 14px;
  color: #fff;
  font-size: 13px;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.4);
}

.sharing-badge.show { display: inline-flex; }

.sharing-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Button loading state ---- */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
}

.btn-secondary.loading::after {
  border-color: var(--border);
  border-top-color: var(--text);
}
