:root {
  --ink: var(--color-ink);
  --muted: var(--color-muted);
  --cream: var(--color-canvas);
  --paper: var(--color-surface);
  --coral: var(--color-primary);
  --coral-deep: var(--color-primary);
  --peach: var(--color-sand);
  --plum: var(--color-plum);
  --moss: var(--color-calm);
  --line: var(--color-line);
  --shadow: var(--shadow-card);
  font-family: var(--font-sans);
  background: var(--color-canvas);
  color: var(--color-ink);
}
.language-control { z-index: 90; }
.app-language-control { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
.language-control select { min-height: 44px; border: 1px solid var(--color-line); border-radius: var(--radius-full); background: var(--color-surface); color: var(--color-ink); padding: 7px 28px 7px 12px; font: 700 18px/1 var(--font-sans); box-shadow: var(--shadow-card); }
.auth-language-control { position: absolute; top: 18px; right: 18px; }
.sheet-language-control { position: absolute; top: 14px; left: 18px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--color-canvas); }
body { margin: 0; height: 100%; overflow: hidden; background: linear-gradient(180deg, #effafd 0%, var(--color-canvas) 58%, #fffaf0 100%); }
.app-loader { position: fixed; z-index: 300; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: radial-gradient(circle at 50% 35%, rgba(98,198,210,.34), transparent 30%), linear-gradient(160deg, #effafd, #fffaf0); transition: opacity .18s ease, visibility .18s ease; }
.app-ready .app-loader { opacity: 0; visibility: hidden; pointer-events: none; }
.app-loader-mark { width: 68px; height: 68px; display: grid; place-items: center; border-radius: 22px; color: white; background: linear-gradient(145deg, var(--color-pool), var(--color-primary)); box-shadow: 0 12px 25px rgba(22,124,145,.22); font-size: 28px; }
.app-loader strong { font-size: 20px; letter-spacing: -.02em; }
.app-loader-dots { display: flex; gap: 5px; }
.app-loader-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); animation: loading-dot .8s ease-in-out infinite alternate; }
.app-loader-dots i:nth-child(2) { animation-delay: .16s; }.app-loader-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes loading-dot { to { opacity: .3; transform: translateY(-3px); } }
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid rgba(22, 124, 145, .32); outline-offset: 3px; }
ion-button { min-height: 44px; margin: 0; text-transform: none; --border-radius: var(--radius-full); font-weight: 700; }
ion-card { color: var(--color-ink); }

.app-shell { width: min(100%, 430px); height: var(--app-viewport-height, 100dvh); margin: 0 auto; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; overflow: clip; position: relative; top: var(--app-viewport-top, 0px); }
.topbar { min-height: 78px; padding: calc(14px + env(safe-area-inset-top)) 20px 12px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 64px; align-items: center; gap: 12px; position: relative; z-index: 20; background: rgba(244,250,251,.98); }
.avatar { width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm); background: linear-gradient(145deg, var(--color-pool), var(--color-primary)) center/cover; color: white; font-weight: 780; letter-spacing: -.03em; box-shadow: 0 7px 18px rgba(22,124,145,.2); }
.portrait-placeholder { display: grid; place-items: center; background: linear-gradient(145deg, var(--color-pool), var(--color-primary)) !important; color: white; font-weight: 850; }
.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-size: 20px; letter-spacing: -.02em; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .14em; color: var(--muted); }
.eyebrow.coral { color: var(--coral-deep); }
.eyebrow.plum { color: var(--plum); }
.eyebrow.moss { color: var(--moss); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #df9a4c; box-shadow: 0 0 0 3px rgba(223,154,76,.14); }

main { min-width: 0; min-height: 0; padding: 0 18px; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.view { display: none; padding-bottom: 18px; }
.view.active { display: block; }
.hero-row { padding: 30px 4px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.date-label { margin: 0 0 9px; font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--coral-deep); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-sans); font-weight: 750; }
h1 { margin-bottom: 8px; font-size: clamp(38px, 9vw, 52px); line-height: .98; letter-spacing: -.045em; }
h2 { margin: 4px 0 0; font-size: 25px; line-height: 1.12; letter-spacing: -.025em; }
h3 { margin: 4px 0 6px; font-size: 18px; line-height: 1.18; }
p { color: var(--muted); line-height: 1.5; }
.hero-copy { max-width: 390px; margin: 0; font-size: 15px; }
.sun-mark { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(22,124,145,.5) 0 2deg, transparent 2deg 14deg); display: grid; place-items: center; animation: spin 40s linear infinite; }
.sun-mark span { width: 48px; height: 48px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--color-sand), var(--color-sun)); box-shadow: 0 8px 20px rgba(242,173,95,.24); }
@keyframes spin { to { transform: rotate(360deg); } }

.demo-banner { display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--color-sand) 65%, white); border: 1px solid var(--color-line); padding: 12px 14px; border-radius: var(--radius-md); margin-bottom: 14px; }
.demo-banner .spark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.6); color: var(--coral-deep); }
.demo-banner div { min-width: 0; flex: 1; }
.demo-banner strong { font-size: 13px; }
.demo-banner p { margin: 1px 0 0; font-size: 11px; line-height: 1.3; }
.demo-banner ion-button { --color: var(--color-primary); font-size: 12px; }

.card { margin: 0 0 14px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); }
.card ion-card-content { padding: 21px; }
.warm-card { background: linear-gradient(145deg, rgba(185,228,243,.68), rgba(244,226,184,.72)); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 14px; }
.demo-pill { border: 1px solid rgba(121,88,112,.3); padding: 5px 8px; border-radius: 999px; color: var(--plum); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.mood-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mood { min-width: 0; min-height: 64px; --background: color-mix(in srgb, var(--color-sky) 28%, white); --border-color: var(--color-line); --border-radius: var(--radius-md); --color: var(--color-ink); font-size: 11px; }
.mood::part(native) { gap: 6px; padding: 10px; }
.mood span { font-size: 23px; }
.story { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 15px 0; border-top: 1px solid rgba(111,72,69,.1); }
.story-number { font-family: Georgia, serif; color: var(--coral-deep); font-style: italic; }
.story-topic { font-size: 9px; font-weight: 850; letter-spacing: .13em; color: var(--plum); }
.story p { margin-bottom: 0; font-size: 13px; }
.card-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.text-button { --color: var(--color-primary); font-weight: 780; }
.text-button span { padding-left: 5px; }
.round-action { width: 44px; height: 44px; --border-radius: 50%; --color: var(--color-primary); }
.round-action, .send-button, .close-sheet { --padding-start: 0; --padding-end: 0; }
.round-action svg { width: 18px; fill: currentColor; }
.quiet-icon { --color: var(--color-primary); font-weight: 800; letter-spacing: 2px; }
.timeline-item { display: grid; grid-template-columns: 44px 12px 1fr; align-items: start; gap: 10px; min-height: 62px; }
.timeline-item .time { font-size: 11px; font-weight: 780; color: var(--moss); padding-top: 3px; }
.timeline-item .line { width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--coral); box-shadow: 0 16px 0 -4px var(--line), 0 24px 0 -4px var(--line), 0 32px 0 -4px var(--line); }
.timeline-item strong { font-size: 14px; }
.timeline-item p { margin: 3px 0 0; font-size: 12px; }
.timeline-item small { display: block; margin-top: 3px; color: var(--color-muted); font-size: 10px; }
.timeline-item.muted { opacity: .62; }
.timeline-empty { margin: 0; color: var(--color-muted); font-size: 12px; line-height: 1.5; }
.rhythm-actions { display: flex; align-items: center; gap: 4px; }

.bottom-nav { position: relative; z-index: 30; width: auto; height: calc(56px + env(safe-area-inset-bottom)); padding: 0 10px env(safe-area-inset-bottom); --background: rgba(255,254,250,.96); border-top: 1px solid var(--color-line); backdrop-filter: blur(18px); }
.bottom-nav ion-tab-button { min-height: 56px; --background: transparent; --color: var(--color-muted); --color-selected: var(--color-primary); font-size: 10px; font-weight: 720; }
.bottom-nav svg { width: 23px; height: 23px; fill: currentColor; }
.bottom-nav ion-tab-button.active { color: var(--color-primary); --color: var(--color-primary); }

.chat-view { padding-bottom: 0; }
.chat-view.active { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-view.has-conversation, .chat-view:has(#message-input:focus) { grid-template-rows: minmax(0, 1fr) auto; }
.chat-view.has-conversation .chat-intro, .chat-view:has(#message-input:focus) .chat-intro { display: none; }
.chat-intro { padding: 34px 4px 26px; }
.chat-intro h1 { margin-top: 6px; }
.chat-intro p { margin-bottom: 0; }
.messages { min-height: 0; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; overscroll-behavior-y: contain; padding-bottom: 14px; }
.message { max-width: 88%; padding: 17px 18px; border-radius: 21px; }
.assistant-message { align-self: flex-start; background: var(--color-surface); border: 1px solid var(--color-line); border-bottom-left-radius: 7px; }
.user-message { align-self: flex-end; background: var(--color-primary); color: white; border-bottom-right-radius: 7px; }
.user-message p { color: white; }
.message-label { font-size: 9px; font-weight: 850; letter-spacing: .11em; color: var(--coral-deep); margin-bottom: 7px; }
.mini-sun { padding-right: 4px; }
.message p { margin-bottom: 0; font-size: 15px; overflow-wrap: anywhere; }
.message-tools { display: flex; gap: 8px; margin-top: 13px; }
.message-tools ion-button { --border-color: var(--color-line); --color: var(--color-primary); min-height: 44px; font-size: 11px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); animation: typing 1s infinite alternate; }
.typing i:nth-child(2) { animation-delay: .18s; }.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { to { transform: translateY(-5px); opacity: .45; } }
.composer { position: relative; left: -18px; z-index: 25; width: calc(100% + 36px); margin: 0; padding: 10px 12px; background: rgba(244,250,251,.98); display: flex; align-items: flex-end; gap: 6px; border-top: 1px solid var(--color-line); }
.composer-field { flex: 1; min-width: 0; }
.composer textarea { display: block; width: 100%; min-height: 46px; max-height: 120px; resize: none; border: 1px solid var(--color-line); border-radius: 22px; padding: 13px 15px; background: var(--color-surface); color: var(--color-ink); }
.attach-button, .send-button { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: grid; place-items: center; }
.attach-button { appearance: none; padding: 0; border: 1px solid var(--color-line); background: transparent; color: var(--color-primary); font-size: 24px; font-weight: 300; line-height: 1; }
.send-button { --background: var(--color-primary); --border-radius: 50%; --color: white; box-shadow: 0 8px 18px rgba(22,124,145,.2); }
.send-button svg { width: 22px; fill: white; }

.page-heading { padding: 34px 4px 28px; }
.page-heading h1 { margin-top: 6px; }
.page-heading p { margin-bottom: 0; max-width: 440px; }
[data-view="settings"] .eyebrow.coral { color: var(--color-primary); }
.moments-grid { display: grid; gap: 14px; }
.moment { border: 1px solid var(--color-line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.moment h2 { margin-top: 6px; }
.moment p { font-size: 13px; }
.moment-audio { padding: 22px; color: white; background: linear-gradient(135deg, var(--color-primary), var(--color-plum)); }
.moment-audio .eyebrow, .moment-audio p { color: rgba(255,255,255,.92); }
.waveform { height: 54px; display: flex; gap: 5px; align-items: center; margin-bottom: 15px; }
.waveform i { width: 4px; height: 15px; border-radius: 9px; background: rgba(255,255,255,.7); animation: wave 1.2s ease-in-out infinite alternate; }
.waveform i:nth-child(2n) { height: 38px; animation-delay: -.4s; }.waveform i:nth-child(3n) { height: 25px; animation-delay: -.7s; }
@keyframes wave { to { transform: scaleY(.55); opacity: .55; } }
.moment-actions { display: flex; gap: 8px; margin-top: 13px; }
.moment-actions ion-button { --border-color: currentColor; --color: currentColor; min-height: 44px; font-size: 11px; }
.moment-image { background: var(--color-sand); }
.paper-sky { height: 190px; position: relative; overflow: hidden; background: linear-gradient(var(--color-sky), var(--color-sand)); }
.paper-sun { position: absolute; top: 28px; right: 55px; width: 55px; height: 55px; border-radius: 50%; background: var(--color-sun); box-shadow: 0 0 0 10px rgba(244,226,184,.42); }
.hill { position: absolute; bottom: -35px; width: 130%; height: 120px; left: -15%; border-radius: 50% 50% 0 0; transform: rotate(-4deg); }
.hill.back { background: color-mix(in srgb, var(--color-calm) 72%, white); bottom: -54px; left: 20%; }.hill.front { background: var(--color-calm); bottom: -83px; }
.cloud { position: absolute; width: 70px; height: 20px; border-radius: 30px; background: rgba(255,250,233,.74); }.cloud:before,.cloud:after{content:"";position:absolute;border-radius:50%;background:inherit}.cloud:before{width:30px;height:30px;left:10px;bottom:0}.cloud:after{width:38px;height:38px;right:8px;bottom:0}.cloud.one{top:43px;left:32px}.cloud.two{top:85px;left:145px;transform:scale(.65)}
.moment-copy { padding: 18px 20px 20px; }
.moment-gif { padding: 20px; background: color-mix(in srgb, var(--color-sky) 35%, white); }
.gif-stage { height: 150px; border-radius: 19px; margin-bottom: 17px; display: grid; place-items: center; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 50%, var(--color-sand), var(--color-pool)); }
.gif-face { width: 82px; height: 82px; border-radius: 50%; background: var(--color-surface-warm); display: grid; place-items: center; font-size: 26px; animation: wiggle 1.5s ease-in-out infinite; }
.gif-star { position: absolute; color: #fff1c9; font-size: 25px; animation: twinkle 1.2s infinite alternate; }.s1{top:25px;left:25%}.s2{top:36px;right:23%;animation-delay:-.6s}.s3{bottom:22px;right:30%;animation-delay:-.3s}
@keyframes wiggle { 40% { transform: rotate(-7deg) scale(1.04); } 70% { transform: rotate(7deg) scale(.98); } }
@keyframes twinkle { to { transform: scale(.45) rotate(30deg); opacity: .35; } }

.identity-card { margin: 0 0 14px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--color-sky), var(--color-sand)); box-shadow: var(--shadow-card); }
.identity-card-content { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 20px; }
.identity-avatar { width: 72px; height: 72px; border-radius: 23px; background: var(--color-pool) center/cover; box-shadow: inset 0 0 0 1px var(--color-line), 0 9px 25px rgba(23,51,61,.14); }
.identity-copy { min-width: 0; }
.identity-copy h2 { margin: 5px 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity-copy p { margin: 0; font-size: 11px; line-height: 1.35; }
.identity-edit { --border-color: var(--color-primary); --border-radius: var(--radius-full); --color: var(--color-primary); min-height: 44px; margin: 0; font-size: 11px; font-weight: 800; text-transform: none; }
.settings-list { margin: 0 0 14px !important; padding: 4px 0; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); }
.settings-list ion-item { --background: transparent; --border-color: var(--color-line); --detail-icon-color: var(--color-muted); --inner-padding-end: 12px; --min-height: 68px; --padding-start: 14px; }
.settings-list ion-label { margin: 12px 0; }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { color: var(--color-ink); font-size: 14px; }
.settings-list small { margin-top: 3px; color: var(--color-muted); font-size: 11px; }
.setting-icon { width: 40px; height: 40px; display: grid; place-items: center; margin-right: 12px; border-radius: 13px; }
.setting-icon.peach { background: var(--color-sand); color: var(--color-ink); }
.setting-icon.green { background: color-mix(in srgb, var(--color-calm) 25%, white); color: var(--color-calm); }
.setting-icon.purple { background: var(--color-sky); color: var(--color-plum); }
.setting-icon.blue { background: color-mix(in srgb, var(--color-pool) 28%, white); color: var(--color-primary); }
.connection-card { margin: 0; border: 1px dashed var(--color-line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-sky) 28%, white); box-shadow: none; }
.connection-card ion-card-content { padding: 22px; }
.connection-card ion-card-content > div { display: flex; align-items: center; gap: 9px; }.connection-card h2{margin-top:10px}.connection-card p{font-size:13px}.connection-card ion-button{--color:var(--color-primary);font-size:12px;font-weight:780}
.qa-card { margin: 0 0 16px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-calm) 14%, white); box-shadow: none; }
.qa-card ion-card-content { padding: 20px; }
.qa-card[hidden] { display: none; }
.qa-card h2 { margin: 8px 0; font-size: 20px; }.qa-card p{font-size:12px}.qa-card ion-card-content > div{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11px}.qa-card ion-button{--border-color:var(--color-calm);--color:var(--color-calm);font-size:10px}

.auth-locked { overflow: hidden; }
.auth-locked .app-shell { visibility: hidden; }
.auth-gate { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, rgba(98,198,210,.38), transparent 34%), linear-gradient(160deg, #effafd, #fffaf0); }
.auth-gate[hidden] { display: none; }
.auth-card { position: relative; width: min(100%, 390px); margin: 0; border: 1px solid var(--color-line); border-radius: 32px; background: rgba(255,254,250,.95); box-shadow: 0 28px 80px rgba(23,51,61,.18); }
.auth-card ion-card-content { padding: 34px 28px; }
.auth-mark { width: 62px; height: 62px; display: grid; place-items: center; margin-bottom: 25px; border-radius: 21px; color: white; background: linear-gradient(145deg, var(--color-pool), var(--color-primary)); font-size: 27px; box-shadow: 0 12px 25px rgba(22,124,145,.22); }
.auth-card h1 { margin: 9px 0 12px; font-size: 35px; }.auth-card ion-card-content > p{font-size:14px}.auth-enrollment{display:grid;gap:10px;margin-top:22px}.auth-enrollment label{font-size:11px;font-weight:800;color:var(--color-plum)}.auth-enrollment input{width:100%;min-height:48px;border:1px solid var(--color-line);border-radius:var(--radius-sm);padding:14px;background:var(--color-surface);color:var(--color-ink)}.auth-enrollment small{color:var(--color-muted);font-size:10px;line-height:1.45}.auth-card ion-card-content > .primary-button{margin-top:22px}.auth-error{margin:16px 0 0!important;padding:11px 13px;border-radius:13px;background:color-mix(in srgb,var(--color-danger) 14%,white);color:var(--color-danger);font-size:11px!important}.auth-qa-hint{margin:18px 0 0!important;padding:10px 12px;border-radius:12px;background:color-mix(in srgb,var(--color-sky) 45%,white);color:var(--color-primary);font-size:10px!important}.auth-qa-hint code{font-weight:800}

.sheet { width: min(calc(100% - 16px), 430px); max-height: calc(100dvh - 16px); overflow: hidden; border: 0; padding: 0; border-radius: 28px 28px 20px 20px; color: var(--color-ink); background: var(--color-surface); box-shadow: 0 35px 90px rgba(23,51,61,.28); }
.sheet::backdrop { background: rgba(45,34,32,.43); backdrop-filter: blur(5px); }
.sheet-content { position: relative; padding: 34px 22px 22px; min-height: 260px; max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; }
.onboarding-content { padding-top: 70px; }
.sheet-handle { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 45px; height: 4px; border-radius: 4px; background: var(--color-line); }
.close-sheet { position: absolute; top: 15px; right: 14px; width: 44px; height: 44px; --border-radius: 50%; --color: var(--color-muted); font-size: 22px; }
.onboarding-progress { position: absolute; top: 0; left: 0; right: 0; height: 4px; overflow: hidden; border-radius: 28px 28px 0 0; }
.onboarding-progress span { display: block; height: 100%; width: 20%; background: linear-gradient(90deg, var(--coral), var(--peach)); transition: width .25s ease; }
.step-number { font-size: 10px; font-weight: 850; letter-spacing: .14em; color: var(--coral-deep); }
.setup-count { float: right; margin-right: 40px; font-size: 10px; font-weight: 800; color: var(--color-muted); }
.onboarding-content h2, #info-content h2 { margin: 13px 36px 10px 0; font-size: 32px; }
.onboarding-content p, #info-content p { font-size: 14px; }
.setup-heading { min-height: 125px; }
.setup-heading p { margin-bottom: 0; }
.setup-body { margin: 20px 0 24px; }
.choice-list { display: grid; gap: 9px; margin: 20px 0; }
.choice { width: 100%; min-height: 48px; --background: var(--color-surface); --border-color: var(--color-line); --border-radius: var(--radius-md); --color: var(--color-ink); font-size: 13px; }
.choice::part(native) { justify-content: flex-start; padding: 13px 15px; }
.choice.selected { --background: color-mix(in srgb, var(--color-sky) 55%, white); --border-color: var(--color-primary); --color: var(--color-primary); }
.step-field { width: 100%; min-height: 48px; border: 1px solid var(--color-line); background: var(--color-surface); border-radius: var(--radius-sm); padding: 13px 15px; color: var(--color-ink); margin: 8px 0 18px; }
.identity-builder { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 16px; margin: 16px 0 22px; padding: 14px; border-radius: 21px; background: color-mix(in srgb, var(--color-sky) 40%, white); }
.identity-builder-avatar { width: 92px; height: 92px; border-radius: 28px; background: var(--color-pool) center/cover; box-shadow: 0 12px 24px rgba(23,51,61,.16); }
.identity-builder strong { display: block; font-size: 20px; margin-bottom: 4px; }
.identity-builder small { display: block; color: var(--muted); line-height: 1.35; }
.identity-group { margin: 17px 0; }
.identity-group-label { display: block; margin-bottom: 8px; font-size: 10px; font-weight: 850; letter-spacing: .12em; color: var(--plum); text-transform: uppercase; }
.identity-options { display: flex; flex-wrap: wrap; gap: 7px; }
.identity-option { min-height: 44px; --background: var(--color-surface); --border-color: var(--color-line); --color: var(--color-ink); font-size: 11px; }
.identity-option.selected { --background: color-mix(in srgb, var(--color-sky) 55%, white); --border-color: var(--color-primary); --color: var(--color-primary); }
.identity-note { padding: 12px 13px; border-radius: 14px; background: color-mix(in srgb, var(--color-calm) 18%, white); color: var(--color-calm); font-size: 11px; line-height: 1.45; margin: 18px 0; }
.generated-portrait-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.generated-portrait-cell { position: relative; overflow: hidden; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 14px; background: var(--color-surface-warm); box-shadow: 0 0 0 1px var(--color-line); }
.generated-portrait-cell > span { position: absolute; inset: 0; background-repeat: no-repeat; }
.generated-portrait-cell b { position: absolute; right: 5px; bottom: 5px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(42,34,33,.7); color: white; font-size: 9px; }
.generated-portrait-cell.selected { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(22,124,145,.2); }
.generated-portrait-cell.selected b { background: var(--coral); }
.portrait-grid-help { margin: 12px 2px; font-size: 11px !important; }
.portrait-regenerate { margin-top: 2px; --border-color: var(--color-line); --color: var(--color-primary); }
.portrait-generation-loading { min-height: 300px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 28px; border: 1px dashed var(--color-line); border-radius: 22px; text-align: center; background: color-mix(in srgb, var(--color-sky) 20%, white); }
.portrait-generation-loading strong { font-size: 20px; }
.portrait-generation-loading p { margin: 0; font-size: 11px !important; }
.portrait-error { margin: 12px 0; padding: 12px 13px; border-radius: 13px; background: color-mix(in srgb, var(--color-danger) 14%, white); color: var(--color-danger); font-size: 11px; line-height: 1.4; }
.voice-list { display: grid; gap: 9px; }
.voice-choice { display: grid; grid-template-columns: 1fr 52px; align-items: stretch; overflow: hidden; border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); }
.voice-choice.selected { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); background: color-mix(in srgb, var(--color-sky) 28%, white); }
.voice-select { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; padding: 13px 14px; background: transparent; text-align: left; }
.voice-select strong, .voice-select small { display: block; }
.voice-select strong { font-size: 13px; }
.voice-select small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.voice-select i { width: 14px; height: 14px; border: 1px solid var(--color-line); border-radius: 50%; }
.voice-choice.selected .voice-select i { border: 4px solid var(--coral); }
.voice-play { width: 52px; min-height: 100%; --border-radius: 0; --color: var(--color-primary); border-left: 1px solid var(--color-line); font-size: 13px; }
.voice-play[aria-busy="true"] { opacity: .55; cursor: wait; }
.message-tools ion-button[aria-busy="true"] { opacity: 1; cursor: wait; }
.message-tools ion-button[aria-busy="true"]::before { content: ""; display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.compact-choice-list { margin: 0; }
.final-companion-card { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 16px; padding: 14px; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--color-sky), var(--color-sand)); }
.final-portrait { width: 118px; aspect-ratio: 1; border-radius: 27px; background: var(--color-pool) center/cover; box-shadow: 0 10px 25px rgba(23,51,61,.16); }
.final-identity h3 { margin: 5px 0 3px; font-size: 25px; }
.final-identity p { margin: 0; font-size: 12px; }
.setup-navigation { position: sticky; bottom: -22px; z-index: 3; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin: 24px -22px -22px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); background: var(--color-surface); border-top: 1px solid var(--color-line); }
.setup-navigation .primary-button { width: auto; }
.back-button { --color: var(--color-muted); min-width: 72px; font-size: 12px; font-weight: 750; }
.primary-button { width: 100%; --background: var(--color-primary); --color: white; --box-shadow: 0 9px 22px rgba(22,124,145,.18); font-weight: 800; }
.secondary-button { width: 100%; --color: var(--color-muted); font-size: 12px; }
.summary-list { padding: 0; list-style: none; display: grid; gap: 8px; }.summary-list li{padding:11px 13px;border-radius:13px;background:color-mix(in srgb,var(--color-sand) 46%,white);font-size:12px}.summary-list strong{display:block;margin-bottom:2px}
.info-callout { padding: 14px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-sky) 38%, white); margin: 16px 0; font-size: 12px; line-height: 1.5; }
.routine-form { min-height: calc(100dvh - 44px); padding-bottom: 1px; display: flex; flex-direction: column; }
.routine-progress { height: 4px; margin: -22px -22px 24px; overflow: hidden; background: color-mix(in srgb, var(--color-primary) 12%, white); }
.routine-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-sun)); transition: width .25s ease; }
.routine-step-body { flex: 1; display: flex; flex-direction: column; min-height: 300px; }
.routine-card-choices { display: grid; gap: 12px; margin-top: 10px; }
.routine-card-choice { position: relative; }
.routine-card-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.routine-card-choice span { min-height: 126px; display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; align-content: center; gap: 3px 14px; padding: 20px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-sky) 22%, white); box-shadow: 0 8px 24px rgba(23,51,61,.05); }
.routine-card-choice b { grid-row: 1 / 3; align-self: center; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: color-mix(in srgb, var(--color-sand) 70%, white); font-size: 24px; }
.routine-card-choice strong { align-self: end; font-size: 16px; }
.routine-card-choice small { color: var(--color-muted); font-size: 11px; line-height: 1.4; }
.routine-card-choice input:checked + span { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-sky) 55%, white); box-shadow: inset 0 0 0 1px var(--color-primary); }
.routine-card-choice input:focus-visible + span { outline: 3px solid rgba(22,124,145,.32); outline-offset: 3px; }
.routine-dialog { height: calc(100dvh - 16px); }
.routine-dialog .sheet-content,
.routine-dialog #info-content { height: 100%; }
.routine-dialog .sheet-content { overflow: hidden; }
.routine-dialog .routine-form { height: 100%; min-height: 0; }
.routine-dialog .routine-step-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.routine-dialog .setup-navigation { position: static; bottom: auto; flex: none; }
.routine-topic-body { justify-content: flex-start; padding-bottom: 24px; }
.routine-topic-step { position: relative; width: 100%; display: flex; flex-direction: column; margin-block: auto; }
.routine-topic-cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 6px; padding: 14px 0; }
.routine-topic-pill { display: inline-flex; flex: 0 1 auto; align-items: center; justify-content: center; min-height: 36px; max-width: min(46%, 172px); padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-line)); border-radius: var(--radius-full); background: color-mix(in srgb, var(--color-sky) 32%, white); color: var(--color-primary); font: inherit; font-size: 11px; font-weight: 760; line-height: 1.25; overflow-wrap: anywhere; text-align: center; text-wrap: balance; cursor: pointer; }
.routine-topic-pill.selected { border-color: var(--color-primary); background: var(--color-primary); color: white; }
.routine-topic-stream-slot { display: flex; flex: 0 0 104px; width: 104px; height: 48px; }
.routine-topic-stream-slot > * { width: 100%; height: 100%; }
.routine-topic-preview { max-width: none; cursor: wait; opacity: .72; border-style: dashed; }
.routine-topic-preview span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.routine-topic-pill:focus-visible { outline: 3px solid rgba(22,124,145,.32); outline-offset: 3px; }
.routine-topic-status { position: absolute; top: 100%; left: 0; width: 100%; min-height: 18px; margin: 0 0 8px; color: var(--color-muted); font-size: 11px !important; text-align: center; }
.routine-topic-status:empty { min-height: 0; margin: 0; }
.routine-topic-entry { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 8px; }
.routine-topic-entry input { min-width: 0; min-height: 46px; padding: 11px 15px; border: 1px solid var(--color-line); border-radius: var(--radius-full); background: var(--color-surface); color: var(--color-ink); }
.routine-topic-entry button { width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: var(--color-primary); color: white; font-size: 25px; font-weight: 400; line-height: 1; box-shadow: 0 8px 18px rgba(22,124,145,.18); }
.routine-topic-disclosure { margin: 0 5px; color: var(--color-muted); font-size: 10px !important; line-height: 1.4; text-align: center; }
.routine-topic-navigation { row-gap: 8px; padding-top: 10px; }
.routine-topic-navigation .routine-topic-entry, .routine-topic-navigation .routine-topic-disclosure { grid-column: 1 / -1; }
.routine-step-stack { display: grid; align-content: start; gap: 12px; margin-top: 8px; }
.routine-schedule-card { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-sky) 16%, white); }
.routine-schedule-card legend { padding: 0 7px; color: var(--color-ink); font-size: 15px; font-weight: 850; }
.routine-style-step { gap: 20px; padding-top: 14px; }
.routine-toggle-list { display: grid; gap: 4px; padding: 8px 14px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-sky) 16%, white); }
.routine-review { display: grid; align-content: start; gap: 14px; padding-top: 8px; }
.routine-preview { display: grid; gap: 8px; padding: 16px; border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-primary) 7%, white); }
.routine-preview h3, .routine-preview p { margin: 0; }
.routine-preview-list { display: grid; gap: 12px; margin: 4px 0 0; padding-left: 20px; }
.routine-preview-list li { padding-left: 4px; }
.routine-preview-list strong, .routine-preview-list span, .routine-preview-list small { display: block; }
.routine-preview-list small, .routine-preview-empty { color: var(--color-muted); }
.routine-notice { padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--coral) 10%, white); font-size: 12px; line-height: 1.5; }
.routine-conflict-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.routine-conflict-actions ion-button { min-height: 44px; margin: 0; font-size: 11px; }
.routine-details { display: grid; gap: 12px; }
.routine-details[hidden] { display: none; }
.routine-choice-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.routine-choice-group > legend { margin-bottom: 7px; padding: 0; }
.routine-help { margin: -3px 0 0; color: var(--color-muted); font-size: 11px; line-height: 1.45; }
.routine-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; font-weight: 750; }
.routine-switch input, .routine-choice input { width: 18px; height: 18px; accent-color: var(--color-primary); }
.routine-label, .routine-time span { color: var(--color-plum); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.routine-time { display: grid; gap: 6px; }
.routine-time input { min-height: 44px; border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--color-surface); color: var(--color-ink); font: inherit; }
.routine-loading-pill { border-radius: var(--radius-full); background: linear-gradient(100deg, color-mix(in srgb, var(--color-sky) 38%, white) 25%, color-mix(in srgb, var(--color-sky) 72%, white) 50%, color-mix(in srgb, var(--color-sky) 38%, white) 75%); background-size: 220% 100%; animation: routine-pill-loading 1.1s ease-in-out infinite; }
@keyframes routine-pill-loading { to { background-position: -120% 0; } }
.routine-time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.routine-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.routine-choice { position: relative; }
.routine-choice input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.routine-choice span { display: grid; place-items: center; min-height: 40px; padding: 8px 12px; border: 1px solid var(--color-line); border-radius: var(--radius-full); background: var(--color-surface); color: var(--color-ink); font-size: 11px; font-weight: 750; }
.routine-choice input:checked + span { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-sky) 55%, white); color: var(--color-primary); }
.routine-choice input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.routine-days .routine-choice span { min-width: 42px; padding-inline: 9px; }
#toast { --background: var(--color-ink); --color: white; --border-radius: var(--radius-full); --box-shadow: var(--shadow-card); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (min-width: 640px) {
  body { height: 100dvh; overflow: hidden; display: grid; place-items: center; padding: 16px; background: linear-gradient(145deg, var(--color-sky), var(--color-sand)); }
  .app-language-control { top: calc(max(16px, (100dvh - 844px) / 2) + 14px); right: calc(50% - 195px + 12px); }
  .app-shell { width: 390px; height: min(844px, calc(100dvh - 32px)); min-height: 0; overflow: hidden; overflow: clip; border: 1px solid var(--color-line); border-radius: 38px; background: linear-gradient(180deg, #effafd 0%, var(--color-canvas) 68%, #fffaf0 100%); box-shadow: 0 30px 80px rgba(23,51,61,.2); top: 0; transform: translateZ(0); }
  .topbar { padding-top: 18px; }
  .bottom-nav { padding-bottom: 8px; height: 74px; }
  .sheet { width: 390px; height: min(844px, calc(100dvh - 32px)); max-height: none; border-radius: 38px; }
  .sheet-content { height: 100%; max-height: none; }
}

@media (max-width: 370px) {
  .sun-mark { display: none; }
  .identity-card-content { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .identity-avatar { width: 64px; height: 64px; border-radius: 20px; }
  .identity-edit { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
