@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@500;700&family=Nunito:wght@400;600;700&display=swap');

/* Палитра из логотипа Happy Time */
:root {
  --red: #b92449;
  --blue: #009cdb;
  --navy: #00559e;
  --green: #58b400;
  --yellow: #fcef34;
  --magenta: #b41ab0;

  --bg: #fffdf7;
  --card: #ffffff;
  --ink: #2a1e3b;
  --muted: #6f6680;
  --line: #ece5d8;
  --soft: #f6f1e7;
  --r: 20px;
  --head: 'Rubik', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.5; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 34px; line-height: 1.08; }
h2 { font-size: 24px; line-height: 1.15; margin-bottom: 14px; }
p { margin: 0; }
.hl { color: var(--red); }

button { font: inherit; cursor: pointer; border: 0; color: inherit; background: none; }
.cta {
  font-family: var(--head); font-weight: 500; font-size: 18px; color: #fff; background: var(--red);
  border-radius: 999px; padding: 16px 28px; width: 100%; box-shadow: 0 4px 0 #8c1a37; transition: transform .1s, box-shadow .1s;
}
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 #8c1a37; }
.cta:disabled { opacity: .5; }
.ghost { width: 56px; height: 56px; border-radius: 50%; background: var(--soft); font-size: 22px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-family: var(--head); font-weight: 500;
  border-radius: 999px; padding: 14px 22px; background: var(--soft); color: var(--ink); }
.btn.main { background: var(--red); color: #fff; box-shadow: 0 4px 0 #8c1a37; }

/* шапка */
.bar-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; max-width: 760px; margin: 0 auto; }
.logo img { height: 34px; display: block; }
.tag { font-family: var(--head); font-weight: 500; font-size: 14px; color: #fff; background: var(--blue); padding: 4px 12px; border-radius: 999px; }

main, .wrap { max-width: 760px; margin: 0 auto; padding: 0 18px 40px; }
section { margin: 0 0 40px; }

/* первый экран */
.hero { padding-top: 8px; }
.hero h1 { margin-top: 26px; }
.lead { color: var(--muted); margin: 14px 0 24px; }
.hero-book { position: relative; height: 240px; margin: 6px auto 0; max-width: 300px; }
.pg { position: absolute; inset: 10px 30px; border-radius: 16px; }
.pg3 { background: var(--yellow); transform: rotate(8deg) translate(14px, 6px); }
.pg2 { background: var(--blue); transform: rotate(-6deg) translate(-10px, 2px); }
.pg1 { background: var(--card); border: 3px solid var(--ink); display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; transform: rotate(1deg); }
.pg1 b { font-family: var(--head); font-size: 26px; line-height: 1.05; }
.pg1 small { color: var(--muted); font-size: 14px; margin-top: 6px; }
.dot { position: absolute; border-radius: 50%; }
.d1 { width: 46px; height: 46px; background: var(--red); top: 20px; left: 20px; }
.d2 { width: 26px; height: 26px; background: var(--green); top: 30px; left: 76px; }
.d3 { width: 18px; height: 18px; background: var(--magenta); top: 64px; left: 60px; }

.demo { background: #fffbd0; border: 2px solid var(--yellow); border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 30px; }

/* как это работает */
.how ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.how li { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; }
.how li p { color: var(--muted); font-size: 15px; }
.num { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--head); font-weight: 700; }
.c-red { background: var(--red); } .c-blue { background: var(--blue); } .c-green { background: var(--green); }

.pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pills figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; }
.pills img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pills figcaption { position: absolute; left: 6px; bottom: 6px; right: 6px; text-align: center; background: #fff; color: var(--ink); font-weight: 700; font-size: 13px; line-height: 1.2; padding: 5px 6px; border-radius: 999px; }

.print-promo { background: var(--navy); color: #fff; border-radius: var(--r); padding: 24px 20px; }
.print-promo p { opacity: .9; }

.faq details { border-bottom: 2px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: '+'; font-family: var(--head); color: var(--red); font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq details p { color: var(--muted); margin-top: 8px; font-size: 15px; }

footer { text-align: center; color: var(--muted); font-size: 14px; padding: 10px 0 30px; }

/* анкета: на весь экран, кнопки снизу под большой палец */
#quiz { min-height: 100dvh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; }
.quiz-top { padding: 4px 18px 0; }
.steps { height: 8px; background: var(--soft); border-radius: 8px; overflow: hidden; }
.steps div { height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--red), var(--magenta), var(--blue), var(--green)); background-size: 400px 100%; transition: width .4s; }
.step-count { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.quiz-body { flex: 1; padding: 22px 18px 120px; }
.quiz-body h2 { font-size: 28px; margin-bottom: 8px; }
.hint { color: var(--muted); margin-bottom: 20px; font-size: 15px; }
.quiz-nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent); max-width: 760px; margin: 0 auto;
}

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cards.one { grid-template-columns: 1fr; }
.card {
  background: var(--card); border: 2.5px solid var(--line); border-radius: var(--r); padding: 18px 16px; text-align: left;
  display: flex; flex-direction: column; gap: 4px; min-height: 72px; overflow: hidden; transition: border-color .15s, transform .1s;
}
.card b { font-family: var(--head); font-weight: 500; font-size: 18px; }
.card small { color: var(--muted); font-size: 14px; line-height: 1.3; }
.card.on { border-color: var(--red); background: #fff5f7; }
.card:active { transform: scale(.98); }
.card .swatch { display: block; aspect-ratio: 1; margin: -18px -16px 10px; overflow: hidden; }
.card .swatch img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .emoji { font-size: 30px; line-height: 1; margin-bottom: 4px; }

input[type=text], input[type=tel], textarea {
  width: 100%; font: inherit; font-size: 20px; padding: 16px 18px; border-radius: 16px; border: 2.5px solid var(--line); background: var(--card); color: var(--ink); resize: none;
}
textarea { font-size: 17px; }
input:focus, textarea:focus { outline: none; border-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { padding: 9px 14px; border-radius: 999px; background: var(--soft); font-size: 15px; font-weight: 600; }
.chip.on { background: var(--blue); color: #fff; }

.photo-box { border-radius: var(--r); background: var(--soft); border: 2.5px dashed #d8cfbf; padding: 18px; text-align: center; }
.crop-hint { margin: 0 0 10px; font-size: 14px; color: #7a6f60; }
.crop { position: relative; width: 100%; max-width: 360px; aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: 16px; background: #1b1b2a; touch-action: none; cursor: grab; user-select: none; }
.crop:active { cursor: grabbing; }
.crop img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-oval { position: absolute; inset: 14% 22% 10%; border: 3px dashed rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.35); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 10px; max-width: 360px; margin: 12px auto 14px; font-weight: 700; font-size: 20px; }
.crop-zoom input { flex: 1; accent-color: var(--blue); }
.photo-btns { display: grid; gap: 10px; }
.photo-btns label { display: block; padding: 15px; border-radius: 999px; font-family: var(--head); font-weight: 500; cursor: pointer; }
.photo-btns .cam { background: var(--blue); color: #fff; }
.photo-btns .gal { background: var(--card); border: 2px solid var(--line); }
input[type=file] { display: none; }
.tips { list-style: none; padding: 0; margin: 16px 0 0; font-size: 14px; color: var(--muted); display: grid; gap: 6px; }
.tips li::before { content: '✓ '; color: var(--green); font-weight: 700; }

.summary { background: var(--card); border: 2.5px solid var(--line); border-radius: var(--r); padding: 16px 18px; margin-bottom: 18px; }
.summary p { margin: 3px 0; }
.summary b { font-family: var(--head); font-size: 20px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.consent input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--red); }
.error { color: var(--red); font-weight: 600; font-size: 15px; min-height: 1.3em; margin-top: 12px; }

/* книжка */
.book-head { text-align: center; padding: 6px 0 18px; }
.book-head h1 { font-size: 28px; }
.book-head .status { color: var(--muted); font-size: 15px; margin-top: 8px; }
.progress { height: 8px; background: var(--soft); border-radius: 8px; overflow: hidden; margin: 14px auto 0; max-width: 280px; }
.progress div { height: 100%; width: 0; background: var(--green); border-radius: 8px; transition: width .6s; }

.slider { align-items: flex-start; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; padding: 4px 18px 10px; margin: 0 -18px; scrollbar-width: none; }
.slider::-webkit-scrollbar { display: none; }
.spread { flex: 0 0 calc(100% - 8px); scroll-snap-align: center; background: var(--card); border-radius: var(--r); overflow: hidden; border: 2.5px solid var(--line); }
.pic { position: relative; aspect-ratio: 1; background: var(--soft); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-text { padding: 20px 20px 16px; position: relative; }
.page-text p { font-size: 19px; line-height: 1.55; }
.page-text .num { position: static; display: block; text-align: right; color: var(--muted); font-size: 13px; margin-top: 10px; width: auto; height: auto; background: none; }
.cover-title { position: absolute; inset: auto 0 0 0; padding: 60px 18px 18px; background: linear-gradient(to top, rgba(20,10,40,.7), transparent); color: #fff; font-family: var(--head); font-weight: 700; font-size: 26px; line-height: 1.1; }
.cover-title small { display: block; font-family: var(--body); font-weight: 600; font-size: 15px; margin-top: 6px; opacity: .95; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.pager button { width: 44px; height: 44px; border-radius: 50%; background: var(--soft); font-size: 18px; }

.wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-weight: 600;
  background: linear-gradient(100deg, var(--soft) 30%, #fff 50%, var(--soft) 70%); background-size: 300% 100%; animation: shimmer 2s infinite linear; }
.wait.failed { animation: none; text-align: center; padding: 20px; }
.wait.failed button { margin-top: 12px; padding: 10px 20px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--head); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.end { margin-top: 28px; }
.actions { display: grid; gap: 10px; }
.print { background: var(--navy); color: #fff; border-radius: var(--r); padding: 22px 18px; margin-top: 26px; }
.print .hint { color: rgba(255,255,255,.85); margin: 6px 0 14px; }
.print .row { display: grid; gap: 10px; }
.print input { border-color: transparent; }
.print .error { color: var(--yellow); }

/* планшет и компьютер */
@media (min-width: 700px) {
  h1 { font-size: 46px; }
  .hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 30px; align-items: center; }
  .hero-book { grid-column: 2; grid-row: 1 / span 3; height: 320px; width: 100%; }
  .hero h1, .lead, .hero .cta { grid-column: 1; }
  .hero .cta, .final .cta { width: auto; }
  .how ol { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .pills { grid-template-columns: repeat(3, 1fr); }
  .spread { flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .spread.cover { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; flex-basis: 100%; }
  .page-text { display: flex; flex-direction: column; justify-content: center; padding: 34px; }
  .actions { grid-template-columns: 1fr 1fr; }
  .print .row { grid-template-columns: 1fr auto; }
}

/* ползунок возраста */
.age { padding: 10px 4px 0; }
.age-num { text-align: center; font-family: var(--head); margin-bottom: 26px; }
.age-num b { display: inline-block; font-size: 96px; line-height: 1; color: var(--red); }
.age-num span { display: block; font-size: 22px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.age input[type=range] {
  --p: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; border-radius: 999px; outline: none; display: block;
  background: linear-gradient(90deg, var(--red), var(--magenta), var(--blue), var(--green)) 0 / var(--p, 0%) 100% no-repeat, var(--soft);
}
.age input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 44px; height: 44px; border-radius: 50%; background: var(--yellow);
  border: 5px solid #fff; box-shadow: 0 3px 10px rgba(42,30,59,.25); cursor: grab;
}
.age input[type=range]::-moz-range-thumb { width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); border: 5px solid #fff; box-shadow: 0 3px 10px rgba(42,30,59,.25); }
.age input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); cursor: grabbing; }
.age-ticks { position: relative; height: 20px; margin: 10px 22px 0; font-size: 13px; color: var(--muted); }
.age-ticks span { position: absolute; transform: translateX(-50%); }
#quiz .bar-top{width:100%;align-self:stretch}

/* Happy Time: общие элементы сайта, анкеты и читалки. */
:root {
  --bg: #f6ecdc; --paper: #fff8ed; --card: #fffbf3; --soft: #efe2cf;
  --ink: #281d1d; --forest: #203e34; --muted: #5c4943; --line: #cdb9a3;
  --red: #912b45; --red-deep: #702136; --blue: #386055; --green: #365e47; --navy: #203e34;
  --r: 14px; --gutter: clamp(16px, 4.5vw, 64px); --ease-out: cubic-bezier(.16, 1, .3, 1);
}
::selection { background: #e7bcc4; color: var(--ink); }
html, body { background: var(--bg); }
body { min-height: 100dvh; }
:is(a, button, input, summary, [tabindex="0"]):focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }
:is(button, .ht-button, .santa-download) { touch-action: manipulation; user-select: none; }
button:disabled, .cta:disabled, .pager button:disabled { cursor: default; opacity: .52; }
.ht-button, .cta, .btn.main {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 19px; border: 0; border-radius: 12px; background: var(--red);
  color: #fff; font-family: var(--body); font-size: 1rem; font-weight: 800; text-decoration: none;
  text-align: center; box-shadow: 0 6px 13px #581d3038; transition: transform 130ms ease-out, background-color 130ms ease-out;
}
.ht-button > svg, .ht-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ht-button-light { background: var(--paper); color: var(--forest); box-shadow: 0 6px 13px #0d211a70; }
.ht-link { color: var(--red-deep); font-weight: 800; text-underline-offset: 4px; }
.ht-button:active, .cta:active:not(:disabled), .btn.main:active { transform: translateY(2px) scale(.985); box-shadow: 0 3px 8px #581d3038; }
.ht-page .bar-top { padding-top: calc(16px + env(safe-area-inset-top)); }
.ht-page .tag { background: var(--forest); }
#quiz { max-width: 690px; }
.quiz-top, .quiz-body { padding-inline: var(--gutter); }
#quiz .bar-top { padding-inline: var(--gutter); }
.quiz-body { padding-top: 25px; padding-bottom: 26px; }
.quiz-body h2 { color: var(--forest); font-size: clamp(1.8rem, 4vw, 2.4rem); }
.quiz-nav { position: sticky; inset: auto 0 0; z-index: 3; width: 100%; max-width: none; padding-inline: var(--gutter); background: var(--bg); border-top: 1px solid var(--line); }
.quiz-nav .ghost { display: grid; place-items: center; background: var(--soft); border-radius: 12px; min-height: 48px; height: auto; }
.steps div, .age input[type=range] { background-image: linear-gradient(var(--red), var(--red)); }
.steps div { transition-duration: 180ms; }
.age input[type=range]:focus-visible { outline: 3px solid var(--red); }
.cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
.card { min-width: 0; border-width: 1px; background: var(--card); border-radius: 12px; }
.card.on { border-color: var(--red); background: #f9e6e8; }
.card b, .card small { overflow-wrap: anywhere; }
.card .swatch { max-height: 100px; }
.card .tale-swatch { aspect-ratio: auto; height: 7px; }
.photo-box { background: var(--paper); }
.photo-btns label { border-radius: 12px; }
.photo-btns label:focus-within { outline: 3px solid var(--red); outline-offset: 3px; }
.photo-btns input[type=file] { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.photo-btns label { position: relative; }
input:is([type=text], [type=tel], [type=password]), textarea { font-size: max(16px, 1rem); caret-color: var(--red); }
.summary, .print, .book-head h1 { overflow-wrap: anywhere; }
.book-page .wrap, .book-page .bar-top { max-width: 1100px; padding-inline: var(--gutter); }
.book-page .book-head { padding-block: 16px 22px; }
.book-page .book-head h1 { color: var(--forest); max-width: 24ch; margin-inline: auto; font-size: clamp(1.8rem, 4vw, 3.5rem); }
.book-tools { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; }
.book-tools .pager { margin-top: 0; }
.book-tools .btn { min-height: 44px; }
.book-page .slider { margin: 0; padding: 0; border-radius: var(--r); }
.book-page .spread { flex: 0 0 100%; min-width: 0; border-width: 1px; scroll-snap-align: start; }
.book-page .spread.cover { max-width: none; margin: 0; }
.book-page .spread.cover .pic { max-height: 670px; }
.book-page .page-text { justify-content: flex-start; padding: clamp(18px, 3.5vw, 40px); }
.book-page .page-text p { white-space: pre-line; overflow-wrap: anywhere; font-family: Georgia, serif; font-size: clamp(1.07rem, 1.7vw, 1.26rem); line-height: 1.58; }
.book-page .pager button { display: grid; place-items: center; min-width: 44px; background: var(--card); border: 1px solid var(--line); }
.book-page .pager span { min-width: 8ch; text-align: center; font-variant-numeric: tabular-nums; }
.book-page .wait { background: var(--soft); animation: none; }
.book-page .print .error { color: #ffe1d8; }
@media (hover: hover) and (pointer: fine) {
  .ht-button:not(.ht-button-light):hover, .cta:hover:not(:disabled), .btn.main:hover { background-color: var(--red-deep); }
  .ht-button-light:hover { background-color: #fff; }
  .card:hover, .book-page .pager button:hover:not(:disabled) { border-color: var(--red); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
