/* ==========================================================================
   EEC Start — standalone onboarding experience.
   Shares the site palette but ships independently, so it can be hosted on its
   own subdomain without pulling in the marketing site's CSS.
   ========================================================================== */
:root {
  --bg-rgb: 246 247 251;
  --fg-rgb: 16 18 32;
  --accent-rgb: 99 91 255;
  --accent-text-rgb: 79 70 229;
  --accent-fg-rgb: 255 255 255;
  --accent-2-rgb: 6 155 184;
  --surface: 255 255 255;
  /* plush mascot palette — white shell, grey trim, cyan face */
  --bot-shell-hi: #ffffff;
  --bot-shell-lo: #dcdfe6;
  --bot-line: rgba(20, 24, 32, 0.16);
  --bot-accent: #46C2F0;
  --bot-grey: #9BA6B6;
  --bot-grey-dk: #7C8899;
  --bot-cheek: #E29AA0;
  --bot-visor: #0D1117;
  --bot-shadow: rgba(16, 18, 32, 0.14);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg-rgb: 10 12 20;
  --fg-rgb: 233 236 245;
  --accent-rgb: 124 116 255;
  --accent-text-rgb: 165 158 255;
  --accent-fg-rgb: 255 255 255;
  --accent-2-rgb: 34 211 238;
  --surface: 18 21 35;
  --bot-shell-hi: #ffffff;
  --bot-shell-lo: #cfd4dd;
  --bot-line: rgba(10, 12, 16, 0.22);
  --bot-accent: #5BD0FA;
  --bot-grey: #98A4B5;
  --bot-grey-dk: #75818F;
  --bot-cheek: #E4979E;
  --bot-visor: #0A0E13;
  --bot-shadow: rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: rgb(var(--bg-rgb));
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100svh;
  overflow-x: clip;
  color: rgb(var(--fg-rgb));
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: rgb(var(--accent-rgb)); color: rgb(var(--accent-fg-rgb)); }

:focus-visible {
  outline: 2px solid rgb(var(--accent-rgb));
  outline-offset: 3px;
  border-radius: 6px;
}

/* soft ambient field behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 12% -10%, rgb(var(--accent-rgb) / 0.13), transparent 65%),
    radial-gradient(50vw 50vw at 92% 108%, rgb(var(--fg-rgb) / 0.07), transparent 65%);
}

#start-app {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* ---------- chrome ---------- */
.s-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem clamp(1rem, 4vw, 2.5rem);
}
.s-brand { display: flex; align-items: center; gap: 0.5rem; }
.s-brand img { height: 1.1rem; width: auto; filter: invert(1); }
html[data-theme="dark"] .s-brand img { filter: invert(0); }
.s-brand span { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.2em; }
.s-ctrl { display: flex; align-items: center; gap: 0.5rem; }
.s-lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgb(var(--fg-rgb) / 0.14);
}
.s-lang button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgb(var(--fg-rgb) / 0.55);
  transition: background-color 0.2s, color 0.2s;
}
.s-lang button.on { background: rgb(var(--accent-rgb)); color: rgb(var(--accent-fg-rgb)); }
.s-sound {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--fg-rgb) / 0.14);
  background: transparent;
  color: rgb(var(--fg-rgb) / 0.65);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.s-sound:hover { color: rgb(var(--fg-rgb)); border-color: rgb(var(--accent-rgb) / 0.5); }
.s-sound svg { width: 1.05rem; height: 1.05rem; }

.s-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(1rem, 4vw, 2.5rem) clamp(2rem, 6vw, 4rem);
}

/* ---------- screen transitions ---------- */
.sc {
  width: 100%;
  max-width: 60rem;
  animation: sc-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes sc-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
}
.sc.leaving {
  position: absolute;
  pointer-events: none;
  animation: sc-out 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes sc-out {
  to { opacity: 0; transform: translateY(-10px); filter: blur(6px); }
}

.kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: rgb(var(--accent-text-rgb));
}
.sc h1 {
  margin-top: 0.9rem;
  font-size: clamp(1.9rem, 5.2vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.06;
  text-wrap: balance;
}
.sc .lead {
  margin-top: 1rem;
  max-width: 38rem;
  color: rgb(var(--fg-rgb) / 0.62);
  text-wrap: pretty;
}

/* ---------- chooser ---------- */
.choose { text-align: center; }
.choose .lead { margin-inline: auto; }
.choose-grid {
  margin-top: 2.75rem;
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 760px) { .choose-grid { grid-template-columns: 1fr 1fr; } }
.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 2rem 1.75rem;
  min-height: 17rem;
  border-radius: 1.5rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.13);
  background: rgb(var(--surface) / 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  text-align: left;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s, background-color 0.3s;
}
.pick:hover { transform: translateY(-4px); border-color: rgb(var(--accent-rgb) / 0.5); }
.pick h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; }
.pick p { color: rgb(var(--fg-rgb) / 0.6); font-size: 0.92rem; }
.pick-cta { margin-top: auto; font-size: 0.875rem; font-weight: 500; color: rgb(var(--accent-text-rgb)); }
.pick-ico {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgb(var(--accent-rgb) / 0.35);
  background: rgb(var(--accent-rgb) / 0.08);
  color: rgb(var(--accent-text-rgb));
  margin-bottom: 0.75rem;
}
.pick-ico svg { width: 1.3rem; height: 1.3rem; }
.pick-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgb(var(--accent-rgb));
  color: rgb(var(--accent-fg-rgb));
}
.pick-bot { display: block; width: 7rem; margin: -0.75rem 0 0.25rem -0.75rem; }

/* ---------- progress ---------- */
.s-progress { margin-bottom: 2rem; }
.s-progress .bar {
  height: 4px;
  border-radius: 999px;
  background: rgb(var(--fg-rgb) / 0.1);
  overflow: hidden;
}
.s-progress .bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: rgb(var(--accent-rgb));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.s-progress .meta {
  margin-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(var(--fg-rgb) / 0.5);
}

.q-head h2 {
  font-size: clamp(1.4rem, 3.6vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}
.q-body { margin-top: 1.75rem; }

/* ---------- widgets ---------- */
.w-input {
  width: 100%;
  padding: 1rem 1.15rem;
  border-radius: 1rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.16);
  background: rgb(var(--surface) / 0.7);
  font-size: 1.05rem;
  transition: border-color 0.2s, background-color 0.2s;
}
.w-input:focus { outline: none; border-color: rgb(var(--accent-rgb)); }
.w-area { resize: vertical; min-height: 7rem; font-size: 1rem; line-height: 1.6; }

.w-cards { display: grid; gap: 0.75rem; }
.w-cards.cols-2 { grid-template-columns: 1fr; }
.w-cards.cols-3 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) {
  .w-cards.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .w-cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.13);
  background: rgb(var(--surface) / 0.55);
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  transition: transform 0.2s, border-color 0.2s, background-color 0.2s;
}
.card:hover { transform: translateY(-2px); border-color: rgb(var(--accent-rgb) / 0.5); }
.card.on { border-color: rgb(var(--accent-rgb)); background: rgb(var(--accent-rgb) / 0.1); }
.card-ico {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border-radius: 0.7rem;
  border: 1px solid rgb(var(--accent-rgb) / 0.3);
  color: rgb(var(--accent-text-rgb));
}
.card-ico svg { width: 1.1rem; height: 1.1rem; }
.card .tick {
  margin-left: auto;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 1px solid rgb(var(--fg-rgb) / 0.2);
  flex-shrink: 0;
  transition: background-color 0.2s, border-color 0.2s;
}
.card.on .tick { background: rgb(var(--accent-rgb)); border-color: rgb(var(--accent-rgb)); }
.w-cards.big .card {
  flex-direction: column;
  align-items: flex-start;
  min-height: 9rem;
  padding: 1.4rem;
}
.w-cards.big .card-ico { width: 2.8rem; height: 2.8rem; }
.w-cards.big .card-ico svg { width: 1.4rem; height: 1.4rem; }
.w-cards.big .tick { position: absolute; top: 1.1rem; right: 1.1rem; margin: 0; }

.w-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--fg-rgb) / 0.16);
  background: rgb(var(--surface) / 0.5);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}
.chip:hover { border-color: rgb(var(--accent-rgb) / 0.55); }
.chip.on { border-color: rgb(var(--accent-rgb)); background: rgb(var(--accent-rgb) / 0.12); }
.chip .tick { display: none; }
.chip .card-ico { width: 1.4rem; height: 1.4rem; border: 0; }
.chip .card-ico svg { width: 1rem; height: 1rem; }
.chip.accent { background: rgb(var(--accent-rgb)); color: rgb(var(--accent-fg-rgb)); border-color: rgb(var(--accent-rgb)); }

.w-slider { padding: 0.5rem 0 0; }
.slider-val {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: rgb(var(--accent-text-rgb));
}
.slider-range {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right,
    rgb(var(--accent-rgb)) 0 var(--p, 0%), rgb(var(--fg-rgb) / 0.12) var(--p, 0%) 100%);
  cursor: pointer;
}
.slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
  border: 3px solid rgb(var(--bg-rgb));
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.25);
}
.slider-range::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgb(var(--accent-rgb));
  border: 3px solid rgb(var(--bg-rgb));
}
.slider-ticks {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: rgb(var(--fg-rgb) / 0.45);
}
.slider-ticks span { flex: 1; text-align: center; transition: color 0.2s; }
.slider-ticks span:first-child { text-align: left; }
.slider-ticks span:last-child { text-align: right; }
.slider-ticks span.on { color: rgb(var(--accent-text-rgb)); font-weight: 600; }

.w-colors { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .w-colors { grid-template-columns: repeat(3, 1fr); } }
.pal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  border-radius: 1rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.13);
  background: rgb(var(--surface) / 0.5);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  transition: border-color 0.2s, transform 0.2s;
}
.pal:hover { transform: translateY(-2px); border-color: rgb(var(--accent-rgb) / 0.5); }
.pal.on { border-color: rgb(var(--accent-rgb)); }
.pal-sw { display: flex; gap: 4px; }
.pal-sw i {
  flex: 1;
  height: 2.1rem;
  border-radius: 0.5rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.1);
}
.pal-sw i.plus {
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 1.1rem;
  color: rgb(var(--fg-rgb) / 0.5);
  background: rgb(var(--fg-rgb) / 0.05);
}
.color-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- nav ---------- */
.s-nav {
  margin-top: 2.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn.primary { background: rgb(var(--accent-rgb)); color: rgb(var(--accent-fg-rgb)); margin-left: auto; }
.btn.primary:hover { transform: scale(1.03); }
.btn.primary[disabled] { opacity: 0.6; cursor: default; transform: none; }
.btn.ghost { border-color: rgb(var(--fg-rgb) / 0.2); background: transparent; }
.btn.ghost:hover { border-color: rgb(var(--accent-rgb) / 0.55); }
.s-err {
  font-size: 0.85rem;
  color: #d9534f;
  opacity: 0;
  transition: opacity 0.2s;
}
html[data-theme="dark"] .s-err { color: #ff8a80; }
.s-err.show { opacity: 1; }

/* ---------- AI layout ---------- */
.ai-wrap { display: grid; gap: 1.5rem; }
@media (min-width: 860px) { .ai-wrap { grid-template-columns: 15rem 1fr; align-items: start; } }
.ai-bot { position: sticky; top: 1rem; }
/* on phones the mascot shrinks and steps aside so the conversation leads */
@media (max-width: 859px) {
  .ai-bot { width: 8.5rem; margin: 0 auto; position: static; }
  .ai-log { max-height: 11rem; }
}
.ai-log {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 15rem;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
}
.bub {
  max-width: 90%;
  padding: 0.8rem 1.05rem;
  border-radius: 1.1rem;
  font-size: 0.98rem;
  line-height: 1.5;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.bub.in { opacity: 0; transform: translateY(8px); }
.bub.bot {
  align-self: flex-start;
  border-bottom-left-radius: 0.35rem;
  background: rgb(var(--surface) / 0.75);
  border: 1px solid rgb(var(--fg-rgb) / 0.1);
}
.bub.me {
  align-self: flex-end;
  border-bottom-right-radius: 0.35rem;
  background: rgb(var(--accent-rgb) / 0.16);
  border: 1px solid rgb(var(--accent-rgb) / 0.3);
}
.ai-input { margin-top: 1.5rem; }

/* ---------- summary ---------- */
.summary, .sent, .resume { text-align: left; }
.sum-bot { width: 8rem; margin-bottom: 0.5rem; }
.sum-id {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: rgb(var(--fg-rgb) / 0.6);
}
.sum-card {
  margin-top: 1.5rem;
  border-radius: 1.25rem;
  border: 1px solid rgb(var(--fg-rgb) / 0.12);
  background: rgb(var(--surface) / 0.6);
  overflow: hidden;
}
.sum-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sum-table th, .sum-table td {
  text-align: left;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid rgb(var(--fg-rgb) / 0.08);
  vertical-align: top;
}
.sum-table tr:last-child th, .sum-table tr:last-child td { border-bottom: 0; }
.sum-table th { width: 40%; font-weight: 500; color: rgb(var(--fg-rgb) / 0.58); }
.sum-actions { margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sum-actions .btn.primary { margin-left: 0; }
.sum-note { margin-top: 1.25rem; }
.fallback {
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px dashed rgb(var(--accent-rgb) / 0.5);
  background: rgb(var(--accent-rgb) / 0.06);
}
.fallback p { margin: 0.4rem 0 1rem; color: rgb(var(--fg-rgb) / 0.65); font-size: 0.9rem; }

/* ==========================================================================
   EEC AI mascot
   Every state is a `data-state` on .bot. Parts cross-fade, bodies ease, and
   the antenna carries a transition-delay so it trails the head — that lag is
   what makes a rigid SVG read as something soft.
   ========================================================================== */
.bot { width: 100%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.bot-svg { width: 100%; height: auto; display: block; overflow: visible; }

/* ---- ambient life ---- */
.bot-float { animation: bot-bob 4.6s ease-in-out infinite; transform-origin: 100px 110px; }
@keyframes bot-bob { 50% { transform: translateY(-7px); } }
.bot-squash { transform-origin: 100px 190px; transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.5, 1); }
.bot-shadow { animation: bot-shade 4.6s ease-in-out infinite; transform-origin: 100px 199px; }
@keyframes bot-shade { 50% { transform: scaleX(0.9); opacity: 0.7; } }
.bot-glow { opacity: 0.9; animation: bot-glow 5.4s ease-in-out infinite; transform-origin: 100px 86px; }
@keyframes bot-glow { 50% { opacity: 0.55; transform: scale(1.06); } }

.bot-ant { transform-origin: 100px 32px; transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.5, 1) 70ms; }
.bot-ant-tip { animation: bot-tip 2.8s ease-in-out infinite; transform-origin: 100px 12px; }
@keyframes bot-tip { 50% { transform: scale(0.9) translateY(1px); } }
.bot-ai { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-anchor: middle; fill: var(--bot-accent); }

.bot-hand { animation: bot-hand 4.6s ease-in-out infinite; transition: transform 0.4s cubic-bezier(0.34, 1.5, 0.5, 1); }
.bot-hand.right { animation-delay: -0.5s; }
.bot-ear { animation: bot-hand 4.6s ease-in-out infinite; animation-delay: -0.8s; }
@keyframes bot-hand { 50% { transform: translateY(4px); } }
.bot-legs { transition: transform 0.4s ease; }

/* ---- face parts cross-fade ---- */
.bot-face { transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.bot-face .f { opacity: 0; transition: opacity 0.18s ease; }
.bot .f-normal { opacity: 1; }
.bot.blink .f-normal .eye { transform: scaleY(0.1); }
.f-normal .eye { transform-origin: center 77px; transition: transform 0.08s ease; }

.bot-mouth .m { opacity: 0; transition: opacity 0.16s ease; }
.bot .m-smile { opacity: 1; }
.bot-cheeks { opacity: 0; transition: opacity 0.3s ease; }
.bot-body { transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.5, 1); }

.bot-think, .bot-spark, .bot-bulb, .bot-zzz { opacity: 0; transition: opacity 0.25s ease; }
.bot-think circle, .bot-spark path { fill: var(--bot-accent); }
.bot-zzz text { fill: var(--bot-accent); font-size: 13px; font-weight: 700; opacity: 0.75; }

/* ======================= per-state faces ======================= */
.bot[data-state="happy"] .f-normal,
.bot[data-state="chuckle"] .f-normal,
.bot[data-state="laugh"] .f-normal,
.bot[data-state="bigLaugh"] .f-normal,
.bot[data-state="excited"] .f-normal,
.bot[data-state="success"] .f-normal,
.bot[data-state="celebrate"] .f-normal,
.bot[data-state="idea"] .f-normal,
.bot[data-state="wave"] .f-normal,
.bot[data-state="goodbye"] .f-normal,
.bot[data-state="surprised"] .f-normal,
.bot[data-state="confused"] .f-normal,
.bot[data-state="sad"] .f-normal,
.bot[data-state="error"] .f-normal,
.bot[data-state="sleeping"] .f-normal,
.bot[data-state="processing"] .f-normal { opacity: 0; }

.bot[data-state="happy"] .f-arc,
.bot[data-state="chuckle"] .f-arc,
.bot[data-state="laugh"] .f-arc,
.bot[data-state="bigLaugh"] .f-arc,
.bot[data-state="excited"] .f-arc,
.bot[data-state="success"] .f-arc,
.bot[data-state="celebrate"] .f-arc,
.bot[data-state="wave"] .f-arc,
.bot[data-state="goodbye"] .f-arc { opacity: 1; }

.bot[data-state="surprised"] .f-wide,
.bot[data-state="idea"] .f-wide { opacity: 1; }
.bot[data-state="confused"] .f-confused { opacity: 1; }
.bot[data-state="sad"] .f-sad { opacity: 1; }
.bot[data-state="error"] .f-error { opacity: 1; }
.bot[data-state="sleeping"] .f-closed { opacity: 1; }
.bot[data-state="processing"] .f-scan { opacity: 1; }
.bot[data-state="processing"] .scan-bar { animation: bot-scan 1.1s ease-in-out infinite; }
@keyframes bot-scan { 50% { transform: translateY(14px) scaleX(0.7); } }

/* eyes brighten on an idea */
.bot[data-state="idea"] .f-wide circle { filter: drop-shadow(0 0 6px var(--bot-accent)); }

/* ======================= per-state mouths ======================= */
.bot[data-state="chuckle"] .m-smile,
.bot[data-state="laugh"] .m-smile,
.bot[data-state="bigLaugh"] .m-smile,
.bot[data-state="excited"] .m-smile,
.bot[data-state="success"] .m-smile,
.bot[data-state="celebrate"] .m-smile,
.bot[data-state="surprised"] .m-smile,
.bot[data-state="thinking"] .m-smile,
.bot[data-state="processing"] .m-smile,
.bot[data-state="confused"] .m-smile,
.bot[data-state="sad"] .m-smile,
.bot[data-state="error"] .m-smile,
.bot[data-state="sleeping"] .m-smile,
.bot[data-state="speaking"] .m-smile,
.bot[data-state="idea"] .m-smile { opacity: 0; }

.bot[data-state="chuckle"] .m-small { opacity: 1; }
.bot[data-state="laugh"] .m-open,
.bot[data-state="excited"] .m-open,
.bot[data-state="success"] .m-open,
.bot[data-state="celebrate"] .m-open,
.bot[data-state="speaking"] .m-open { opacity: 1; }
.bot[data-state="bigLaugh"] .m-grin { opacity: 1; }
.bot[data-state="surprised"] .m-o,
.bot[data-state="idea"] .m-o { opacity: 1; }
.bot[data-state="thinking"] .m-flat,
.bot[data-state="processing"] .m-flat,
.bot[data-state="error"] .m-flat,
.bot[data-state="sleeping"] .m-flat { opacity: 1; }
.bot[data-state="confused"] .m-wave { opacity: 1; }
.bot[data-state="sad"] .m-frown { opacity: 1; }

/* blushes whenever it is pleased */
.bot[data-state="happy"] .bot-cheeks,
.bot[data-state="chuckle"] .bot-cheeks,
.bot[data-state="laugh"] .bot-cheeks,
.bot[data-state="bigLaugh"] .bot-cheeks,
.bot[data-state="excited"] .bot-cheeks,
.bot[data-state="success"] .bot-cheeks,
.bot[data-state="celebrate"] .bot-cheeks,
.bot[data-state="wave"] .bot-cheeks,
.bot[data-state="listening"] .bot-cheeks,
.bot[data-state="typing"] .bot-cheeks { opacity: 1; }

/* ======================= idle & hover ======================= */
.bot[data-state="idleLookAround"] .bot-body { transform: rotate(-3deg); transform-origin: 100px 128px; }
.bot[data-state="idleLookAround"] .bot-ant { transform: rotate(4deg); }
.bot[data-state="idleLookAround"] .bot-face { transform: translateX(-4px); }
.bot.glance-l .bot-face { transform: translateX(-4.5px); }
.bot.glance-r .bot-face { transform: translateX(4.5px); }

.bot[data-state="hover"] .bot-body { transform: rotate(-4deg) translateY(-2px); transform-origin: 100px 128px; }
.bot[data-state="hover"] .bot-ant { transform: rotate(6deg); }

/* ======================= listening / typing ======================= */
.bot[data-state="listening"] .bot-body,
.bot[data-state="typing"] .bot-body { transform: translateY(3px) rotate(1.5deg); transform-origin: 100px 128px; }
.bot[data-state="listening"] .bot-ant,
.bot[data-state="typing"] .bot-ant { transform: rotate(-3deg); }
.bot[data-state="typing"] .bot-ant-tip { animation-duration: 1s; }
.bot.nod .bot-float { animation: bot-nod 0.34s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bot-nod { 40% { transform: translateY(5px) rotate(-1.5deg); } 100% { transform: none; } }

/* ======================= thinking ======================= */
.bot[data-state="thinking"] .bot-face { transform: translate(-6px, -5px); }
.bot[data-state="thinking"] .bot-body { transform: rotate(-6deg); transform-origin: 100px 128px; }
.bot[data-state="thinking"] .bot-ant { transform: rotate(9deg); animation: bot-ant-spin 3.4s ease-in-out infinite; }
@keyframes bot-ant-spin { 50% { transform: rotate(-9deg); } }
.bot[data-state="thinking"] .bot-think { opacity: 1; }
.bot[data-state="thinking"] .bot-think circle { animation: bot-think 1.4s ease-in-out infinite; }
.bot[data-state="thinking"] .bot-think circle:nth-child(2) { animation-delay: 0.18s; }
.bot[data-state="thinking"] .bot-think circle:nth-child(3) { animation-delay: 0.36s; }
@keyframes bot-think {
  0%, 100% { opacity: 0.25; transform: translateY(2px); }
  50% { opacity: 1; transform: translateY(-2px); }
}
.bot[data-state="thinking"] .bot-float { animation-duration: 6.4s; }

/* ======================= speaking (mouth follows --mouth) ======================= */
.bot[data-state="speaking"] .m-open {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(calc(0.28 + var(--mouth, 0.4) * 0.95));
  transition: transform 0.09s ease-out;
}
.bot[data-state="speaking"] .bot-body { animation: bot-talk 2.6s ease-in-out infinite; transform-origin: 100px 128px; }
@keyframes bot-talk { 25% { transform: rotate(1.6deg); } 75% { transform: rotate(-1.6deg); } }
.bot[data-state="speaking"] .bot-hand.right { animation: bot-hand 1.7s ease-in-out infinite; }

/* ======================= laughter, three intensities ======================= */
.bot[data-state="chuckle"] .bot-float { animation-duration: 1.15s; }
.bot[data-state="chuckle"] .bot-squash { transform: translateY(1px) scaleY(0.985); }

.bot[data-state="laugh"] .bot-float { animation-duration: 0.46s; }
.bot[data-state="laugh"] .bot-body { transform: rotate(-4deg) translateY(-2px); transform-origin: 100px 128px; }
.bot[data-state="laugh"] .bot-ant { animation: bot-ant-shake 0.24s ease-in-out infinite; }
@keyframes bot-ant-shake { 50% { transform: rotate(-11deg); } }
.bot[data-state="laugh"] .m-open {
  transform-box: fill-box; transform-origin: center;
  animation: m-laugh 0.26s ease-in-out infinite alternate;
}
@keyframes m-laugh { to { transform: scaleY(0.55) scaleX(1.08); } }
.bot[data-state="laugh"] .bot-hand.left { animation: bot-wave 0.42s ease-in-out infinite; transform-origin: 58px 140px; }
.bot[data-state="laugh"] .bot-hand.right { animation: bot-wave 0.42s ease-in-out infinite reverse; transform-origin: 142px 140px; }

.bot[data-state="bigLaugh"] .bot-float { animation: bot-belly 0.34s ease-in-out infinite; }
@keyframes bot-belly { 50% { transform: translateY(-11px) rotate(1deg); } }
.bot[data-state="bigLaugh"] .bot-body { animation: bot-headback 0.9s ease-in-out infinite; transform-origin: 100px 128px; }
@keyframes bot-headback {
  0%, 100% { transform: rotate(-9deg) translateY(-3px); }
  50% { transform: rotate(4deg) translateY(1px); }
}
.bot[data-state="bigLaugh"] .bot-ant { animation: bot-ant-wild 0.2s ease-in-out infinite; }
@keyframes bot-ant-wild { 0% { transform: rotate(-16deg); } 100% { transform: rotate(16deg); } }
.bot[data-state="bigLaugh"] .m-grin {
  transform-box: fill-box; transform-origin: center top;
  animation: m-laugh 0.22s ease-in-out infinite alternate;
}
.bot[data-state="bigLaugh"] .bot-hand.left { animation: bot-wave 0.3s ease-in-out infinite; transform-origin: 58px 140px; }
.bot[data-state="bigLaugh"] .bot-hand.right { animation: bot-wave 0.3s ease-in-out infinite reverse; transform-origin: 142px 140px; }
.bot[data-state="bigLaugh"] .bot-legs { animation: bot-feet 0.34s ease-in-out infinite alternate; }
@keyframes bot-feet { to { transform: translateY(-3px) scaleX(1.04); } }
.bot[data-state="bigLaugh"] .bot-spark { opacity: 0.8; }

/* ======================= surprised ======================= */
.bot[data-state="surprised"] .bot-float { animation: bot-jolt 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bot-jolt { 35% { transform: translateY(-16px); } 100% { transform: none; } }
.bot[data-state="surprised"] .bot-ant { transform: rotate(0deg) scaleY(1.18); }
.bot[data-state="surprised"] .bot-squash { transform: scaleY(1.05) scaleX(0.96); }

/* ======================= idea ======================= */
.bot[data-state="idea"] .bot-bulb { opacity: 1; animation: bulb-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bulb-pop { from { opacity: 0; transform: scale(0.4) translateY(6px); } }
.bot[data-state="idea"] .bot-hand.right { transform: translate(4px, -26px) rotate(-18deg); transform-origin: 142px 148px; }
.bot[data-state="idea"] .bot-body { transform: rotate(3deg); transform-origin: 100px 128px; }
.bot[data-state="idea"] .bot-float { animation-duration: 3s; }

/* ======================= success / celebrate ======================= */
.bot[data-state="success"] .bot-float,
.bot[data-state="celebrate"] .bot-float { animation: bot-jump 0.72s cubic-bezier(0.34, 1.4, 0.5, 1) 2; }
@keyframes bot-jump {
  0% { transform: none; }
  22% { transform: translateY(3px); }
  55% { transform: translateY(-22px); }
  100% { transform: none; }
}
.bot[data-state="success"] .bot-squash,
.bot[data-state="celebrate"] .bot-squash { animation: bot-stretch 0.72s cubic-bezier(0.34, 1.4, 0.5, 1) 2; }
@keyframes bot-stretch {
  0% { transform: none; }
  22% { transform: scaleY(0.88) scaleX(1.08); }   /* squash before takeoff */
  55% { transform: scaleY(1.09) scaleX(0.94); }   /* stretch in the air     */
  78% { transform: scaleY(0.93) scaleX(1.05); }   /* compress on landing    */
  100% { transform: none; }
}
.bot[data-state="success"] .bot-hand.left,
.bot[data-state="celebrate"] .bot-hand.left { transform: translate(-2px, -30px) rotate(24deg); transform-origin: 58px 148px; }
.bot[data-state="success"] .bot-hand.right,
.bot[data-state="celebrate"] .bot-hand.right { transform: translate(2px, -30px) rotate(-24deg); transform-origin: 142px 148px; }
.bot[data-state="success"] .bot-spark,
.bot[data-state="celebrate"] .bot-spark,
.bot[data-state="excited"] .bot-spark { opacity: 1; animation: bot-spark 1.1s ease-in-out infinite; }
@keyframes bot-spark {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.12); }
}
.bot[data-state="excited"] .bot-float { animation-duration: 0.9s; }

/* ======================= error ======================= */
.bot[data-state="error"] .bot-float { animation: none; }
.bot[data-state="error"] .bot-squash { animation: bot-glitch 0.42s steps(2) 3; }
@keyframes bot-glitch {
  0% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}
.bot[data-state="error"] .bot-ant { animation: bot-ant-glitch 0.16s steps(2) 8; }
@keyframes bot-ant-glitch { 50% { transform: rotate(-14deg) translateY(2px); } }
.bot[data-state="error"] .bot-ant-tip { opacity: 0.35; }

/* ======================= sleeping / waking ======================= */
.bot[data-state="sleeping"] .bot-float { animation: bot-breathe 5.6s ease-in-out infinite; }
@keyframes bot-breathe { 50% { transform: translateY(-3px); } }
.bot[data-state="sleeping"] .bot-squash { animation: bot-breathe-sq 5.6s ease-in-out infinite; }
@keyframes bot-breathe-sq { 50% { transform: scaleY(1.02) scaleX(0.99); } }
.bot[data-state="sleeping"] .bot-body { transform: rotate(7deg) translateY(4px); transform-origin: 100px 128px; }
.bot[data-state="sleeping"] .bot-ant { transform: rotate(26deg) translateY(3px); }
.bot[data-state="sleeping"] .bot-glow { opacity: 0.25; }
.bot[data-state="sleeping"] .bot-zzz { opacity: 1; }
.bot[data-state="sleeping"] .bot-zzz text { animation: zzz 3.2s ease-in-out infinite; }
.bot[data-state="sleeping"] .bot-zzz text:nth-child(2) { animation-delay: 0.5s; }
.bot[data-state="sleeping"] .bot-zzz text:nth-child(3) { animation-delay: 1s; }
@keyframes zzz {
  0% { opacity: 0; transform: translateY(6px) scale(0.7); }
  35% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-8px) scale(1.1); }
}

.bot[data-state="wakeUp"] .bot-float { animation: bot-jolt 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bot[data-state="wakeUp"] .bot-ant { animation: bot-ant-pop 0.5s cubic-bezier(0.34, 1.7, 0.5, 1); }
@keyframes bot-ant-pop { from { transform: rotate(26deg) translateY(3px); } to { transform: none; } }
.bot[data-state="wakeUp"] .f-wide { opacity: 1; }
.bot[data-state="wakeUp"] .f-normal { opacity: 0; }

/* ======================= wave / goodbye ======================= */
.bot[data-state="wave"] .bot-hand.right,
.bot[data-state="goodbye"] .bot-hand.right {
  animation: bot-wave 0.62s ease-in-out infinite;
  transform-origin: 142px 148px;
}
@keyframes bot-wave { 50% { transform: rotate(-30deg) translateY(-10px); } }
.bot[data-state="wave"] .bot-body,
.bot[data-state="goodbye"] .bot-body { transform: rotate(-3deg); transform-origin: 100px 128px; }

/* ======================= tap feedback ======================= */
.bot.poked .bot-squash { animation: bot-poke 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes bot-poke {
  0% { transform: none; }
  25% { transform: scaleY(0.86) scaleX(1.1); }    /* squash */
  60% { transform: scaleY(1.06) scaleX(0.96); }   /* rebound */
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .bot-zzz, .bot-think, .bot-spark, .bot-bulb { opacity: 1; }
  .sc, .sc.leaving { opacity: 1; transform: none; filter: none; }
  .bub.in { opacity: 1; transform: none; }
}
