/* ════════════════════════════════════════════════
   RoomVerse — Design System
   ════════════════════════════════════════════════ */

:root {
  --bg-deep:    #060f22;
  --bg-card:    rgba(14, 25, 56, 0.72);
  --bg-input:   #0a1530;
  --bg-hover:   rgba(83, 200, 255, 0.06);
  --panel:      #0f1c39;
  --panel-soft: #172751;
  --text:       #edf2ff;
  --text-secondary: #8ea4cf;
  --muted:      #627ba3;
  --line:       rgba(74, 112, 175, 0.22);
  --accent:     #53c8ff;
  --accent-2:   #4ef8c7;
  --accent-strong: #ffd37a;
  --good:       #41ff9f;
  --warn:       #f6c95a;
  --bad:        #ff6887;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.18);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.28);
  --shadow-lg:  0 20px 60px rgba(0,0,0,0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ─── Shared field styles ─── */
.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.93rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(83, 200, 255, 0.15);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

textarea { min-height: 88px; resize: vertical; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238ea4cf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select option {
  background: #0c1a3a;
  color: var(--text);
}

.feedback {
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin-top: 8px;
  color: var(--bad);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 18px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active:not(:disabled) { transform: translateY(0); }

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

.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131f;
  border: none;
  font-weight: 700;
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(83, 200, 255, 0.35);
  filter: brightness(1.06);
}

.btn--secondary {
  background: var(--panel-soft);
  border-color: var(--line);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn--text {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 12px;
}

.btn--text:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
}

.btn--record {
  background: transparent;
  border: 1px solid var(--bad);
  color: var(--text);
}

.btn--record:hover:not(:disabled) {
  background: rgba(255, 104, 135, 0.08);
}

.btn--record.is-recording {
  background: rgba(255, 104, 135, 0.15);
  border-color: var(--bad);
  animation: pulse-record 1.5s infinite;
}

@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 104, 135, 0.3); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 104, 135, 0); }
}


/* ════════════════════════════════════════════════
   UI LANGUAGE SELECTOR
   ════════════════════════════════════════════════ */

.lang-select {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 30px 6px 10px;
  cursor: pointer;
  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 1l4 4 4-4' stroke='%238ea4cf' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all var(--transition);
}

.lang-select:hover {
  border-color: var(--accent);
}

.lang-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(83, 200, 255, 0.15);
}

.lang-select--sm {
  padding: 4px 26px 4px 8px;
  font-size: 0.78rem;
}


/* ════════════════════════════════════════════════
   LOGIN SCREEN
   ════════════════════════════════════════════════ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(83, 200, 255, 0.08), transparent),
    radial-gradient(ellipse 50% 60% at 80% 100%, rgba(78, 248, 199, 0.06), transparent),
    linear-gradient(170deg, #0a1a3a 0%, var(--bg-deep) 50%, #030911 100%);
}

.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.5;
}

.login-glow--1 {
  width: 500px;
  height: 500px;
  top: -120px;
  left: -80px;
  background: rgba(83, 200, 255, 0.12);
}

.login-glow--2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -60px;
  background: rgba(78, 248, 199, 0.1);
}

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #06131f;
  box-shadow: 0 8px 32px rgba(83, 200, 255, 0.3);
}

.login-brand h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131f;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(83, 200, 255, 0.4);
  filter: brightness(1.05);
}

.btn-login:active { transform: translateY(0); }

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

.login-error {
  font-size: 0.85rem;
  color: var(--bad);
  min-height: 1.2rem;
  text-align: center;
}

.login-lang-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.login-lang-row svg {
  flex-shrink: 0;
}


/* ════════════════════════════════════════════════
   APP HEADER
   ════════════════════════════════════════════════ */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: rgba(6, 15, 34, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #06131f;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.room-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(83, 200, 255, 0.08);
  border: 1px solid rgba(83, 200, 255, 0.15);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

.room-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.room-badge-dot.active {
  background: var(--good);
  box-shadow: 0 0 8px rgba(65, 255, 159, 0.5);
}

/* ─── User menu / dropdown ─── */
.user-menu { position: relative; }

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.user-trigger:hover {
  background: var(--bg-hover);
  border-color: var(--line);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131f;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.user-trigger-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.chevron-icon {
  color: var(--muted);
  transition: transform var(--transition);
}

.user-menu.open .chevron-icon {
  transform: rotate(180deg);
}

.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: rgba(15, 28, 57, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: dropdown-in 0.18s ease-out;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.dropdown-item:hover { background: var(--bg-hover); }

.dropdown-item svg { color: var(--text-secondary); flex-shrink: 0; }

.dropdown-item--danger { color: var(--bad); }
.dropdown-item--danger svg { color: var(--bad); }
.dropdown-item--danger:hover { background: rgba(255, 104, 135, 0.08); }

.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}


/* ════════════════════════════════════════════════
   MAIN / ROOM
   ════════════════════════════════════════════════ */

.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.room-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.room-top { padding: 28px 28px 0; }

.room-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.room-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.room-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 6px;
  line-height: 1.5;
}

/* Status chip */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(98, 123, 163, 0.12);
  border: 1px solid rgba(98, 123, 163, 0.2);
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.status-chip.good { background: rgba(65,255,159,0.1); border-color: rgba(65,255,159,0.25); color: var(--good); }
.status-chip.good .status-dot { background: var(--good); box-shadow: 0 0 8px rgba(65,255,159,0.6); animation: pulse-dot 2s infinite; }
.status-chip.warn { background: rgba(246,201,90,0.1); border-color: rgba(246,201,90,0.25); color: var(--warn); }
.status-chip.warn .status-dot { background: var(--warn); }
.status-chip.bad { background: rgba(255,104,135,0.1); border-color: rgba(255,104,135,0.25); color: var(--bad); }
.status-chip.bad .status-dot { background: var(--bad); }
.status-chip.neutral { color: var(--muted); }
.status-chip.neutral .status-dot { background: var(--muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* Room controls */
.room-controls {
  padding: 20px 28px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.controls-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Transcript panel */
.transcript-panel { border-top: 1px solid var(--line); }

.transcript-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.12);
}

.transcript-log {
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 0;
}

.transcript-log::-webkit-scrollbar { width: 6px; }
.transcript-log::-webkit-scrollbar-track { background: transparent; }
.transcript-log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

/* Transcript empty state */
.transcript-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 28px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.transcript-empty.hidden { display: none !important; }

/* Transcript rows */
.line {
  padding: 12px 28px;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(74, 112, 175, 0.1);
  transition: background var(--transition);
  animation: row-in 0.3s ease-out;
}

.line:hover { background: rgba(83, 200, 255, 0.03); }
.line:last-child { border-bottom: 0; }
.line.err  { color: var(--bad); }
.line.ok   { color: var(--good); }
.line.system { color: var(--accent-strong); }

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

/* ─── Chat message bubbles ─── */
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 28px;
  border-bottom: 1px solid rgba(74, 112, 175, 0.08);
  animation: row-in 0.3s ease-out;
}

.chat-msg--self {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131f;
}

.chat-msg--self .chat-avatar {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.chat-bubble {
  flex: 1;
  min-width: 0;
  background: rgba(83, 200, 255, 0.06);
  border: 1px solid rgba(83, 200, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  max-width: 85%;
}

.chat-msg--self .chat-bubble {
  background: rgba(78, 248, 199, 0.06);
  border-color: rgba(78, 248, 199, 0.12);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
}

.chat-msg--self .chat-name {
  color: var(--accent-2);
}

.chat-time {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
}

.chat-translated {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 4px;
}

.chat-original {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  opacity: 0.75;
}

.chat-original-label {
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

/* ─── Chat replay button ─── */
.chat-replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  border: 1px solid rgba(83, 200, 255, 0.2);
  border-radius: 999px;
  background: rgba(83, 200, 255, 0.06);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-replay-btn:hover {
  background: rgba(83, 200, 255, 0.15);
}
.chat-replay-btn svg { flex-shrink: 0; }

/* ─── Chat timing badges (in bubbles) ─── */
.chat-timings {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(74, 112, 175, 0.1);
}

.chat-timing {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.chat-timing--stt {
  background: rgba(83, 200, 255, 0.08);
  color: var(--accent);
}

.chat-timing--translate {
  background: rgba(78, 248, 199, 0.08);
  color: var(--accent-2);
}

.chat-timing--tts {
  background: rgba(255, 211, 122, 0.08);
  color: var(--accent-strong);
}

.chat-timing--total {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-weight: 800;
}

/* Legacy transcript (keep for backwards compat) */
.transcript {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(74, 112, 175, 0.1);
  animation: row-in 0.3s ease-out;
}

.transcript:hover { background: rgba(83, 200, 255, 0.03); }

.transcript strong {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.transcript div { font-size: 0.9rem; line-height: 1.55; }

.muted { color: var(--text-secondary); }


/* ─── Voice activity indicator ─── */
.voice-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 28px;
  background: rgba(83, 200, 255, 0.04);
  border-top: 1px solid rgba(83, 200, 255, 0.08);
  transition: all 0.3s ease;
}

.voice-activity.hidden { display: none !important; }

.voice-activity.speaking {
  background: rgba(78, 248, 199, 0.08);
  border-top-color: rgba(78, 248, 199, 0.15);
}

.voice-activity-icon {
  color: var(--muted);
  display: flex;
  transition: color 0.3s;
}

.voice-activity.speaking .voice-activity-icon {
  color: var(--accent-2);
  animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.15); }
}

.voice-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
}

.voice-bars span {
  width: 3px;
  min-height: 3px;
  background: var(--muted);
  border-radius: 2px;
  transition: height 0.1s ease, background 0.3s;
}

.voice-activity.speaking .voice-bars span {
  background: var(--accent-2);
}

.voice-activity-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.voice-activity.speaking .voice-activity-label {
  color: var(--accent-2);
}


/* ════════════════════════════════════════════════
   SIMULATION MODE
   ════════════════════════════════════════════════ */

.sim-panel {
  border-top: 1px solid var(--line);
  padding: 0;
}

.sim-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  gap: 12px;
}

.sim-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.sim-toggle-label input[type="checkbox"] {
  display: none;
}

.sim-toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  transition: all var(--transition);
  flex-shrink: 0;
}

.sim-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: all var(--transition);
}

.sim-toggle-label input:checked + .sim-toggle-switch {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.sim-toggle-label input:checked + .sim-toggle-switch::after {
  left: 20px;
  background: #06131f;
}

.sim-toggle-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.sim-body {
  padding: 0 28px 20px;
  animation: sim-in 0.25s ease-out;
}

@keyframes sim-in {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 600px; }
}

.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-lang-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.sim-lang-row .field { flex: 1; }

.sim-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  padding-bottom: 10px;
  flex-shrink: 0;
}

.sim-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Sim results ─── */
.sim-results {
  margin-top: 16px;
  animation: sim-in 0.25s ease-out;
}

.sim-result-card {
  background: rgba(83, 200, 255, 0.04);
  border: 1px solid rgba(83, 200, 255, 0.15);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sim-result-section {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(83, 200, 255, 0.08);
}

.sim-result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.sim-result-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.sim-result-text--translated {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.sim-audio-row {
  padding: 10px 18px;
  border-bottom: 1px solid rgba(83, 200, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sim-play-btn {
  padding: 8px 16px;
  font-size: 0.84rem;
}

.sim-play-btn svg {
  color: var(--accent-2);
}

/* ─── Sim timings ─── */
.sim-timings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
}

.sim-timing-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.sim-timing-badge--stt {
  background: rgba(83, 200, 255, 0.1);
  border: 1px solid rgba(83, 200, 255, 0.2);
  color: var(--accent);
}

.sim-timing-badge--translate {
  background: rgba(78, 248, 199, 0.1);
  border: 1px solid rgba(78, 248, 199, 0.2);
  color: var(--accent-2);
}

.sim-timing-badge--tts {
  background: rgba(255, 211, 122, 0.1);
  border: 1px solid rgba(255, 211, 122, 0.2);
  color: var(--accent-strong);
}

.sim-timing-badge--total {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* ─── Sim processing spinner ─── */
.sim-processing {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  animation: sim-in 0.2s ease-out;
}

.sim-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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


/* ─── Mute button active state ─── */
.btn.is-muted {
  border-color: var(--bad);
  color: var(--bad);
  background: rgba(255, 104, 135, 0.08);
}

.btn.is-muted svg { stroke: var(--bad); }


/* ─── Participants bar ─── */
.participants-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 28px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--line);
}

.participants-bar.hidden { display: none !important; }

.participants-bar svg { flex-shrink: 0; color: var(--text-secondary); }


/* ─── Live language bar ─── */
.live-lang-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 28px 12px;
  background: rgba(0, 0, 0, 0.06);
  border-top: 1px solid var(--line);
}
.live-lang-bar.hidden { display: none !important; }

.live-lang-fields {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex: 1;
}

.live-lang-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.live-lang-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 600;
}
.live-lang-field select {
  font-size: 0.85rem;
  padding: 6px 10px;
}

.live-lang-arrow {
  color: var(--text-secondary);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.btn--small {
  padding: 6px 14px;
  font-size: 0.8rem;
}


/* ════════════════════════════════════════════════
   SETTINGS MODAL
   ════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 6, 16, 0.7);
  backdrop-filter: blur(6px);
  animation: overlay-in 0.2s ease-out;
  padding: 24px;
}

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

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(12, 22, 50, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(24px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.25s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-head h2 { font-size: 1.25rem; font-weight: 700; }

.modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 24px 0;
  border-bottom: 1px solid var(--line);
}

.modal-tab {
  padding: 10px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.modal-tab:hover { color: var(--text); }

.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.modal-body { padding: 20px 24px 28px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 20px;
}

/* FIX: settings grid alignment - both fields align properly side by side */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Only add vertical spacing for stacked fields OUTSIDE of grids */
.modal-body > .field + .field,
.tab-content > .field + .field { margin-top: 14px; }

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}


/* ─── Clone sentence display ─── */
.clone-sentence {
  margin-top: 16px;
  border: 1px solid rgba(83, 200, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(83, 200, 255, 0.04);
  overflow: hidden;
}

.clone-sentence-label {
  padding: 10px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(83, 200, 255, 0.06);
  border-bottom: 1px solid rgba(83, 200, 255, 0.12);
}

.clone-sentence-text {
  padding: 16px;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text);
  user-select: text;
}


/* ─── Clone cards ─── */
.clone-grid {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.clone-card {
  border: 1px solid var(--line);
  background: rgba(15, 37, 72, 0.5);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.clone-card h4 { font-size: 0.92rem; font-weight: 700; color: var(--accent); }
.clone-card p  { color: var(--text-secondary); font-size: 0.84rem; margin: 2px 0 0; }

.clone-card .btn {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 0.8rem;
}


/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */

@media (max-width: 680px) {
  .header { padding: 0 16px; }
  .header-right { gap: 8px; }
  .header-lang { display: none; }
  .room-badge { display: none; }
  .user-trigger-name { display: none; }

  .main { padding: 16px 12px 32px; }
  .room-top { padding: 20px 18px 0; }
  .room-controls { padding: 16px 18px; }
  .controls-grid { grid-template-columns: 1fr; }
  .controls-actions { justify-content: stretch; }
  .controls-actions .btn { flex: 1; }

  .transcript-header { padding: 12px 18px; }
  .line { padding: 10px 18px; }
  .transcript { grid-template-columns: 1fr; padding: 12px 18px; }
  .chat-msg { padding: 10px 18px; }
  .chat-bubble { max-width: 95%; }
  .voice-activity { padding: 8px 18px; }
  .participants-bar { padding: 8px 18px; }
  .sim-toggle-row { padding: 12px 18px; flex-direction: column; align-items: flex-start; }
  .sim-body { padding: 0 18px 16px; }
  .sim-lang-row { flex-direction: column; }
  .sim-arrow { transform: rotate(90deg); padding: 0; }

  .modal-overlay { padding: 12px; }
  .modal-body { padding: 16px 18px 24px; }
  .modal-head { padding: 18px 18px 0; }
  .modal-tabs { padding: 12px 18px 0; }
  .settings-grid { grid-template-columns: 1fr; }

  .login-card { padding: 24px 20px; }
  .room-title-row { flex-direction: column; align-items: flex-start; }
}
