:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #14b8a6;
  --accent: #0369a1;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --warning: #b45309;
  --bg-outer: #0b1929;
  --bg-app: #f1f5f9;
  --surface: #ffffff;
  --surface-soft: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #cbd5e1;
  --bubble-me: #0f766e;
  --bubble-other: #ffffff;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}

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

html,
body {
  height: 100%;
  height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #134e4a 0%, #0f172a 55%, #020617 100%);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible accessible */
:focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
}

.top-bar :focus-visible,
.btn-primary:focus-visible,
.ptt-button:focus-visible,
.msg-row.me :focus-visible,
.msg-row.sos :focus-visible {
  outline: 3px solid #fde047;
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.screen {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: min(880px, calc(100dvh - 24px));
  background: var(--bg-app);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==================== ÉCRAN CONNEXION ==================== */
.join-screen {
  background: linear-gradient(160deg, #f0fdfa 0%, #f8fafc 45%, #e0f2fe 100%);
  padding: 24px 20px;
  overflow-y: auto;
}

.join-card {
  width: 100%;
  margin: auto 0;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.brand-logo {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.25);
  flex-shrink: 0;
}

.brand-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 2px;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 118, 110, 0.14);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.avatar-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.field-group label,
.field-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}

.field-group input,
.field-group select {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-size: 1rem;
  background: #f8fafc;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}

.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
}

.field-group input.input-invalid {
  border-color: var(--danger-dark);
  background: #fef2f2;
}

.field-error {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--danger-dark);
  line-height: 1.3;
}

.field-warning {
  font-size: 0.8rem;
  font-weight: 600;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.35;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: #f0fdfa;
  color: var(--primary-dark);
  border: 1px solid #5eead4;
  border-radius: 999px;
  min-height: 40px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}

.chip:hover {
  background: #ccfbf1;
  transform: translateY(-1px);
}

.chip.active {
  background: #ccfbf1;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.avatar-btn {
  aspect-ratio: 1;
  min-width: 40px;
  min-height: 40px;
  font-size: 1.35rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.avatar-btn.selected {
  border-color: var(--primary);
  background: #ccfbf1;
  transform: scale(1.06);
}

.room-input-row {
  display: flex;
  gap: 8px;
}

.room-input-row input {
  min-width: 0;
  flex: 1;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Boutons communs */
.btn-primary,
.btn-secondary,
.btn-danger {
  border: none;
  border-radius: 14px;
  min-height: 44px;
  padding: 11px 16px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.28);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(0.98);
}

.btn-large {
  min-height: 50px;
  padding: 14px 20px;
  font-size: 1.05rem;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-danger {
  background: #fee2e2;
  color: var(--danger-dark);
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-confirming {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 2px solid #f59e0b !important;
}

/* ==================== ÉCRAN PRINCIPAL ==================== */
.top-bar {
  background: linear-gradient(135deg, #0f766e 0%, #0369a1 100%);
  color: #ffffff;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  z-index: 10;
}

.top-bar-left {
  min-width: 0;
  flex: 1;
}

button.room-badge {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 12px;
  transition: background 0.15s;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.room-badge-text {
  min-width: 0;
  flex: 1;
}

button.room-badge:hover {
  background: rgba(255, 255, 255, 0.14);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
  flex-shrink: 0;
}

.status-dot.online {
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.32);
}

.status-dot.offline {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.32);
}

.room-title {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.02em;
  min-width: 0;
}

#display-room {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-icon {
  font-size: 0.85rem;
  opacity: 0.95;
  flex-shrink: 0;
}

.connection-label {
  font-size: 0.74rem;
  opacity: 0.95;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-pill {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(15, 23, 42, 0.24);
  color: #ffffff;
  border-radius: 999px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s, transform 0.12s;
}

.icon-pill.active {
  background: rgba(15, 23, 42, 0.42);
  border-color: rgba(255, 255, 255, 0.78);
}

.icon-pill.sos-pill {
  background: #dc2626;
  border-color: #fecaca;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.4);
}

.icon-pill.sos-pill:hover {
  background: #b91c1c;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.24);
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-header .icon-btn {
  background: #f1f5f9;
  color: var(--text);
}

/* Barre des membres en ligne */
.members-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  overflow-x: auto;
}

.members-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.members-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdfa;
  border: 1px solid #5eead4;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.member-pill.me {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}

.member-pill.speaking {
  background: #fef2f2;
  border-color: #fca5a5;
  color: var(--danger-dark);
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

.member-pill.speaking .online-dot {
  background: #dc2626;
  animation: blink 0.9s infinite;
}

.member-invite-pill {
  border: 1px dashed var(--primary);
  background: #ccfbf1;
  color: var(--primary-dark);
  border-radius: 999px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.member-invite-pill:hover {
  background: #99f6e4;
}

/* Bannière d'alerte */
.alert-banner {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #f59e0b;
  padding: 9px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

/* Fil des messages */
.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.empty-state {
  margin: auto;
  text-align: center;
  max-width: 340px;
  color: var(--text-muted);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  font-size: 3.1rem;
}

.empty-state h2 {
  font-size: 1.15rem;
  color: var(--text);
}

.empty-room-pill {
  background: #ccfbf1;
  color: var(--primary-dark);
  border: 1px solid #5eead4;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.84rem;
}

.empty-state p {
  font-size: 0.9rem;
  line-height: 1.45;
}

.empty-invite-btn {
  margin-top: 4px;
}

/* Bulles de messages */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 92%;
  animation: popIn 0.22s ease-out;
}

.msg-row.me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row.other {
  align-self: flex-start;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.msg-bubble {
  background: var(--bubble-other);
  color: var(--text);
  border-radius: 18px 18px 18px 6px;
  padding: 10px 12px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.07);
  min-width: 215px;
  max-width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.msg-row.unread .msg-bubble {
  border: 2px solid #c2410c;
  box-shadow: 0 4px 16px rgba(194, 65, 12, 0.16);
}

.msg-row.me .msg-bubble {
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  color: #ffffff;
  border-radius: 18px 18px 6px 18px;
  border-color: transparent;
}

.msg-row.sos .msg-bubble {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  border: 2px solid #fecaca;
  animation: sosPulse 1.4s ease-in-out 2;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.76rem;
}

.msg-sender {
  font-weight: 800;
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-meta-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.msg-time {
  opacity: 0.92;
}

.badge-new {
  background: #c2410c;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-played {
  background: #ccfbf1;
  color: #115e59;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}

.msg-text {
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

/* Lecteur audio personnalisé */
.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s, background 0.15s;
}

.msg-row.me .play-btn {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.play-btn:hover {
  transform: scale(1.06);
}

.voice-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 120px;
}

.waveform-bars {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 32px;
  cursor: pointer;
  touch-action: none;
  border-radius: 6px;
  padding: 2px 0;
}

.wave-bar {
  flex: 1;
  min-width: 3px;
  border-radius: 99px;
  background: rgba(15, 118, 110, 0.3);
  transition: background 0.1s;
}

.wave-bar.played {
  background: var(--primary);
}

.msg-row.me .wave-bar {
  background: rgba(255, 255, 255, 0.36);
}

.msg-row.me .wave-bar.played {
  background: #ffffff;
}

.voice-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
  opacity: 0.94;
}

.voice-duration {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

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

.speed-btn,
.delete-btn {
  background: rgba(15, 23, 42, 0.08);
  border: none;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 34px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.msg-row.me .speed-btn,
.msg-row.me .delete-btn {
  background: rgba(255, 255, 255, 0.18);
}

.speed-btn:hover,
.delete-btn:hover {
  background: rgba(0, 0, 0, 0.18);
}

/* Barre messages rapides */
.quick-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px 6px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-bar::-webkit-scrollbar {
  display: none;
}

.quick-btn {
  border: 1px solid #94a3b8;
  background: #ffffff;
  color: var(--text);
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.quick-btn:hover {
  background: #f0fdfa;
  border-color: var(--primary);
}

.quick-btn.sent {
  background: #ccfbf1;
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ==================== CONSOLE PTT ==================== */
.ptt-dock {
  background: #ffffff;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.recording-panel {
  width: 100%;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--danger-dark);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.rec-indicator.rec-warning {
  color: #991b1b;
  text-decoration: underline;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 0.9s infinite;
}

#waveform-canvas {
  flex: 1;
  min-width: 0;
  width: 0;
  height: 32px;
  max-width: 240px;
}

.btn-cancel-rec {
  border: none;
  background: #fee2e2;
  color: var(--danger-dark);
  font-weight: 700;
  font-size: 0.8rem;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.ptt-controls-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mode-switch {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 14px;
  width: 86px;
  flex-shrink: 0;
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  min-height: 34px;
  padding: 5px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.mode-btn.active {
  background: #ffffff;
  color: var(--primary-dark);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}

.ptt-button {
  position: relative;
  width: 106px;
  height: 106px;
  border-radius: 50%;
  border: 4px solid #ccfbf1;
  background: linear-gradient(145deg, #0f766e 0%, #115e59 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.38);
  transition: transform 0.14s, background 0.18s, box-shadow 0.18s;
}

.ptt-button:hover {
  transform: scale(1.03);
}

.ptt-button.recording {
  background: linear-gradient(145deg, #dc2626 0%, #991b1b 100%);
  border-color: #fecaca;
  transform: scale(1.07);
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.48);
}

.ptt-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid transparent;
  pointer-events: none;
}

.ptt-button.recording .ptt-ring {
  border-color: rgba(220, 38, 38, 0.45);
  animation: pulseRing 1.2s infinite;
}

.ptt-icon {
  font-size: 2rem;
  line-height: 1;
}

.ptt-label {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.ptt-spacer {
  width: 86px;
  flex-shrink: 0;
}

.ptt-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==================== MODALE ==================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.modal-card {
  width: 100%;
  max-width: 410px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.1rem;
}

.modal-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  gap: 10px;
}

.info-row span {
  color: var(--text-muted);
  flex-shrink: 0;
}

.info-row strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mic-test-panel {
  background: #f0fdfa;
  border: 1px solid #5eead4;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mic-test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.mic-test-device {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mic-test-timer {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.mic-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #cbd5e1;
  overflow: hidden;
}

.mic-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e 0%, #16a34a 75%, #dc2626 100%);
  transition: width 0.08s linear;
}

.mic-test-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.tip-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tip-card p {
  margin-top: 4px;
}

/* Toast */
.toast {
  position: absolute;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.84rem;
  font-weight: 600;
  z-index: 40;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  white-space: normal;
  text-align: center;
  max-width: min(90%, 380px);
}

/* Animations */
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes pulseRing {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.22);
    opacity: 0;
  }
}

@keyframes sosPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Desktop Ergonomics */
@media (min-width: 840px) {
  .join-screen {
    max-width: 500px;
  }
  .app-screen {
    max-width: 780px;
    max-height: min(900px, calc(100dvh - 32px));
  }
  .members-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .members-list {
    flex-wrap: wrap;
  }
  .quick-bar {
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
  }
  .msg-row {
    max-width: 72%;
  }
}

/* Mobile plein écran */
@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }
  .screen {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .pill-text {
    display: none;
  }
}

/* Avatar grid 4 colonnes sur petits smartphones pour cibles >= 44px */
@media (max-width: 440px) {
  .avatar-picker {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  .avatar-btn {
    min-height: 48px;
    font-size: 1.45rem;
  }
}

/* Écrans courts (ex: 375x667) */
@media (max-height: 700px) {
  .ptt-dock {
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }
  .ptt-button {
    width: 92px;
    height: 92px;
  }
  .ptt-icon {
    font-size: 1.7rem;
  }
  .toast {
    bottom: 142px;
  }
}

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ptt-button:hover,
  .ptt-button.recording,
  .play-btn:hover,
  .avatar-btn.selected,
  .chip:hover {
    transform: none !important;
  }
}
