:root {
  --radius: 1.55rem;
  --font-display: "Raleway", "Trebuchet MS", sans-serif;
  --background: oklch(0.22 0.055 270);
  --foreground: oklch(0.97 0.018 84);
  --card: oklch(0.99 0.012 96 / 92%);
  --card-foreground: oklch(0.24 0.045 270);
  --primary: oklch(0.82 0.112 84);
  --primary-foreground: oklch(0.24 0.045 270);
  --secondary: oklch(0.84 0.072 229);
  --muted: oklch(0.95 0.018 96 / 72%);
  --muted-foreground: oklch(0.78 0.02 96 / 0.82);
  --accent: oklch(0.88 0.08 326);
  --border: oklch(0.93 0.02 96 / 54%);
  --input: oklch(0.98 0.01 96 / 80%);
  --ring: oklch(0.81 0.052 304);
  --story-cloud-accent: oklch(0.81 0.052 304);
  --story-ink: oklch(0.24 0.045 270);
  --story-sky-soft: oklch(0.46 0.08 274 / 88%);
  --gradient-night: radial-gradient(circle at 50% 0%, oklch(0.56 0.1 263), transparent 42%), linear-gradient(180deg, oklch(0.33 0.082 270), oklch(0.2 0.055 282) 58%, oklch(0.16 0.046 288));
  --gradient-welcome-phone: linear-gradient(180deg, oklch(0.29 0.08 269 / 96%), oklch(0.2 0.056 285 / 98%));
  --gradient-button: linear-gradient(180deg, oklch(0.85 0.06 288), oklch(0.77 0.07 285));
  --shadow-story: 0 26px 70px -34px color-mix(in oklab, oklch(0.05 0.02 282) 80%, transparent);
  --hf: oklch(0.83 0.16 88);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--gradient-night); color: var(--foreground); font-family: var(--font-display); letter-spacing: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
button[disabled] { cursor: not-allowed; opacity: .55; }
.night-stage { position: relative; min-height: 100vh; overflow: hidden; padding: 1.5rem 1.25rem; background: var(--gradient-night); }
.layer { pointer-events: none; position: absolute; inset: 0; }
.stars-field { background-image: radial-gradient(circle, oklch(0.98 0.04 96 / 90%) 1px, transparent 1.8px), radial-gradient(circle, oklch(0.9 0.1 84 / 80%) 1px, transparent 1.6px), radial-gradient(circle, oklch(0.86 0.06 229 / 70%) 1.4px, transparent 2px); background-position: 0 0, 55px 80px, 120px 35px; background-size: 140px 140px, 190px 190px, 240px 240px; animation: twinkle 3.8s ease-in-out infinite alternate; }
.twinkle-layer { background-image: radial-gradient(circle at 20% 18%, oklch(0.95 0.08 84 / 90%) 0 2px, transparent 3px), radial-gradient(circle at 78% 14%, oklch(0.95 0.04 96 / 80%) 0 1.5px, transparent 3px), radial-gradient(circle at 64% 48%, oklch(0.88 0.08 326 / 70%) 0 2px, transparent 3px), radial-gradient(circle at 28% 72%, oklch(0.88 0.08 229 / 75%) 0 1.5px, transparent 3px); animation: sparkle-pop 2.6s ease-in-out infinite; }
.gold-sparkles { background-image: radial-gradient(ellipse at 50% 50%, oklch(0.99 0.08 91 / 0.95) 0 1.8px, transparent 2.8px), linear-gradient(90deg, transparent calc(50% - .6px), oklch(0.94 0.11 88 / .76) calc(50% - .6px), oklch(0.94 0.11 88 / .76) calc(50% + .6px), transparent calc(50% + .6px)), linear-gradient(0deg, transparent calc(50% - .6px), oklch(0.94 0.11 88 / .76) calc(50% - .6px), oklch(0.94 0.11 88 / .76) calc(50% + .6px), transparent calc(50% + .6px)); background-position: 9% 16%, 9% 16%, 9% 16%; background-repeat: no-repeat; background-size: 16px 16px, 16px 16px, 16px 16px; filter: drop-shadow(0 0 7px oklch(0.92 0.12 88 / 0.5)); opacity: .78; animation: gold-sparkle 3.6s ease-in-out infinite alternate; }
.cloud, .welcome-cloud { position: absolute; width: 8rem; height: 2.9rem; border-radius: 999px; background: #A6A3BF; box-shadow: 0 20px 36px -28px color-mix(in oklab, black 55%, transparent); pointer-events: none; }
.cloud:before, .cloud:after, .welcome-cloud:before, .welcome-cloud:after { content: ""; position: absolute; border-radius: 999px; background: inherit; }
.cloud:before, .welcome-cloud:before { width: 4.1rem; height: 4.1rem; left: .9rem; top: -1.7rem; }
.cloud:after, .welcome-cloud:after { width: 4.8rem; height: 4.8rem; right: .7rem; top: -2.1rem; }
.cloud-one { left: -9rem; top: 10%; animation: cloud-drift 36s linear infinite; }
.cloud-two { right: -10rem; top: 34%; transform: scale(.72); animation: cloud-drift-reverse 48s linear infinite; }
.phone-shell { position: relative; z-index: 1; margin: 0 auto; display: flex; min-height: 780px; width: 100%; max-width: 430px; flex-direction: column; overflow: hidden; border-radius: 2.25rem; padding: 4rem 1.25rem 1.25rem; border: 1px solid color-mix(in oklab, var(--border) 82%, transparent); background: var(--gradient-welcome-phone); box-shadow: var(--shadow-story); backdrop-filter: blur(14px); }
#screen-host { display: flex; flex: 1; flex-direction: column; }
.phone-shell:before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 12%, color-mix(in oklab, var(--secondary) 36%, transparent), transparent 34%); pointer-events: none; }
.welcome-stars, .welcome-twinkles { pointer-events: none; position: absolute; inset: 0; }
.welcome-stars { background-image: radial-gradient(circle at 15% 12%, oklch(0.98 0.04 96 / 95%) 0 1.6px, transparent 2.8px), radial-gradient(circle at 76% 10%, oklch(0.96 0.08 84 / 95%) 0 2.2px, transparent 3.2px), radial-gradient(circle at 24% 34%, oklch(0.95 0.04 96 / 88%) 0 1.2px, transparent 2.2px), radial-gradient(circle at 82% 40%, oklch(0.91 0.06 229 / 88%) 0 1.6px, transparent 2.6px), radial-gradient(circle at 12% 62%, oklch(0.96 0.08 84 / 92%) 0 1.8px, transparent 2.7px), radial-gradient(circle at 66% 68%, oklch(0.98 0.02 96 / 96%) 0 1.4px, transparent 2.2px), radial-gradient(circle at 90% 78%, oklch(0.88 0.08 326 / 92%) 0 1.8px, transparent 2.8px); filter: drop-shadow(0 0 6px oklch(0.97 0.04 96 / .45)); animation: star-glow 2.6s ease-in-out infinite alternate; }
.welcome-twinkles { background-image: radial-gradient(circle at 26% 18%, oklch(0.99 0.04 96 / 96%) 0 2.5px, transparent 4px), radial-gradient(circle at 58% 26%, oklch(0.97 0.06 84 / 90%) 0 2px, transparent 3.6px), radial-gradient(circle at 72% 58%, oklch(0.95 0.05 96 / 86%) 0 2.2px, transparent 3.6px), radial-gradient(circle at 36% 74%, oklch(0.89 0.07 326 / 82%) 0 1.8px, transparent 3.2px); filter: drop-shadow(0 0 8px oklch(0.97 0.04 96 / .4)); animation: welcome-sparkle 3.2s ease-in-out infinite; }
.welcome-cloud-one { left: -8rem; top: 12%; transform: scale(.92); animation: cloud-drift-welcome 18s linear infinite; }
.welcome-cloud-two { right: -9rem; top: 38%; transform: scale(.76); animation: cloud-drift-welcome-reverse 24s linear infinite; }
.screen { position: relative; z-index: 10; display: flex; flex: 1; flex-direction: column; }
.topbar { position: absolute; top: 1.25rem; left: 1.25rem; right: 1.25rem; z-index: 20; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .55rem; margin-left: -.55rem; border-radius: .75rem; background: transparent; font-size: .875rem; font-weight: 900; color: white; cursor: pointer; transition: background .15s ease; }
.brand:hover { background: color-mix(in oklab, white 8%, transparent); }
.topbar-right { display: inline-flex; align-items: center; gap: .5rem; }
.lang-toggle { display: inline-flex; gap: .25rem; padding: .2rem; border-radius: 999px; background: color-mix(in oklab, white 10%, transparent); border: 1px solid color-mix(in oklab, white 14%, transparent); }
.settings-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 999px; background: color-mix(in oklab, white 10%, transparent); border: 1px solid color-mix(in oklab, white 14%, transparent); color: rgb(255 255 255 / .8); font-size: 1rem; line-height: 1; transition: background .15s ease, transform .15s ease; }
.settings-btn:hover { background: color-mix(in oklab, white 18%, transparent); transform: rotate(30deg); }
.lang-toggle button { padding: .25rem .65rem; border-radius: 999px; background: transparent; color: rgb(255 255 255 / .72); font-weight: 800; font-size: .72rem; }
.lang-toggle button.active { background: var(--gradient-button); color: oklch(0.25 0.045 270); }
.center { justify-content: center; text-align: center; padding-top: 1rem; }
.robot-float { margin: 0 auto; display: flex; height: 14rem; width: 14rem; align-items: center; justify-content: center; animation: robot-float 4.8s ease-in-out infinite; }
.robot-float.large { height: 16rem; width: 16rem; }
.robot-float img { width: 16rem; height: 16rem; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.welcome-title { margin: .5rem 0 0; font-size: 3rem; line-height: .92; font-weight: 900; color: white; text-shadow: 0 10px 34px color-mix(in oklab, black 26%, transparent); }
.lead { margin: 1rem auto 0; max-width: 15rem; color: rgb(255 255 255 / .72); font-size: 1rem; font-weight: 700; line-height: 1.5; }
.welcome-hint { margin: 1rem auto 0; max-width: 18rem; color: rgb(255 255 255 / .68); font-size: .8rem; font-weight: 700; line-height: 1.5; text-align: center; }
.hero-cta, .cta-primary { display: inline-flex; min-height: 3.5rem; width: 100%; align-items: center; justify-content: center; gap: .5rem; border-radius: 1.35rem; padding: 0 1rem; background: var(--gradient-button); color: oklch(0.25 0.045 270); font-weight: 900; box-shadow: 0 0 0 1px color-mix(in oklab, white 28%, transparent) inset, 0 14px 34px -20px color-mix(in oklab, oklch(0.88 0.08 326) 80%, transparent), 0 0 18px color-mix(in oklab, white 34%, transparent); transition: transform .2s ease; }
.hero-cta:hover, .cta-primary:hover { transform: translateY(-2px); }
.cta-primary { margin-top: auto; font-size: .875rem; }
.story-card { border: 1px solid color-mix(in oklab, white 16%, transparent); background: linear-gradient(180deg, oklch(0.31 0.048 274 / .8), oklch(0.22 0.04 278 / .88)); box-shadow: 0 16px 38px -24px color-mix(in oklab, black 72%, transparent), inset 0 1px 0 color-mix(in oklab, white 18%, transparent); backdrop-filter: blur(18px); }
.key-card { margin-top: 1.25rem; border-radius: 1.6rem; padding: 1rem; text-align: left; display: flex; flex-direction: column; gap: .85rem; animation: card-fade-in .35s ease both; }
@keyframes card-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.label { display: block; color: rgb(255 255 255 / .62); font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.story-input, .story-select { position: relative; z-index: 2; pointer-events: auto; height: 3rem; width: 100%; border-radius: 1rem; border: 1px solid var(--input); background: var(--background); padding: 0 1rem; color: oklch(0.9 0.018 96); font-size: .875rem; font-weight: 700; outline: none; }
.label + .story-input, .label + .story-select { margin-top: .75rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.muted { color: var(--muted-foreground); font-size: .75rem; font-weight: 700; line-height: 1.5; }
.hf-btn.connected { background: linear-gradient(180deg, oklch(0.6 0.14 150), oklch(0.5 0.13 154)); color: white; }
.link-btn { background: transparent; color: rgb(255 255 255 / .7); font-size: .875rem; font-weight: 900; }
.story-scroll { scrollbar-width: none; }
.story-scroll::-webkit-scrollbar { display: none; }
.tile-text h3, .tile-text h2 { margin: 0; color: white; font-weight: 900; line-height: 1.2; }
.step-header { position: relative; z-index: 10; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.back-btn { display: flex; height: 2.5rem; width: 2.5rem; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 999px; background: var(--muted); color: var(--story-ink); font-weight: 900; }
.header-copy { flex: 1; text-align: center; }
.eyebrow { margin: 0; color: rgb(255 255 255 / .6); font-size: .75rem; font-weight: 900; text-transform: uppercase; }
h1 { margin: .5rem 0 0; color: white; font-size: 1.875rem; line-height: 1.1; font-weight: 900; }
.subtitle { margin: .5rem auto 0; max-width: 20rem; color: rgb(255 255 255 / .78); font-size: .875rem; font-weight: 700; line-height: 1.45; }
.age-grid { margin-top: 2rem; display: grid; gap: 1rem; padding-bottom: 2.5rem; }
.age-card { display: flex; min-height: 5rem; align-items: center; justify-content: space-between; border-radius: 1.5rem; padding: 0 1.25rem; color: white; text-align: left; transition: transform .2s ease; }
.age-card.active { outline: 2px solid var(--ring); }
.age-card strong { display: block; font-size: 1.125rem; }
.age-card span { display: block; margin-top: .25rem; color: var(--muted-foreground); font-size: .875rem; font-weight: 700; }
.duration-card { margin-top: 2.5rem; margin-bottom: 2.5rem; border-radius: 1.8rem; padding: 1.25rem; }
.duration-top { display: flex; align-items: center; justify-content: space-between; }
.duration-top p, .pref-card h2 { margin: 0; color: white; font-size: .875rem; font-weight: 900; }
.duration-pill, .preference-chip { border: 1px solid color-mix(in oklab, var(--story-cloud-accent) 40%, white 10%, transparent); background: linear-gradient(180deg, oklch(0.35 0.052 288 / .78), oklch(0.25 0.044 286 / .92)); box-shadow: inset 0 1px 0 color-mix(in oklab, white 14%, transparent); color: white; }
.duration-pill { display: flex; align-items: center; gap: .5rem; border-radius: 999px; padding: .25rem .75rem; font-size: .875rem; font-weight: 900; }
.story-range { margin-top: 2rem; width: 100%; accent-color: var(--story-cloud-accent); }
.range-labels { margin-top: .75rem; display: flex; justify-content: space-between; color: rgb(255 255 255 / .68); font-size: .75rem; font-weight: 900; }
.values-list { margin-top: 2rem; flex: 1; overflow-y: auto; padding: 0 .25rem 1rem 0; display: flex; flex-direction: column; gap: 1rem; }
.pref-card { border-radius: 1.8rem; padding: 1rem; }
.chips { margin-top: .75rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.preference-chip { border-radius: 999px; padding: .5rem .875rem; font-size: .875rem; font-weight: 900; transition: transform .2s ease; }
.preference-chip.active { background: linear-gradient(180deg, var(--story-cloud-accent), oklch(0.72 0.06 304)); color: oklch(0.22 0.04 278); box-shadow: 0 0 0 1px color-mix(in oklab, white 24%, transparent) inset, 0 10px 24px -18px color-mix(in oklab, var(--story-cloud-accent) 80%, transparent); }
.story-experience { margin: -1.5rem -1.25rem -1.25rem; min-height: 780px; padding: 1.5rem 1.25rem 1.25rem; }
.pulse-speak { position: absolute; top: 22%; height: 9rem; width: 9rem; border-radius: 999px; background: rgb(245 232 184 / .2); filter: blur(28px); animation: pulse-speak 1.8s ease-in-out infinite; }
.night-mode { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.night-mode .eyebrow { color: var(--primary); }
.night-mode h1 { max-width: 20rem; font-size: 2.25rem; }
.night-status { margin-top: 1rem; min-height: 1.5rem; max-width: 22rem; color: rgb(255 255 255 / .78); font-size: .9rem; font-weight: 700; line-height: 1.4; font-style: italic; opacity: .9; transition: opacity .35s ease; }
.hf-line { display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .35rem .75rem; border-radius: 999px; background: color-mix(in oklab, white 10%, transparent); border: 1px solid color-mix(in oklab, white 14%, transparent); color: white; font-size: .75rem; font-weight: 900; align-self: flex-start; }
.robot-status { display: flex; align-items: center; gap: .4rem; margin: .25rem 0 0; }
.robot-status.ok { color: oklch(0.86 0.13 150); }
.meta { margin: .5rem 0 0; color: white; font-size: .875rem; font-weight: 700; }
.connecting-overlay { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 2rem; background: color-mix(in oklab, oklch(0.18 0.05 280) 92%, transparent); backdrop-filter: blur(8px); text-align: center; }
.connecting-overlay h3 { margin: 0; color: white; font-size: 1.125rem; font-weight: 900; }
.connecting-overlay p { margin: 0; color: rgb(255 255 255 / .72); font-size: .8rem; max-width: 18rem; line-height: 1.5; }
.spinner { width: 2.5rem; height: 2.5rem; border-radius: 999px; border: 3px solid color-mix(in oklab, white 18%, transparent); border-top-color: var(--story-cloud-accent); animation: spin 1s linear infinite; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 60; padding: .75rem 1rem; max-width: 22rem; border-radius: 1rem; background: color-mix(in oklab, oklch(0.22 0.05 280) 92%, transparent); border: 1px solid color-mix(in oklab, white 18%, transparent); color: white; font-size: .8rem; font-weight: 700; box-shadow: 0 16px 32px -20px black; }
.toast.error { background: linear-gradient(180deg, oklch(0.45 0.18 25), oklch(0.32 0.16 25)); }
.audio-meter { position: absolute; top: 1.25rem; right: 1.25rem; height: .5rem; width: 4rem; border-radius: 999px; background: color-mix(in oklab, white 12%, transparent); overflow: hidden; }
.audio-meter > span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, oklch(0.78 0.16 150), var(--story-cloud-accent)); transition: width .08s linear; }
@keyframes robot-float { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
@keyframes pulse-speak { 0%,100% { transform: scale(1); opacity: .6; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes twinkle { 0% { opacity: .5; transform: scale(1); } 100% { opacity: 1; transform: scale(1.015); } }
@keyframes sparkle-pop { 0%,100% { opacity: .35; } 45% { opacity: 1; } 70% { opacity: .55; } }
@keyframes welcome-sparkle { 0%,100% { opacity: .28; } 50% { opacity: .95; } }
@keyframes star-glow { 0% { opacity: .72; } 100% { opacity: 1; } }
@keyframes gold-sparkle { 0% { opacity: .42; } 100% { opacity: .82; } }
@keyframes cloud-drift { 0% { transform: translateX(0); } 100% { transform: translateX(calc(100vw + 18rem)); } }
@keyframes cloud-drift-reverse { 0% { transform: translateX(0) scale(.72); } 100% { transform: translateX(calc(-100vw - 18rem)) scale(.72); } }
@keyframes cloud-drift-welcome { 0% { transform: translateX(0) scale(.92); } 100% { transform: translateX(calc(100vw + 14rem)) scale(.92); } }
@keyframes cloud-drift-welcome-reverse { 0% { transform: translateX(0) scale(.76); } 100% { transform: translateX(calc(-100vw - 14rem)) scale(.76); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .night-stage { padding: 0; } .phone-shell { max-width: none; min-height: 100vh; border-radius: 0; } }
/* Web/desktop: keep the night-sky atmosphere (stars + clouds) but drop the phone-frame skeuomorphism so the content sits flush on the sky. */
@media (min-width: 481px) {
  .phone-shell { border: 0; background: transparent; box-shadow: none; backdrop-filter: none; border-radius: 0; padding: 4rem 1.5rem 2rem; }
  .phone-shell:before { display: none; }
  /* These inner clouds were designed to drift inside the phone frame; with no frame they get clipped mid-flight at the column edge. The outer .cloud-one / .cloud-two already drift across the full viewport, so just hide the framed ones. */
  .welcome-cloud-one, .welcome-cloud-two { display: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .robot-float, .pulse-speak, .stars-field, .twinkle-layer, .welcome-stars, .welcome-twinkles, .gold-sparkles, .cloud-one, .cloud-two, .welcome-cloud-one, .welcome-cloud-two, .spinner { animation: none; } }
