:root {
  color-scheme: light;
  --ink: #173f46; --muted: #52777c; --aqua: #75d6d3; --aqua-dark: #36aaa9;
  --cream: #fff9ee; --coral: #ff8878; --yellow: #ffd45f; --focus: #5d39b8;
  font-family: Inter, ui-rounded, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); position: relative; overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.48) 0 1px, transparent 1.8px) 0 0 / 12px 12px,
    radial-gradient(circle at 75% 70%, rgba(48,146,143,.08) 0 1px, transparent 2px) 0 0 / 15px 15px,
    linear-gradient(145deg, #d7f4ef 0%, #a9e3df 48%, #e9f5e9 100%);
  background-attachment: fixed;
}
body::before, body::after { content: ""; position: fixed; pointer-events: none; z-index: -1; }
body::before {
  width: 230px; height: 140px; left: -58px; bottom: 6vh; border-radius: 55% 45% 48% 52%;
  background: radial-gradient(circle at 34% 28%, #ffd7ca, transparent 34%), linear-gradient(145deg, #ffbea9, #ee8178);
  border: 4px solid rgba(255,255,255,.42);
  box-shadow: 12px 15px 26px rgba(130,88,76,.18), inset 12px 12px 22px rgba(255,255,255,.38), inset -13px -15px 21px rgba(177,81,70,.15), 155px 48px 0 -42px #68ccc8;
}
body::after {
  width: 175px; height: 110px; right: -42px; top: 18vh; border-radius: 60% 40% 55% 45%;
  background: radial-gradient(circle at 34% 28%, #ffeca7, transparent 35%), linear-gradient(145deg, #ffda67, #eea630);
  border: 4px solid rgba(255,255,255,.42);
  box-shadow: 10px 14px 24px rgba(142,104,35,.17), inset 10px 10px 19px rgba(255,255,255,.42), inset -12px -14px 20px rgba(184,114,25,.13), -105px 52vh 0 -30px #ffc0b4;
}
.shell::before, .shell::after {
  content: ""; position: fixed; pointer-events: none; z-index: -1;
  width: 56px; height: 56px; border-radius: 48% 52% 45% 55%;
  background: linear-gradient(145deg, #fffdf2, #e6e9da);
  box-shadow: 6px 8px 14px rgba(65,125,119,.12), inset 6px 6px 10px rgba(255,255,255,.7);
  transform: rotate(24deg);
}
.shell::before { left: 7vw; top: 34vh; }
.shell::after { right: 9vw; bottom: 12vh; width: 42px; height: 42px; background: linear-gradient(145deg, #8bd9d3, #58bab6); }
button, select, textarea, input { font: inherit; }
[hidden] { display: none !important; }
button { touch-action: manipulation; }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 5px solid var(--focus); outline-offset: 4px;
}
.shell { width: min(100%, 980px); margin: 0 auto; padding: 28px; }
.setup-shell { width: min(100%, 820px); }
.secondary-choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.secondary-choices .big-button { min-height: 82px; font-size: 1.05rem; }
.optional-support { width: 100%; margin-top: 16px; }
.welcome-shell { width: min(100%, 760px); min-height: 100vh; display: grid; place-items: center; padding-block: 32px; }
.welcome-card { width: 100%; padding: clamp(28px, 6vw, 56px); text-align: center; border: 3px solid rgba(255,255,255,.82); border-radius: 42px; background: rgba(255,248,231,.94); box-shadow: 0 24px 70px rgba(49,97,107,.22), inset 0 0 0 2px rgba(113,211,220,.28); }
.welcome-bear { width: clamp(130px, 27vw, 190px); height: clamp(130px, 27vw, 190px); margin: -8px auto 10px; }
.eyebrow { margin: 0 0 8px; color: #ba6254; font-size: .82rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.welcome-card h1 { max-width: 620px; margin: 0 auto 16px; font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.03; }
.welcome-copy { max-width: 590px; margin: 0 auto 22px; font-size: clamp(1rem, 2.5vw, 1.2rem); line-height: 1.55; }
.welcome-points { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 0 auto 26px; }
.welcome-points span { padding: 9px 13px; border-radius: 999px; background: #d9f5f1; color: #27535a; font-size: .88rem; font-weight: 800; }
.welcome-start { width: min(100%, 360px); font-size: 1.12rem; }
.welcome-privacy { max-width: 540px; margin: 18px auto 0; font-size: .88rem; }
.brand { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.bear {
  display: grid; place-items: center; width: 84px; height: 84px; flex: 0 0 auto;
  font-size: 3.45rem; line-height: 1; border: 3px solid rgba(255,255,255,.82); overflow: hidden;
  border-radius: 32px; background: linear-gradient(145deg, #8be3df, #51c1bf);
  box-shadow: 9px 11px 20px rgba(39,132,131,.28), -7px -7px 18px rgba(255,255,255,.75), inset 4px 4px 7px rgba(255,255,255,.65), inset -5px -6px 9px rgba(27,125,122,.18);
}
.bear img { width: 78px; height: 78px; object-fit: contain; transform: translateY(4px); }
h1, h2, p { margin-top: 0; }
h1 { color: #153f46; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.045em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.3rem); letter-spacing: -.03em; }
.subtitle { font-size: 1.15rem; color: #3b6b71; font-weight: 650; }
.card {
  position: relative; isolation: isolate; overflow: hidden;
  background:
    radial-gradient(circle at 18% 4%, rgba(255,255,255,.95), transparent 32%),
    linear-gradient(145deg, rgba(255,253,245,.97), rgba(255,239,220,.94));
  border: 4px solid rgba(255,255,255,.9); border-radius: 38px;
  box-shadow: 16px 20px 36px rgba(34,130,129,.2), -9px -9px 24px rgba(255,255,255,.62), inset 6px 7px 12px rgba(255,255,255,.76), inset -7px -8px 13px rgba(201,143,105,.1);
  backdrop-filter: blur(12px); padding: clamp(24px, 4vw, 40px); margin-bottom: 28px;
}
.card::after {
  content: ""; position: absolute; inset: 10px; z-index: -1; pointer-events: none;
  border: 2px dashed rgba(192,130,90,.2); border-radius: 28px;
}
.field { display: grid; gap: 10px; margin: 20px 0; font-weight: 800; font-size: 1.1rem; }
select, textarea, .field input {
  width: 100%; border: 4px solid #78cfcb; border-radius: 22px; padding: 17px;
  background: linear-gradient(145deg, #fbfffc, #eef9f4); color: var(--ink);
  box-shadow: inset 5px 6px 12px rgba(31,123,121,.13), inset -3px -3px 7px #fff, 0 5px 0 rgba(69,172,169,.2);
}
textarea { min-height: 112px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 12px; margin: 22px 0; font-weight: 800; }
.check input { width: 29px; height: 29px; flex: 0 0 auto; accent-color: var(--aqua-dark); }
.note {
  border: 3px solid #ffd66b; border-left: 9px solid #f1af2d;
  background: linear-gradient(145deg, #fff5cd, #ffe9a8); padding: 17px 19px;
  border-radius: 20px; box-shadow: 6px 7px 13px rgba(178,129,40,.12), inset 4px 4px 7px rgba(255,255,255,.6), inset -4px -5px 7px rgba(213,148,28,.11);
}
.privacy { color: #2d7478; font-weight: 800; }
.small { font-size: .95rem; font-weight: 500; color: var(--muted); }
.primary, .big-button, .global-button {
  position: relative; overflow: hidden;
  border: 4px solid rgba(255,255,255,.86); border-radius: 28px; cursor: pointer; min-height: 80px;
  padding: 17px 23px; font-weight: 900; letter-spacing: -.02em;
  box-shadow: 9px 12px 18px rgba(41,122,121,.24), -5px -5px 12px rgba(255,255,255,.62), inset 5px 5px 8px rgba(255,255,255,.5), inset -6px -7px 9px rgba(24,96,94,.15);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}
.primary::before, .big-button::before, .global-button::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 7px; height: 20%;
  border-radius: 999px; background: rgba(255,255,255,.2); pointer-events: none;
}
.primary { width: 100%; background: linear-gradient(145deg, #67d4d1, #35aaa8); color: #103f45; font-size: 1.4rem; }
.primary:hover, .big-button:hover, .global-button:hover { filter: saturate(1.08) brightness(1.03); transform: translateY(-2px); }
.primary:active, .big-button:active, .global-button:active { transform: translateY(4px); box-shadow: 3px 4px 8px rgba(41,122,121,.24), inset 3px 4px 8px rgba(29,103,101,.18); }
.child-shell { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 126px; }
.child-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.stage-name { font-size: 1rem; font-weight: 900; color: #2f7478; text-transform: uppercase; letter-spacing: .08em; }
.prompt { text-align: center; font-size: clamp(2rem, 5.5vw, 4rem); line-height: 1.18; margin: 24px 0 32px; }
.response { text-align: center; color: #315e63; font-size: clamp(1.45rem, 4vw, 2.4rem); line-height: 1.3; font-weight: 650; }
.button-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.big-button { background: linear-gradient(145deg, #fdfdf7, #e8f7f2); color: var(--ink); font-size: clamp(1.25rem, 3vw, 1.8rem); }
.feeling { min-height: 172px; font-size: clamp(1.35rem, 3vw, 1.9rem); border-radius: 34px; }
.feeling span { display: block; font-size: 3.3rem; margin-bottom: 9px; filter: drop-shadow(0 4px 3px rgba(45,92,92,.15)); }
.happy { background: radial-gradient(circle at 30% 18%, #fff2b6, transparent 30%), linear-gradient(145deg, #ffe581, #ffc847); }
.sad { background: radial-gradient(circle at 30% 18%, #d5f5fb, transparent 30%), linear-gradient(145deg, #9de2f3, #62bcdc); }
.other { background: radial-gradient(circle at 30% 18%, #ffe1db, transparent 30%), linear-gradient(145deg, #ffc2b7, #ff8d82); }
.unsure { background: radial-gradient(circle at 30% 18%, #eff9f2, transparent 30%), linear-gradient(145deg, #d7eddf, #a7d3be); }
.support { min-height: 134px; }
.help { background: linear-gradient(145deg, #83daf0, #42abd3); }
.breeze { background: linear-gradient(145deg, #a9e6d1, #65c9aa); }
.person-choice { background: linear-gradient(145deg, #ffd7cc, #f59b8d); }
.global-bar {
  position: fixed; left: 50%; bottom: 14px; z-index: 20; transform: translateX(-50%);
  width: min(calc(100% - 28px), 924px); margin-top: auto; padding: 10px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  border-radius: 30px; background: rgba(215,244,239,.76); backdrop-filter: blur(10px);
}
.global-button { color: #173f46; font-size: clamp(1.25rem, 3vw, 1.75rem); }
.help-button { background: linear-gradient(145deg, #82dcf2, #3eacd4); }
.stop-button { background: linear-gradient(145deg, #ff9a91, #ef626b); color: #571b23; }
.handoff-wait { border-color: #6acbc8; background: rgba(231,255,250,.93); }
.adult-confirm { background: linear-gradient(145deg, #91e1c8, #49bc9a); color: #17483f; width: 100%; font-size: 1.5rem; }
.stopped { border-color: #ff9a91; background: rgba(255,235,230,.95); text-align: center; }
.setup-return { width: 100%; background: linear-gradient(145deg, #82dcf2, #3eacd4); color: #153f46; }
.account-return { display: block; margin: 16px auto 0; font-size: 1rem; }
.error { color: #a8263b; font-weight: 900; }
.account-shell { width: min(100%, 1040px); }
.auth-card { width: min(100%, 620px); margin-inline: auto; }
.text-button { border: 0; background: transparent; color: #246e76; font-weight: 900; text-decoration: underline; padding: 13px; cursor: pointer; }
.account-message { min-height: 1.4em; color: #a8263b; font-weight: 800; }
.account-message.success { color: #237058; }
.account-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.account-toolbar > div { display: flex; align-items: center; gap: 10px; }
.compact-field { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.compact-field select { padding: 10px 14px; border-width: 2px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
.profile-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.profile-row, .empty-state, .invite-result { padding: 15px; border-radius: 18px; background: rgba(217,245,241,.72); }
.profile-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-row span { display: block; color: var(--muted); }
.remove-profile { border: 0; border-radius: 999px; padding: 9px 12px; background: #ffe0d9; color: #7a3d35; font-weight: 900; cursor: pointer; }
.inline-form { margin-top: 20px; padding-top: 8px; border-top: 2px dashed rgba(47,116,120,.25); }
.inline-form .primary, #invite-form .primary { min-height: 62px; font-size: 1.05rem; }
.launch-button { margin-top: 26px; }
.voice-entry { margin-bottom: 28px; }
.voice-entry p { max-width: 650px; line-height: 1.5; }
.voice-shell { width: min(100%, 840px); }
.voice-setup { margin-top: 18px; }
.voice-setup h1 { font-size: clamp(2rem, 5vw, 3rem); }
.voice-setup p { line-height: 1.55; }
.voice-stage { min-height: 100svh; display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 145px; }
.voice-topline { display: flex; width: 100%; gap: 16px; justify-content: space-between; align-items: center; font-weight: 800; }
.trial-badge { background: var(--cream); border-radius: 999px; padding: 10px 14px; font-size: .9rem; }
.voice-orbit { position: relative; display: grid; place-items: center; width: min(78vw, 380px); aspect-ratio: 1; margin: 25px auto 8px; }
.voice-teddy { position: relative; z-index: 1; width: 88%; height: 88%; object-fit: contain; filter: drop-shadow(0 20px 18px rgba(31,104,102,.2)); transform-origin: bottom center; }
.voice-rings { position: absolute; inset: 8%; border-radius: 50%; border: 3px solid rgba(255,255,255,.8); background: rgba(255,249,238,.3); box-shadow: 0 0 0 18px rgba(255,255,255,.18), 0 0 0 36px rgba(255,255,255,.10); }
[data-state="speaking"] .voice-teddy { animation: voice-speak 1.2s ease-in-out infinite alternate; }
[data-state="listening"] .voice-rings { animation: voice-listen 3s ease-in-out infinite alternate; }
.voice-stage h1 { margin-bottom: 12px; }
.voice-status { font-size: 1.05rem; font-weight: 800; }
.voice-caption { max-width: 620px; min-height: 3em; line-height: 1.5; font-size: 1.15rem; }
.voice-hint { color: var(--muted); font-size: 1rem; }
.voice-controls { position: fixed; bottom: 12px; z-index: 20; width: min(calc(100% - 28px), 740px); padding: 10px; border-radius: 30px; backdrop-filter: blur(15px); background: rgba(237,249,240,.94); display: flex; align-items: center; justify-content: center; gap: 12px; }
.voice-controls .global-button { flex: 1; min-height: 64px; font-size: 1.15rem; }
.trial-again { width: min(100%, 360px); min-height: 64px; font-size: 1.1rem; }
button:disabled { cursor: not-allowed; opacity: .6; transform: none; }
@keyframes voice-speak { from { transform: rotate(-1deg) translateY(0); } to { transform: rotate(1deg) translateY(-5px); } }
@keyframes voice-listen { from { transform: scale(.98); } to { transform: scale(1.04); } }
@media (max-width: 500px) { .voice-controls { flex-direction: column; gap: 0; } .voice-controls .global-button { width: 100%; } .voice-stage { padding-bottom: 180px; } }
@media (prefers-reduced-motion: reduce) { .voice-teddy, .voice-rings { animation: none !important; } }
@media (max-width: 760px) { .dashboard-grid { grid-template-columns: 1fr; } .account-toolbar { align-items: flex-start; flex-direction: column; } }
.mascot-walker {
  position: relative; left: 0; bottom: auto; z-index: 5; width: 132px; height: 150px;
  margin: 8px 0 -2px;
  pointer-events: none; filter: drop-shadow(0 12px 12px rgba(29, 100, 98, .24));
  animation: teddy-walk 16s ease-in-out infinite alternate;
}
.mascot-walker img {
  display: block; width: 112px; height: auto; margin: 0 auto;
  transform-origin: 50% 100%; animation: teddy-step .72s ease-in-out infinite alternate;
}
.mascot-bubble {
  position: absolute; left: 88px; bottom: 88px; width: min(250px, 44vw);
  padding: 12px 15px; color: #173f46; background: rgba(255,255,255,.96);
  border: 4px solid #72c7c4; border-radius: 25px 25px 25px 8px;
  box-shadow: 7px 10px 18px rgba(35,116,114,.2), inset 4px 4px 7px rgba(255,255,255,.7), inset -4px -4px 7px rgba(65,159,155,.1); font-size: .98rem;
  font-weight: 850; line-height: 1.25;
}
@keyframes teddy-walk {
  0% { left: 2vw; }
  46% { left: 2vw; }
  100% { left: calc(50% - 66px); }
}
@keyframes teddy-step {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-8px) rotate(3deg); }
}
@media (max-width: 600px) {
  .shell { padding: 14px; } .brand { align-items: flex-start; }
  .bear { width: 70px; height: 70px; border-radius: 24px; font-size: 2.8rem; }
  .bear img { width: 64px; height: 64px; }
  .card { border-radius: 25px; }
  .child-shell { padding-bottom: 218px; }
  .global-bar { grid-template-columns: 1fr; gap: 12px; }
  .mascot-walker { width: 92px; height: 124px; bottom: auto; }
  .mascot-walker img { width: 78px; }
  .mascot-bubble { left: 64px; bottom: 60px; font-size: .82rem; width: min(210px, 55vw); }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .mascot-walker { animation: none; left: 18px; }
  .mascot-walker img { animation: none; }
}

/* Family management stays within the established plush palette. */
.child-settings > section + section { margin-top: 2rem; border-top: 2px dashed #b4dcd5; padding-top: 1.5rem; }
.child-settings fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.child-settings fieldset:disabled { opacity: .85; }
.child-settings input, .child-settings select, .member-permission-form select { max-width: 100%; }
.permission-guide { padding: 1.2rem; border-radius: 24px; background: #e8f6ef; box-shadow: inset 2px 2px 8px #badbd533; }
.permission-guide dt { font-weight: 850; margin-top: .75rem; }
.permission-guide dt:first-child { margin-top: 0; }
.permission-guide dd { margin: .25rem 0 0; line-height: 1.5; }
.member-permission-form { flex: 1 1 260px; max-width: 430px; }
.family-access .profile-row { align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.profile-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.invitation-list { margin-block: 1rem; }
.invitation-list .profile-row { align-items: flex-start; flex-wrap: wrap; }
.account-toolbar > div { min-width: 0; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button:disabled { cursor: wait; opacity: .7; }
@media (max-width: 600px) {
  .profile-row { flex-wrap: wrap; gap: .5rem; }
  .profile-actions { width: 100%; }
}
