@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #fffdf5;
  --white: #ffffff;
  --ink: #24314a;
  --muted: #737b8b;
  --line: #e7e8e4;
  --blue: #4876e8;
  --blue-deep: #3564d5;
  --blue-soft: #edf2ff;
  --yellow: #ffd45c;
  --green: #448b63;
  --green-soft: #edf6ef;
  --orange: #de8750;
  --orange-soft: #fff0e5;
  --radius: 24px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 5px;
}
h1[tabindex="-1"]:focus { outline: none; }
a { color: inherit; }
img, svg { display: block; }
button svg { flex-shrink: 0; }
::selection { background: #ffe7a0; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app-header { border-bottom: 1px solid var(--line); background: rgba(255, 253, 245, .96); }
.header-inner {
  max-width: 1224px; min-height: 94px; padding: 20px 32px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; border: 0; padding: 0; background: none; color: var(--ink); text-align: left; }
.brand-mark {
  width: 46px; height: 46px; display: grid; place-items: center;
  border-radius: 14px; background: var(--yellow); color: var(--ink); transform: rotate(-5deg);
}
.brand-mark svg { width: 27px; height: 27px; transform: rotate(5deg); }
.brand-name { display: block; font-size: 28px; font-weight: 800; line-height: 1.05; letter-spacing: -.8px; }
.brand-caption { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .2px; }
.age-badge {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid #dde4db;
  border-radius: 100px; background: #f3f7ec; color: #52694b; padding: 9px 15px;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.age-badge svg { width: 17px; height: 17px; }
.header-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 17px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: #758093; font-size: 17px; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.nav-button svg { width: 19px; height: 19px; }
.nav-button:hover { background: #f2f4f8; color: var(--ink); }
.nav-button.active, .nav-button[aria-current="page"] { background: var(--blue-soft); color: var(--blue); border-color: #e1e8fa; }
.app-main { max-width: 1224px; padding: 44px 32px 54px; margin: 0 auto; min-height: calc(100vh - 185px); }
.home-intro { margin-bottom: 29px; }
.eyebrow, .reader-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 11px;
  color: var(--blue); font-size: 14px; font-weight: 750; letter-spacing: 1.3px; text-transform: uppercase;
}
.eyebrow svg { width: 15px; height: 15px; }
h1 { font-size: clamp(32px, 4vw, 43px); line-height: 1.18; font-weight: 750; letter-spacing: -1.55px; margin: 0; }
.intro-copy { color: var(--muted); font-size: 16px; line-height: 1.65; margin: 12px 0 0; }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.story-card {
  --theme: var(--blue); --theme-soft: var(--blue-soft);
  position: relative; overflow: hidden; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 5px 0 rgba(36, 49, 74, .025);
  transition: transform .2s ease, box-shadow .2s ease;
}
.story-card[data-theme="green"] { --theme: var(--green); --theme-soft: var(--green-soft); }
.story-card[data-theme="orange"] { --theme: var(--orange); --theme-soft: var(--orange-soft); }
.story-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(36, 49, 74, .065); }
.story-cover { height: 266px; position: relative; overflow: hidden; background: var(--theme-soft); }
.story-image { display: block; width: 100%; height: 100%; background-size: 200% 200%; background-repeat: no-repeat; }
.setting-image { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.story-cover .story-image { transition: transform .45s ease; }
.story-card:hover .story-cover .story-image { transform: scale(1.025); }
.card-body { padding: 24px 25px 23px; }
.card-eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px; color: var(--theme); font-size: 14px; line-height: 1.4; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; }
.story-title { margin: 0 0 9px; font-size: 25px; line-height: 1.2; font-weight: 750; letter-spacing: -.65px; }
.story-description { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; min-height: 52px; }
.story-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 19px 0 20px; }
.meta-item { display: inline-flex; align-items: center; gap: 6px; color: #7a8290; font-size: 12px; font-weight: 550; }
.meta-item svg { width: 15px; height: 15px; color: #9a9fab; }
.card-footer { display: flex; align-items: center; gap: 10px; }
.primary-button, .secondary-button, .text-button, .icon-button, .back-button {
  display: inline-flex; justify-content: center; align-items: center; gap: 10px; border-radius: 13px;
  font-weight: 650; line-height: 1.25; border: 0; text-decoration: none; transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.primary-button { min-height: 49px; padding: 14px 24px; background: var(--blue); color: white; font-size: 15px; }
.primary-button:hover:not(:disabled) { background: var(--blue-deep); transform: translateY(-1px); box-shadow: 0 5px 12px rgba(72, 118, 232, .16); }
.primary-button:active:not(:disabled), .secondary-button:active:not(:disabled) { transform: translateY(1px); }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.card-footer .primary-button { flex: 1; min-width: 0; width: auto; padding-right: 17px; padding-left: 17px; }
.card-count { flex: 0 0 auto; white-space: nowrap; color: #939aa5; font-size: 12px; }
.cover-index { position: absolute; top: 16px; left: 16px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 253, 245, .88); color: #6c766f; font-size: 12px; font-weight: 700; }
.story-card[data-theme="green"] .primary-button { background: var(--green); }
.story-card[data-theme="green"] .primary-button:hover { background: #377a55; }
.story-card[data-theme="orange"] .primary-button { background: var(--orange); }
.story-card[data-theme="orange"] .primary-button:hover { background: #cd7845; }
.secondary-button { min-height: 49px; padding: 13px 21px; color: var(--ink); background: white; border: 1px solid #dfe3ea; font-size: 15px; }
.secondary-button:hover:not(:disabled) { background: #f7f9fd; border-color: #bbc9e7; }
.text-button { padding: 10px 12px; background: none; color: var(--blue); font-size: 14px; }
.text-button:hover { background: var(--blue-soft); }
.icon-button { width: 42px; height: 42px; padding: 0; background: white; color: var(--ink); border: 1px solid var(--line); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: var(--blue-soft); }
.completed-badge {
  position: absolute; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 100px; padding: 8px 12px; background: white; color: var(--green); font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(36, 49, 74, .07);
}
.completed-badge svg { width: 15px; height: 15px; }
.steps-banner { margin-top: 32px; padding: 24px 29px; border-radius: 20px; background: #fff1bb; display: flex; align-items: center; gap: 28px; }
.steps-title { margin: 0; font-size: 16px; font-weight: 750; line-height: 1.4; max-width: 142px; flex: 0 0 142px; }
.steps-list { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 22px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; align-items: center; gap: 12px; }
.step-number { width: 33px; height: 33px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--paper); color: #8b6a15; font-size: 14px; font-weight: 750; }
.step-text { font-size: 14px; color: #776436; line-height: 1.5; }
.step-text strong { display: block; color: var(--ink); font-size: 14px; font-weight: 700; }
.app-footer { max-width: 1224px; margin: 0 auto; padding: 22px 32px 26px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 1px solid var(--line); color: #959b9e; font-size: 12px; }
.footer-note { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.footer-note svg { width: 17px; height: 17px; color: #a0a796; }

.view-topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: -10px 0 35px; }
.back-button { padding: 9px 0; background: none; color: #6f788a; font-size: 14px; font-weight: 600; }
.back-button svg { width: 18px; height: 18px; }
.back-button:hover { color: var(--blue); }
.flow-steps { display: flex; gap: 9px; align-items: center; }
.flow-step { display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 100px; color: #9197a1; font-size: 14px; font-weight: 600; }
.flow-step > span { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #dfe3ea; border-radius: 50%; font-size: 14px; font-weight: 700; }
.flow-step.active > span { background: var(--blue); color: white; border-color: var(--blue); }
.flow-step.done > span { background: var(--green-soft); border-color: #d0e4d5; }
.flow-connector { width: 24px; height: 1px; background: #dde3ec; }
.flow-step.active { background: var(--blue-soft); color: var(--blue); }
.flow-step.done { color: var(--green); }
.flow-step svg { width: 15px; height: 15px; }
.reader-header { text-align: center; margin: 0 auto 28px; }
.reader-eyebrow { color: var(--green); margin-bottom: 12px; }
.reader-title { margin: 0; font-size: 38px; line-height: 1.2; letter-spacing: -1px; font-weight: 750; }
.reader-meta { display: flex; justify-content: center; gap: 18px; margin-top: 15px; }
.reading-layout { width: 100%; max-width: 920px; margin: 0 auto; }
.story-paper { background: white; border: 1px solid var(--line); border-radius: 24px; padding: 32px 52px 27px; box-shadow: 0 5px 0 rgba(36, 49, 74, .02); }
.reading-prose { display: flow-root; }
.reading-prose .story-paragraph { margin: 0 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: 24px; line-height: 1.75; letter-spacing: .1px; color: #2e384b; }
.reading-prose .story-paragraph:last-child { margin-bottom: 0; }
.review-highlight { color: inherit; background: #fff0ad; border-radius: .18em; padding: .07em .1em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.needs-review { scroll-margin-block-start: 130px; }
.needs-review:focus-visible { outline: 2px solid #dbbc4f; outline-offset: 5px; border-radius: 4px; }
.inline-illustration.inline-setting { float: right; display: block; width: 185px; max-width: 38%; height: auto; aspect-ratio: 1; margin: 10px 0 10px 28px; border-radius: 20px; overflow: hidden; transform: none; shape-outside: inset(0 round 20px); }
.paragraph-block { display: flex; gap: 32px; align-items: center; padding: 18px 0; }
.paragraph-block + .paragraph-block { border-top: 1px solid #f0f0ed; }
.story-paragraph, .paragraph-block p { flex: 1; font-family: Georgia, "Times New Roman", serif; font-size: 24px; line-height: 1.8; letter-spacing: .1px; margin: 0; color: #2e384b; }
.inline-illustration { width: 157px; height: 157px; flex: 0 0 157px; margin: 0; overflow: hidden; border-radius: 20px; background: #f0f3ea; transform: rotate(2deg); }
.paragraph-block:nth-child(even) .inline-illustration { transform: rotate(-2deg); }
.reading-actions { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 27px; }
.read-done { min-width: 218px; min-height: 55px; background: var(--blue); font-size: 17px; border-radius: 15px; }
.reading-tip { color: #8a919c; font-size: 14px; text-align: center; margin: 15px 0 0; line-height: 1.6; }
.reading-actions .reading-tip { margin: 0; }
.reading-layout > .reading-tip { margin: 0 0 17px; color: #887443; background: #fff3c9; border-radius: 13px; padding: 13px 18px; }
.reading-layout > .review-note { position: sticky; top: 12px; z-index: 2; font-size: 16px; color: #6d5924; border: 1px solid #f0d781; box-shadow: 0 3px 12px rgba(109, 89, 36, .08); }
.stats-caption { margin: -8px 0 27px; color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 850px; }
.reading-tip svg { display: inline-block; width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

.puzzle-header { text-align: center; margin: 0 auto 29px; }
.puzzle-title { font-size: 34px; line-height: 1.2; margin: 0; letter-spacing: -.9px; font-weight: 750; }
.puzzle-instruction { font-size: 16px; line-height: 1.6; color: var(--muted); margin: 11px auto 0; max-width: 620px; }
.puzzle-board { background: #eff3fc; border: 1px solid #e1e8f7; border-radius: 24px; padding: 22px; }
.board-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 2px 16px; color: #657897; font-size: 14px; font-weight: 650; }
.placement-count { padding: 5px 10px; border-radius: 100px; background: #dfe8fa; color: #6480b5; font-size: 14px; font-weight: 650; }
.sequence-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.sequence-slot { position: relative; min-width: 0; min-height: 247px; padding: 34px 10px 10px; border-radius: 17px; border: 2px dashed #c4d0e5; background: rgba(255, 255, 255, .55); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.slot-number { position: absolute; top: 9px; left: 13px; font-size: 14px; color: #7d90b1; font-weight: 750; line-height: 1; }
.empty-slot { width: 100%; min-height: 199px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: #93a3bd; font-size: 14px; text-align: center; padding: 10px; line-height: 1.45; border: 0; background: transparent; border-radius: 10px; }
.empty-slot:hover { color: #7089b3; background: rgba(224, 233, 250, .45); }
.empty-slot-icon { font-size: 32px; line-height: 1; color: #a2b3ce; font-weight: 300; }
.empty-slot svg { width: 28px; height: 28px; stroke-width: 1.5; }
.sequence-slot:has(.slot-card) { border-style: solid; border-color: #ccd8ed; background: white; }
.sequence-slot:hover { border-color: #9fb3d7; }
.sequence-slot.drop-target { border-color: var(--blue); background: #e1eaff; transform: translateY(-2px); }
.slot-card { position: relative; overflow: hidden; width: 100%; border-radius: 12px; background: white; border: 0; padding: 0; font: inherit; cursor: grab; user-select: none; touch-action: none; }
.slot-card:active { cursor: grabbing; }
.slot-image { width: 100%; aspect-ratio: 1; height: auto; border-radius: 11px; overflow: hidden; background-size: 200% 200%; }
.slot-label { display: block; min-height: 40px; padding: 9px 3px 1px; text-align: center; color: var(--ink); font-size: 14px; line-height: 1.4; font-weight: 600; }
.slot-remove { position: absolute; top: 5px; right: 7px; width: 24px; height: 24px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #667287; font-size: 19px; box-shadow: 0 1px 7px rgba(36, 49, 74, .08); }
.slot-remove svg { width: 13px; height: 13px; }
.slot-remove:hover { background: white; color: var(--blue); }
.bank-label { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #7d8797; font-size: 14px; font-weight: 650; max-width: 950px; margin: 26px auto 13px; line-height: 1.6; }
.bank-label > span + span { font-weight: 400; color: #8a919c; text-align: right; }
.card-bank { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; max-width: 950px; margin: 0 auto; }
.event-card { position: relative; min-width: 0; overflow: hidden; padding: 8px 8px 13px; border: 2px solid var(--line); border-radius: 17px; background: white; color: var(--ink); cursor: grab; text-align: center; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; user-select: none; touch-action: none; }
.event-card:hover { transform: translateY(-3px); border-color: #bccbee; box-shadow: 0 7px 16px rgba(36, 49, 74, .06); }
.event-card:active { cursor: grabbing; }
.event-card.selected, .slot-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(72, 118, 232, .15); }
.event-card.selected { transform: translateY(-5px); }
.event-card.dragging, .slot-card.dragging { opacity: .4; transform: scale(.97); }
.event-image { width: 100%; aspect-ratio: 1; height: auto; border-radius: 11px; background-size: 200% 200%; background-repeat: no-repeat; }
.event-label { display: block; padding: 11px 10px 1px; font-size: 14px; font-weight: 650; line-height: 1.45; min-height: 44px; }
.event-handle { display: flex; align-items: center; justify-content: center; gap: 2px; color: #b8beca; margin-top: 5px; height: 9px; }
.event-handle svg { width: 18px; height: 12px; }
.event-bottom { display: block; }
.bank-empty { grid-column: 1 / -1; margin: 0; padding: 19px 25px; border-radius: 14px; border: 1px dashed #dbe1ed; background: #fafbfe; text-align: center; color: #8a919c; font-size: 14px; line-height: 1.6; }
.drag-ghost { position: fixed; z-index: 200; transform: translate(-50%, -50%) rotate(3deg); pointer-events: none; padding: 8px 8px 13px; border: 2px solid var(--blue); border-radius: 17px; overflow: hidden; background: white; color: var(--ink); text-align: center; box-shadow: 0 16px 35px rgba(36, 49, 74, .22); opacity: .95; user-select: none; }
.drag-ghost .slot-image, .drag-ghost .event-image { aspect-ratio: 1; width: 100%; height: auto; }
.drag-ghost .slot-label, .drag-ghost .event-label { font-size: 14px; }
.drag-ghost .event-handle { display: none; }
.puzzle-actions { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 27px; }
.puzzle-actions .primary-button { min-width: 177px; }
.puzzle-hint { margin: 0; text-align: center; color: #8a919c; font-size: 14px; line-height: 1.6; }
.puzzle-actions .puzzle-hint { flex: 1; }
.card-bank:empty { display: none; }

.feedback-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(36, 49, 74, .26); backdrop-filter: blur(7px); animation: overlay-in .2s ease both; }
.feedback-card { position: relative; width: min(100%, 430px); text-align: center; background: var(--paper); padding: 38px 34px 35px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 28px; box-shadow: 0 24px 70px rgba(36, 49, 74, .17); animation: card-in .35s cubic-bezier(.2,.9,.3,1.2) both; }
.feedback-icon { width: 88px; height: 88px; border-radius: 27px; margin: 0 auto 24px; display: grid; place-items: center; color: #b38822; background: #fff0b8; }
.feedback-icon svg { width: 46px; height: 46px; stroke-width: 1.7; }
.feedback-title { font-size: 27px; line-height: 1.2; margin: 0; font-weight: 750; letter-spacing: -.6px; }
.feedback-copy { font-size: 16px; line-height: 1.65; color: #77808c; margin: 13px 0 0; }
.feedback-card .primary-button { margin-top: 23px; }
.feedback-retry .feedback-icon { animation: gentle-wobble .9s ease .25s both; }
.feedback-success .feedback-icon { color: var(--green); background: #e4f3df; animation: celebrate .7s ease .2s both; }
.feedback-progress { width: 130px; height: 4px; border-radius: 10px; background: #ece8db; overflow: hidden; margin: 25px auto 0; }
.feedback-progress::after { content: ""; display: block; width: 100%; height: 100%; border-radius: inherit; background: #dbc269; transform-origin: left; animation: feedback-timer 2.6s linear both; }
.feedback-success .feedback-progress::after { background: #79ad79; animation-duration: 1.65s; }
.confetti-piece { position: fixed; top: -20px; left: var(--x, 50%); z-index: 102; width: 10px; height: 15px; border-radius: 3px; pointer-events: none; background: var(--color, var(--yellow)); animation: confetti-fall 1.8s ease-in forwards; animation-delay: var(--delay, 0s); }

.success-panel { max-width: 850px; margin: 0 auto; text-align: center; padding: 23px 0 10px; animation: page-in .35s ease both; }
.success-medallion { display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%; background: #ffe58e; margin: 0 auto 22px; color: #9b7415; box-shadow: 0 0 0 9px #fff2c9; animation: celebrate .7s ease both; }
.success-medallion svg { width: 51px; height: 51px; stroke-width: 1.6; }
.success-title { margin: 0; font-size: 40px; letter-spacing: -1px; line-height: 1.2; font-weight: 750; }
.success-copy { max-width: 520px; margin: 14px auto 0; font-size: 17px; line-height: 1.65; color: var(--muted); }
.success-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 27px; }
.success-recap { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; background: white; border: 1px solid var(--line); border-radius: 23px; padding: 22px; margin-top: 38px; }
.recap-item { min-width: 0; position: relative; }
.recap-image { width: 100%; height: auto; aspect-ratio: 1; border-radius: 13px; background-size: 200% 200%; background-repeat: no-repeat; }
.recap-item p, .recap-item .event-label { margin: 0; padding: 10px 2px 0; font-size: 14px; line-height: 1.5; font-weight: 600; }
.recap-number { position: absolute; top: 8px; left: 8px; display: grid; place-items: center; width: 25px; height: 25px; background: white; border-radius: 50%; color: var(--ink); font-size: 14px; font-weight: 700; box-shadow: 0 1px 5px rgba(36, 49, 74, .06); }
.recap-item .slot-number { top: 8px; left: 8px; display: grid; place-items: center; width: 24px; height: 24px; background: white; border-radius: 50%; color: var(--ink); }

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gentle-wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
@keyframes celebrate { 0% { transform: scale(.75) rotate(-12deg); } 45% { transform: scale(1.08) rotate(5deg); } 75% { transform: scale(.97) rotate(-2deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes confetti-fall { 0% { transform: translate3d(0, -30px, 0) rotate(var(--r, 0deg)); opacity: 1; } 100% { transform: translate3d(70px, 110vh, 0) rotate(calc(var(--r, 0deg) + 580deg)); opacity: .2; } }
@keyframes feedback-timer { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.quiz-header { max-width: 760px; margin: 0 auto 30px; text-align: center; }
.quiz-header h1 { margin: 0; font-size: 36px; line-height: 1.2; letter-spacing: -.9px; }
.quiz-header .intro-copy { font-size: 17px; line-height: 1.65; }
.quiz-form { display: grid; gap: 22px; width: 100%; max-width: 850px; margin: 0 auto; }
.question-card { min-width: 0; margin: 0; padding: 27px 28px 28px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 4px 0 rgba(36, 49, 74, .018); }
.question-title { float: left; display: flex; align-items: flex-start; gap: 12px; width: 100%; margin: 0 0 20px; padding: 0; font-size: 21px; font-weight: 700; line-height: 1.5; letter-spacing: -.3px; }
.question-number { display: grid; place-items: center; flex: 0 0 31px; width: 31px; height: 31px; margin-top: 1px; border-radius: 10px; background: #fff0bb; color: #91721a; font-size: 17px; line-height: 1; font-weight: 750; }
.question-options { clear: both; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.question-option { position: relative; display: flex; align-items: center; min-width: 0; min-height: 64px; padding: 15px 16px; border: 1.5px solid #e1e5ed; border-radius: 14px; background: #fafbfd; color: var(--ink); font-size: 18px; font-weight: 600; line-height: 1.5; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color .15s ease, background .15s ease; }
.question-option input[type="radio"] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; opacity: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.option-label { display: flex; align-items: center; gap: 12px; min-width: 0; width: 100%; overflow-wrap: break-word; }
.option-label::before { content: ""; display: block; flex: 0 0 23px; width: 23px; height: 23px; border: 2px solid #bec8d8; border-radius: 50%; background: white; }
.question-option:hover { border-color: #bac9e9; background: #f5f8ff; }
.question-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.question-option input:checked + .option-label::before { border: 7px solid var(--blue); }
.question-option:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 4px; }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; max-width: 850px; margin: 25px auto 0; }
.quiz-actions .primary-button, .quiz-actions .secondary-button { min-height: 52px; font-size: 17px; }

.stats-header { margin-bottom: 29px; }
.stats-header .intro-copy { max-width: 740px; font-size: 17px; line-height: 1.65; }
.stats-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 0 0 30px; }
.stat-summary-card { min-width: 0; padding: 25px 27px; border: 1px solid #e1e7f1; border-radius: 20px; background: #eff4ff; }
.stat-summary-card:nth-child(2) { border-color: #efe5c7; background: #fff4d2; }
.stat-summary-card:nth-child(3) { border-color: #dfeadd; background: #eff6ed; }
.stat-value { display: block; font-size: 38px; line-height: 1.2; font-weight: 750; letter-spacing: -1.1px; color: var(--ink); }
.stat-label { display: block; margin: 8px 0 0; color: #758093; font-size: 17px; line-height: 1.5; font-weight: 500; }
.story-progress-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.story-progress-card { display: flex; flex-direction: column; min-width: 0; padding: 25px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 4px 0 rgba(36, 49, 74, .018); }
.story-progress-card h2 { margin: 0 0 14px; font-size: 24px; line-height: 1.3; font-weight: 750; letter-spacing: -.6px; }
.progress-status { margin: 0 0 18px; min-height: 33px; }
.stats-status { display: inline-flex; align-items: center; gap: 7px; width: fit-content; max-width: 100%; padding: 7px 11px; border-radius: 100px; background: #f0f2f6; color: #7a8291; font-size: 14px; font-weight: 650; line-height: 1.4; }
.stats-status.completed { background: #eaf5e8; color: #438253; }
.stats-status.in-progress { background: #edf2ff; color: #5378cb; }
.progress-metrics { margin: 0 0 19px; padding: 0; }
.progress-metrics > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eff0f0; }
.progress-metrics > div:last-child { border-bottom: 0; }
.progress-metrics dt { margin: 0; color: #7d8593; font-size: 17px; line-height: 1.5; font-weight: 400; }
.progress-metrics dd { margin: 0; color: var(--ink); text-align: right; font-size: 17px; line-height: 1.5; font-weight: 700; }
.progress-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.progress-actions .primary-button, .progress-actions .secondary-button, .progress-actions .text-button { flex: 1; min-width: 0; min-height: 52px; padding-right: 15px; padding-left: 15px; font-size: 17px; }
.stats-empty { margin: 0 0 22px; color: #818a97; font-size: 17px; line-height: 1.65; }
.history-title { margin: 20px 0 8px; font-size: 17px; line-height: 1.5; font-weight: 650; }
.history-list, .history-list ul { margin: 18px 0 22px; padding: 0; list-style: none; }
.history-list ul { margin: 0; }
.history-list li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; padding: 11px 0; border-top: 1px solid #edf0f2; color: #66758b; font-size: 17px; line-height: 1.5; }
.history-date { display: block; flex-basis: 100%; color: #9098a4; font-size: 14px; line-height: 1.5; }

@media (min-width: 1300px) {
  .app-main { padding-top: 47px; }
  .story-cover { height: 278px; }
}
@media (max-width: 1000px) {
  .inline-illustration.inline-setting { width: 150px; margin-left: 24px; }
  .story-grid { gap: 18px; }
  .story-cover { height: 225px; }
  .card-body { padding: 21px 20px; }
  .story-title { font-size: 22px; }
  .steps-banner { gap: 18px; padding: 22px; }
  .steps-title { flex-basis: 125px; max-width: 125px; }
  .steps-list { gap: 15px; }
  .step { gap: 9px; }
  .step-text { font-size: 14px; }
  .step-text strong { font-size: 14px; }
  .sequence-slots, .card-bank { gap: 12px; }
  .sequence-slot { min-height: 210px; padding: 31px 8px 8px; }
  .empty-slot { min-height: 166px; }
  .slot-label, .event-label { font-size: 14px; }
}
@media (max-width: 760px) {
  .header-inner { min-height: 84px; padding: 17px 22px; }
  .brand-name { font-size: 26px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 13px; }
  .brand-caption { font-size: 11px; }
  .age-badge { font-size: 12px; padding: 8px 12px; }
  .app-main { padding: 33px 22px 40px; }
  .home-intro { margin-bottom: 25px; }
  h1 { font-size: 35px; letter-spacing: -1.2px; }
  .intro-copy { font-size: 16px; }
  .story-grid { grid-template-columns: 1fr; gap: 22px; max-width: 520px; margin: 0 auto; }
  .story-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); }
  .story-cover { height: 100%; min-height: 278px; }
  .card-body { padding: 23px 22px; }
  .story-title { font-size: 24px; }
  .story-description { font-size: 16px; min-height: 0; }
  .story-meta { gap: 10px; margin: 17px 0; }
  .meta-item { font-size: 12px; }
  .primary-button { padding: 13px 18px; font-size: 14px; }
  .steps-banner { display: block; margin-top: 25px; padding: 22px; }
  .steps-title { max-width: none; margin-bottom: 17px; }
  .steps-list { gap: 16px; }
  .step { align-items: flex-start; }
  .step-number { width: 29px; height: 29px; font-size: 14px; }
  .step-text { font-size: 14px; }
  .app-footer { padding: 20px 22px 24px; font-size: 11px; }
  .view-topbar { margin: -5px 0 25px; }
  .flow-steps { gap: 2px; }
  .flow-step { font-size: 14px; padding: 7px 9px; }
  .flow-connector { width: 12px; }
  .reader-title { font-size: 33px; }
  .story-paper { padding: 18px 28px 20px; }
  .paragraph-block { gap: 22px; padding: 17px 0; }
  .story-paragraph, .paragraph-block p { font-size: 23px; line-height: 1.7; }
  .inline-illustration { width: 128px; height: 128px; flex-basis: 128px; border-radius: 17px; }
  .inline-illustration.inline-setting { width: 150px; max-width: 38%; margin: 9px 0 10px 24px; border-radius: 17px; }
  .puzzle-title { font-size: 29px; }
  .puzzle-instruction { font-size: 15px; }
  .puzzle-board { padding: 16px; border-radius: 20px; }
  .sequence-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
  .sequence-slot { padding: 31px 10px 10px; min-height: 240px; }
  .empty-slot { min-height: 197px; }
  .slot-label { font-size: 14px; }
  .card-bank { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; max-width: 510px; }
  .bank-label { display: block; max-width: 510px; }
  .bank-label > span { display: block; }
  .bank-label > span + span { margin-top: 3px; text-align: left; }
  .event-label { font-size: 14px; }
  .puzzle-actions { gap: 10px; flex-wrap: wrap; }
  .puzzle-actions .puzzle-hint { flex-basis: 100%; order: 3; margin-top: 5px; }
  .success-title { font-size: 35px; }
  .success-copy { font-size: 16px; }
  .success-recap { gap: 11px; padding: 16px; }
}
@media (max-width: 480px) {
  .header-inner { padding: 15px 18px; gap: 12px; }
  .brand { gap: 10px; }
  .brand-caption { font-size: 10px; }
  .age-badge { padding: 7px 9px; font-size: 12px; gap: 5px; }
  .age-badge svg { width: 14px; height: 14px; }
  .app-main { padding: 29px 18px 35px; }
  h1 { font-size: 32px; line-height: 1.19; max-width: 320px; letter-spacing: -1px; }
  .eyebrow { font-size: 14px; letter-spacing: 1.1px; }
  .intro-copy { font-size: 16px; line-height: 1.6; max-width: 340px; }
  .story-card { display: block; border-radius: 22px; }
  .story-cover { height: 255px; min-height: 0; }
  .card-body { padding: 22px; }
  .story-description { font-size: 16px; }
  .story-meta { margin: 18px 0; gap: 15px; }
  .meta-item { font-size: 12px; }
  .card-footer .primary-button { font-size: 15px; }
  .steps-list { display: block; }
  .step { gap: 12px; align-items: center; }
  .step + .step { margin-top: 16px; }
  .step-text { font-size: 14px; }
  .step-text strong { display: block; margin-right: 0; font-size: 14px; }
  .steps-title { font-size: 17px; }
  .app-footer { flex-direction: column; align-items: flex-start; gap: 9px; padding: 18px; }
  .view-topbar { gap: 10px; flex-wrap: wrap; }
  .back-button { font-size: 14px; }
  .flow-step { padding: 7px 8px; font-size: 14px; gap: 5px; }
  .flow-step svg { width: 12px; height: 12px; }
  .reader-header { margin-bottom: 23px; }
  .reader-title { font-size: 30px; }
  .reader-eyebrow { font-size: 14px; }
  .reader-meta { gap: 13px; margin-top: 12px; }
  .story-paper { padding: 22px 18px; border-radius: 21px; }
  .paragraph-block { display: block; padding: 22px 0; }
  .story-paragraph, .paragraph-block p { font-size: 23px; line-height: 1.7; }
  .inline-illustration { width: 130px; height: 130px; margin: 20px auto 0; }
  .reading-prose .story-paragraph { font-size: 22px; line-height: 1.7; margin-bottom: 18px; }
  .inline-illustration.inline-setting { width: min(115px, calc(100% - 156px)); max-width: none; margin: 8px 0 8px 16px; border-radius: 14px; shape-outside: inset(0 round 14px); }
  .reading-actions { margin-top: 23px; }
  .read-done { width: 100%; }
  .reading-tip { font-size: 14px; }
  .reading-actions .reading-tip { margin-bottom: 3px; }
  .puzzle-header { margin-bottom: 23px; }
  .puzzle-title { font-size: 27px; }
  .puzzle-instruction { font-size: 14px; line-height: 1.6; }
  .puzzle-board { padding: 11px; border-radius: 17px; }
  .sequence-slots { gap: 9px; }
  .sequence-slot { border-radius: 13px; min-height: 206px; padding: 29px 7px 8px; }
  .empty-slot { min-height: 163px; font-size: 14px; gap: 7px; padding: 7px; }
  .slot-number { top: 9px; left: 11px; font-size: 14px; }
  .slot-label { font-size: 14px; min-height: 40px; }
  .slot-remove { width: 24px; height: 24px; }
  .bank-label { margin-top: 23px; font-size: 14px; }
  .card-bank { gap: 11px; }
  .event-card { padding: 6px 6px 9px; border-radius: 14px; }
  .event-label { padding: 9px 4px 0; font-size: 14px; min-height: 41px; }
  .puzzle-actions .primary-button, .puzzle-actions .secondary-button { padding: 13px 16px; font-size: 14px; }
  .puzzle-actions .primary-button { min-width: 145px; }
  .puzzle-hint { font-size: 14px; }
  .feedback-card { padding: 32px 25px; border-radius: 24px; }
  .feedback-title { font-size: 25px; }
  .feedback-copy { font-size: 15px; }
  .success-panel { padding-top: 15px; }
  .success-medallion { width: 90px; height: 90px; margin-bottom: 24px; }
  .success-title { font-size: 32px; }
  .success-copy { font-size: 15px; }
  .success-actions { margin-top: 23px; }
  .success-actions .primary-button, .success-actions .secondary-button { width: 100%; }
  .success-recap { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; gap: 16px 12px; margin-top: 28px; }
  .recap-item p, .recap-item .event-label { font-size: 14px; }
}

@media (min-width: 600px) and (max-width: 1000px) {
  .story-grid { grid-template-columns: 1fr; gap: 22px; width: 100%; max-width: 760px; margin: 0 auto; }
  .story-card { display: grid; grid-template-columns: 42% minmax(0, 1fr); }
  .story-cover { height: 100%; min-height: 250px; }
  .card-body { display: flex; flex-direction: column; min-width: 0; padding: 25px 28px; }
  .story-title { font-size: 26px; }
  .story-description { min-height: 0; font-size: 16px; }
  .story-meta { gap: 14px; margin: 18px 0; }
  .card-footer { margin-top: auto; }
  .card-footer .primary-button { min-height: 52px; font-size: 15px; }
  .slot-remove { top: 3px; right: 4px; width: 44px; height: 44px; font-size: 26px; }
  .sequence-slot { padding-top: 50px; }
  .slot-number { top: 18px; }
}

@media (min-width: 761px) and (max-width: 900px) {
  .puzzle-board { padding: 16px; }
  .sequence-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .sequence-slot { min-height: 210px; padding: 50px 6px 8px; }
  .empty-slot { min-height: 150px; padding: 7px; }
  .card-bank { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .slot-label, .event-label { font-size: 16px; }
  .event-label { padding-right: 5px; padding-left: 5px; }
  .bank-label { gap: 14px; }
  .puzzle-actions { flex-wrap: wrap; gap: 12px; }
  .puzzle-actions .puzzle-hint { flex-basis: 100%; order: 3; margin-top: 2px; }
  .puzzle-actions .primary-button, .puzzle-actions .secondary-button { min-height: 52px; }
}

@media (any-pointer: coarse) {
  .primary-button, .secondary-button { min-height: 52px; }
  .text-button, .back-button { min-height: 44px; }
  .icon-button { min-width: 44px; min-height: 44px; }
  .sequence-slot { padding-top: 50px; }
  .slot-number { top: 18px; }
  .slot-remove { top: 3px; right: 4px; width: 44px; height: 44px; font-size: 26px; }
  .event-label, .slot-label, .drag-ghost .event-label, .drag-ghost .slot-label { font-size: 16px; }
  .event-label { min-height: 48px; padding-right: 5px; padding-left: 5px; }
  .story-card:hover { transform: none; box-shadow: 0 5px 0 rgba(36, 49, 74, .025); }
  .story-card:hover .story-cover .story-image { transform: none; }
  .event-card:hover { transform: none; box-shadow: none; }
  .event-card.selected { transform: none; }
  .primary-button:hover:not(:disabled) { transform: none; box-shadow: none; }
}

@media (max-width: 1000px) {
  .stats-summary { gap: 14px; }
  .stat-summary-card { padding: 22px; }
  .stat-value { font-size: 34px; }
  .story-progress-grid { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; gap: 20px; }
  .story-progress-card { padding: 26px 28px; }
}

@media (max-width: 900px) {
  .quiz-form { max-width: 760px; gap: 20px; }
  .quiz-header h1 { font-size: 33px; }
  .question-card { padding: 24px; }
  .question-title { font-size: 20px; margin-bottom: 17px; }
  .question-options { grid-template-columns: 1fr; gap: 11px; }
  .quiz-actions { max-width: 760px; }
}

@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .brand-caption { display: none; }
  .age-badge { margin-left: auto; }
  .header-nav { order: 3; flex: 0 0 100%; width: 100%; margin: 0; gap: 8px; }
  .nav-button { flex: 1; min-width: 0; min-height: 52px; padding: 12px; }
  .view-topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
  .flow-steps { align-self: center; justify-content: center; flex-wrap: wrap; width: 100%; gap: 2px; }
  .flow-step { padding: 7px 5px; gap: 4px; flex-shrink: 0; }
  .flow-step > span { flex: 0 0 21px; width: 21px; height: 21px; }
  .flow-connector { flex: 0 0 6px; width: 6px; }
  .quiz-header { margin-bottom: 23px; }
  .quiz-header h1 { max-width: none; margin: 0 auto; font-size: 30px; }
  .quiz-header .intro-copy { font-size: 17px; }
  .quiz-form { gap: 17px; }
  .question-card { padding: 21px 18px 20px; border-radius: 19px; }
  .question-title { gap: 10px; font-size: 19px; line-height: 1.5; }
  .question-number { flex-basis: 29px; width: 29px; height: 29px; font-size: 17px; }
  .question-option { min-height: 62px; padding: 15px; font-size: 18px; }
  .quiz-actions { flex-direction: column; align-items: stretch; gap: 11px; margin-top: 21px; }
  .quiz-actions .primary-button, .quiz-actions .secondary-button { width: 100%; }
  .stats-header { margin-bottom: 23px; }
  .stats-summary { grid-template-columns: 1fr; gap: 11px; margin-bottom: 24px; }
  .stat-summary-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 22px; border-radius: 17px; }
  .stat-value { flex: 0 0 auto; font-size: 32px; }
  .stat-label { margin: 0; text-align: right; font-size: 17px; }
  .story-progress-grid { gap: 18px; }
  .story-progress-card { padding: 23px 21px; border-radius: 20px; }
  .story-progress-card h2 { font-size: 23px; }
  .progress-metrics > div { gap: 10px; }
  .progress-actions { flex-direction: column; }
  .history-list li { font-size: 17px; }
}

@media (any-pointer: coarse) {
  .nav-button { min-height: 52px; }
  .question-option { min-height: 64px; }
}

@media (max-width: 360px) {
  .brand-caption { display: none; }
}

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