/* Kiko — style toon-pop, scène plein écran */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --fg: #1a1410;
  --muted: #7c756a;
  --accent: #f4845f;
  --accent-2: #6ec6e6;
  --accent-3: #ffd64d;
  --ink: #1a1410;
  --radius: 20px;
  --shadow: 5px 5px 0 rgba(26, 20, 16, 0.9);
  --shadow-sm: 3px 3px 0 rgba(26, 20, 16, 0.9);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  /* motif pointillé cartoon très léger */
  background-image: radial-gradient(rgba(26, 20, 16, 0.055) 1.5px, transparent 1.6px);
  background-size: 26px 26px;
  color: var(--fg);
  font-family: "Inter", sans-serif;
  overflow: hidden;
}
.app { position: relative; z-index: 1; height: 100svh; display: flex; flex-direction: column; align-items: center; }

/* ---- blobs pastel du fond ---- */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; opacity: .2; }
.b1 { width: 46vmin; height: 46vmin; background: var(--accent); top: -12vmin; left: -10vmin; }
.b2 { width: 38vmin; height: 38vmin; background: var(--accent-2); bottom: -10vmin; right: -8vmin; }
.b3 { width: 24vmin; height: 24vmin; background: var(--accent-3); top: 16vmin; right: 8vmin; }
.b4 { width: 18vmin; height: 18vmin; background: #c8a2ff; bottom: 12vmin; left: 7vmin; opacity: .14; }

/* ---- titre + accroche : le bloc central (hero -> footer) se centre verticalement ---- */
.hero { text-align: center; padding: 0 1rem 1.6rem; margin-top: auto; }
.title {
  font-family: "Fredoka", sans-serif; font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.05;
}
.title span { display: inline-block; }
.subtitle { color: var(--muted); font-size: clamp(.9rem, 1.4vw, 1.02rem); max-width: 36rem; margin: .45rem auto 0; }

.brand { display: flex; align-items: center; gap: .8rem; flex: 0 0 auto; }
.badge {
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: .74rem;
  background: var(--accent-3); border: 2.5px solid var(--ink); border-radius: 999px;
  padding: .28rem .8rem; box-shadow: var(--shadow-sm); transform: rotate(-2deg);
}
.page-foot { color: var(--muted); font-size: .82rem; padding-top: 1.2rem; text-align: center; margin-bottom: auto; }

/* ---- barre du haut : grille symétrique 1fr / auto / 1fr -> personas parfaitement centrés ---- */
.topbar {
  flex: 0 0 auto; width: 100%;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 1rem 1.6rem;
  position: relative; z-index: 5;
}
.topbar .brand { justify-self: start; }
.topbar .personas { justify-self: center; }
.topbar .lang { justify-self: end; }
.logo { font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 1.5rem; letter-spacing: .04em; flex: 0 0 auto; }
.logo-dot { color: var(--accent); }

.personas { display: flex; gap: .55rem; flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.persona {
  font-family: "Fredoka", sans-serif; cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  background: var(--surface); border: 2.5px solid var(--ink);
  border-radius: 999px; padding: .45rem .95rem; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .2s;
}
.persona:hover { transform: translate(-1px, -2px); }
.persona.active { background: var(--accent); color: #fff; }
.persona:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.p-emoji { font-size: 1.15rem; }
.p-name { font-weight: 600; font-size: .92rem; }

.lang { display: flex; gap: .3rem; flex: 0 0 auto; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 999px; padding: .2rem; box-shadow: var(--shadow-sm); }
.lang-btn {
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: .82rem; cursor: pointer;
  border: none; background: transparent; color: var(--muted);
  border-radius: 999px; padding: .28rem .6rem;
}
.lang-btn.active { background: var(--accent-3); color: var(--ink); }

/* ---- support (cadre 3D) : taille contrainte, centré, avec du fond crème autour ---- */
.stage-wrap {
  flex: 0 1 auto;
  width: min(920px, 92vw);
  height: min(56vh, 540px);
  margin: 0 auto;
  position: relative; min-height: 0;
  border: 3.5px solid var(--ink); border-radius: calc(var(--radius) + 8px);
  box-shadow: 8px 8px 0 rgba(26, 20, 16, 0.9);
  overflow: hidden;
  background: linear-gradient(160deg, #cdeafc 0%, #fdf3ea 60%, #ffe6cb 100%);
}
#stage { width: 100%; height: 100%; display: block; }
.stage-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(26, 20, 16, 0.12) 100%);
}

/* état */
.state-chip {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  display: flex; align-items: center; gap: .45rem;
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: .85rem;
  background: var(--surface); border: 2.5px solid var(--ink); border-radius: 999px;
  padding: .3rem .85rem; box-shadow: var(--shadow-sm);
}
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: #b9b2a6; }
.state-chip[data-state="listening"]  .chip-dot { background: var(--accent-2); animation: pulse 1s infinite; }
.state-chip[data-state="thinking"]   .chip-dot { background: var(--accent-3); animation: pulse .6s infinite; }
.state-chip[data-state="speaking"]   .chip-dot { background: var(--accent); animation: pulse .8s infinite; }
.state-chip[data-state="connecting"] .chip-dot { background: #c8a2ff; animation: pulse .5s infinite; }
@keyframes pulse { 50% { transform: scale(1.55); } }

/* bulle transcript */
.speech-bubble {
  position: absolute; left: 16px; bottom: 96px; max-width: min(420px, 60%); z-index: 3;
  background: var(--surface); border: 2.5px solid var(--ink);
  border-radius: 18px; border-bottom-left-radius: 4px;
  padding: .7rem 1rem; box-shadow: var(--shadow-sm);
  font-size: .92rem; line-height: 1.35; max-height: 34%; overflow-y: auto;
}
.credit-mini { position: absolute; right: 14px; bottom: 12px; z-index: 3; font-size: 10px; color: var(--muted); opacity: .6; }
.credit-mini a { color: inherit; text-decoration: underline; }
.credit-mini a:hover { color: var(--accent); }

/* ---- micro : à cheval sur le bord bas du support ---- */
.mic-dock { position: relative; margin-top: -39px; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
.mic-btn {
  pointer-events: auto; cursor: pointer;
  width: 78px; height: 78px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: 3px solid var(--ink); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease, background .2s ease;
}
.mic-btn svg { width: 34px; height: 34px; }
.mic-btn:hover { transform: scale(1.06); }
.mic-btn.live { background: #e5484d; animation: breathe 1.6s infinite; }
.mic-btn.connecting { background: #c8a2ff; pointer-events: none; }
@keyframes breathe { 50% { box-shadow: 5px 5px 0 rgba(26,20,16,.9), 0 0 0 12px rgba(229,72,77,.15); } }
.mic-hint {
  font-family: "Fredoka", sans-serif; color: var(--fg); font-size: .85rem;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 999px;
  padding: .2rem .7rem; box-shadow: var(--shadow-sm);
}

/* ---- modale fin de démo / budget ---- */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(26, 20, 16, 0.35); backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface); border: 3px solid var(--ink); border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow); padding: 2rem 1.8rem; max-width: 380px; margin: 1rem; text-align: center;
}
.modal-emoji { font-size: 2.6rem; display: block; }
.modal-card h2 { font-family: "Fredoka", sans-serif; font-size: 1.4rem; margin: .6rem 0 .4rem; }
.modal-card p { color: var(--muted); font-size: .95rem; line-height: 1.45; }
.modal-btn {
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1rem; cursor: pointer;
  margin-top: 1.2rem; background: var(--accent); color: #fff;
  border: 2.5px solid var(--ink); border-radius: 999px; padding: .55rem 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform .12s ease;
}
.modal-btn:hover { transform: translate(-1px, -2px); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .6rem; }
  .personas { order: 3; width: 100%; }
  .p-name { font-size: .82rem; }
  .speech-bubble { max-width: 78%; bottom: 92px; }
}
