@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #060b14;
  --bg2: #0d1625;
  --bg3: #111c2e;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --accent: #00e5c8;
  --accent2: #7b61ff;
  --accent-glow: rgba(0,229,200,0.18);
  --text: #e8f0fe;
  --text-muted: #6b7f9e;
  --text-dim: #3d4f68;
  --danger: #ff5c5c;
  --success: #00e5a0;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --font: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* ─── Light theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #ffffff;
  --bg2: #f8f9fa;
  --bg3: #f1f3f5;
  --surface: rgba(0,0,0,0.03);
  --surface-hover: rgba(0,0,0,0.06);
  --border: rgba(0,0,0,0.1);
  --text: #1a1a2e;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --accent-glow: rgba(0,229,200,0.12);
}
[data-theme="light"] .bg-mesh {
  background:
    radial-gradient(ellipse 60% 50% at 10% 10%, rgba(0,229,200,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 90% 80%, rgba(109,40,217,0.05) 0%, transparent 70%);
}
[data-theme="light"] .room-header {
  background: rgba(255,255,255,0.9);
}
[data-theme="light"] .room-footer {
  background: rgba(255,255,255,0.9);
}
[data-theme="light"] .modal {
  background: var(--bg2);
}
[data-theme="light"] .modal-backdrop {
  background: rgba(255,255,255,0.7);
}
[data-theme="light"] .card {
  background: var(--bg);
}
[data-theme="light"] .field input,
[data-theme="light"] .field select {
  background: rgba(0,0,0,0.03);
}
[data-theme="light"] .field select option {
  background: #fff;
}
[data-theme="light"] .msg-avatar,
[data-theme="light"] .p-card-avatar-circle {
  color: #fff;
}
[data-theme="light"] .mic-btn {
  color: #fff;
}
[data-theme="light"] .btn-primary {
  color: #fff;
}
[data-theme="light"] .p-card {
  background: var(--bg3);
}
[data-theme="light"] .p-card-label {
  background: rgba(255,255,255,0.85);
  color: var(--text);
}
[data-theme="light"] .toast {
  background: var(--bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
[data-theme="light"] .conn-banner {
  background: rgba(255,92,92,0.06);
}
[data-theme="light"] .logo-name {
  background: linear-gradient(135deg, var(--accent) 0%, #1a1a2e 60%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
[data-theme="light"] .msg-wrap.own .msg-bubble {
  background: rgba(0,229,200,0.06);
}
[data-theme="light"] .ctrl-btn.danger {
  color: #fff;
}
[data-theme="light"] .screen-share-label {
  background: rgba(255,255,255,0.85);
  color: var(--text);
}
[data-theme="light"] .screen-share-close {
  background: rgba(255,92,92,0.08);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }
* { -webkit-tap-highlight-color: transparent; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }

/* ─── Background mesh ───────────────────────────────────────────────────────── */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 10% 10%, rgba(0,229,200,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 90% 80%, rgba(109,40,217,0.08) 0%, transparent 70%);
}

/* ─── Landing page ──────────────────────────────────────────────────────────── */
.landing {
  position: relative; z-index: 1;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 20px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  gap: 0;
}

.logo-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 40px;
  animation: fadeUp 0.6s ease both;
}
.logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 40px var(--accent-glow), 0 8px 32px rgba(0,0,0,0.4);
  position: relative;
}
.logo-icon::after {
  content: '';
  position: absolute; inset: -1px;
  border-radius: 21px;
  background: linear-gradient(135deg, rgba(0,229,200,0.3), rgba(109,40,217,0.3));
  z-index: -1; filter: blur(8px);
}
.logo-name {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, #fff 60%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-tagline {
  font-size: 13px; color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Card */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 28px 24px;
  width: 100%; max-width: 400px;
}

/* Form elements */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
}
.field input, .field select {
  height: 48px; padding: 0 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none; appearance: none;
  outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,200,0.12);
}
.field input::placeholder { color: var(--text-dim); }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7f9e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field select option { background: #0d1625; }

.btn {
  height: 52px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600;
  transition: all 0.2s; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: 0.2px; position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: white; opacity: 0; transition: opacity 0.15s;
}
.btn:active::after { opacity: 0.04; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00b8a2);
  color: #060b14;
  box-shadow: 0 4px 20px rgba(0,229,200,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(0,229,200,0.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.15); }
.btn-ghost { color: var(--text-muted); font-size: 13px; }
.btn-ghost:hover { color: var(--accent); }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); font-size: 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.lang-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.lang-btn {
  height: 52px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s; background: transparent;
  cursor: pointer;
}
.lang-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text); }
.lang-btn.active {
  border-color: var(--accent); color: var(--accent);
  background: rgba(0,229,200,0.08);
  box-shadow: 0 0 0 1px rgba(0,229,200,0.2) inset;
}
.lang-emoji { font-size: 20px; }

.error-msg {
  background: rgba(255,92,92,0.08); border: 1px solid rgba(255,92,92,0.2);
  color: #ff8080; border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 13px; display: none;
}
.error-msg.show { display: block; }

/* Sections */
.section { display: flex; flex-direction: column; gap: 16px; animation: fadeUp 0.5s ease both; }
.section.hidden { display: none; }

/* Step indicator */
.step-indicator {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
}
.step-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim); transition: all 0.3s;
}
.step-dot.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ─── Room page ─────────────────────────────────────────────────────────────── */
.room-layout {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100dvh;
}

/* Header */
.room-header {
  padding: 8px 16px;
  padding-top: calc(8px + var(--safe-top));
  display: flex; align-items: center; gap: 10px;
  background: rgba(6,11,20,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0; position: relative; z-index: 10;
}
.room-code-badge {
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 600;
  color: var(--accent); letter-spacing: 2px;
}
.room-count {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 20px;
}
.count-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 6px var(--success); animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.header-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  color: var(--text);
}
.icon-btn:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.15); }
.icon-btn:active { transform: scale(0.92); }

/* Room body */
.room-body {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* ─── Participants bar (video cards — small strip) ─────────────────────── */
.participants-bar {
  padding: 8px 12px;
  display: flex; gap: 6px; overflow-x: auto; flex-shrink: 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.participants-bar::-webkit-scrollbar { display: none; }

.p-card {
  position: relative; flex-shrink: 0;
  width: 60px; height: 80px;
  border-radius: 10px; overflow: hidden;
  background: var(--bg3); border: 1.5px solid var(--accent);
  transition: all 0.3s;
  animation: cardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  box-shadow: 0 0 8px rgba(0,229,200,0.1);
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.8) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.p-card.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0,229,200,0.4);
  animation: cardSpeak 1.5s ease-in-out infinite;
}
@keyframes cardSpeak {
  0%, 100% { box-shadow: 0 0 8px rgba(0,229,200,0.2); }
  50% { box-shadow: 0 0 18px rgba(0,229,200,0.5); }
}
.p-card video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1);
}
.p-card-avatar {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.p-card-avatar-circle {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #060b14;
}
.p-card-avatar-name {
  font-size: 9px; color: var(--text-muted);
  max-width: 54px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-card-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 1px 4px;
  background: rgba(6,11,20,0.7);
  font-size: 8px; color: var(--text); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Room main */
.room-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden;
}

/* Screen share */
.screen-share-container {
  display: none; flex-shrink: 0;
  position: relative;
  background: #000;
  border-bottom: 1px solid var(--border);
}
.screen-share-container.active { display: block; }
.screen-share-container video {
  width: 100%; max-height: 40vh;
  object-fit: contain; display: block;
}
.screen-share-label {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 10px;
  background: rgba(6,11,20,0.8);
  border-radius: 6px;
  font-size: 11px; color: var(--text);
  display: flex; align-items: center; gap: 5px;
}
.screen-share-label .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger); animation: pulse-dot 1.5s infinite;
}
.screen-share-close {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,92,92,0.1); border: 1px solid rgba(255,92,92,0.3);
  color: #ff8080; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.screen-share-close:hover { background: rgba(255,92,92,0.2); }

/* Chat area — full width */
.chat-area {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}

.system-msg {
  text-align: center; font-size: 12px; color: var(--text-dim);
  padding: 3px 0;
}

.msg-wrap {
  display: flex; gap: 8px; max-width: 88%;
  animation: msgIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-wrap.own { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #060b14;
  margin-top: 2px;
}

.msg-bubble-group { display: flex; flex-direction: column; gap: 3px; }
.msg-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-dim);
}
.msg-wrap.own .msg-meta { flex-direction: row-reverse; }
.msg-name { font-weight: 600; }

.msg-bubble {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 12px;
  position: relative;
}
.msg-wrap.own .msg-bubble {
  border-radius: 14px 4px 14px 14px;
  background: rgba(0,229,200,0.08);
  border-color: rgba(0,229,200,0.2);
}
.msg-original { font-size: 14px; line-height: 1.45; color: var(--text); }
.msg-translation {
  font-size: 13px; line-height: 1.45; color: var(--text-muted);
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border);
}
.msg-translation-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-dim); margin-bottom: 2px;
  display: flex; align-items: center; gap: 4px;
}

/* Live interpreter subtitle */
.live-subtitle {
  font-size: 13px; color: var(--text);
  padding: 6px 12px;
  background: rgba(123,97,255,0.08);
  border-left: 3px solid var(--accent2);
  border-radius: 0 8px 8px 0;
  animation: msgIn 0.2s ease both;
}
.live-subtitle.live-own {
  background: rgba(0,229,200,0.06);
  border-left-color: var(--accent);
  text-align: right;
  border-left: none;
  border-right: 3px solid var(--accent);
  border-radius: 8px 0 0 8px;
}

.msg-tone { font-size: 16px; vertical-align: middle; }
.msg-corrected-hint {
  font-size: 9px; color: var(--accent); font-style: italic;
  margin-top: 2px; opacity: 0.7;
}
.msg-pending {
  font-size: 11px; color: var(--text-dim); font-style: italic;
  margin-top: 4px; animation: pulse-dot 1.2s infinite;
}
.msg-error {
  font-size: 12px; color: var(--danger); font-style: italic;
  margin-top: 4px;
}

/* Typing indicators */
.typing-indicators {
  padding: 0 16px 4px; display: flex; flex-direction: column; gap: 3px; flex-shrink: 0;
  min-height: 0;
}
.typing-indicators:empty { display: none; }
.typing-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-muted);
  animation: fadeUp 0.2s ease;
}
.typing-dots { display: flex; gap: 3px; }
.typing-dots span {
  width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
  animation: typingDot 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* ─── Interim text ────────────────────────────────────────────────────────── */
.interim-text {
  font-size: 12px; color: var(--text-muted); font-style: italic;
  text-align: center; padding: 4px 16px 0;
  flex-shrink: 0;
}
.interim-text:empty { display: none; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.room-footer {
  padding: 8px 16px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: rgba(6,11,20,0.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

.footer-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}

/* Control buttons */
.ctrl-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.ctrl-btn:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.15); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.active {
  color: var(--accent); border-color: var(--accent); background: rgba(0,229,200,0.08);
  animation: ctrlGlow 2s ease-in-out infinite;
}
@keyframes ctrlGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,229,200,0); }
  50% { box-shadow: 0 0 12px 2px rgba(0,229,200,0.25); }
}
.ctrl-btn.off { color: var(--danger); border-color: rgba(255,92,92,0.3); background: rgba(255,92,92,0.08); }
.ctrl-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctrl-btn.danger:hover { background: #ff4040; }

/* SVG icon toggle */
.ctrl-btn .ctrl-svg.off-icon { display: none; }
.ctrl-btn .ctrl-svg.on-icon { display: block; }
.ctrl-btn.off .ctrl-svg.off-icon { display: block; }
.ctrl-btn.off .ctrl-svg.on-icon { display: none; }

/* STT Mic button — center, special */
.mic-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
}
.mic-ripple {
  position: absolute; top: 50%; left: 50%;
  width: 52px; height: 52px; border-radius: 50%;
  margin-top: -26px; margin-left: -26px;
  border: 2px solid var(--accent); opacity: 0;
  animation: none; pointer-events: none;
}
.mic-wrap.active .mic-ripple {
  animation: ripple 1.5s ease-out infinite;
}
.mic-wrap.active .mic-ripple:nth-child(2) { animation-delay: 0.5s; }
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

.mic-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00b8a2);
  border: none;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
  color: #060b14;
  box-shadow: 0 4px 20px rgba(0,229,200,0.25);
}
.mic-btn:hover { box-shadow: 0 6px 28px rgba(0,229,200,0.4); transform: scale(1.05); }
.mic-btn.active {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,200,0.3), 0 4px 20px rgba(0,229,200,0.25);
  transform: scale(1.08);
}

.mic-status {
  font-size: 10px; color: var(--text-dim); text-align: center;
  min-height: 14px;
}
.mic-status:empty { display: none; }
.mic-status.listening { color: var(--accent); font-weight: 500; }

/* Theme toggle */
.theme-toggle {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  color: var(--text);
}
.theme-toggle:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.15); }
.theme-toggle:active { transform: scale(0.92); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle:hover { border-color: rgba(0,0,0,0.2); }

/* Landing theme toggle — top-right */
.landing-theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 50;
}

/* ─── Desktop layout (≥768px) ────────────────────────────────────────────── */
@media (min-width: 768px) {
  .room-body { flex-direction: row; }

  .participants-bar {
    flex-direction: column;
    width: 100px; padding: 12px 8px;
    overflow-y: auto; overflow-x: hidden;
    border-bottom: none;
    border-right: 1px solid var(--border);
    gap: 8px; align-items: center;
  }
  .p-card { width: 80px; height: 100px; }
  .p-card-avatar-circle { width: 36px; height: 36px; font-size: 15px; }
  .p-card-avatar-name { font-size: 10px; max-width: 72px; }
  .p-card-label { font-size: 9px; }

  .room-main { flex: 1; }
  .chat-area { padding: 16px 24px; }
  .msg-wrap { max-width: 70%; }
  .footer-bar { gap: 12px; }
  .ctrl-btn { width: 44px; height: 44px; }
  .mic-btn { width: 56px; height: 56px; }
  .mic-ripple { width: 56px; height: 56px; margin-top: -28px; margin-left: -28px; }
  .screen-share-container video { max-height: 50vh; }
}

/* ─── Wide desktop (≥1200px) ─────────────────────────────────────────────── */
@media (min-width: 1200px) {
  .participants-bar { width: 140px; padding: 16px 12px; gap: 10px; }
  .p-card { width: 110px; height: 140px; border-radius: 12px; }
  .p-card-avatar-circle { width: 44px; height: 44px; font-size: 18px; }
  .p-card-avatar-name { font-size: 11px; max-width: 100px; }
  .p-card-label { font-size: 10px; padding: 2px 6px; }
  .chat-area { padding: 20px 32px; gap: 12px; }
  .msg-wrap { max-width: 60%; }
  .msg-original { font-size: 15px; }
  .msg-translation { font-size: 14px; }
  .footer-bar { gap: 14px; }
  .ctrl-btn { width: 46px; height: 46px; }
  .mic-btn { width: 58px; height: 58px; }
  .screen-share-container video { max-height: 60vh; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 18px;
  font-size: 13px; color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.out { animation: toastOut 0.2s ease both; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ─── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Connection state ─────────────────────────────────────────────────────── */
.conn-banner {
  position: fixed; top: var(--safe-top); left: 0; right: 0; z-index: 200;
  background: rgba(255,92,92,0.08); border-bottom: 1px solid rgba(255,92,92,0.2);
  padding: 8px 16px; text-align: center;
  font-size: 12px; color: #ff8080;
  display: none;
}
.conn-banner.show { display: block; }

/* ─── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 14px; color: var(--text-muted); }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(6,11,20,0.85);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: var(--safe-bottom);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-backdrop.show { opacity: 1; pointer-events: all; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 32px;
  transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex; flex-direction: column; gap: 16px;
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal-handle {
  width: 36px; height: 4px; background: var(--border); border-radius: 2px;
  margin: 0 auto -8px;
}
.modal-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
}

/* ─── No speech API warning ─────────────────────────────────────────────────── */
.browser-warn {
  background: rgba(255,185,0,0.08); border: 1px solid rgba(255,185,0,0.2);
  color: #ffd566; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12px; line-height: 1.5;
  display: none;
}
.browser-warn.show { display: block; }
