/* ═══════════════════════════════════════════════════════
   HCB Meeting PWA — Mobile-first CSS
   ═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --accent: #58a6ff;
  --accent-bg: rgba(88,166,255,0.1);
  --green: #3fb950;
  --green-bg: rgba(63,185,80,0.12);
  --yellow: #d29922;
  --red: #f85149;
  --red-bg: rgba(248,81,73,0.12);
  --text: #e6edf3;
  --text2: #8b949e;
  --text3: #484f58;
  --font-size: 18px;
  --radius: 10px;
  --radius-lg: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
}

/* ─── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform 0.08s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-secondary {
  background: var(--surface2);
  border-color: var(--border);
}
.btn-danger-sm {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
  font-weight: 600;
}

/* ─── Toolbar ──────────────────────────────────────── */
#toolbar {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-top);
  max-width: 100vw;
  overflow: hidden;
}

.toolbar-main {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.toolbar-main::-webkit-scrollbar { display: none; }

.toolbar-secondary {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 6px;
  border-top: 1px solid rgba(255,255,255,0.04);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.toolbar-secondary::-webkit-scrollbar { display: none; }
.toolbar-secondary .btn { flex-shrink: 0; }

.toolbar-room {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(88,166,255,0.03);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.toolbar-room::-webkit-scrollbar { display: none; }
.toolbar-room .btn { flex-shrink: 0; }

.toolbar-spacer { flex-shrink: 0; width: 4px; }

/* Status dot */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.gray { background: var(--text3); }
.status-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* Start / Stop */
.btn-start {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  height: 34px;
  border-radius: 8px;
}
.btn-stop {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  height: 34px;
  border-radius: 8px;
}
.btn-save {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  height: 34px;
  border-radius: 8px;
  animation: pulse-save 1.5s ease-in-out infinite;
}
@keyframes pulse-save {
  0%, 100% { box-shadow: 0 0 0 0 rgba(88,166,255,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(88,166,255,0); }
}

/* TTS group */
.tts-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.btn-tts-off {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-tts-off.tts-on {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}
.tts-lang-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  padding: 3px 8px;
  background: var(--accent-bg);
  border-radius: 6px;
  white-space: nowrap;
}

/* TTS language picker popup */
.tts-picker {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.tts-picker-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: 90%;
  max-width: 320px;
  animation: sheet-up .2s ease-out;
}
.tts-picker-box h3 {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
}
.tts-picker-box p {
  font-size: 12px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 14px;
}
.tts-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.tts-pick-btn {
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-width: 70px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.tts-pick-btn:active { transform: scale(.96); }
.tts-pick-btn.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}
.tts-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.tts-picker-actions .btn { flex: 1; height: 42px; font-size: 14px; }

/* Waveform */
#waveform {
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  height: 24px;
  width: 64px;
}

/* Language group */
.lang-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  max-width: fit-content;
}
.lang-group select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 6px;
  height: 28px;
  min-width: 42px;
  max-width: 50px;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.btn-swap {
  font-size: 14px;
  padding: 2px 6px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: 6px;
  flex-shrink: 0;
}
.btn-swap:hover { background: rgba(255,255,255,0.06); }

/* Delay */
.delay-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text2);
  flex-shrink: 0;
}
.delay-ctrl input[type="range"] {
  width: 60px;
  accent-color: var(--accent);
  height: 4px;
}

/* Tool buttons (row 2) */
.btn-tool {
  font-size: 12px;
  padding: 4px 8px;
  height: 30px;
  min-width: fit-content;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text2);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-tool:hover { background: rgba(255,255,255,0.06); }

/* User badge */
.user-badge {
  font-size: 12px;
  color: var(--green);
  padding: 3px 8px;
  background: var(--green-bg);
  border-radius: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  flex-shrink: 1;
  min-width: 0;
}

/* Logout */
.btn-logout {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 12px;
  padding: 4px 10px;
  height: 28px;
  border-radius: 6px;
  font-weight: 600;
}

/* Room action buttons in toolbar */
.btn-room-create {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-room-join {
  background: var(--surface2);
  border-color: var(--border);
  font-size: 12px;
  padding: 4px 10px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ─── Room section ─────────────────────────────────── */
#room-screen { 
  flex-shrink: 0; 
  padding: 0 12px;
  max-width: 100%;
  overflow: hidden;
}

/* My meetings search */
.meeting-search-wrap {
  padding: 6px 0;
}
.meeting-search-bar {
  position: relative;
}
.meeting-search-bar input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
.meeting-search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}
.meeting-search-bar input::placeholder { color: var(--text3); }
.meeting-results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.meeting-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.03);
  cursor: pointer;
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.meeting-result-item:last-child { border-bottom: none; }
.meeting-result-item:active { background: var(--surface2); }
.mr-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mr-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-meta { font-size: 11px; color: var(--text2); }
.mr-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.mr-badge-active { background: var(--green-bg); color: var(--green); }
.mr-badge-ended { background: var(--surface2); color: var(--text3); }

/* Join form */
#join-form { 
  padding: 6px 0;
  max-width: 100%;
  overflow: hidden;
}
.join-form-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 0 4px;
}
#join-form input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  text-align: center;
  letter-spacing: 6px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
#join-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-bg);
}
#join-form .btn { 
  height: 48px; 
  padding: 0 18px; 
  font-size: 15px;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Room info bar */
#room-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 4px 0;
}
.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.room-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.room-label {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.room-code {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.room-count {
  font-size: 12px;
  color: var(--text2);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
}
.room-details {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 8px;
}
.qr-area { flex-shrink: 0; }
.qr-area canvas, .qr-area img {
  max-width: 90px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface2);
  font-size: 11px;
  color: var(--text2);
  border: 1px solid var(--border);
}
.participant-chip .chip-icon { font-size: 12px; }

/* ─── Transcript area ──────────────────────────────── */
#transcript-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Mobile: card layout */
.seg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 6px;
  border-left: 3px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.seg-card.seg-speaking {
  border-left-color: var(--green);
  background: var(--green-bg);
}
.seg-card .seg-meta {
  margin-bottom: 4px;
}
.seg-card .seg-original {
  font-size: var(--font-size);
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}
.seg-card .seg-translated {
  font-size: calc(var(--font-size) - 1px);
  line-height: 1.55;
  color: var(--accent);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  word-break: break-word;
}
.lang-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}
.seg-provisional {
  padding: 10px 14px;
  font-size: var(--font-size);
  line-height: 1.5;
  color: var(--text3);
  font-style: italic;
}

/* Desktop: two-column */
.transcript-col {
  overflow-y: auto;
  padding: 10px;
  font-size: var(--font-size);
  line-height: 1.5;
}
.seg-row {
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  transition: background 0.2s;
  border-left: 3px solid transparent;
}
.seg-row.provisional { opacity: 0.4; }
.seg-row.seg-speaking {
  background: var(--green-bg);
  border-left-color: var(--green);
}
.seg-text { word-break: break-word; }

/* SVG Line Mapping */
.line-map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}
.line-map-svg line {
  stroke: rgba(88,166,255,0.25);
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
}
.line-map-svg line.line-active {
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 3px var(--green));
}

/* ─── Listener view ────────────────────────────────── */
#listener-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.listener-row {
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: var(--font-size);
  line-height: 1.6;
}
.listener-timestamp { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.listener-text { word-break: break-word; }

/* ─── Settings panel ───────────────────────────────── */
#settings-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.settings-sheet {
  position: relative;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  animation: sheet-up 0.25s ease-out;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.settings-handle {
  width: 36px;
  height: 4px;
  background: var(--text3);
  border-radius: 2px;
  margin: 10px auto 0;
}
.settings-sheet h3 {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  padding: 12px 0 8px;
}
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text2);
}
.settings-body input[type="password"],
.settings-body input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.settings-body input:focus { outline: none; border-color: var(--accent); }
.settings-body select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-appearance: none;
}
.settings-body input[type="range"] { accent-color: var(--accent); }
.key-input-wrap { display: flex; gap: 4px; }
.key-input-wrap input { flex: 1; }
.settings-close {
  margin: 8px 20px;
  margin-bottom: calc(12px + var(--safe-bottom));
  height: 48px;
  font-size: 16px;
  border-radius: var(--radius);
}

/* ─── Toast ────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: 90%;
  max-width: 340px;
}
.toast {
  background: var(--surface2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: toast-in 0.2s ease, toast-out 0.25s ease 2.5s forwards;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ─── QR Scanner ───────────────────────────────────── */
#qr-scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
.qr-scanner-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding: 20px;
}
.qr-scanner-container h3 { font-size: 18px; font-weight: 600; }
#qr-video {
  width: min(260px, 75vw);
  height: min(260px, 75vw);
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--green);
}
.qr-hint { font-size: 13px; color: var(--text2); }

/* ─── Auth screen ──────────────────────────────────── */
#auth-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.auth-container {
  background: var(--surface);
  padding: 32px 24px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid var(--border);
}
.auth-logo { text-align: center; }
.auth-logo-img {
  width: 64px; height: 64px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  margin-bottom: 10px;
}
.auth-logo h1 { font-size: 20px; font-weight: 700; }
.auth-subtitle { font-size: 13px; color: var(--text2); margin-top: 4px; }
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text2);
}
.auth-form input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-submit {
  margin-top: 4px;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
}
.auth-error { color: var(--red); font-size: 13px; text-align: center; min-height: 18px; }

/* ─── Utilities ────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
  .delay-ctrl { display: none; }
  #waveform { width: 48px; }
  .room-details { flex-direction: column; }
  .qr-area canvas, .qr-area img { max-width: 80px; }
  
  /* Compact toolbar buttons on mobile */
  .btn-start, .btn-stop, .btn-save {
    font-size: 12px;
    padding: 5px 10px;
    height: 30px;
  }
  
  .tts-group {
    gap: 3px;
  }
  
  .btn-tts-off {
    font-size: 11px;
    padding: 5px 8px;
    height: 28px;
  }
  
  .tts-lang-label {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .lang-group select {
    font-size: 12px;
    padding: 3px 4px;
    min-width: 38px;
    max-width: 45px;
  }
  
  .btn-swap {
    font-size: 13px;
    padding: 2px 4px;
    min-width: 24px;
    max-width: 24px;
  }
  
  .user-badge {
    font-size: 11px;
    padding: 2px 6px;
    max-width: 80px;
  }
  
  .btn-logout {
    font-size: 11px;
    padding: 3px 8px;
    height: 26px;
  }
  
  .btn-room-create, .btn-room-join {
    font-size: 11px;
    padding: 3px 8px;
    height: 26px;
  }
  
  .btn-tool {
    font-size: 11px;
    padding: 3px 6px;
    height: 28px;
  }
  
  /* Ensure toolbar rows don't wrap */
  .toolbar-main, .toolbar-secondary, .toolbar-room {
    flex-wrap: nowrap;
    padding-left: 8px;
    padding-right: 8px;
  }
  
  /* Join form mobile adjustments */
  .join-form-inner {
    gap: 6px;
    padding: 0 2px;
  }
  
  #join-form input {
    font-size: 18px;
    letter-spacing: 4px;
    padding: 6px 8px;
    height: 44px;
  }
  
  #join-form .btn {
    height: 44px;
    padding: 0 12px;
    font-size: 14px;
  }
}

@media (max-width: 400px) {
  /* Extra small screens - even more compact */
  .status-dot {
    width: 6px;
    height: 6px;
  }
  
  #waveform {
    width: 40px;
    height: 20px;
  }
  
  .btn-start, .btn-stop, .btn-save {
    font-size: 11px;
    padding: 4px 8px;
    height: 28px;
  }
  
  .lang-group select {
    font-size: 11px;
    min-width: 36px;
    max-width: 40px;
  }
  
  .toolbar-main, .toolbar-secondary, .toolbar-room {
    gap: 4px;
    padding-left: 6px;
    padding-right: 6px;
  }
  
  /* Join form extra small screens */
  .join-form-inner {
    gap: 4px;
    padding: 0;
  }
  
  #join-form input {
    font-size: 16px;
    letter-spacing: 3px;
    padding: 4px 6px;
    height: 40px;
  }
  
  #join-form .btn {
    height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  #transcript-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    padding: 0;
    background: var(--border);
  }
  #col-original, #col-translated {
    display: block !important;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
  }
  .seg-card, .seg-provisional { display: none; }
  #transcript-area { position: relative; }
}

@media (max-width: 767px) {
  #col-original, #col-translated { display: none !important; }
}
