/* The guided intake and free-form chat are two views of the same conversation. */
#lia-builder-progress { display: flex; list-style: none; gap: 12px; margin: 0; padding: 8px 28px 16px; flex: none; }
#lia-builder-progress[hidden], #lia-builder-guidance[hidden] { display: none; }
#lia-builder-progress li { flex: 1; color: var(--text-muted); font-size: .6875rem; }
#lia-builder-progress li > span { display: block; height: 4px; border-radius: 8px; background: var(--border); margin-bottom: 7px; }
#lia-builder-progress li.is-reached > span { background: var(--lime); }
#lia-builder-progress li[aria-current] { color: var(--text); font-weight: 800; }
#lia-builder.is-guided-intake .lia-builder-chat { display: none; }
#lia-builder.is-guided-intake .lia-builder-hero { display: none; }
#lia-builder.is-guided-intake .lia-builder-chat-wrap { flex: 1 1 auto; }
#lia-builder-guidance { overflow-y: auto; min-height: 0; padding: 12px 28px 4px; flex: 1; }
.lia-guided-heading { text-align: center; max-width: 540px; margin: 0 auto 22px; }
.lia-guided-heading > p { font-size: .625rem; letter-spacing: .14em; font-weight: 750; color: var(--text-muted); margin: 0 0 12px; }
.lia-guided-heading h2 { font: 850 clamp(1.65rem, 3vw, 2.2rem)/1.12 var(--font-body); letter-spacing: -.035em; margin: 0 0 12px; color: var(--text); }
.lia-guided-heading > span { color: var(--text-muted); font-size: .875rem; line-height: 1.5; }
.lia-guided-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; margin: auto; }
.lia-guided-choice { display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 86px; text-align: left; font: inherit; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); cursor: pointer; }
.lia-guided-choice[aria-pressed="true"] { border-color: var(--text); background: color-mix(in srgb, var(--lime) 16%, var(--surface)); box-shadow: inset 0 0 0 1px var(--text); }
.lia-guided-choice:hover { border-color: var(--text); }
.lia-guided-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; background: color-mix(in srgb, var(--lime) 30%, var(--surface)); }
.lia-guided-icon svg { width: 23px; height: 23px; }
.lia-guided-choice-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.lia-guided-choice-copy strong { font-size: .9rem; font-weight: 800; }
.lia-guided-choice-copy small { color: var(--text-muted); font-size: .7rem; line-height: 1.35; }
.lia-guided-check { color: var(--text-muted); font-size: 1.1rem; }
.lia-guided-choice[aria-pressed="true"] .lia-guided-check { color: var(--text); }
.lia-guided-actions { position: sticky; bottom: -4px; z-index: 1; background: var(--surface); padding: 12px 0; max-width: 640px; margin: 8px auto 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lia-guided-actions > span, .lia-guided-write { color: var(--text-muted); font-size: .75rem; }
.lia-guided-continue { display: flex; align-items: center; justify-content: center; gap: 24px; border: 0; border-radius: 12px; padding: 13px 24px; min-height: 46px; font: 800 .875rem var(--font-body); color: var(--navy); background: var(--lime); cursor: pointer; }
.lia-guided-continue:disabled { opacity: .4; cursor: default; }
.lia-guided-write { text-align: center; margin: 18px 0 4px; }
.lia-guided-answer { font-size: .75rem; line-height: 1.5; color: var(--text-muted); border-left: 3px solid var(--lime); padding: 7px 12px; max-width: 640px; margin: 0 auto 16px; }
.lia-guided-choice:focus-visible, .lia-guided-continue:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
@media (min-width: 601px) and (max-height: 760px) {
  .lia-guided-heading { margin-bottom: 16px; }
  .lia-guided-heading > p { display: none; }
  .lia-guided-heading h2 { font-size: 1.8rem; margin-bottom: 8px; }
  .lia-guided-choice { min-height: 68px; padding: 10px 14px; }
  .lia-guided-write { margin-top: 8px; }
}
@media (max-width: 600px) {
  #lia-builder-progress { padding: 0 20px 16px; }
  #lia-builder-guidance { padding: 8px 20px; }
  .lia-guided-heading { margin-bottom: 18px; }
  .lia-guided-heading > p { font-size: .5625rem; }
  .lia-guided-heading > span { font-size: .8125rem; }
  .lia-guided-choices { grid-template-columns: 1fr; gap: 8px; }
  .lia-guided-choice { min-height: 65px; padding: 10px 13px; border-radius: 12px; }
  .lia-guided-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .lia-guided-actions { position: sticky; bottom: -8px; padding: 12px 0; margin-top: 8px; background: var(--surface); }
  .lia-guided-actions > span { max-width: 120px; font-size: .6875rem; }
  .lia-guided-continue { padding-inline: 16px; gap: 14px; }
  .lia-guided-write { margin-top: 8px; font-size: .6875rem; }
}

/* Intake occupies the full surface; pending requests use the chat view. */
#lia-builder.is-guided-intake .lia-builder-composer,
#lia-builder.is-guided-intake .lia-builder-chat-headperson,
#lia-builder.is-guided-intake #lia-builder-edit-btn { display: none; }
#lia-builder.is-guided-intake .lia-builder-shell { max-width: 820px; padding-top: 24px; }
#lia-builder.is-guided-intake .lia-builder-chat-wrap { min-height: 0; }
#lia-builder.is-guided-intake .lia-builder-chat-head { flex-shrink: 0; }
#lia-builder-guidance { padding-bottom: 24px; }
.lia-guided-context, .lia-guided-followup { max-width: 640px; margin: 20px auto; }
.lia-guided-context label, .lia-guided-followup label { display: block; margin-bottom: 8px; font-size: .8rem; color: var(--text-muted); }
#lia-guided-context { width: 100%; box-sizing: border-box; resize: vertical; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; }
.lia-guided-followup > p { line-height: 1.6; color: var(--text); margin-bottom: 24px; }
.lia-guided-followup .lia-guided-continue { margin-top: 14px; }
.lia-guided-retry { border: 0; background: none; color: var(--text-muted); text-decoration: underline; padding: 16px 0; cursor: pointer; }
.lia-guided-reset-protocol { display: flex; align-items: center; justify-content: center; gap: 9px; width: fit-content; min-height: 40px; margin-top: 2px; padding: 9px 13px; border: 1px solid #c9cec4; border-radius: 10px; background: transparent; color: #4d574f; font: 750 .78rem var(--font-body); cursor: pointer; }
.lia-guided-reset-protocol:hover { border-color: #17221b; color: #17221b; background: #f3f3ed; }
.lia-guided-reset-protocol:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.lia-guided-reset-protocol svg { flex: 0 0 auto; }
.lia-guided-sachets { display: flex; align-items: center; justify-content: center; min-height: 170px; gap: 12px; }
.lia-guided-sachets span { display: grid; place-items: center; width: 85px; height: 118px; border-radius: 8px; border-top: 6px double #8eafbb; border-bottom: 6px double #8eafbb; background: var(--navy); color: var(--lime); font-size: 1.8rem; font-weight: 800; animation: lia-sachet-build 2.2s ease-in-out infinite; }
.lia-guided-sachets span:nth-child(2) { animation-delay: .3s; }
.lia-guided-sachets span:nth-child(3) { animation-delay: .6s; }
@keyframes lia-sachet-build { 0%, 100% { transform: translateY(6px) rotate(-3deg); opacity: .55; } 50% { transform: translateY(-10px) rotate(3deg); opacity: 1; } }
#lia-builder-protocol-preview[hidden] { display: none; }
#lia-builder.has-protocol-preview .lia-builder-hero { display: none; }
#lia-builder.has-protocol-preview .lia-builder-shell { max-width: 1320px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 20px; padding: 24px; }
#lia-builder.has-protocol-preview .lia-builder-chat-wrap { min-height: 0; height: 100%; }
#lia-builder.has-protocol-preview .lia-builder-disclaimer { grid-column: 1 / -1; margin: 0 auto; }
#lia-builder-protocol-preview { min-width: 0; min-height: 0; overflow-y: auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; }
.lia-protocol-preview-heading > p { font-size: .625rem; font-weight: 800; letter-spacing: .14em; color: var(--text-muted); }
.lia-protocol-preview-heading h2 { font-size: 2rem; letter-spacing: -.04em; margin: 8px 0; }
.lia-protocol-preview-heading > span { color: var(--text-muted); font-size: .875rem; line-height: 1.5; }
.lia-protocol-preview-cards { display: grid; gap: 14px; margin: 24px 0; }
.lia-protocol-preview-card { display: grid; grid-template-columns: 90px minmax(0, 1fr); align-items: start; gap: 18px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; }
.lia-protocol-preview-sachet { min-height: 118px; display: grid; place-items: center; background: var(--navy); color: var(--lime); border-radius: 8px; padding: 8px; font-size: .9rem; font-weight: 800; overflow-wrap: anywhere; }
.lia-protocol-preview-card h3 { margin: 0 0 6px; font-size: 1rem; }
.lia-protocol-preview-card p { font-size: .6875rem; color: var(--text-muted); }
.lia-protocol-preview-card ul { list-style: none; margin: 12px 0 0; padding: 0; }
.lia-protocol-preview-card li { display: flex; justify-content: space-between; gap: 12px; font-size: .75rem; padding: 6px 0; border-bottom: 1px solid var(--border); }
.lia-protocol-preview-card li span { overflow-wrap: anywhere; }
.lia-protocol-preview-card li strong { flex-shrink: 0; }
@media (max-width: 760px) {
  #lia-builder.is-guided-intake .lia-builder-shell { padding: 0; }
  #lia-builder.has-protocol-preview .lia-builder-shell { padding: 0; gap: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(160px, 42%) minmax(0, 1fr); }
  #lia-builder-protocol-preview { padding: 18px; border-radius: 0; border-width: 0 0 1px; }
  #lia-builder.has-protocol-preview .lia-builder-disclaimer { display: none; }
  .lia-protocol-preview-heading h2 { font-size: 1.5rem; }
  .lia-protocol-preview-card { grid-template-columns: 65px minmax(0, 1fr); padding: 12px; gap: 12px; }
  .lia-protocol-preview-sachet { min-height: 90px; font-size: .625rem; letter-spacing: -.04em; padding-inline: 4px; }
  .lia-guided-sachets span { width: 70px; height: 100px; }
  #lia-builder-guidance { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .lia-guided-sachets span { animation: none; }
}

/* Welcome concept: design/go2ia-welcome/concept.png. Keep these styles scoped
   to the welcome state so the questionnaire and conversation keep their layout. */
body[data-screen="lia-builder"] #lia-builder.screen.is-guided-welcome {
  background: #faf9f6;
}
#lia-builder.is-guided-welcome .lia-builder-shell {
  width: 100%;
  max-width: none;
  padding: 0;
  background: #faf9f6;
}
#lia-builder.is-guided-welcome .lia-builder-chat-wrap {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
#lia-builder.is-guided-welcome .lia-builder-chat-head,
#lia-builder.is-guided-welcome .lia-builder-disclaimer { display: none; }
#lia-builder.is-guided-welcome #lia-builder-guidance {
  padding: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
.lia-welcome {
  --welcome-ink: #141512;
  --welcome-muted: #62645e;
  --welcome-line: #d4d5cd;
  --welcome-lime: #d8f900;
  width: min(100%, 1536px);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px clamp(24px, 3.5vw, 54px) 0;
  margin: auto;
  color: var(--welcome-ink);
  font-family: var(--font-body);
}
.lia-welcome button { -webkit-tap-highlight-color: transparent; font-family: inherit; }
.lia-welcome button:focus-visible { outline: 2px solid var(--welcome-ink); outline-offset: 5px; }
.lia-welcome-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(24px, 3.4vw, 52px);
  padding: 32px 0 40px;
  flex: 1 0 auto;
}
.lia-welcome-copy { padding: 24px 0 12px; }
.lia-welcome h1 {
  margin: 0;
  font-size: clamp(44px, 6.25vw, 96px);
  font-weight: 900;
  line-height: 1.025;
  letter-spacing: -.065em;
  color: var(--welcome-ink);
}
.lia-welcome h1 > span {
  white-space: nowrap;
  background: linear-gradient(transparent 72%, var(--welcome-lime) 72%, var(--welcome-lime) 94%, transparent 94%);
  padding-right: .07em;
}
.lia-welcome-description { max-width: 560px; margin: 28px 0; font-size: clamp(16px, 1.55vw, 22px); line-height: 1.6; letter-spacing: -.025em; }
.lia-welcome-begin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 260px;
  min-height: 62px;
  padding: 15px 24px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--welcome-lime);
  color: var(--welcome-ink);
  font-size: 21px;
  font-weight: 850;
  letter-spacing: -.035em;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.lia-welcome-begin svg { width: 22px; height: 22px; flex: 0 0 22px; transition: transform .18s ease; }
.lia-welcome-begin:hover { background: #c9eb00; }
.lia-welcome-begin:hover svg { transform: translateX(4px); }
.lia-welcome-begin:active { transform: translateY(1px); }
.lia-welcome-art {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1.06;
  overflow: hidden;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 42%, #f0f1e9 0%, #e6e8dd 58%, #e2e5d9 100%);
}
.lia-welcome-orbits { position: absolute; inset: 6%; display: grid; place-items: center; }
.lia-welcome-orbits i { position: absolute; width: 100%; aspect-ratio: 1; border: 1px solid rgba(255, 255, 255, .85); border-radius: 50%; }
.lia-welcome-orbits i:nth-child(2) { width: 80%; }
.lia-welcome-orbits i:nth-child(3) { width: 59%; }
.lia-welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  border-top: 1px solid var(--welcome-line);
  margin: 0;
  padding: 30px 0 22px;
}
.lia-welcome-steps > li { display: flex; align-items: center; gap: 24px; min-width: 0; padding: 12px 28px; }
.lia-welcome-steps > li + li { border-left: 1px solid var(--welcome-line); }
.lia-welcome-step-number { flex: none; width: 56px; height: 56px; border: 1px solid #b7b9af; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.lia-welcome-steps h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.2; font-weight: 900; letter-spacing: -.04em; color: var(--welcome-ink); }
.lia-welcome-steps p { font-size: 16px; line-height: 1.5; margin: 0; letter-spacing: -.02em; }
.lia-welcome-disclaimer { font-size: 11px; line-height: 1.6; color: var(--welcome-muted); text-align: center; margin: 0; padding: 16px 0 20px; }
@media (max-width: 1100px) {
  .lia-welcome-steps > li { gap: 14px; padding: 10px 16px; }
  .lia-welcome-steps h2 { font-size: 19px; }
  .lia-welcome-steps p { font-size: 14px; }
  .lia-welcome-step-number { width: 44px; height: 44px; font-size: 17px; }
}
@media (max-width: 900px) {
  .lia-welcome { padding: max(12px, env(safe-area-inset-top)) 24px 0; }
  .lia-welcome-main { grid-template-columns: minmax(0, 1fr); padding: 32px 0 28px; gap: 28px; }
  .lia-welcome-copy { padding: 0; }
  .lia-welcome h1 { font-size: clamp(42px, 10.5vw, 70px); }
  .lia-welcome-description { margin: 20px 0 22px; font-size: 16px; line-height: 1.6; max-width: 520px; }
  .lia-welcome-begin { width: 100%; max-width: 360px; min-height: 56px; font-size: 18px; padding: 14px 20px; }
  .lia-welcome-art { max-width: 520px; aspect-ratio: 1.15; border-radius: 20px; justify-self: center; }
  .lia-welcome-steps { grid-template-columns: minmax(0, 1fr); padding: 12px 0; }
  .lia-welcome-steps > li { padding: 18px 0; gap: 18px; }
  .lia-welcome-steps > li + li { border-left: 0; border-top: 1px solid var(--welcome-line); }
  .lia-welcome-steps h2 { font-size: 19px; margin-bottom: 4px; }
  .lia-welcome-steps p { font-size: 14px; }
  .lia-welcome-disclaimer { text-align: left; font-size: 10px; padding: 12px 0 max(20px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .lia-welcome-begin, .lia-welcome-begin svg { transition: none; }
}

/* The welcome is part of the storefront. Later intake/chat steps retain their
   focused full-screen layout. Override the early route shell only in this state. */
html.lia-builder-route:has(#lia-builder.active.is-guided-welcome),
html.lia-builder-route:has(#lia-builder.active.is-guided-welcome) body {
  height: auto;
  overflow: auto !important;
}
html.lia-builder-route:has(#lia-builder.active.is-guided-welcome) #app {
  height: auto;
  overflow: visible;
}
html.lia-builder-route:has(#lia-builder.active.is-guided-welcome) .site-header,
html.lia-builder-route:has(#lia-builder.active.is-guided-welcome) .site-footer {
  display: block !important;
}
body[data-screen="lia-builder"] #lia-builder.screen.is-guided-welcome {
  height: auto;
  min-height: 0;
  padding-top: calc(var(--navbar-h) + 20px);
  overflow: visible;
}
#lia-builder.is-guided-welcome .lia-builder-shell,
#lia-builder.is-guided-welcome .lia-builder-chat-wrap {
  height: auto;
  min-height: 0;
  overflow: visible;
}
#lia-builder.is-guided-welcome #lia-builder-guidance { overflow: visible; scrollbar-gutter: auto; }
.lia-welcome { --welcome-lime: var(--lime); max-width: 1400px; padding-top: 0; }
.lia-welcome-art { background: radial-gradient(ellipse at 40% 30%, #f5f4eb, #e8ece5 70%, #dce7df); }
.lia-welcome-art { perspective: 1000px; }
.lia-welcome-art::before { content: ""; position: absolute; inset: 0; opacity: .16; background: var(--sachet-glow, transparent); transition: background .5s ease; }
.lia-welcome-art[data-selected-sachet="morning"] { --sachet-glow: var(--stack-morning-gradient); }
.lia-welcome-art[data-selected-sachet="preworkout"] { --sachet-glow: var(--stack-preworkout-gradient); }
.lia-welcome-art[data-selected-sachet="focus"] { --sachet-glow: var(--stack-focus-gradient); }
.lia-welcome-art[data-selected-sachet="muscle"] { --sachet-glow: var(--stack-muscle-gradient); }
.lia-welcome-art[data-selected-sachet="night"] { --sachet-glow: var(--stack-night-gradient); }
.lia-welcome-art[data-selected-sachet="daily"] { --sachet-glow: var(--stack-daily-gradient); }
.lia-welcome-art[data-selected-sachet="electrolyte"] { --sachet-glow: var(--stack-electrolyte-gradient); }
.lia-welcome-art[data-selected-sachet="gut"] { --sachet-glow: var(--stack-gut-gradient); }
.lia-welcome-packages {
  position: absolute; inset: 11% 7% 15%;
  isolation: isolate;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 9% 6%;
}
.lia-welcome-packet, .lia-welcome-mascot-slot {
  --packet-angle: -7deg;
  --packet-delay: 0s;
  --packet-phase: 0s;
  position: relative; min-width: 0; width: 100%; height: auto; aspect-ratio: 3 / 4; align-self: center; container-type: inline-size;
  z-index: 1; isolation: isolate;
  border: 0; padding: 0; background: transparent; cursor: pointer;
  transform: rotate(var(--packet-angle));
  filter: drop-shadow(0 12px 9px #29372e22);
}
.lia-welcome-packet:nth-child(even), .lia-welcome-mascot-slot:nth-child(even) { --packet-angle: 7deg; }
.lia-welcome-packet-2 { --packet-phase: -0.85s; --packet-delay: .09s; }
.lia-welcome-packet-3 { --packet-phase: -1.70s; --packet-delay: .18s; }
.lia-welcome-packet-4 { --packet-phase: -2.55s; --packet-delay: .27s; }
.lia-welcome-packet-5 { --packet-phase: -3.40s; --packet-delay: .36s; }
.lia-welcome-packet-6 { --packet-phase: -4.25s; --packet-delay: .45s; }
.lia-welcome-packet-7 { --packet-phase: -5.10s; --packet-delay: .54s; }
.lia-welcome-packet-8 { --packet-phase: -5.95s; --packet-delay: .63s; }
.lia-welcome-drift {
  display: block; width: 100%; height: 100%;
  animation: lia-welcome-float 8s ease-in-out var(--packet-phase) infinite;
}
.lia-welcome-orbits i { animation: lia-welcome-orbit 9s ease-in-out infinite alternate; }
.lia-welcome-orbits i:nth-child(2) { animation-delay: -3s; }
.lia-welcome-orbits i:nth-child(3) { animation-delay: -6s; }
.lia-welcome-packet .pb-sachet-render {
  width: 100%; height: auto; aspect-ratio: 3 / 4; margin: 0;
  /* Keep the occluding surface solid from the first frame of each peek. */
  animation: none;
}
.lia-welcome-packet .pb-sachet-render-top { padding: 14% 6% 8%; }
.lia-welcome-packet .pb-sachet-render-name { font-size: clamp(9px, 13cqw, 22px); letter-spacing: -.035em; }
.lia-welcome-packet .pb-sachet-render-window { margin: 0 9%; padding: 0; }
.lia-welcome-packet .pb-sachet-render-body { margin: 6% 7% 0; padding: 0 0 12%; }
.lia-welcome-packet .pb-sachet-render-subtitle { font-size: clamp(4px, 5cqw, 9px); }
/* Interacting with a mascot never reorders or lifts its sachet. */
.lia-welcome-packet:focus-visible { outline: 2px solid #253c30; outline-offset: 7px; border-radius: 4px; }
.lia-welcome-art-caption { position: absolute; bottom: 5%; left: 5%; right: 5%; margin: 0; text-align: center; font-size: 13px; line-height: 1.5; color: #304034; }
@keyframes lia-welcome-float {
  0%, 100% { transform: perspective(600px) translate3d(-3px, 5px, 0) rotateZ(-3deg) rotateY(-8deg); }
  25% { transform: perspective(600px) translate3d(4px, -10px, 12px) rotateZ(3deg) rotateY(9deg); }
  50% { transform: perspective(600px) translate3d(6px, -3px, 0) rotateZ(5deg) rotateY(0deg); }
  75% { transform: perspective(600px) translate3d(-4px, 9px, -8px) rotateZ(-2deg) rotateY(-10deg); }
}
@keyframes lia-welcome-orbit {
  from { transform: rotateX(12deg) rotateZ(-14deg) scale(.92); opacity: .45; }
  to { transform: rotateX(34deg) rotateZ(16deg) scale(1.08); opacity: 1; }
}
@keyframes lia-welcome-unfold {
  0% { opacity: 0; transform: translateY(65px) rotateY(-65deg) scale(.65); }
  65% { opacity: 1; transform: translateY(-12px) rotateY(10deg) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) rotateY(0) scale(1); }
}
@media (max-width: 600px) {
  body[data-screen="lia-builder"] #lia-builder.screen.is-guided-welcome { padding-top: calc(var(--navbar-h) + 8px); }
  .lia-welcome-art { aspect-ratio: .95; }
  .lia-welcome-art-caption { font-size: 11px; }
  .lia-welcome-packages { inset: 10% 7% 16%; gap: 12% 6%; }
}
@media (prefers-reduced-motion: reduce) {
  .lia-welcome-packet, .lia-welcome-art::before { transition: none; }
  .lia-welcome-packet .pb-sachet-render, .lia-welcome-drift, .lia-welcome-orbits i { animation: none; }
}

/* A larger storefront display. Packet dimensions stay identical to home (3:4). */
.lia-welcome { max-width: 1536px; padding-inline: clamp(24px, 3vw, 44px); }
.lia-welcome-main { grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr); gap: clamp(24px, 3vw, 46px); }
.lia-welcome-art { aspect-ratio: 1.06; }
.lia-welcome-packages { inset: 8% 4% 15%; gap: 5% 3%; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render { --pb-sachet-render-base-height: 340px; box-shadow: inset 0 1px 0 #ffffff99; }
/* Scale the heat seal and tear notch with the packet, not the viewport height. */
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render {
  -webkit-mask: radial-gradient(circle 3.5cqw at 0 8.1%, transparent 0 98%, #000 100%);
  mask: radial-gradient(circle 3.5cqw at 0 8.1%, transparent 0 98%, #000 100%);
}
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render::before { border-width: 4.9cqw; background-size: 100% 100%; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render::after {
  top: calc(8.1% - 3.5cqw); width: 7cqw; height: 7cqw;
  background: radial-gradient(circle at 0 50%, transparent 0 3.3cqw, #111b3224 3.4cqw 3.8cqw, transparent 3.9cqw);
}
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render-top { padding: 9.1% 9.1% 4.8%; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render-name { font-size: 10.9cqw; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render-window { margin: 0 9.1%; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render-body { margin: 4.8% 9.1% 0; padding-bottom: 12.2%; }
:is(.lia-welcome-packet, .lia-protocol-preview-sachet) .pb-sachet-render-subtitle { font-size: 5.2cqw; white-space: nowrap; }
.lia-welcome-art-caption { left: 18%; right: 18%; bottom: 4%; }
.lia-mascot { display: block; position: relative; aspect-ratio: 1; isolation: isolate; }
.lia-mascot-frame { display: block; position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; }
.lia-mascot-still, .lia-mascot-motion { display: block; width: 100%; height: 100%; object-fit: contain; opacity: 1; filter: none; mix-blend-mode: normal; }
.lia-mascot-motion { position: absolute; inset: 0; }
.lia-mascot-motion[hidden] { display: none; }
.lia-mascot:has(.lia-mascot-motion:not([hidden])) .lia-mascot-still { visibility: hidden; }
.lia-mascot[data-mascot="muscle"] { scale: 1.25; translate: -6% 0; transform-origin: 50% 90%; }
.lia-welcome-mascot { position: absolute; width: 15%; bottom: 0; right: 1%; pointer-events: none; animation: lia-mascot-arrive .55s cubic-bezier(.16,1,.3,1); }
.lia-welcome-mascot[hidden] { display: none; }
@keyframes lia-mascot-arrive { from { opacity: 0; transform: translateY(28px) rotate(-12deg) scale(.7); } to { opacity: 1; transform: none; } }

/* Questions share the welcome's warm canvas, oversized type and sage artwork. */
body[data-screen="lia-builder"] #lia-builder.is-guided-intake:not(.is-guided-welcome) { background: #faf9f6; }
#lia-builder.is-guided-intake:not(.is-guided-welcome) .lia-builder-shell { max-width: 1320px; padding: 16px 28px 0; background: #faf9f6; }
#lia-builder.is-guided-intake:not(.is-guided-welcome) .lia-builder-chat-wrap { background: transparent; box-shadow: none; border: 0; border-radius: 0; }
#lia-builder.is-guided-intake:not(.is-guided-welcome) .lia-builder-chat-head { background: transparent; padding: 0 0 16px; min-height: 52px; border: 0; }
#lia-builder.is-guided-intake:not(.is-guided-welcome) .lia-builder-disclaimer { color: #62645e; padding-block: 10px; }
#lia-builder.is-guided-intake #lia-builder-progress { padding: 0 0 22px; gap: 18px; }
#lia-builder.is-guided-intake #lia-builder-progress li { color: #686b61; font-size: 12px; }
#lia-builder.is-guided-intake #lia-builder-progress li[aria-current] { color: #17221b; }
#lia-builder.is-guided-intake #lia-builder-progress li > span { background: #e2e4da; height: 3px; }
#lia-builder.is-guided-intake #lia-builder-progress li.is-reached > span { background: #263c2d; }
#lia-builder.is-guided-intake:not(.is-guided-welcome) #lia-builder-guidance { padding: 12px 8px 24px 0; }
.lia-intake-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .85fr); gap: clamp(28px, 4vw, 56px); align-items: start; color: #17221b; }
.lia-intake-content { min-width: 0; }
.lia-intake-content .lia-guided-heading { text-align: left; max-width: none; margin: 0 0 28px; }
.lia-intake-content .lia-guided-heading > p { display: block; color: #62645e; font-size: 11px; letter-spacing: .16em; margin-bottom: 16px; }
.lia-intake-content .lia-guided-heading h2 { font-size: clamp(32px, 3.3vw, 48px); letter-spacing: -.05em; line-height: 1.02; color: #141512; font-weight: 900; max-width: 640px; outline: none; }
.lia-intake-content .lia-guided-heading > span { display: block; max-width: 500px; color: #62645e; line-height: 1.55; }
.lia-intake-content .lia-guided-choices { max-width: none; gap: 12px; }
.lia-intake-content .lia-guided-choice { min-height: 105px; padding: 14px 12px; border-color: #dedfd6; background: #fffefa; border-radius: 16px; gap: 10px; color: #17221b; transition: border-color .2s, background .2s, transform .2s; }
.lia-intake-content .lia-guided-choice:hover { border-color: #6c7d67; transform: translateY(-2px); }
.lia-intake-content .lia-guided-choice[aria-pressed="true"] { background: #edf2d5; border-color: #455a3b; box-shadow: inset 0 0 0 1px #455a3b; }
.lia-intake-content .lia-guided-choice .lia-mascot { width: 58px; flex: 0 0 58px; }
.lia-intake-content .lia-guided-choice-copy strong { font-size: 15px; line-height: 1.2; }
.lia-intake-content .lia-guided-choice-copy small { font-size: 11px; line-height: 1.4; color: #677060; }
.lia-intake-content .lia-guided-check { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid #c9cfbf; color: #677060; font-size: 15px; }
.lia-intake-content .lia-guided-choice[aria-pressed="true"] .lia-guided-check { background: #2b412c; color: #f5f9e9; border-color: #2b412c; }
.lia-intake-content .lia-guided-icon { background: #edf0e5; border-radius: 50%; font-size: 13px; font-weight: 800; width: 34px; height: 34px; flex-basis: 34px; }
.lia-intake-content .lia-guided-actions { max-width: none; background: #faf9f6ed; backdrop-filter: blur(12px); padding-block: 20px; bottom: -24px; margin-top: 16px; }
.lia-intake-content .lia-guided-actions > span { color: #677060; }
.lia-intake-content .lia-guided-continue { min-height: 52px; background: var(--lime); color: #19221c; font-size: 15px; padding-inline: 24px; }
.lia-intake-content .lia-guided-context { max-width: none; margin-block: 24px 8px; }
.lia-intake-content .lia-guided-context label, .lia-care-details label { color: #4b5747; font-size: 13px; line-height: 1.5; }
.lia-intake-content #lia-guided-context, .lia-care-details textarea { width: 100%; border: 1px solid #d5dacb; border-radius: 14px; background: #fffefa; padding: 14px; color: #17221b; font: inherit; font-size: 14px; resize: vertical; }
.lia-care-details { display: grid; gap: 18px; margin-top: 20px; }
.lia-care-details:empty { display: none; }
.lia-care-details textarea { display: block; margin-top: 8px; }
[data-intake-step="care"] .lia-guided-choices { grid-template-columns: 1fr; gap: 8px; }
[data-intake-step="care"] .lia-guided-choice { min-height: 70px; }
.lia-intake-scene { position: sticky; top: 4px; overflow: hidden; isolation: isolate; min-height: 570px; padding: 30px; border-radius: 26px; background: radial-gradient(ellipse at 50% 36%, #fffdf0, #e5ecdf 76%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.lia-scene-kicker { color: #68745f; font-size: 10px; font-weight: 800; letter-spacing: .18em; z-index: 1; }
.lia-intake-scene > .lia-mascot { width: min(100%, 330px); margin-block: 24px 10px; }
.lia-scene-orbit { position: absolute; width: 90%; aspect-ratio: 1; border: 1px solid #ffffffb3; top: 12%; border-radius: 50%; box-shadow: 0 0 0 35px #ffffff26, 0 0 0 70px #ffffff1a; animation: lia-welcome-orbit 10s ease-in-out infinite alternate; pointer-events: none; }
.lia-scene-copy { position: relative; z-index: 1; margin-top: auto; }
.lia-scene-name { font-weight: 800; font-size: 14px; display: inline-block; border: 1px solid #c6cebd; padding: 6px 14px; border-radius: 30px; }
.lia-scene-copy h3 { font-size: clamp(24px, 2.3vw, 34px); font-weight: 900; line-height: 1.06; letter-spacing: -.04em; margin: 18px 0 12px; color: #1c2a20; }
.lia-scene-copy p { color: #66715d; font-size: 13px; line-height: 1.65; margin: 0; }

@media (max-width: 1050px) {
  .lia-intake-layout { grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr); gap: 24px; }
  .lia-intake-scene { min-height: 480px; padding: 24px 20px; }
  .lia-intake-content .lia-guided-choice .lia-mascot { width: 42px; flex-basis: 42px; }
}
@media (max-width: 900px) {
  .lia-welcome-main { grid-template-columns: 1fr; }
  .lia-welcome-art { max-width: 650px; }
  .lia-intake-layout { grid-template-columns: 1fr; }
  .lia-intake-scene { position: relative; top: auto; order: -1; min-height: 0; display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 20px; text-align: left; padding: 16px 22px; border-radius: 20px; }
  .lia-intake-scene > .lia-mascot { width: 120px; margin: 0; }
  .lia-scene-kicker, .lia-scene-orbit, .lia-scene-copy p { display: none; }
  .lia-scene-copy { margin: 0; }
  .lia-scene-name { font-size: 11px; padding: 3px 10px; }
  .lia-scene-copy h3 { font-size: 25px; margin: 10px 0 0; }
}
@media (max-width: 600px) {
  .lia-welcome-packages { inset: 8% 5% 15%; gap: 6% 5%; }
  .lia-welcome-art { aspect-ratio: .95; }
  .lia-welcome-art-caption { left: 5%; right: 18%; font-size: 10px; }
  #lia-builder.is-guided-intake:not(.is-guided-welcome) .lia-builder-shell { padding: 12px 20px 0; }
  #lia-builder.is-guided-intake:not(.is-guided-welcome) #lia-builder-guidance { padding: 4px 3px 24px 0; }
  .lia-intake-layout { gap: 24px; }
  .lia-intake-content .lia-guided-heading h2 { font-size: 35px; }
  .lia-intake-content .lia-guided-heading { margin-bottom: 22px; }
  .lia-intake-content .lia-guided-choices { grid-template-columns: 1fr; gap: 9px; }
  .lia-intake-content .lia-guided-choice { min-height: 78px; padding: 12px; }
  .lia-intake-content .lia-guided-choice .lia-mascot { width: 50px; flex-basis: 50px; }
  .lia-intake-content .lia-guided-choice-copy strong { font-size: 15px; }
  .lia-intake-content .lia-guided-choice-copy small { font-size: 12px; }
  .lia-intake-scene { grid-template-columns: 90px 1fr; gap: 12px; padding: 12px 16px; }
  .lia-intake-scene > .lia-mascot { width: 90px; }
  .lia-scene-copy h3 { font-size: 22px; }
  .lia-intake-content .lia-guided-actions { gap: 10px; }
  .lia-intake-content .lia-guided-continue { padding-inline: 18px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .lia-welcome-mascot, .lia-scene-orbit { animation: none; }
  .lia-mascot video { display: none; }
  .lia-mascot .lia-mascot-still { visibility: visible !important; }
  .lia-intake-content .lia-guided-choice { transition: none; }
}
/* The same cast accompanies the actual saved formula and its chosen flavors. */
#lia-builder-protocol-preview { background: #faf9f6; border-color: #dde1d6; }
#lia-builder-protocol-preview .lia-protocol-preview-heading { color: #17221b; }
#lia-builder-protocol-preview .lia-protocol-preview-heading h2 { font-size: clamp(30px, 3vw, 44px); font-weight: 900; }
#lia-builder-protocol-preview .lia-protocol-preview-card { grid-template-columns: 110px minmax(0, 1fr); background: #fffefa; color: #17221b; border-color: #dde1d6; border-radius: 20px; }
#lia-builder-protocol-preview .lia-protocol-preview-card { position:relative; }
#lia-builder-protocol-preview .lia-protocol-preview-sachet { display: block; position: relative; min-height: 0; padding: 0; background: transparent; border-radius: 0; overflow: visible; color: #203720; container-type: inline-size; }
.lia-protocol-preview-sachet .pb-sachet-render { width: 100%; height: auto; aspect-ratio: 3 / 4; margin: 0; }
.lia-preview-companion { position: absolute; width: 62%; bottom: -10%; right: -8%; }
.lia-preview-flavor { display: inline-block; background: #edf2d5; color: #42523a; border-radius: 20px; padding: 5px 10px; font-size: 11px; }
.lia-preview-card-body{min-width:0}
.lia-preview-remove{position:absolute;z-index:5;top:10px;right:10px;width:32px;height:32px;border:1px solid #d8ddd1;border-radius:50%;background:#fffefa;color:#65705f;font:500 20px/1 var(--font-body);cursor:pointer}
.lia-preview-remove:hover{border-color:#98584c;color:#88483d;background:#fff5f1}
.lia-preview-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:14px 0 10px}
.lia-preview-controls label{display:flex;min-width:0;flex-direction:column;gap:6px;color:#687260;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.lia-preview-controls label>span{display:flex;align-items:center;gap:5px;min-height:20px}
.lia-preview-controls select{width:100%;min-height:40px;border:1px solid #d5dccb;border-radius:11px;background:#fafbf4;color:#253827;padding:8px 25px 8px 9px;font:700 12px var(--font-body)}
.lia-preview-controls small{font-size:9px;font-weight:600;line-height:1.3;text-transform:none;letter-spacing:0;color:#6b7764}
.lia-preview-ai{display:inline-flex;align-items:center;gap:3px;padding:3px 6px;border-radius:20px;background:#e6f25b;color:#293a22;font-size:8px;font-weight:900;letter-spacing:.06em;white-space:nowrap}
.lia-preview-ingredients{margin-top:8px;border-top:1px solid #e4e7df;border-bottom:1px solid #e4e7df}
.lia-preview-ingredients summary{padding:11px 0;color:#53624d;font-size:11px;font-weight:800;cursor:pointer}
.lia-preview-ingredients ul{margin:0 0 10px}
.lia-preview-edit{width:100%;margin-top:12px;border:1px solid #cdd6c4;border-radius:12px;background:#f7f9ee;color:#30482e;padding:11px 13px;font:800 12px var(--font-body);cursor:pointer}
.lia-preview-edit span{float:right}
.lia-preview-add{position:relative;margin:-6px 0 20px}
.lia-preview-add-toggle{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;border:1px dashed #aebba3;border-radius:14px;background:#f8faef;color:#385036;font:800 13px var(--font-body);cursor:pointer}
.lia-preview-add-toggle:disabled{opacity:.45;cursor:default}
.lia-preview-add-toggle>span{font-size:20px}
.lia-preview-add-panel{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:9px;padding:10px;border:1px solid #d9dfd1;border-radius:14px;background:#fffefa}
.lia-preview-add-panel[hidden]{display:none}
.lia-preview-add-panel button{min-height:42px;border:1px solid #dbe1d4;border-radius:10px;background:#fafbf6;color:#30452e;font:800 12px var(--font-body);cursor:pointer}
.lia-preview-add-panel .pb-sachet-render-name-mark{margin-right:2px}
@media (max-width: 600px) { #lia-builder-protocol-preview .lia-protocol-preview-card { grid-template-columns: 76px minmax(0, 1fr); } }
@media (max-width:600px){.lia-preview-controls{grid-template-columns:1fr}.lia-preview-remove{top:7px;right:7px}.lia-preview-add-panel{grid-template-columns:1fr 1fr}}

.lia-preview-flavor { animation: lia-mascot-arrive .45s ease-out; }
@media (prefers-reduced-motion: reduce) { .lia-preview-flavor { animation: none; } }

/* Complete peeking sprites sit behind the real, opaque sachet surface. */
.lia-welcome-drift { --peek-top: -55%; position: relative; isolation: isolate; }
.lia-welcome-companion { position: absolute; display: block; width: 108%; aspect-ratio: 1; left: -4%; top: 0; z-index: 0; pointer-events: auto; transform: translateY(4%); animation: lia-mascot-peek 6.8s ease-in-out var(--packet-phase) infinite; }
.lia-welcome-grip { position: absolute; display: block; width: 108%; height: auto; aspect-ratio: 1; left: -4%; top: 0; z-index: 2; pointer-events: none; visibility: hidden; transform: translateY(4%); animation: lia-mascot-peek 6.8s ease-in-out var(--packet-phase) infinite, lia-mascot-grip 6.8s steps(1,end) var(--packet-phase) infinite; }
.lia-welcome-packet[aria-pressed="true"] .lia-welcome-grip,
.lia-welcome-packet[data-mascot-transition] .lia-welcome-grip { visibility: hidden; animation: none; }
.lia-welcome-companion img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.lia-welcome-front { position: absolute; display: block; inset: 0; opacity: 0; pointer-events: none; }
/* The foreground mirrors each packet's position, rotation and drift, but sits
   above the complete packet group rather than inside one packet's stack. */
.lia-welcome-foreground { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.lia-welcome-mascot-slot { visibility: hidden; pointer-events: none; filter: none; }
.lia-welcome-mascot-slot:is([data-active="true"], [data-mascot-transition]) { visibility: visible; }
.lia-welcome-mascot-slot .lia-welcome-companion { animation: none; transform: translateY(40%); pointer-events: none; }
.lia-welcome-mascot-slot:is([data-active="true"], [data-mascot-transition]) .lia-welcome-companion { pointer-events: auto; }
.lia-welcome-mascot-slot[data-active="true"] .lia-welcome-front { opacity: 1; }
/* Remove the legacy animation matte fringe without tinting the artwork.
   Gut and Sleep already use clean, corrected stills. */
.lia-welcome-front .lia-mascot:not([data-mascot="gut"]):not([data-mascot="sleep"]) .lia-mascot-frame { filter: url("/assets/mascots/edge-cleanup.svg#trim"); }
.lia-welcome-packet[aria-pressed="true"] .lia-welcome-peek { opacity: 0; }
.lia-welcome-packet[aria-pressed="true"] .lia-welcome-front { opacity: 1; }
/* Preserve the opaque accessories on the two corrected original mascots. */
.lia-welcome-mascot-slot[data-active="true"] .lia-welcome-front .lia-mascot[data-mascot="gut"] { animation: lia-welcome-gut-sway 1.7s ease-in-out infinite alternate; }
.lia-welcome-mascot-slot[data-active="true"] .lia-welcome-front .lia-mascot[data-mascot="sleep"] { animation: none; }
@keyframes lia-welcome-gut-sway { from { transform: translateY(2px) rotate(-2deg); } to { transform: translateY(-5px) rotate(3deg); } }
@keyframes lia-welcome-sleep-breathe { 0%, 100% { transform: translateY(2px) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(1deg); } }
.lia-welcome-drift[data-peek-mascot="pre"],
.lia-welcome-drift[data-peek-mascot="daily"] { --peek-top: -56%; }
.lia-welcome-drift[data-peek-mascot="focus"] { --peek-top: -52%; }
.lia-welcome-drift[data-peek-mascot="muscle"] { --peek-top: -50%; }
.lia-welcome-drift[data-peek-mascot="gut"] { --peek-top: -46%; }
.lia-welcome-packet[aria-pressed="true"] .lia-welcome-companion { z-index: 3; animation: none; transform: translateY(40%); }
.lia-welcome-packet[data-mascot-transition] .lia-welcome-companion { animation: none; }
/* Lift both hands clear of the seam, bring them forward, then settle onto it.
   The overlay and body share a path; visibility changes only above the sachet. */
@keyframes lia-mascot-peek {
  0%, 16%, 84%, 100% { transform: translateY(4%); }
  28%, 67% { transform: translateY(calc(var(--peek-top) - 10%)); }
  36%, 59% { transform: translateY(var(--peek-top)); }
}
@keyframes lia-mascot-grip {
  0%, 67%, 100% { visibility: hidden; }
  28% { visibility: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .lia-welcome-companion, .lia-welcome-grip { animation: none; transform: translateY(var(--peek-top)); }
  .lia-welcome-grip { visibility: visible; }
  .lia-welcome-mascot-slot[data-active="true"] .lia-welcome-front .lia-mascot { animation: none; }
}
.lia-welcome-packet .pb-sachet-render { position: relative; z-index: 1; }
.lia-welcome-packet, .lia-welcome-packet[aria-pressed="true"] { filter: none; }
.lia-welcome-packet .pb-sachet-render { filter: drop-shadow(0 12px 9px #29372e22); }
.lia-welcome-art-caption { left: 8%; right: 8%; }

/* Each selected goal joins the same persistent playground. */
.lia-intake-scene.lia-playground { display: flex; flex-direction: column; min-height: 540px; padding: 24px 18px; text-align: center; }
.lia-play-field { width: 100%; position: relative; height: 470px; flex: none; }
.lia-play-floor { position: absolute; left: 4%; right: 4%; bottom: 6%; height: 55%; border-radius: 50%; background: radial-gradient(ellipse, #d4e5b67a, #e5eccf24 65%, transparent 70%); border: 1px solid #ffffffb0; transform: rotateX(32deg); box-shadow: 0 0 0 28px #ffffff24; }
.lia-play-actors { position: absolute; inset: 0; }
.lia-play-actor { max-width: 210px; position: absolute; transform: translate(-50%,-50%); padding: 0; border: 0; background: none; cursor: pointer; transition: left .75s cubic-bezier(.22,1,.36,1), top .75s cubic-bezier(.22,1,.36,1), width .65s ease; }
.lia-play-body { display: block; position: relative; z-index: 1; }
.lia-play-sky { display: none; position: absolute; inset: 0; pointer-events: none; }
.lia-playground[data-play-mode="routine"] { transition: background .7s ease, box-shadow .7s ease; }
.lia-playground[data-play-mode="routine"] .lia-play-sky { display: block; }
.lia-play-sky::before { content: ""; position: absolute; top: 6%; left: 10%; width: 50px; height: 50px; border-radius: 50%; background: #efcc7e; opacity: 0; box-shadow: 0 0 0 12px #efcc7e20, 0 0 0 25px #efcc7e0d; transition: opacity .6s ease, background .6s ease, transform .6s ease, box-shadow .6s ease; }
.lia-play-sky::after { content: ""; position: absolute; inset: 7% 12% 40%; opacity: 0; background: radial-gradient(circle at 60% 6%,#fffbe3 0 2px,transparent 3px), radial-gradient(circle at 95% 34%,#fffbe3 0 2px,transparent 3px), radial-gradient(circle at 48% 45%,#fffbe3 0 1px,transparent 2px); transition: opacity .6s ease; }
.lia-playground[data-routine-time="time_morning"] { background: linear-gradient(160deg,#f8e9ce,#e7eddd 65%); }
.lia-playground[data-routine-time="time_afternoon"] { background: linear-gradient(145deg,#f3e2b8,#edebd5 55%,#dce7d9); }
.lia-playground[data-routine-time="time_evening"] { background: linear-gradient(155deg,#7b8ca4,#b1bccc 45%,#dce4dc); }
.lia-playground[data-routine-time="time_varies"] { background: linear-gradient(135deg,#f6dfbd,#e0e9df 50%,#bccadd); }
.lia-playground[data-routine-time="time_morning"] .lia-play-sky::before { opacity: 1; }
.lia-playground[data-routine-time="time_afternoon"] .lia-play-sky::before { opacity: 1; background: #ebba61; transform: translateX(45px); }
.lia-playground[data-routine-time="time_evening"] .lia-play-sky::before { opacity: 1; background: transparent; box-shadow: -12px 6px 0 0 #fff4d4; transform: translateX(16px) rotate(-20deg); }
.lia-playground[data-routine-time="time_evening"] .lia-play-sky::after { opacity: 1; }
.lia-playground[data-routine-time="time_varies"] .lia-play-sky::before { opacity: 1; background: linear-gradient(90deg,#efcc7e 50%,#9cacc1 50%); }
.lia-playground[data-play-mode="routine"][data-routine-day="seated"] .lia-play-body { animation: lia-routine-rest 4.5s ease-in-out var(--actor-phase) infinite; }
.lia-playground[data-play-mode="routine"][data-routine-day="moving"] .lia-play-body { animation: lia-routine-walk 2.6s ease-in-out var(--actor-phase) infinite; }
.lia-playground[data-play-mode="routine"][data-routine-day="training"] .lia-play-body { animation: lia-routine-bounce 1.6s ease-in-out var(--actor-phase) infinite; }
.lia-playground[data-play-mode="routine"][data-routine-day="varied"] .lia-play-body { animation: lia-routine-wander 3.8s ease-in-out var(--actor-phase) infinite; }
@keyframes lia-routine-rest { 0%,100% { transform: rotate(-1deg); } 50% { transform: translateY(2px) rotate(1deg); } }
@keyframes lia-routine-walk { 0%,100% { transform: translateX(-6px) rotate(-3deg); } 50% { transform: translate(6px,-4px) rotate(3deg); } }
@keyframes lia-routine-bounce { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-12px) rotate(3deg); } }
@keyframes lia-routine-wander { 0%,100% { transform: translate(-5px,2px) rotate(-4deg); } 35% { transform: translate(6px,-7px) rotate(4deg); } 70% { transform: translate(3px,1px); } }
.lia-play-actor:hover { z-index: 3; }
.lia-play-actor:focus-visible { outline: 2px dashed #506649; outline-offset: 2px; border-radius: 45%; z-index: 4; }
.lia-play-actor:hover .lia-play-body { animation-play-state: paused; }
.lia-play-shadow { position: absolute; left: 30%; right: 25%; bottom: 7%; height: 5%; background: #6b7c5626; filter: blur(4px); border-radius: 50%; }
@keyframes lia-play-sway { 0%,100% { transform: translateY(3px) rotate(-3deg); } 35% { transform: translateY(-9px) rotate(3deg); } 65% { transform: translateY(1px) rotate(1deg); } }
.lia-play-empty { position: absolute; inset: 28% 8% auto; line-height: 1.6; color: #778269; font-size: 16px; }
.lia-play-empty[hidden], .lia-play-ball[hidden], .lia-play-speech[hidden] { display: none; }
.lia-play-speech { position: absolute; z-index: 7; width: 184px; max-width: calc(100% - 16px); padding: 12px 15px 14px; margin: 0; border: 1px solid #d1dcc4; border-radius: 19px; background: #fffff8; box-shadow: 0 8px 22px #51613912; text-align: left; pointer-events: none; transform-origin: var(--bubble-tail,50%) 100%; }
.lia-play-speech::after { content: ""; position: absolute; width: 12px; height: 12px; bottom: -7px; left: calc(var(--bubble-tail,50%) - 6px); transform: rotate(45deg); border-right: 1px solid #d1dcc4; border-bottom: 1px solid #d1dcc4; background: #fffff8; }
.lia-play-speech .lia-scene-name { display: block; padding: 0; margin: 0 0 5px; border: 0; background: none; border-radius: 0; font-size: 10px; line-height: 1.2; font-weight: 800; color: #718062; }
.lia-play-speech h3 { margin: 0; font-size: 14px; line-height: 1.28; font-weight: 750; letter-spacing: -.02em; color: #203320; }
.lia-play-actor[aria-pressed="true"] { z-index: 4; }
.lia-play-ball { width: 19px; height: 19px; position: absolute; z-index: 5; border-radius: 50%; background: radial-gradient(circle at 30% 25%,#ffffed,#dfed72 50%,#b0cb5f); box-shadow: 0 3px 8px #73853e26; opacity: 0; pointer-events: none; }
.lia-day-picker fieldset { border: 0; padding: 0; margin: 0 0 28px; }
.lia-day-picker legend { font-weight: 800; font-size: 15px; margin-bottom: 14px; }
.lia-day-activities { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.lia-day-activities button { display: flex; flex-direction: column; align-items: flex-start; padding: 18px; gap: 5px; border-radius: 18px; border: 1px solid #d9dfcf; background: #fffefa; color: #243522; text-align: left; cursor: pointer; }
.lia-day-activities strong { font: 800 16px var(--font-body); }
.lia-day-activities small { font: 12px var(--font-body); color: #6b7764; }
.lia-day-symbol { font-size: 35px; font-weight: 400; line-height: 1; margin-bottom: 12px; color: #647b4f; }
.lia-day-activities [aria-pressed="true"], .lia-day-times [aria-pressed="true"] { border-color: #3d5634; box-shadow: inset 0 0 0 1px #3d5634; background: #edf2d5; }
.lia-day-clock { display: flex; gap: 16px; align-items: center; color: #9ea958; font-size: 24px; margin: 0 10px 16px; }
.lia-day-clock i { height: 3px; border-radius: 4px; flex: 1; background: linear-gradient(90deg,#d8df83,#e4bd8e,#aebdd6); }
.lia-day-times { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.lia-day-times button { border: 1px solid #d9dfcf; border-radius: 30px; background: #fffefa; padding: 12px 4px; font: 750 13px var(--font-body); color: #384730; cursor: pointer; }
[data-intake-step="care"] .lia-care-details { margin-top: 30px; }
[data-intake-step="care"] .lia-care-details textarea { min-height: 210px; }
[data-intake-step="care"] .lia-guided-actions { margin-top: 32px; }
.lia-play-cauldron { position: absolute; z-index: 2; left: 40%; bottom: 9%; width: 20%; height: 18%; border-radius: 10px 10px 70px 70px; border: 2px solid #7f956a; background: linear-gradient(130deg,#fffff7,#d4e3b4); box-shadow: 0 14px 12px -12px #58794066; pointer-events: none; }
.lia-play-cauldron i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #bdcf86; left: 35%; top: -15%; animation: lia-bubble 2.1s ease-out infinite; }
.lia-play-cauldron i:nth-child(2) { left: 60%; animation-delay: -.6s; }
.lia-play-cauldron i:nth-child(3) { left: 48%; animation-delay: -1.3s; }
@keyframes lia-bubble { from { opacity: .9; transform: translateY(0) scale(.5); } to { opacity: 0; transform: translateY(-40px) scale(1.5); } }

/* Final choices edit the existing draft, using the catalog's actual options. */
.lia-flavor-studio { width: min(1120px,calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 48px); margin: auto; padding: 30px 38px; border: 1px solid #dce2d2; border-radius: 28px; background: #faf9f6; color: #1c2d21; box-shadow: 0 28px 100px #111b3240; overflow-y: auto; }
.lia-flavor-studio::backdrop { background: #18281d80; backdrop-filter: blur(8px); }
.lia-flavor-studio header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.lia-flavor-studio header button { border: 0; background: none; font: 700 13px var(--font-body); padding: 8px 0; color: #5c6b52; cursor: pointer; }
.lia-flavor-studio header > span { font-size: 10px; font-weight: 800; letter-spacing: .16em; color: #708060; }
.lia-finish-heading { margin-block: 22px; }
.lia-finish-heading h2 { font-size: clamp(32px,4vw,52px); line-height: 1.05; letter-spacing: -.05em; font-weight: 900; margin: 0 0 10px; }
.lia-finish-heading p { color: #6c7960; font-size: 14px; margin: 0; }
.lia-finish-tabs { display: flex; gap: 10px; overflow-x: auto; padding: 3px 3px 16px; }
.lia-finish-tabs button { flex: 0 0 auto; min-width: 120px; border: 1px solid #d4ddc8; border-radius: 14px; background: #fffefa; color: #2a402b; padding: 10px 18px; font: 800 14px var(--font-body); cursor: pointer; }
.lia-finish-tabs button small { display: block; font-size: 10px; font-weight: 500; color: #65745a; margin-top: 4px; }
.lia-finish-tabs [aria-pressed="true"] { background: #e8eed8; border-color: #536f44; }
.lia-finish-layout { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 34px; margin-top: 12px; }
.lia-finish-stage { position: sticky; top: 0; height: 460px; min-width: 0; border: 2px solid transparent; border-radius: 24px; background: radial-gradient(ellipse at 45% 35%,#f7f9e5,#e0e9d4); overflow: hidden; isolation: isolate; }
.lia-finish-ring { position: absolute; inset: 12% 8% 15%; border: 1px solid #ffffff99; border-radius: 50%; box-shadow: 0 0 0 26px #ffffff30; }
.lia-finish-character { position: absolute; left: -1%; top: 24%; width: 51%; z-index: 2; }
.lia-finish-packet { position: absolute; width: 37%; right: 10%; top: 22%; container-type: inline-size; transform: rotate(5deg); filter: drop-shadow(0 18px 12px #42583925); }
.lia-finish-stamp { position: absolute; top: 37%; left: 30%; width: 42%; display: flex; align-items: center; justify-content: center; }
.lia-finish-stamp svg { filter: drop-shadow(0 2px 3px #ffffff88); }
.lia-finish-floor { position: absolute; left: 10%; right: 10%; bottom: 17%; height: 8%; background: #a1b58233; border-radius: 50%; filter: blur(8px); z-index: -1; }
.lia-finish-stage > p { position: absolute; bottom: 6%; left: 0; right: 0; text-align: center; color: #435c36; font: 800 18px var(--font-body); }
.lia-finish-controls fieldset { border: 0; padding: 0; margin: 0 0 24px; }
.lia-finish-controls legend { font-size: 16px; font-weight: 850; margin-bottom: 12px; }
.lia-finish-controls fieldset > p { font-size: 12px; color: #6b7960; margin: -4px 0 15px; }
.lia-finish-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lia-finish-forms button { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; padding: 18px 12px; min-height: 85px; border: 1px solid #d5deca; border-radius: 16px; background: #fffefa; color: #354b2e; cursor: pointer; font-family: inherit; }
.lia-finish-forms [aria-pressed="true"] { border-color: #48643d; box-shadow: inset 0 0 0 1px #48643d; background: #edf3d9; }
.lia-finish-forms button:disabled { opacity: .4; cursor: not-allowed; }
.lia-finish-forms button small { flex: 0 0 100%; font-size: 10px; }
.lia-capsule-art { display: inline-block; width: 33px; height: 15px; border: 2px solid #476347; border-radius: 20px; background: linear-gradient(90deg,#c6d9a7 0 48%,#476347 48% 53%,#fffef0 53%); transform: rotate(-35deg); }
.lia-powder-art { font-size: 38px; color: #6e8a55; line-height: 1; }
.lia-flavor-palette { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.lia-flavor-palette button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid #d7dfce; border-radius: 16px; background: #fffefa; padding: 8px 5px 12px; color: #43573a; font: 700 11px var(--font-body); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.lia-flavor-palette button[aria-pressed="true"] { border-color: #49673b; background: #eaf1d6; box-shadow: inset 0 0 0 1px #49673b; }
.lia-flavor-palette button:active { cursor: grabbing; }
.lia-flavor-fruit { width: 62px; max-width: 100%; height: auto; display: block; pointer-events: none; }
.lia-flavor-palette button:hover svg { transform: translateY(-4px) rotate(-7deg); transition: transform .2s ease; }
.lia-finish-status { color: #68785c; font-size: 12px; min-height: 18px; }
.lia-finish-controls > .lia-guided-continue { width: 100%; font-size: 16px; }
.lia-finish-capsule-note { border: 1px dashed #c0ccb2; border-radius: 18px; padding: 28px; text-align: center; margin-block: 30px; }
.lia-finish-capsule-note h3 { font-size: 22px; line-height: 1.15; margin: 20px 0 10px; letter-spacing: -.03em; }
.lia-finish-capsule-note p { font-size: 13px; color: #64765a; }
.lia-flying-fruit { position: absolute; width: 65px; z-index: 6; pointer-events: none; }
.lia-flavor-drag-ghost { position: absolute; z-index: 99; width: 72px; transform: translate(-50%,-50%) rotate(-12deg); pointer-events: none; filter: drop-shadow(0 7px 10px #2d4b3340); }
.lia-flavor-studio .is-drop-target { border-color: #90a64d; box-shadow: inset 0 0 0 3px #c5e777; }
.lia-finish-splashes { position: absolute; width: 30px; height: 30px; top: 46%; left: 66%; z-index: 6; }
.lia-finish-splashes i { position: absolute; width: 6px; height: 9px; border-radius: 50%; background: #bfd568; opacity: 0; }
.lia-flavor-studio button:focus-visible { outline: 3px solid #72884f; outline-offset: 3px; }
@media (max-width:900px) {
  .lia-intake-scene.lia-playground { display: block; min-height: 0; padding: 10px 16px; }
  .lia-play-field { height: 310px; }
  .lia-play-empty { font-size: 12px; }
  .lia-finish-layout { gap: 22px; }
  .lia-finish-stage { height: 410px; }
}
@media (max-width:600px) {
  .lia-intake-scene.lia-playground { padding: 10px; }
  .lia-play-field { height: 290px; }
  .lia-play-speech { width: 168px; padding: 10px 12px 12px; }
  .lia-play-speech h3 { font-size: 13px; }
  .lia-day-activities button { padding: 16px 12px; }
  .lia-day-activities strong { font-size: 15px; }
  .lia-day-activities small { font-size: 11px; }
  .lia-day-times { gap: 5px; }
  .lia-day-times button { font-size: 12px; }
  [data-intake-step="care"] .lia-guided-choices { grid-template-columns: 1fr; }
  [data-intake-step="care"] .lia-guided-choice { min-height: 85px; }
  .lia-flavor-studio { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 18px; border-radius: 22px; }
  .lia-flavor-studio header > span { font-size: 8px; }
  .lia-finish-heading { margin-block: 18px; }
  .lia-finish-heading h2 { font-size: 33px; }
  .lia-finish-layout { grid-template-columns: 1fr; gap: 24px; }
  .lia-finish-stage { position: relative; height: 310px; }
  .lia-finish-packet { width: 32%; top: 17%; right: 15%; }
  .lia-finish-character { width: 47%; top: 20%; left: 2%; }
  .lia-flavor-palette { grid-template-columns: repeat(3,1fr); }
  .lia-finish-tabs button { min-width: 100px; padding: 8px 12px; }
}
@media (prefers-reduced-motion:reduce) {
  .lia-play-body, .lia-play-cauldron i, .lia-welcome-companion { animation: none; }
  .lia-play-actor, .lia-flavor-palette button:hover svg { transition: none; }
  .lia-play-ball { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lia-mascot.is-animated { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .lia-playground[data-play-mode="routine"] .lia-play-body { animation: none !important; }
  .lia-playground, .lia-play-sky::before, .lia-play-sky::after { transition: none; }
}

/* Animate the corrected Sleep artwork without the translucent legacy video. */
@media (prefers-reduced-motion: no-preference) {
  .lia-mascot.is-sleeping .lia-mascot-still {
    /* Cut out only the original top-right Zs; keep the hat and body intact. */
    clip-path: polygon(0 0, 64% 0, 64% 29%, 68% 34%, 100% 34%, 100% 100%, 0 100%);
  }
  .lia-mascot.is-sleeping .lia-mascot-frame {
    overflow: visible;
    transform-origin: 50% 80%;
    animation: lia-sleep-breathe 2.8s ease-in-out infinite;
  }
}
@keyframes lia-sleep-breathe {
  0%, 100% { transform: scale(1, .985); }
  50% { transform: scale(1.015, 1.025); }
}

/* Sleep exhales a staggered trail of dreams, even while peeking. */
.lia-sleep-dreams { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lia-sleep-dreams text { fill: #172747; font: 800 9px "Nunito Sans", sans-serif; opacity: 0; transform-box: view-box; transform-origin: 70% 36%; }
.lia-welcome-packet[aria-pressed="true"] .lia-sleep-dreams,
.lia-welcome-packet[data-mascot-transition] .lia-sleep-dreams { display: none; }
@media (prefers-reduced-motion: no-preference) {
  :is(.lia-mascot.is-sleeping, .lia-welcome-companion[data-peek-mascot="sleep"]) .lia-sleep-dreams text { animation: lia-sleep-dream 3.6s linear infinite; }
  :is(.lia-mascot.is-sleeping, .lia-welcome-companion[data-peek-mascot="sleep"]) .lia-sleep-dreams text:nth-child(2) { animation-delay: -1.2s; }
  :is(.lia-mascot.is-sleeping, .lia-welcome-companion[data-peek-mascot="sleep"]) .lia-sleep-dreams text:nth-child(3) { animation-delay: -2.4s; }
}
@keyframes lia-sleep-dream {
  0% { opacity: 0; transform: translate(0, 0) scale(.55) rotate(-12deg); }
  18% { opacity: .9; }
  65% { opacity: .8; }
  100% { opacity: 0; transform: translate(24%, -36%) scale(1.1) rotate(12deg); }
}

/* The welcome Sleep pose uses the same breathing character as the quiz. */
.lia-welcome-companion > span.lia-welcome-peek { display: block; width: 100%; height: 100%; }
.lia-welcome-companion[data-peek-mascot="sleep"] .lia-mascot { width: 100%; height: 100%; }
