:root {
  color-scheme: light;
  --ink: #292b39;
  --muted: #777887;
  --paper: #fffefa;
  --lavender: #8273bd;
  --lavender-dark: #67599e;
  --peach: #edab86;
  --line: #e9e5ed;
  --mint: #e9f2e7;
  font-family: ui-rounded, 'Avenir Next', Avenir, 'Segoe UI', sans-serif;
  background: #fbf6ec;
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 75% 0%, #f1e9fa 0, transparent 38%),
              radial-gradient(ellipse at 0% 38%, #f6e9dd 0, transparent 28%),
              #fbf6ec;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.sky { position: fixed; z-index: -1; border-radius: 50%; filter: blur(1px); pointer-events: none; }
.sky-one { width: 260px; height: 260px; right: -105px; top: 190px; background: #f6e5d6; opacity: .55; }
.sky-two { width: 190px; height: 190px; left: -80px; bottom: 80px; background: #e8e2f2; opacity: .7; }
.site-header, .site-footer { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.site-header { height: 88px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 18px ui-rounded, 'Avenir Next', Avenir, 'Segoe UI', sans-serif; letter-spacing: -.7px; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 12px; color: #fff; background: var(--lavender); box-shadow: 0 6px 16px #8273bd40; font-size: 19px; }
.header-login { border: 1px solid #d9d3e4; border-radius: 999px; padding: 10px 19px; background: #ffffff8c; color: var(--ink); font-weight: 600; transition: .2s; }
.header-login:hover { background: #fff; border-color: var(--lavender); }
.app-shell { width: min(1120px, calc(100% - 48px)); min-height: calc(100vh - 150px); margin: 0 auto; display: grid; align-items: center; padding: 24px 0 48px; }
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 34px; align-items: center; }
.hero-copy { padding: 24px 0 32px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 19px; color: var(--lavender-dark); font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.eyebrow::before { content: ''; width: 20px; height: 1px; background: var(--peach); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: ui-rounded, 'Avenir Next', Avenir, 'Segoe UI', sans-serif; }
.hero h1 { max-width: 590px; margin-bottom: 22px; font-size: clamp(42px, 5.6vw, 70px); line-height: 1.06; letter-spacing: -3.8px; font-weight: 800; }
.hero h1 span { color: var(--lavender); }
.hero-description { max-width: 480px; margin-bottom: 30px; color: #666675; font-size: 17px; line-height: 1.75; }
.primary-button, .secondary-button, .outline-button { min-height: 52px; border-radius: 15px; padding: 0 23px; font-weight: 700; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { border: 0; color: #fff; background: var(--lavender); box-shadow: 0 9px 22px #8273bd42; }
.primary-button:hover { transform: translateY(-2px); background: var(--lavender-dark); box-shadow: 0 12px 26px #8273bd55; }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.secondary-button { border: 0; color: var(--lavender-dark); background: #f0edf8; }
.secondary-button:hover { background: #e8e2f4; }
.outline-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.outline-button:hover { border-color: #c9bfdc; background: #fcfbff; }
.hero-notes { display: flex; flex-wrap: wrap; gap: 17px; margin-top: 24px; color: var(--muted); font-size: 13px; }
.hero-notes span::before { content: '✧'; margin-right: 7px; color: var(--peach); }
.storybook { position: relative; min-height: 465px; display: grid; place-items: center; }
.storybook-halo { position: absolute; width: min(100%, 470px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #efe6f7 0 48%, #f6e9dc 49% 67%, transparent 68%); }
.book { position: relative; width: min(330px, 78vw); height: 300px; transform: rotate(-5deg); filter: drop-shadow(0 28px 25px #4d3e5130); }
.book-cover { position: absolute; inset: 0 0 0 15px; overflow: hidden; border: 8px solid #fff9f0; border-radius: 20px 28px 28px 20px; background: linear-gradient(145deg, #a795d0, #7971ad 54%, #687a9c); }
.book-cover::after { content: ''; position: absolute; inset: 14px; border: 1px solid #ffffff8a; border-radius: 12px 18px 18px 12px; }
.book-spine { position: absolute; z-index: 2; top: 0; bottom: 0; left: 17px; width: 18px; border-radius: 10px 0 0 10px; background: linear-gradient(90deg, #60568e, #8273bd); }
.book-moon { position: absolute; top: 42px; right: 48px; color: #f8e4a7; font-size: 50px; }
.book-stars { position: absolute; top: 54px; left: 54px; color: #fff1cf; font-size: 22px; letter-spacing: 21px; }
.book-illustration { position: absolute; right: 0; bottom: -5px; left: 0; display: grid; place-items: center; height: 185px; border-radius: 50% 50% 0 0 / 36% 36% 0 0; background: linear-gradient(0deg, #344762, #7084a0); }
.book-illustration::before { content: ''; position: absolute; top: -30px; left: 34px; width: 88px; height: 105px; border-radius: 50% 50% 44% 44%; background: #f0c9a8; transform: rotate(-16deg); box-shadow: 37px 2px 0 -10px #8d6c61; }
.book-illustration::after { content: '🐇'; position: relative; z-index: 2; margin-top: -9px; margin-left: 34px; font-size: 100px; filter: drop-shadow(0 4px 1px #34476266); }
.floating-star { position: absolute; color: #d2a45b; font-size: 25px; animation: float 4s ease-in-out infinite; }
.star-a { top: 50px; left: 20px; }.star-b { right: 15px; top: 130px; animation-delay: -1.5s; }.star-c { bottom: 51px; left: 66px; font-size: 16px; animation-delay: -2.5s; }
@keyframes float { 50% { transform: translateY(-9px) rotate(12deg); } }
.feature-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 25px; }
.feature { display: flex; gap: 13px; align-items: flex-start; padding: 19px; border: 1px solid #ece7e7; border-radius: 18px; background: #fffaf3b8; }
.feature-icon { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: #f0edf8; font-size: 18px; }
.feature:nth-child(2) .feature-icon { background: #f8eee5; }.feature:nth-child(3) .feature-icon { background: var(--mint); }
.feature strong { display: block; margin: 2px 0 4px; font: 700 14px ui-rounded, 'Avenir Next', Avenir, 'Segoe UI', sans-serif; }
.feature small { display: block; color: var(--muted); line-height: 1.5; }
.panel { width: min(720px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 48px); border: 1px solid #eee9ec; border-radius: 28px; background: #fffefaed; box-shadow: 0 22px 70px #443d4910; }
.panel.narrow { width: min(520px, 100%); }
.panel-head { margin-bottom: 29px; }
.back-button { border: 0; padding: 0; margin-bottom: 24px; color: var(--muted); background: transparent; font-size: 14px; }
.back-button:hover { color: var(--lavender-dark); }
.panel h2 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 38px); letter-spacing: -1.8px; }
.panel-intro { margin-bottom: 0; color: var(--muted); line-height: 1.65; }
.step-label { display: inline-block; margin-bottom: 11px; color: var(--lavender-dark); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 700; font-size: 14px; }
.field .optional { margin-left: 6px; color: #9896a1; font-weight: 400; }
.field input, .field textarea { width: 100%; border: 1px solid #dedbe2; border-radius: 13px; outline: none; padding: 13px 15px; color: var(--ink); background: #fff; transition: .18s; }
.field input { height: 49px; }.field textarea { min-height: 86px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: #9f93ca; box-shadow: 0 0 0 3px #8273bd1c; }
.field input:disabled, .field textarea:disabled { color: #9694a0; background: #f6f4f6; }
.field-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.field-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.field-actions button { border: 0; padding: 0; color: var(--lavender-dark); background: transparent; font-size: 12px; font-weight: 700; }
.field-actions button:hover { text-decoration: underline; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 25px; }
.form-status { min-height: 21px; margin: 14px 0 0; color: #9b4d43; font-size: 13px; line-height: 1.5; }
.form-status.success { color: #47744c; }
.choice-card { display: grid; gap: 14px; margin-top: 26px; }
.choice-button { display: flex; width: 100%; align-items: center; gap: 15px; border: 1px solid var(--line); border-radius: 17px; padding: 18px; text-align: left; color: var(--ink); background: #fff; transition: .18s; }
.choice-button:hover { transform: translateY(-1px); border-color: #b8acd7; box-shadow: 0 8px 22px #8273bd12; }
.choice-button:disabled { cursor: not-allowed; opacity: .58; transform: none; box-shadow: none; }
.choice-icon { flex: 0 0 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #f0edf8; font-size: 19px; }
.choice-button.telegram .choice-icon { background: #e6f2f7; }
.choice-copy { flex: 1; }.choice-copy strong { display: block; margin-bottom: 3px; }.choice-copy small { display: block; color: var(--muted); line-height: 1.45; }
.choice-arrow { color: #a6a1b0; font-size: 22px; }
.secure-note { display: flex; gap: 9px; margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.auth-form { display: grid; gap: 17px; margin-top: 24px; }
.auth-form .primary-button { width: 100%; margin-top: 2px; }
.text-link { border: 0; padding: 0; color: var(--lavender-dark); background: transparent; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.demo-badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 11px; color: #735f28; background: #f8f0d8; font-size: 11px; font-weight: 700; }
.notice { border: 1px solid #e9e1ce; border-radius: 13px; padding: 13px 15px; color: #6e644b; background: #fcf7e8; font-size: 13px; line-height: 1.55; }
.notice-spaced { margin-top: 14px; }.account-welcome { margin-top: 20px; }
.telegram-choice { cursor: default; }.telegram-choice:hover { transform: none; box-shadow: none; }
#telegram-widget { margin: -4px 0 8px 57px; }
.generating-panel { text-align: center; }.storybook-mini { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 23px; color: #fff0c6; background: linear-gradient(145deg, #a795d0, #687a9c); box-shadow: 0 12px 28px #8273bd35; font-size: 42px; }
.generating-panel h2 { margin-bottom: 10px; }.loading-line { width: min(250px, 100%); height: 4px; margin: 26px auto 4px; overflow: hidden; border-radius: 9px; background: #eeeaf2; }.loading-line span { display: block; width: 38%; height: 100%; border-radius: inherit; background: var(--peach); animation: loading 1.2s ease-in-out infinite alternate; }
@keyframes loading { to { transform: translateX(165%); } }
.story-panel { width: min(780px, 100%); }.story-topline { display: flex; justify-content: space-between; align-items: center; gap: 15px; }.story-topline .step-label { margin: 0; }.chapter-text { margin: 25px 0; color: #4e4d59; font-family: Georgia, 'Times New Roman', serif; font-size: 19px; line-height: 1.85; white-space: pre-wrap; }.story-audio { width: 100%; margin: 0 0 25px; }.story-choices { display: grid; gap: 11px; margin-top: 30px; }.story-choices .step-label { margin-bottom: 2px; }.story-choice { margin: 0; }.story-ending { margin: 27px 0 0; padding: 17px; border-radius: 15px; color: #665594; background: #f2eff8; line-height: 1.6; }
.site-footer { display: flex; justify-content: space-between; padding: 13px 0 25px; color: #96929b; font-size: 12px; }
.footer-sparkle { color: var(--peach); }
.hidden { display: none !important; }

.dashboard { width: min(980px, 100%); margin: 0 auto; }
.dashboard-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 10px 0 32px; }
.dashboard h2, .dashboard h3 { margin-bottom: 8px; letter-spacing: -1.5px; }
.dashboard h2 { font-size: clamp(32px, 5vw, 46px); }
.dashboard h3 { font-size: 24px; }
.quota-card { flex: 0 0 185px; display: grid; gap: 5px; padding: 17px 20px; border: 1px solid #e7dfed; border-radius: 20px; background: #fffdf8d9; box-shadow: 0 12px 30px #5142570a; }
.quota-card span, .quota-card small { color: var(--muted); font-size: 12px; }
.quota-card strong { color: var(--lavender-dark); font-size: 31px; line-height: 1.1; }
.dashboard-section { margin: 34px 0 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.child-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.child-card { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; border: 1px solid #ebe5e7; border-radius: 21px; padding: 19px; color: var(--ink); text-align: left; background: #fffefaeb; box-shadow: 0 12px 35px #5142570a; transition: transform .18s, box-shadow .18s, border-color .18s; }
.child-card:hover, .library-card:hover { transform: translateY(-2px); border-color: #cfc5df; box-shadow: 0 14px 32px #51425712; }
.child-avatar { display: grid; width: 49px; height: 49px; place-items: center; margin-bottom: 5px; border-radius: 18px; color: #665891; background: linear-gradient(145deg, #f0eaf8, #f8e8d9); font-size: 21px; font-weight: 800; }
.child-avatar.large { width: 72px; height: 72px; border-radius: 25px; font-size: 30px; }
.child-card strong { font-size: 18px; }
.child-card > span:not(.child-avatar):not(.child-card-arrow) { color: var(--muted); font-size: 13px; }
.child-card small { overflow: hidden; max-width: 100%; color: #87838f; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.child-card-arrow { margin-top: 8px; color: var(--lavender-dark); font-size: 12px; font-weight: 700; }
.empty-card { display: grid; justify-items: center; padding: 30px 20px; border: 1px dashed #dcd4e3; border-radius: 22px; text-align: center; background: #fffefa9c; }
.empty-card h3 { margin: 7px 0; font-size: 20px; }
.empty-card p { max-width: 420px; margin-bottom: 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.empty-icon { font-size: 34px; }
.empty-inline { padding: 17px; border-radius: 16px; color: var(--muted); background: #fffefaad; }
.library-list { display: grid; gap: 10px; }
.library-card { display: flex; align-items: center; gap: 14px; width: 100%; border: 1px solid #e9e5ed; border-radius: 17px; padding: 15px 18px; color: var(--ink); text-align: left; background: #fffefaed; transition: .18s; }
.library-card-icon { display: grid; flex: 0 0 43px; height: 43px; place-items: center; border-radius: 14px; background: #f0edf8; font-size: 20px; }
.library-card-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.library-card-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-card-copy small { color: var(--muted); font-size: 12px; }
.dashboard-actions { display: flex; justify-content: flex-end; margin-top: 30px; }
.profile-hero { display: flex; align-items: center; gap: 18px; margin: 8px 0 28px; }
.profile-hero h2 { margin: 0; font-size: 35px; }
.profile-hero .step-label { margin-bottom: 6px; }
.profile-detail { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; }
.profile-detail span, .profile-summary span { color: var(--muted); font-size: 13px; }
.profile-detail p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.6; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 22px; }
.profile-summary { display: grid; gap: 5px; border-radius: 14px; padding: 13px 15px; background: #f8f5fa; }
.library-heading { margin: 15px 0 22px; }
.library-heading h2 { font-size: clamp(27px, 4vw, 38px); }
.story-origin { color: var(--muted); font-size: 12px; }
.saved-chapter { scroll-margin-top: 24px; padding: 24px; border: 1px solid #ebe5ed; border-radius: 20px; background: #fffefaad; box-shadow: 0 9px 24px #51425708; }
.saved-chapter + .saved-chapter { margin-top: 16px; }
.saved-chapter-title { margin: 0; color: var(--lavender-dark); font-size: 22px; letter-spacing: -.5px; }
.saved-chapter .chapter-text { margin: 14px 0 18px; }
.saved-choices { display: grid; gap: 6px; margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: #f8f6fa; }
.saved-choices p { margin: 0; color: var(--muted); font-size: 13px; }
.saved-choices .selected-choice { color: #4e7754; font-weight: 700; }
.resume-box { margin-top: 22px; padding: 18px; border-radius: 17px; background: #f3eff8; }
.resume-box .primary-button { margin-top: 12px; }
.continue-story:disabled { opacity: .7; }
@media (max-width: 760px) {
  .dashboard-heading { display: grid; }
  .quota-card { width: 100%; grid-template-columns: 1fr auto; align-items: center; }
  .quota-card strong { grid-row: span 2; grid-column: 2; }
  .child-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .library-heading { flex-direction: column; }
  .library-heading .primary-button { width: 100%; }
  .profile-actions { display: grid; }
  .profile-actions > button { width: 100%; }
  .story-topline { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 430px) {
  .child-grid { grid-template-columns: 1fr; }
  .child-card { min-height: 190px; }
  .library-card { padding: 13px; }
}

@media (max-width: 760px) {
  .site-header, .site-footer, .app-shell { width: min(100% - 32px, 540px); }
  .site-header { height: 72px; }.brand { font-size: 16px; }.brand-mark { width: 31px; height: 31px; }
  .app-shell { min-height: calc(100vh - 132px); padding: 12px 0 32px; }
  .hero { grid-template-columns: 1fr; gap: 0; }.hero-copy { padding: 22px 0 0; }.hero h1 { max-width: 530px; font-size: clamp(41px, 11vw, 61px); letter-spacing: -2.8px; }.hero-description { font-size: 15px; }
  .storybook { min-height: 350px; order: -1; }.book { width: 260px; height: 238px; }.book-illustration { height: 145px; }.book-illustration::after { font-size: 78px; }.book-moon { top: 34px; right: 39px; font-size: 40px; }.book-stars { top: 43px; left: 43px; font-size: 18px; }.storybook-halo { width: 330px; }
  .feature-strip { grid-template-columns: 1fr; margin-top: 32px; }.feature { padding: 14px; }
  .panel { border-radius: 22px; }.form-grid { grid-template-columns: 1fr; }.field.full { grid-column: auto; }.form-footer { align-items: stretch; flex-direction: column-reverse; }.form-footer .primary-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }
