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

:root {
  --ink: #24364b;
  --muted: #718196;
  --turquoise: #40c7cf;
  --sky: #dff8fa;
  --yellow: #ffd86f;
  --coral: #f98b72;
  --pink: #ffbdd0;
  --green: #8ed37b;
  --cream: #fffaf0;
  --paper: #fffdf9;
  --shadow: 0 18px 40px rgba(42, 87, 104, .14);
  --soft-shadow: 0 10px 24px rgba(42, 87, 104, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #dbf6f6; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); font-family: 'Cairo', system-ui, sans-serif; background: radial-gradient(circle at 10% 0%, #fff9dd 0, transparent 35%), linear-gradient(135deg, #daf7f5 0%, #edfafd 49%, #fff7e8 100%); }
button { font: inherit; cursor: pointer; border: 0; }
button:focus-visible { outline: 4px solid rgba(64, 199, 207, .35); outline-offset: 3px; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar { width: min(1180px, 100%); margin: 0 auto; padding: 18px 28px 12px; display: flex; align-items: center; justify-content: space-between; gap: 20px; position: relative; z-index: 2; }
.brand-mark { display: inline-flex; gap: 9px; align-items: center; color: var(--ink); background: transparent; font-size: 15px; font-weight: 900; }
.brand-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 12px; background: var(--yellow); color: #8a6725; box-shadow: 0 5px 0 #e6b952; transform: rotate(-5deg); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { color: var(--ink); background: rgba(255,255,255,.72); border: 1px solid rgba(54, 106, 123, .1); padding: 9px 13px; border-radius: 999px; font-weight: 800; font-size: 12px; box-shadow: 0 5px 15px rgba(34, 88, 104, .06); transition: .2s ease; }
.icon-button:hover { transform: translateY(-2px); background: #fff; }
.main-content { width: min(1180px, 100%); margin: 0 auto; flex: 1; padding: 20px 28px 16px; position: relative; }
.cover-screen { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); align-items: center; gap: clamp(24px, 5vw, 84px); min-height: min(720px, calc(100vh - 116px)); padding: 20px 0 34px; }
.cover-art-wrap { position: relative; min-height: 500px; display: grid; place-items: center; order: 1; }
.cover-art-wrap::before { content: ''; position: absolute; width: min(540px, 86%); aspect-ratio: 1; border-radius: 48% 52% 57% 43%; background: linear-gradient(145deg, #b3f0eb, #e7fbf5 75%); transform: rotate(-8deg); box-shadow: inset 0 -16px 0 rgba(105, 208, 201, .14), 0 25px 40px rgba(58, 161, 163, .12); }
.cover-art { width: min(460px, 82%); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 38% 38% 26% 26%; position: relative; z-index: 1; box-shadow: var(--shadow); border: 10px solid rgba(255,255,255,.8); background: linear-gradient(#e5fbff, #fff9e7); }
.cover-fallback { position: absolute; z-index: 2; display: none; gap: 5px; padding: 12px 18px; border-radius: 30px; background: rgba(255,255,255,.78); box-shadow: 0 8px 20px rgba(53, 101, 111, .12); font-size: 33px; bottom: 7%; }
.cover-copy { order: 0; padding: 10px 0; max-width: 530px; }
.eyebrow { color: #37a7b1; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; font-weight: 900; margin: 0 0 10px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(42px, 6vw, 78px); line-height: 1.04; letter-spacing: -.055em; margin-bottom: 16px; font-weight: 900; }
h1 span { color: var(--coral); }
.cover-subtitle { color: #e47964; font-size: clamp(21px, 3vw, 31px); font-weight: 900; margin-bottom: 12px; }
.cover-note { max-width: 420px; color: var(--muted); line-height: 1.9; font-size: 15px; margin-bottom: 26px; }
.primary-button, .outline-button { border-radius: 17px; padding: 13px 22px; font-weight: 900; font-size: 15px; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.primary-button { color: #fff; background: var(--coral); box-shadow: 0 7px 0 #d96d5d, 0 14px 22px rgba(249, 139, 114, .2); margin-left: 8px; }
.primary-button:hover, .outline-button:hover { transform: translateY(-3px); }
.primary-button:active { transform: translateY(2px); box-shadow: 0 3px 0 #d96d5d; }
.outline-button { color: var(--ink); background: rgba(255,255,255,.7); border: 2px solid #bce9e8; }
.sun-burst { position: absolute; width: 80px; height: 80px; border-radius: 50%; background: var(--yellow); left: 9%; top: 7%; opacity: .85; box-shadow: 0 0 0 14px rgba(255, 216, 111, .15); }
.floating-star { position: absolute; z-index: 2; color: #f5bd40; font-size: 31px; text-shadow: 0 5px 0 rgba(245, 189, 64, .13); }
.star-one { top: 15%; right: 7%; }
.star-two { bottom: 19%; left: 5%; color: var(--coral); }
.floating-cloud, .stage-cloud { position: absolute; height: 26px; width: 72px; border-radius: 999px; background: rgba(255,255,255,.8); filter: drop-shadow(0 8px 4px rgba(70, 145, 150, .08)); }
.floating-cloud::before, .floating-cloud::after, .stage-cloud::before, .stage-cloud::after { content: ''; position: absolute; background: inherit; border-radius: 50%; }
.floating-cloud::before, .stage-cloud::before { width: 32px; height: 32px; left: 12px; bottom: 8px; }
.floating-cloud::after, .stage-cloud::after { width: 40px; height: 40px; right: 9px; bottom: 5px; }
.cloud-one { top: 16%; left: 3%; transform: scale(.75); }
.cloud-two { bottom: 14%; right: 3%; transform: scale(1.1); }

.book-screen { max-width: 760px; margin: 0 auto; padding: 8px 0 20px; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.back-to-cover { background: transparent; color: var(--muted); font-size: 12px; font-weight: 900; }
.progress-info { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 800; }
.progress-info span:last-child { color: var(--ink); }
.progress-pip { width: 5px; height: 5px; background: var(--yellow); border-radius: 50%; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,.72); overflow: hidden; margin-bottom: 18px; }
.progress-track span { display: block; height: 100%; width: 3.57%; min-width: 18px; border-radius: inherit; background: linear-gradient(90deg, var(--coral), var(--yellow)); transition: width .35s ease; }
.letter-page { position: relative; min-height: min(650px, calc(100vh - 240px)); padding: 32px clamp(22px, 6vw, 72px) 25px; border-radius: 35px; overflow: hidden; background: linear-gradient(145deg, rgba(255,255,255,.93), rgba(255,253,245,.94)); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); text-align: center; }
.letter-page::before { content: ''; position: absolute; width: 260px; height: 260px; background: var(--page-accent, #e2f8f6); border-radius: 45% 55% 65% 35%; top: -120px; left: -75px; transform: rotate(24deg); opacity: .8; }
.letter-page::after { content: ''; position: absolute; width: 220px; height: 220px; background: #fff1c5; border-radius: 55% 45% 35% 65%; bottom: -100px; right: -70px; transform: rotate(-22deg); opacity: .67; }
.page-decoration { position: absolute; color: #f2c557; letter-spacing: 8px; font-size: 17px; z-index: 1; }
.decor-top { top: 20px; left: 26px; }
.decor-bottom { bottom: 18px; right: 26px; color: #eaa78d; font-size: 13px; letter-spacing: 3px; }
.letter-heading, .animal-stage, .animal-copy { position: relative; z-index: 2; }
.today-label { display: inline-block; color: #fff; background: var(--coral); padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 900; margin-bottom: 12px; box-shadow: 0 5px 0 rgba(201, 97, 81, .16); }
.letter-badge { width: 92px; height: 92px; margin: 0 auto 5px; display: grid; place-items: center; border-radius: 30px 30px 38px 30px; color: var(--ink); background: var(--page-accent, #e2f8f6); font-size: 64px; line-height: 1; font-weight: 900; box-shadow: inset 0 -7px 0 rgba(53, 150, 155, .1), 0 10px 18px rgba(65, 146, 151, .1); transform: rotate(-3deg); }
.letter-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.letter-hint strong { color: var(--coral); font-size: 17px; }
.animal-stage { width: min(330px, 78vw); aspect-ratio: 1.18; margin: 0 auto; display: grid; place-items: center; isolation: isolate; }
.stage-glow { position: absolute; inset: 10%; background: var(--page-accent, #e2f8f6); border-radius: 50% 48% 53% 47%; opacity: .75; z-index: -1; }
.animal-emoji { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; font-size: clamp(125px, 21vw, 195px); line-height: 1; transform: translateY(-6px); filter: drop-shadow(0 18px 5px rgba(55, 97, 100, .16)); animation: floaty 4.5s ease-in-out infinite; user-select: none; }
.stage-ground { position: absolute; width: 72%; height: 18px; bottom: 11%; border-radius: 50%; background: rgba(73, 149, 147, .17); filter: blur(3px); z-index: -1; }
.stage-sparkle { position: absolute; color: #f3c249; font-size: 25px; animation: twinkle 2.2s ease-in-out infinite; }
.sparkle-one { top: 13%; right: 7%; }
.sparkle-two { bottom: 22%; left: 6%; animation-delay: .8s; color: var(--coral); }
.stage-cloud { transform: scale(.68); opacity: .9; top: 15%; left: 5%; }
.stage-cloud-two { top: auto; bottom: 21%; left: auto; right: 2%; transform: scale(.48); }
.animal-copy { margin-top: -4px; }
.animal-prefix { color: var(--muted); font-size: 13px; margin-bottom: 1px; }
.animal-prefix span { color: var(--coral); font-size: 17px; font-weight: 900; }
.animal-copy h2 { font-size: clamp(30px, 5vw, 46px); margin-bottom: 4px; line-height: 1.2; font-weight: 900; color: var(--ink); }
.animal-copy p:last-child { color: var(--muted); font-size: 13px; margin: 0; }
.page-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin-top: 17px; }
.nav-button { color: var(--ink); background: rgba(255,255,255,.75); border: 1px solid rgba(54, 106, 123, .1); border-radius: 15px; padding: 11px 15px; font-size: 13px; font-weight: 900; box-shadow: 0 6px 18px rgba(42,87,104,.07); transition: .2s ease; }
.nav-button:hover { transform: translateY(-2px); background: #fff; }
.nav-button.next { justify-self: end; background: var(--turquoise); color: #fff; border-color: transparent; box-shadow: 0 6px 0 #2daab0; }
.nav-button.previous { justify-self: start; }
.round-index { width: 55px; height: 55px; border-radius: 50%; background: var(--yellow); color: #7d642c; display: grid; place-items: center; align-content: center; line-height: 1; box-shadow: 0 6px 0 #e9bd54; }
.round-index span { font-size: 19px; font-weight: 900; }
.round-index small { font-size: 9px; font-weight: 900; }
.app-footer { padding: 0 20px 16px; display: flex; justify-content: center; gap: 9px; color: #8a9ca8; font-size: 11px; font-weight: 700; }

.index-drawer { position: fixed; inset: 0; z-index: 10; visibility: hidden; transition: visibility .25s ease; }
.index-drawer.open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(33, 59, 72, .28); opacity: 0; transition: opacity .25s ease; }
.index-drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(410px, 92vw); padding: 30px 24px 22px; background: #fffdf9; box-shadow: 15px 0 35px rgba(30, 69, 77, .16); transform: translateX(-105%); transition: transform .3s cubic-bezier(.2,.8,.2,1); overflow: auto; }
.index-drawer.open .drawer-panel { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.drawer-header h2 { font-size: 31px; line-height: 1; margin: 0; }
.close-button { width: 36px; height: 36px; border-radius: 50%; background: #f1f7f6; color: var(--ink); font-size: 26px; line-height: 1; }
.letter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.letter-chip { min-height: 82px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 17px; background: #f0fbfa; color: var(--ink); transition: .2s ease; }
.letter-chip:hover, .letter-chip.active { transform: translateY(-3px); background: var(--chip-color, #ffe69a); box-shadow: 0 7px 0 rgba(41, 118, 126, .12); }
.letter-chip strong { font-size: 27px; line-height: 1; }
.letter-chip small { color: var(--muted); font-size: 10px; font-weight: 800; }
.drawer-tip { color: var(--muted); text-align: center; font-size: 12px; margin: 21px 0 0; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 12px; font-weight: 800; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes floaty { 0%, 100% { transform: translateY(-6px) rotate(-2deg); } 50% { transform: translateY(-16px) rotate(2deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(.8) rotate(0); opacity: .5; } 50% { transform: scale(1.18) rotate(10deg); opacity: 1; } }

@media (max-width: 760px) {
  .topbar { padding: 13px 16px 7px; }
  .brand-mark { font-size: 12px; }
  .brand-icon { width: 28px; height: 28px; border-radius: 10px; }
  .icon-button { padding: 8px 10px; font-size: 11px; }
  .main-content { padding: 8px 16px 12px; }
  .cover-screen { grid-template-columns: 1fr; gap: 10px; min-height: unset; padding-top: 6px; }
  .cover-art-wrap { min-height: 330px; order: 0; }
  .cover-art { width: min(310px, 75%); }
  .cover-fallback { font-size: 24px; padding: 9px 13px; bottom: 1%; }
  .sun-burst { width: 56px; height: 56px; top: 5%; left: 9%; }
  .cover-copy { text-align: center; order: 1; }
  h1 { font-size: clamp(38px, 11vw, 55px); }
  .cover-subtitle { font-size: 22px; }
  .cover-note { margin: 0 auto 20px; font-size: 13px; }
  .primary-button, .outline-button { padding: 11px 16px; font-size: 13px; }
  .letter-page { min-height: 540px; padding: 25px 15px 23px; border-radius: 27px; }
  .progress-row { gap: 8px; }
  .progress-info { font-size: 10px; }
  .back-to-cover { font-size: 11px; }
  .animal-stage { width: min(285px, 78vw); }
  .animal-emoji { font-size: clamp(116px, 37vw, 165px); }
  .page-navigation { gap: 9px; }
  .nav-button { padding: 10px 11px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
