/* AutoPodcast IA — CSS complet */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #E05A2B;
  --brand-light: #FAECE7;
  --brand-dark:  #993C1D;
  --brand-dim:   rgba(224,90,43,0.12);

  --surface:  #ffffff;
  --surface2: #f5f4f0;
  --surface3: #eeece7;
  --text:     #1a1917;
  --text2:    #6b6762;
  --text3:    #a09c96;
  --border:   rgba(26,25,23,0.09);
  --border2:  rgba(26,25,23,0.18);

  --r:  12px;
  --rm: 8px;
  --rs: 6px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow:    0 2px 10px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-light: rgba(224,90,43,0.15);
    --brand-dark:  #f07040;
    --surface:  #1c1b18;
    --surface2: #242320;
    --surface3: #2c2b27;
    --text:     #f0ede8;
    --text2:    #9e9b95;
    --text3:    #6b6864;
    --border:   rgba(255,255,255,0.08);
    --border2:  rgba(255,255,255,0.15);
  }
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  color: var(--text);
  background: var(--surface3);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.app {
  display: none; /* affiché par JS (showApp) une fois la session vérifiée */
  grid-template-columns: 250px 1fr;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}

.logo {
  padding: 18px 18px 14px;
  border-bottom: 0.5px solid var(--border);
}

.logo-mark { display: flex; align-items: center; gap: 10px; }

.logo-icon {
  width: 34px; height: 34px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.logo-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.4px;
}

.logo-sub { font-size: 11px; color: var(--text3); }

.nav { padding: 10px 8px; flex: 1; }

.nav-section { margin-bottom: 18px; }

.nav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--rm);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }

.nav-item.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}

.ni { font-size: 15px; width: 18px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--brand);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-badge:empty, .nav-badge[data-count="0"] { display: none; }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 0.5px solid var(--border);
}

.health-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}

.health-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s;
}

.health-dot.ok { background: #3B6D11; }
.health-dot.err { background: #A32D2D; }

.lang-switcher { display: flex; gap: 5px; }

.lang-btn {
  flex: 1;
  padding: 6px;
  border-radius: var(--rm);
  border: 0.5px solid var(--border2);
  background: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.12s;
}

.lang-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main { display: flex; flex-direction: column; overflow: hidden; background: var(--surface3); }

.topbar {
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  flex: 1;
}

.topbar-actions { display: flex; gap: 8px; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 40px;
}

.page { display: none; }
.page.active { display: block; }

/* ── Boutons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: var(--rm);
  border: 0.5px solid var(--border2);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  transition: background 0.12s;
  text-decoration: none;
}

.btn:hover { background: var(--surface2); }

.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-danger {
  color: #A32D2D;
  border-color: rgba(163,45,45,0.25);
}

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

.btn-block { width: 100%; justify-content: center; }

/* ── Formulaires ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 13px; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 5px;
}

input[type=text],
input[type=email],
textarea,
select {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--rm);
  border: 0.5px solid var(--border2);
  background: var(--surface2);
  font-size: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
textarea:focus { border-color: var(--brand); }

input[type=password] {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--rm);
  border: 0.5px solid var(--border2);
  background: var(--surface2);
  font-size: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}

.field-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
select { appearance: none; cursor: pointer; 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='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.toggle-group {
  display: flex;
  background: var(--surface2);
  border-radius: var(--rm);
  padding: 3px;
  gap: 2px;
}

.toggle-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.13s;
  white-space: nowrap;
}

.toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 0.5px var(--border2);
}

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: 0.5px solid var(--border2);
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text3);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .switch-slider { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); background: white; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
}

.card-title {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
}

.card-desc { font-size: 13px; color: var(--text2); margin-bottom: 14px; line-height: 1.6; }

.stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

.stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-val { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── Grilles ────────────────────────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }

/* ── Hero prompt ────────────────────────────────────────────────────────────── */
.hero-prompt {
  background: #18170f;
  border-radius: var(--r);
  padding: 22px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.hero-prompt::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(224,90,43,0.12);
  pointer-events: none;
}

.hp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.hp-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hp-hint { font-size: 11px; color: rgba(255,255,255,0.3); }

.hp-textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.1);
  border-radius: var(--rm);
  padding: 11px 13px;
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  min-height: 72px;
  outline: none;
}

.hp-textarea::placeholder { color: rgba(255,255,255,0.3); }
.hp-textarea:focus { border-color: rgba(224,90,43,0.4); }

.hp-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 10px;
  flex-wrap: wrap;
}

.hp-tags { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }

.hp-tag {
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
}

.btn-generate {
  background: var(--brand);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: var(--rm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: background 0.13s;
}

.btn-generate:hover { background: var(--brand-dark); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Quick options ──────────────────────────────────────────────────────────── */
.quick-options {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.qo-group { flex: 1; min-width: 130px; }

.qo-group .label { margin-bottom: 5px; }

/* ── Generating card ────────────────────────────────────────────────────────── */
.generating-card { margin-bottom: 18px; }

.gen-anim { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }

.waveform { display: flex; align-items: center; gap: 2px; height: 28px; flex-shrink: 0; }

.wave-bar {
  width: 3px;
  background: var(--brand);
  border-radius: 2px;
  height: 100%;
  animation: wave 1.1s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.2); }
  50% { transform: scaleY(1); }
}

.gen-title { font-weight: 500; font-size: 14px; }
.gen-step { font-size: 12px; color: var(--text3); margin-top: 2px; }

.gen-progress {
  height: 3px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}

.gen-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
  transition: width 0.6s ease;
  width: 0%;
}

/* ── Page toolbar ───────────────────────────────────────────────────────────── */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

/* ── Scenarios grid ─────────────────────────────────────────────────────────── */
.scenarios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.scenario-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  position: relative;
  transition: border-color 0.13s, box-shadow 0.13s;
}

.scenario-card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }

.sc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }

.sc-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600; margin-bottom: 6px; }

.sc-meta { font-size: 12px; color: var(--text2); display: flex; flex-direction: column; gap: 3px; }

.sc-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

.sc-add-card {
  border: 1px dashed var(--border2);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
  color: var(--text3);
  font-size: 13px;
  flex-direction: column;
  gap: 6px;
}

.sc-add-card:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-orange { background: var(--brand-light); color: var(--brand-dark); }
.badge-green  { background: #EAF3DE; color: #3B6D11; }
.badge-blue   { background: #E6F1FB; color: #185FA5; }
.badge-gray   { background: var(--surface3); color: var(--text2); }
.badge-red    { background: #FCEBEB; color: #A32D2D; }

/* ── Episodes list ──────────────────────────────────────────────────────────── */
.episodes-list { display: flex; flex-direction: column; gap: 0; }

.episode-row {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  transition: border-color 0.12s;
}

.episode-row:hover { border-color: var(--border2); }

.play-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}

.play-btn:hover { background: var(--brand-dark); }
.play-btn svg { fill: white; width: 14px; height: 14px; margin-left: 2px; }

.ep-info { flex: 1; min-width: 0; }

.ep-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }

.ep-bar {
  height: 2px;
  background: var(--surface3);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.ep-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
}

.ep-actions { display: flex; gap: 5px; flex-shrink: 0; }

.ep-status-generating {
  font-size: 11px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ep-status-error {
  font-size: 11px;
  color: #A32D2D;
}

/* ── Sources ────────────────────────────────────────────────────────────────── */
.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}

.source-row:last-child { border-bottom: none; }
.source-row .sr-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sources-check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 6px 0;
}

.source-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.source-check input[type=checkbox] { width: auto; accent-color: var(--brand); }

/* ── Info panel ─────────────────────────────────────────────────────────────── */
.info-panel {
  background: var(--brand-light);
  border: 0.5px solid rgba(224,90,43,0.2);
  border-radius: var(--rm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ip-icon { font-size: 18px; flex-shrink: 0; }

.ip-text { font-size: 13px; color: var(--brand-dark); line-height: 1.5; }
.ip-title { font-weight: 500; margin-bottom: 2px; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 16px;
  overflow-y: auto;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: var(--r);
  border: 0.5px solid var(--border2);
  width: 100%;
  max-width: 540px;
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 18px;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  font-size: 22px;
  line-height: 1;
  padding: 2px;
}

.close-btn:hover { color: var(--text); }

.modal-footer {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-footer .btn { flex: 1; justify-content: center; }
.modal-footer .btn-primary { flex: 2; }

/* ── Script viewer ──────────────────────────────────────────────────────────── */
.script-viewer {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text2);
  max-height: 60vh;
  overflow-y: auto;
  white-space: pre-wrap;
  padding: 2px;
}

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider { height: 0.5px; background: var(--border); margin: 14px 0; }

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text3);
}

.es-icon { font-size: 30px; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ── Notification ───────────────────────────────────────────────────────────── */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #18170f;
  color: white;
  padding: 11px 16px;
  border-radius: var(--rm);
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.22s;
  max-width: 300px;
  pointer-events: none;
}

.notification.show { opacity: 1; transform: translateY(0); }

/* ── Sidebar overlay (mobile) ───────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 39;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0; bottom: 0;
    width: 250px;
    transition: left 0.25s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.mobile-open { left: 0; }

  .sidebar-overlay.show { display: block; }

  .mobile-menu-btn { display: flex; }

  .topbar-actions .btn:first-child { display: none; }

  .grid2, .grid3 { grid-template-columns: 1fr; }

  .quick-options { flex-direction: column; }

  .qo-group { min-width: 100%; }

  .content { padding: 14px 14px 40px; }

  .scenarios-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .episode-row { flex-wrap: wrap; }
  .ep-actions { width: 100%; justify-content: flex-end; }
  .topbar-actions .btn-primary { padding: 7px 10px; font-size: 12px; }
}

code {
  font-family: monospace;
  background: var(--surface3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

/* ── Polish : élévation au survol ──────────────────────────────────────────── */
.card, .stat-card {
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.stat-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.episode-row:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.hero-prompt::after {
  content: '';
  position: absolute;
  left: -40px; bottom: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(224,90,43,0.08);
  pointer-events: none;
}

/* ── Écran d'authentification ──────────────────────────────────────────────── */
.auth-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--surface3);
}

.auth-screen.show { display: flex; }

.auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(224,90,43,0.14), transparent 55%),
    radial-gradient(500px circle at 85% 80%, rgba(224,90,43,0.10), transparent 55%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 0.5px solid var(--border2);
  border-radius: var(--r);
  padding: 30px 28px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border-radius: var(--rm);
  padding: 3px;
  gap: 2px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  transition: all 0.13s;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 0 0 0.5px var(--border2);
}

.auth-error {
  background: #FCEBEB;
  color: #A32D2D;
  border-radius: var(--rm);
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.auth-switch {
  text-align: center;
  font-size: 12.5px;
  color: var(--text3);
  margin-top: 14px;
}

.auth-switch a { color: var(--brand); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Menu utilisateur (sidebar) ────────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: var(--rm);
  background: var(--surface2);
  margin-bottom: 10px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info { flex: 1; min-width: 0; }

.user-email {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-logout {
  font-size: 11px;
  color: var(--text3);
  text-decoration: none;
}

.user-logout:hover { color: var(--brand); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════════
   Champs date / heure / nombre
   ══════════════════════════════════════════════════════════════════════════════ */
input[type=date], input[type=time], input[type=number] {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--rm);
  border: 0.5px solid var(--border2);
  background: var(--surface2);
  font-size: 14px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  color-scheme: light dark;
}
input[type=date]:focus, input[type=time]:focus, input[type=number]:focus { border-color: var(--brand); }

/* ── Puces ─────────────────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 0.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.chip:hover { border-color: var(--brand); }
.chip:active { transform: scale(.97); }
.chip.on, .chip-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.trip-card { margin-top: 16px; }

/* ══════════════════════════════════════════════════════════════════════════════
   Lecteur permanent
   ══════════════════════════════════════════════════════════════════════════════ */
body.has-player .content { padding-bottom: 104px; }

.player {
  position: fixed; left: 250px; right: 0; bottom: 0; z-index: 60;
  background: var(--surface);
  border-top: 0.5px solid var(--border2);
  box-shadow: 0 -4px 20px rgba(0,0,0,.10);
  padding-bottom: env(safe-area-inset-bottom);
}
.pl-progress { position: relative; height: 6px; background: var(--surface3); cursor: pointer; }
.pl-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--brand); }
.pl-ticks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.pl-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--surface); }
.pl-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; }
.pl-meta { flex: 1; min-width: 0; cursor: pointer; }
.pl-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-chapter { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-controls { display: flex; align-items: center; gap: 4px; }
.pl-btn {
  min-width: 40px; height: 40px; padding: 0 8px;
  border: none; background: none; color: var(--text);
  border-radius: 999px; font-size: 15px; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.pl-btn:hover { background: var(--surface2); }
.pl-play { background: var(--brand); color: #fff; width: 44px; height: 44px; font-size: 17px; }
.pl-play:hover { background: var(--brand-dark); }
.pl-play-lg { width: 68px; height: 68px; font-size: 26px; }
.pl-speed { font-size: 12px; font-weight: 600; }

@media (max-width: 768px) {
  .player { left: 0; }
  .pl-hide-sm { display: none; }
  .pl-controls { gap: 0; }
  .pl-btn { min-width: 36px; padding: 0 5px; }
  .pl-row { padding: 6px 8px 6px 12px; gap: 6px; }
}

/* ── Fiche plein écran ─────────────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 90; background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 0.5px solid var(--border);
}
.sheet-ep { flex: 1; min-width: 0; text-align: center; }
.sheet-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-sub { font-size: 12px; color: var(--text2); }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 16px 40px; max-width: 640px; width: 100%; margin: 0 auto; }
.sheet-time { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); font-variant-numeric: tabular-nums; }
#sh-seek { width: 100%; accent-color: var(--brand); margin: 4px 0 10px; }
.sheet-controls { display: flex; align-items: center; justify-content: center; gap: 10px; }
.sheet-section { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
                 color: var(--text3); margin: 22px 0 8px; }
.chapter-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--rm);
  cursor: pointer; border: 0.5px solid transparent;
}
.chapter-row:hover { background: var(--surface2); }
.chapter-row.now { background: var(--brand-light); border-color: var(--brand); }
.chapter-time { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; min-width: 40px; padding-top: 2px; }
.chapter-name { font-size: 14px; font-weight: 500; }
.chapter-src { font-size: 11.5px; margin-top: 2px; }
.chapter-src a { color: var(--brand); text-decoration: none; }
.chapter-src a:hover { text-decoration: underline; }

.ask-box { background: var(--surface2); border-radius: var(--r); padding: 14px; margin-top: 8px; }
.ask-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.ask-row { display: flex; gap: 8px; margin-bottom: 10px; }
.ask-row input { flex: 1; min-width: 0; }
.ask-answer { margin-top: 10px; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; }
.ask-answer.busy::after { content: " …"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ══════════════════════════════════════════════════════════════════════════════
   Mode voiture : gros boutons, fort contraste, zéro lecture
   ══════════════════════════════════════════════════════════════════════════════ */
.car {
  position: fixed; inset: 0; z-index: 200; background: #0c0c0b; color: #f4f1ec;
  display: flex; flex-direction: column; gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  user-select: none; -webkit-user-select: none;
}
.car-top { display: flex; align-items: center; gap: 14px; }
.car-clock { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 34px; font-variant-numeric: tabular-nums; }
.car-status { flex: 1; font-size: 15px; color: #a8a39b; text-align: center; }
.car-exit { background: #2a2926; color: #f4f1ec; border: none; border-radius: 14px; padding: 12px 18px; font-size: 16px; }
.car-info { padding: 4px 4px 0; }
.car-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: clamp(24px, 5.2vw, 44px); line-height: 1.15;
             display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.car-chapter { font-size: clamp(18px, 3.6vw, 30px); color: #E8845C; margin-top: 8px; }
.car-bar { height: 10px; background: #2a2926; border-radius: 6px; margin-top: 14px; overflow: hidden; }
.car-fill { height: 100%; width: 0; background: #E05A2B; }
.car-grid {
  flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: 1fr 1.4fr 1fr; grid-template-rows: 1.5fr 1fr;
}
.car-btn {
  background: #22211f; color: #f4f1ec; border: 2px solid #34322e; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: clamp(14px, 2.6vw, 22px); font-family: 'DM Sans', sans-serif; cursor: pointer;
  -webkit-tap-highlight-color: transparent; min-height: 84px;
}
.car-btn span { font-size: clamp(34px, 8vw, 70px); line-height: 1; }
.car-btn:active { background: #34322e; transform: scale(.98); }
.car-big { grid-row: span 1; background: #E05A2B; border-color: #E05A2B; color: #fff; font-weight: 700; }
.car-big:active { background: #B94620; }
.car-mic.listening { background: #2f7a3f; border-color: #43b25a; animation: carpulse 1.1s infinite; }
@keyframes carpulse { 50% { box-shadow: 0 0 0 14px rgba(67,178,90,.25); } }
.car-foot { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
.car-chip { flex: 0 0 auto; background: #22211f; color: #f4f1ec; border: 2px solid #34322e; border-radius: 999px;
            padding: 14px 20px; font-size: 17px; }
.car-heard { min-height: 24px; text-align: center; color: #a8a39b; font-size: 16px; }

@media (orientation: landscape) and (max-height: 560px) {
  .car { gap: 8px; }
  .car-grid { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr; }
  .car-top { gap: 8px; } .car-clock { font-size: 26px; }
  .car-title { font-size: 22px; -webkit-line-clamp: 1; } .car-chapter { font-size: 16px; margin-top: 2px; }
  .car-bar { margin-top: 6px; }
  .car-big { grid-column: auto; }
}

.car-suggest {
  position: fixed; left: 12px; right: 12px; bottom: 96px; z-index: 150; display: flex; align-items: center; gap: 10px;
  background: #1c1b18; color: #f4f1ec; border: 1px solid #E05A2B; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); font-size: 14px;
}
.car-suggest span { flex: 1; }
@media (min-width: 769px) { .car-suggest { left: auto; right: 20px; max-width: 460px; } }
