:root {
    --ink: #243752;
    --muted: #66758d;
    --sky: #73d5ff;
    --sky-soft: #eaf9ff;
    --pink: #ff6f91;
    --purple: #7f72e8;
    --yellow: #ffd861;
    --green: #70d58b;
    --white: #ffffff;
    --shadow: 0 22px 70px rgba(54, 90, 120, .16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: 'Nunito', sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 10%, rgba(255,255,255,.9) 0 4%, transparent 5%),
        linear-gradient(180deg, #dff6ff 0%, #f8fdff 45%, #fff8ea 100%);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.story-app { min-height: 100vh; padding-bottom: 28px; }
.story-topbar {
    min-height: 76px;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px clamp(14px, 4vw, 42px);
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid rgba(97, 160, 195, .15);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.story-back {
    width: 46px; height: 46px; display: grid; place-items: center;
    border-radius: 16px; background: #eef9ff; color: #3d83aa;
    font-family: 'Baloo 2'; font-size: 34px; font-weight: 700; line-height: 1;
}
.story-title-wrap { min-width: 0; }
.story-title-wrap strong {
    display: block; font-family: 'Baloo 2'; font-size: clamp(16px, 2.4vw, 22px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.story-title-wrap span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.sound-toggle {
    border: 0; border-radius: 16px; background: #fff0f5; color: #a43c63;
    padding: 10px 14px; display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; font-weight: 800;
}
.sound-toggle.speaking { background: #effcf2; color: #347c48; }

.progress-shell { max-width: 1180px; margin: 18px auto 0; padding: 0 clamp(14px, 3vw, 26px); }
.progress-copy { display: flex; justify-content: space-between; color: #6e7b8f; font-size: 12px; font-weight: 800; margin-bottom: 7px; }
.progress-track { height: 10px; border-radius: 999px; background: rgba(86,164,205,.15); overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #63c9f4, #8f75eb, #ff7f9e); transition: width .25s ease; }

.reader-wrap { max-width: 1180px; margin: 18px auto 0; padding: 0 clamp(14px, 3vw, 26px); }
.story-card {
    min-height: min(690px, calc(100vh - 220px));
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr);
    overflow: hidden;
    border: 5px solid rgba(255,255,255,.86);
    border-radius: 34px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.storybook-sky {
    min-height: 520px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 22%, rgba(255,238,120,.72) 0 7%, transparent 7.5%),
        linear-gradient(180deg, #82dbff 0%, #bdeeff 58%, #f7fbdf 100%);
}
.storybook-sky::before {
    content: '';
    position: absolute; inset: auto -10% -9% -10%; height: 35%;
    background: #83d98f; border-radius: 50% 50% 0 0 / 45% 45% 0 0;
    transform: rotate(-2deg);
}
.storybook-sky::after {
    content: '';
    position: absolute; left: -10%; right: -10%; bottom: -2%; height: 22%;
    background: #b3e580; border-radius: 50% 50% 0 0 / 65% 65% 0 0;
    transform: rotate(3deg);
}
.decor { position: absolute; z-index: 2; user-select: none; }
.star { color: #fff5a1; text-shadow: 0 2px 8px rgba(255,201,69,.55); }
.s1 { left: 12%; top: 13%; font-size: 34px; }
.s2 { right: 13%; top: 34%; font-size: 26px; }
.c1 { left: 9%; top: 26%; font-size: 70px; opacity: .92; }
.c2 { right: 4%; top: 12%; font-size: 88px; opacity: .8; }
.sp1 { right: 24%; top: 19%; font-size: 34px; }
.art-stage { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; }
.art-emoji {
    position: absolute;
    filter: drop-shadow(0 18px 18px rgba(55,76,91,.16));
    animation: floaty 3.5s ease-in-out infinite;
}
.art-1 { font-size: clamp(100px, 15vw, 200px); transform: translate(-28%, 12%); }
.art-2 { font-size: clamp(115px, 17vw, 220px); transform: translate(28%, 12%); animation-delay: -.7s; }
.art-3 { font-size: clamp(70px, 10vw, 135px); transform: translate(6%, -80%); animation-delay: -1.3s; }
@keyframes floaty { 0%,100% { margin-top: 0; } 50% { margin-top: -12px; } }

.story-copy-panel {
    display: flex; flex-direction: column; justify-content: center;
    padding: clamp(28px, 5vw, 68px);
    background:
        radial-gradient(circle at 90% 10%, rgba(255,215,104,.22), transparent 22%),
        radial-gradient(circle at 12% 92%, rgba(127,114,232,.12), transparent 27%),
        #fff;
}
.story-eyebrow {
    display: inline-flex; align-self: flex-start;
    background: #fff3cf; color: #8a6815; border-radius: 999px; padding: 7px 12px;
    font-size: 12px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
}
.story-copy-panel h1 {
    margin: 14px 0 12px; font-family: 'Baloo 2'; font-size: clamp(32px, 4.5vw, 56px); line-height: 1.03;
    color: #243b5a;
}
.story-copy-panel > p {
    margin: 0; font-size: clamp(19px, 2.25vw, 27px); line-height: 1.62; color: #445871; font-weight: 700;
}
.choice-title { margin-top: 30px; font-family: 'Baloo 2'; font-weight: 800; font-size: 21px; }
.choice-grid { display: grid; gap: 12px; margin-top: 11px; }
.choice-card {
    display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 12px;
    padding: 14px; border-radius: 20px; background: #f8fbff; border: 2px solid #e4eff7;
    transition: .15s ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: #9fcff0; box-shadow: 0 10px 24px rgba(71,124,160,.12); }
.choice-emoji { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: #fff5cf; font-size: 28px; }
.choice-copy strong { display: block; font-family: 'Baloo 2'; font-size: 18px; }
.choice-copy small { display: block; color: #778598; font-size: 12px; font-weight: 700; margin-top: 2px; }
.choice-arrow { font-family: 'Baloo 2'; font-size: 31px; color: #6c9fbe; }
.finish-box { margin-top: 28px; border: 2px dashed #efc55e; border-radius: 22px; background: #fff9df; padding: 18px; text-align: center; }
.finish-stars { font-size: 28px; margin-bottom: 7px; }
.finish-box strong { display: block; font-family: 'Baloo 2'; font-size: 24px; color: #745716; }
.finish-box span { display: block; font-weight: 700; color: #776f55; }

.reader-actions {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 18px;
}
.reader-right { display: flex; justify-content: flex-end; }
.reader-btn {
    min-height: 50px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 17px; padding: 0 20px; font-family: 'Baloo 2'; font-weight: 800; font-size: 17px;
}
.reader-btn.ghost { background: #fff; border: 2px solid #ddeaf2; color: #5f758b; }
.reader-btn.primary { background: linear-gradient(135deg, #ff7191, #ff9270); color: #fff; box-shadow: 0 10px 24px rgba(235,96,126,.24); }
.reader-hint { color: #7d8b9b; font-size: 13px; font-weight: 800; }
.page-dots { max-width: 400px; display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.page-dots span { width: 8px; height: 8px; border-radius: 999px; background: #d9e6ed; }
.page-dots span.done { background: #a5d8ec; }
.page-dots span.active { width: 22px; background: #7a77e5; }
.parent-note {
    display: flex; gap: 12px; align-items: flex-start; max-width: 800px; margin: 18px auto 0;
    padding: 12px 16px; border-radius: 18px; color: #718092; background: rgba(255,255,255,.72);
    font-size: 12px; line-height: 1.5;
}
.parent-note span { font-size: 21px; }
.parent-note p { margin: 0; }

.scene-kitchen .storybook-sky { background: linear-gradient(180deg, #ffdca2, #fff1c8 58%, #d7efb0); }
.scene-choice .storybook-sky, .scene-choice2 .storybook-sky { background: linear-gradient(180deg, #b6a8ff, #d9d5ff 58%, #beeaa7); }
.scene-garden .storybook-sky { background: linear-gradient(180deg, #84dcff, #cbf4ff 54%, #a7e27f); }
.scene-talk .storybook-sky { background: linear-gradient(180deg, #8ccffc, #d8f3ff 58%, #f5e7aa); }
.scene-challenge .storybook-sky { background: linear-gradient(180deg, #83d7ff, #d2f3ff 58%, #86d69a); }
.scene-challenge2 .storybook-sky { background: linear-gradient(180deg, #ffd48a, #ffe9b7 58%, #b9e79b); }
.scene-celebrate .storybook-sky { background: linear-gradient(180deg, #a3a0ff, #e0dfff 54%, #ffe69a); }
.scene-home .storybook-sky { background: linear-gradient(180deg, #ffd3b9, #ffeade 58%, #aadf9a); }
.scene-finish .storybook-sky { background: linear-gradient(180deg, #83dbff, #ccefff 54%, #ffeaa0); }

@media (max-width: 820px) {
    .story-topbar { grid-template-columns: 46px minmax(0, 1fr) 46px; padding: 8px 12px; }
    .sound-toggle { width: 46px; height: 46px; justify-content: center; padding: 0; }
    .sound-label { display: none; }
    .story-card { grid-template-columns: 1fr; min-height: 0; border-radius: 28px; }
    .storybook-sky { min-height: 360px; }
    .story-copy-panel { padding: 28px 24px 30px; }
    .story-copy-panel > p { font-size: 20px; }
    .reader-actions { grid-template-columns: 1fr 1fr; }
    .page-dots { grid-column: 1 / -1; grid-row: 1; }
    .reader-left { grid-column: 1; grid-row: 2; }
    .reader-right { grid-column: 2; grid-row: 2; }
    .parent-note { margin-bottom: 85px; }
}

@media (max-width: 520px) {
    .story-title-wrap strong { font-size: 15px; }
    .story-title-wrap span { display: none; }
    .progress-shell, .reader-wrap { padding-left: 10px; padding-right: 10px; }
    .storybook-sky { min-height: 290px; }
    .art-1 { font-size: 104px; }
    .art-2 { font-size: 116px; }
    .art-3 { font-size: 72px; }
    .story-copy-panel { padding: 24px 18px 26px; }
    .story-copy-panel h1 { font-size: 34px; }
    .story-copy-panel > p { font-size: 18px; line-height: 1.55; }
    .choice-card { grid-template-columns: 46px 1fr 24px; padding: 11px; }
    .reader-btn { width: 100%; padding: 0 10px; font-size: 15px; }
    .reader-hint { text-align: right; }
}

/* =====================================================
   CERIAKU V7 - AI ILLUSTRATION
   ===================================================== */
.reader-alert{margin:0 0 14px;padding:13px 16px;border-radius:16px;font-weight:800;line-height:1.5}.reader-alert.success{background:#e8faef;color:#3d7755;border:1px solid #cfeeda}.reader-alert.error{background:#fff0f1;color:#a74c5e;border:1px solid #f4d4d9}.ai-image-stage{position:absolute;inset:0;z-index:6;background:#dff5ff;overflow:hidden}.story-ai-image{display:block;width:100%;height:100%;object-fit:cover}.ai-image-stage::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(255,255,255,.03),rgba(23,45,76,.07));pointer-events:none}.ai-image-badge{position:absolute;left:18px;bottom:18px;z-index:3;background:rgba(255,255,255,.88);backdrop-filter:blur(8px);padding:8px 11px;border-radius:999px;font-size:12px;font-weight:900;color:#576680;box-shadow:0 8px 22px rgba(36,55,82,.13)}.illustration-cta{margin-top:16px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:15px;padding:17px 18px;border-radius:22px;background:linear-gradient(120deg,#eef8ff,#fff1f5 54%,#fff8d9);border:1px solid #fff;box-shadow:0 12px 32px rgba(67,91,125,.08)}.illustration-cta.partial{background:linear-gradient(120deg,#fff8df,#f5f1ff)}.illustration-cta-icon{width:52px;height:52px;border-radius:17px;display:grid;place-items:center;background:#fff;font-size:28px;box-shadow:0 8px 20px rgba(72,85,121,.09)}.illustration-cta-copy strong{display:block;font-family:'Baloo 2';font-size:19px;color:#334967}.illustration-cta-copy span{display:block;margin-top:2px;color:#71809a;font-size:12px;font-weight:700;line-height:1.5}.illustration-generate-btn{border:0;border-radius:15px;padding:12px 16px;background:linear-gradient(135deg,#6f7cf5,#ff7998);color:#fff;font:inherit;font-weight:900;cursor:pointer;box-shadow:0 10px 22px rgba(104,111,226,.2);white-space:nowrap}.illustration-ready-note{margin-top:16px;padding:12px 15px;border-radius:16px;background:#eaf9f0;color:#44765a;font-size:13px;font-weight:800;border:1px solid #d0ecd9}
@media(max-width:760px){.illustration-cta{grid-template-columns:auto 1fr}.illustration-cta form{grid-column:1/-1}.illustration-generate-btn{width:100%}.ai-image-badge{left:12px;bottom:12px}}
.illustration-progress-line{margin-top:7px;color:#526b92!important;font-size:12px!important;font-weight:900!important}.illustration-generate-btn:disabled{opacity:.7;cursor:wait;filter:saturate(.75)}

/* =====================================================
   CERIAKU V8 - AI AUDIO STORY
   ===================================================== */
.audio-cta{margin-top:16px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:15px;padding:17px 18px;border-radius:22px;background:linear-gradient(120deg,#eef4ff,#f3eeff 52%,#fff2e5);border:1px solid #fff;box-shadow:0 12px 32px rgba(67,91,125,.08)}
.audio-cta.partial{background:linear-gradient(120deg,#eef8ff,#fff8e8)}
.audio-cta-icon{width:52px;height:52px;border-radius:17px;display:grid;place-items:center;background:#fff;font-size:28px;box-shadow:0 8px 20px rgba(72,85,121,.09)}
.audio-cta-copy strong{display:block;font-family:'Baloo 2';font-size:19px;color:#334967}.audio-cta-copy span{display:block;margin-top:2px;color:#71809a;font-size:12px;font-weight:700;line-height:1.5}
.audio-progress-line{margin-top:7px!important;color:#526b92!important;font-size:12px!important;font-weight:900!important}
.audio-generate-btn{border:0;border-radius:15px;padding:12px 16px;background:linear-gradient(135deg,#567fe8,#8f75ee);color:#fff;font:inherit;font-weight:900;cursor:pointer;box-shadow:0 10px 22px rgba(89,102,213,.2);white-space:nowrap}.audio-generate-btn:disabled{opacity:.7;cursor:wait;filter:saturate(.75)}
.audio-ready-note{margin-top:16px;padding:12px 15px;border-radius:16px;background:#edf4ff;color:#4b6484;font-size:13px;font-weight:800;border:1px solid #d8e5f7}
@media(max-width:760px){.audio-cta{grid-template-columns:auto 1fr}.audio-cta form{grid-column:1/-1}.audio-generate-btn{width:100%}}

.ai-audio-badge{display:inline-flex;align-self:flex-start;margin-top:14px;padding:7px 11px;border-radius:999px;background:#eef4ff;color:#5a6f92;font-size:11px;font-weight:900;border:1px solid #dce7f8}


/* =====================================================
   CERIAKU V9 - KIDS LIBRARY / FAVORITE
   ===================================================== */
.reader-top-actions{display:flex;align-items:center;gap:8px}.reader-favorite-form{margin:0}.reader-favorite{width:46px;height:46px;border:0;border-radius:16px;background:#f6f8fb;display:grid;place-items:center;font-size:21px;cursor:pointer;box-shadow:inset 0 0 0 1px #e7edf2}.reader-favorite.active{background:#fff0f4;box-shadow:inset 0 0 0 1px #ffdbe5}.reader-favorite:hover{transform:translateY(-1px)}
@media(max-width:820px){.story-topbar{grid-template-columns:46px minmax(0,1fr) auto}.reader-top-actions{gap:5px}.reader-favorite{width:42px;height:42px;border-radius:14px}.sound-toggle{width:42px;height:42px}}
@media(max-width:520px){.reader-favorite{width:40px;height:40px}.sound-toggle{width:40px;height:40px}}
