/* ============================================================
   Le scribe perso de Mariamarum — design system kawaii pastel
   Lavande → pêche · grand frère taquin
   ============================================================ */

/* --- Fonts self-hostées (woff2 dans /fonts) ----------------- */
@font-face {
  font-family: 'Fredoka';
  src: url('fonts/fredoka-500.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('fonts/fredoka-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/nunito-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/caveat-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}

/* --- Design tokens ----------------------------------------- */
:root {
  --grad-bg: linear-gradient(135deg, #E9E4FF 0%, #FBDCEB 50%, #FFE5D4 100%);
  --card-bg: rgba(255, 255, 255, 0.75);
  --coral: #FF9E8A;
  --coral-deep: #FF8FA3;
  --coral-light: #FFB199;
  --lila: #B49DF6;
  --lila-soft: #C9BBF5;
  --ink: #5A5470;
  --muted: #8A85A0;
  --radius-card: 28px;
  --radius-zone: 22px;
  --shadow-card: 0 20px 60px rgba(150, 120, 200, 0.18);
  --shadow-soft: 0 8px 24px rgba(150, 120, 200, 0.14);

  --font-ui: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-hand: 'Caveat', 'Comic Sans MS', cursive;

  /* palette de voix (interlocuteurs) */
  --spk-0: #B49DF6; --spk-1: #FF9E8A; --spk-2: #7FD1C1;
  --spk-3: #FFC76B; --spk-4: #8FB7FF;
}

/* --- Reset léger ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--grad-bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* --- Décor : taches floues --------------------------------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
  animation: drift 18s ease-in-out infinite alternate;
}
.blob--1 { width: 340px; height: 340px; background: #D9C8FF; top: -80px; left: -60px; }
.blob--2 { width: 300px; height: 300px; background: #FFC9B3; bottom: -70px; right: -50px; animation-delay: -6s; }
.blob--3 { width: 260px; height: 260px; background: #FFB6D2; top: 40%; right: 10%; animation-delay: -12s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -20px) scale(1.12); }
}

/* --- Carte ------------------------------------------------- */
.card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: clamp(28px, 5vw, 44px);
  text-align: center;
}

/* --- Gestion des écrans (state machine) -------------------- */
.screen { display: none; animation: pop 0.45s cubic-bezier(.2,.9,.3,1.3); }
#app[data-state="gate"]      .screen--gate,
#app[data-state="idle"]      .screen--idle,
#app[data-state="uploading"] .screen--listening,
#app[data-state="listening"] .screen--listening,
#app[data-state="result"]    .screen--result,
#app[data-state="error"]     .screen--error { display: block; }

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* --- Typo ------------------------------------------------- */
.title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(120deg, var(--lila), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title--sm { font-size: clamp(1.3rem, 4.5vw, 1.6rem); }

.subtitle {
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 24px;
  max-width: 38ch;
  margin-inline: auto;
}

/* --- Emoji flottant --------------------------------------- */
.emoji-float {
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  margin-bottom: 10px;
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}

/* --- Boutons ---------------------------------------------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--coral-light), var(--coral-deep));
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.04); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 3px solid var(--lila); outline-offset: 3px; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: .9rem;
  padding: 10px 18px;
  margin-top: 18px;
}
.btn--ghost:hover { color: var(--ink); filter: none; }

/* --- GATE -------------------------------------------------- */
.gate-form { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: 8px; }
.gate-input {
  font-family: var(--font-body);
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 6px;
  width: min(260px, 100%);
  padding: 14px 18px;
  border: 2px dashed var(--lila-soft);
  border-radius: var(--radius-zone);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.gate-input:focus { outline: none; border-color: var(--lila); box-shadow: 0 0 0 4px rgba(180,157,246,.2); }
.gate-error { color: var(--coral-deep); font-weight: 700; margin-top: 14px; }

/* --- Dropzone --------------------------------------------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: clamp(28px, 7vw, 44px) 20px;
  border: 2px dashed var(--lila-soft);
  border-radius: var(--radius-zone);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
  animation: breathe 3.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.018); }
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--coral);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}
.dropzone.is-dragover {
  border-color: var(--coral);
  background: rgba(255, 222, 210, 0.6);
  transform: scale(1.04);
  animation: none;
}
.dropzone__icon { font-size: 2.6rem; }
.dropzone__text { font-weight: 700; color: var(--ink); line-height: 1.5; }
.dropzone__text small { font-weight: 600; color: var(--muted); }

.reassure {
  margin-top: 22px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.reassure--sm { margin-top: 18px; font-size: .8rem; }

/* --- Waveform (écoute) ------------------------------------- */
.waveform { display: flex; justify-content: center; align-items: flex-end; gap: 5px; height: 56px; margin-bottom: 16px; }
.waveform span {
  width: 6px;
  border-radius: 999px;
  background: linear-gradient(var(--lila), var(--coral));
  animation: wave 1s ease-in-out infinite;
}
.waveform span:nth-child(odd)  { animation-delay: -.2s; }
.waveform span:nth-child(3n)   { animation-delay: -.4s; }
.waveform span:nth-child(4n)   { animation-delay: -.6s; }
.waveform span:nth-child(5n)   { animation-delay: -.8s; }
@keyframes wave {
  0%, 100% { height: 14px; }
  50%      { height: 52px; }
}

/* --- Progress --------------------------------------------- */
.progress {
  height: 14px;
  width: 100%;
  background: rgba(180, 157, 246, 0.18);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lila), var(--coral));
  transition: width .4s ease;
}
.progress__pct { margin-top: 10px; font-weight: 700; color: var(--ink); font-size: 1.1rem; }

/* --- Résultat --------------------------------------------- */
.sparkle { font-size: 2.6rem; animation: sparkle 1.6s ease-in-out infinite; }
@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0); opacity: 1; }
  50%      { transform: scale(1.25) rotate(12deg); opacity: .8; }
}

.transcript {
  text-align: left;
  max-height: 320px;
  overflow-y: auto;
  margin: 8px 0 20px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.seg { display: flex; flex-direction: column; gap: 4px; }
.seg__head { display: flex; align-items: center; gap: 8px; }
.seg__dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.seg__name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1px dashed transparent;
  padding: 2px 2px;
  cursor: text;
  min-width: 60px;
}
.seg__name:hover { border-bottom-color: var(--lila-soft); }
.seg__name:focus { outline: none; border-bottom-color: var(--lila); }
.seg__time { font-size: .75rem; color: var(--muted); font-weight: 600; margin-left: auto; }
.seg__text {
  font-size: .95rem;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  border-left: 3px solid var(--spk-0);
  padding: 10px 14px;
}

/* --- Downloads -------------------------------------------- */
.downloads { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.downloads__label { font-weight: 700; color: var(--muted); font-size: .85rem; width: 100%; margin-bottom: 2px; }
.chip {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: .9rem;
  color: var(--ink);
  border: 1.5px solid var(--lila-soft);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.chip:hover { transform: translateY(-2px); background: #fff; border-color: var(--coral); }
.chip:active { transform: translateY(0); }
.chip:focus-visible { outline: 3px solid var(--lila); outline-offset: 2px; }

/* --- Signature -------------------------------------------- */
.signature {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed rgba(180, 157, 246, 0.35);
  font-family: var(--font-hand);
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--ink);
}
.signature small { font-size: 1rem; color: var(--muted); }
.heart { display: inline-block; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  15%      { transform: scale(1.25); }
  30%      { transform: scale(1); }
}

/* --- Accessibilité : mouvement réduit --------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
