
/* Complete envelope geometry; foreground is a duplicate of the fox, not an envelope cutout. */
body[data-theme='warm'] .envelope-back{clip-path:none;border-radius:4px;inset:0;border:1.5px solid #b9985e}
body[data-theme='warm'] .envelope-front{inset:30% 0 0;clip-path:none;border-radius:0 0 4px 4px;background:linear-gradient(110deg,#fff0c4,#f8e3af);border:0;border-bottom:1px solid #b9985e}
body[data-theme='warm'] .envelope-flap{filter:drop-shadow(0 2px 0 #b69a63) drop-shadow(0 5px 2px #7a5a323d) drop-shadow(0 8px 5px #8a6b2829)}
body[data-theme='warm'] .envelope-letter{visibility:hidden}
body[data-theme='warm'] .unsealing .envelope-letter{visibility:visible}
body[data-theme='warm'] .fox-foreground{z-index:12}
body[data-theme='night'] .night-botanical{right:-9%;top:10%;width:47%;height:75%;overflow:visible}
body[data-theme='night'] .letter-scene{overflow:visible}
body[data-theme='night'] .envelope-insignia{border-radius:44% 52% 46% 51%;background:radial-gradient(ellipse at 29% 18%,#75998b 0,transparent 28%),radial-gradient(ellipse at 55% 60%,#174b41 30%,#0d362f 54%,#719083 61%,#234f40 70%,#092a25 85%);box-shadow:inset 3px 4px 3px #cadbc37d,inset -4px -5px 4px #001e19cc,0 2px 0 #0a2b23,1px 5px 0 #153c31,1px 8px 7px #182e2570}
body[data-theme='night'] #museumPage .category-tile small{color:#fff;background:#35553d}
body[data-theme='warm'] #museumPage .museum-title{font-family:Georgia,'Times New Roman',serif;font-weight:800;color:#304b30;text-shadow:0 1px 0 #fff8df,0 2px 4px #fff7df;letter-spacing:.12em}
.reading-letter #storyText{font-size:16px;line-height:1.95;white-space:normal}
.reading-letter #storyText.en{font:15px/1.85 var(--serif)}
.reading-letter #storyText .story-paragraph{margin:0;font:inherit;line-height:inherit;white-space:normal}
.paragraph-divider{display:flex;align-items:center;justify-content:center;height:44px;text-align:center;font:14px/1 Georgia;color:#a28b57}
.divider-warm{display:none}body[data-theme='warm'] .divider-night{display:none}body[data-theme='warm'] .divider-warm{display:inline;color:#7d955c}
.vocab-word{display:inline;margin:0;padding:0;border:0;border-radius:5px;background:transparent;color:inherit;box-shadow:none;font:inherit;line-height:inherit;cursor:pointer;text-decoration:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.vocab-word:active,.vocab-word[aria-expanded='true']{background:#51412618;box-shadow:0 0 0 2px #51412618}
.vocab-word:focus-visible{outline:2px solid #6b8155;outline-offset:2px}
.word-popup{position:fixed;z-index:60;left:50%;bottom:calc(94px + env(safe-area-inset-bottom));transform:translateX(-50%);width:min(86vw,370px);padding:18px 43px 18px 20px;border:1px solid #b7b58b;border-radius:15px;background:#fff7e1;color:#354c38;box-shadow:0 8px 30px #0005;font-family:var(--sans)}
.word-popup[hidden]{display:none}.word-popup strong{display:block;font:600 19px Georgia;margin-bottom:7px}.word-popup span{font-size:14px;line-height:1.6}.word-popup button{position:absolute;right:9px;top:9px;width:30px;height:30px;border:0;background:none;color:#657455;font-size:22px}
.illustration[hidden],.image-caption[hidden]{display:none!important}

body[data-theme='night'] .envelope-insignia{border-radius:44% 52% 46% 51% / 49% 43% 54% 46%;outline:1px solid #194939;outline-offset:-1px}
body[data-theme='night'] .envelope-insignia::before{border-width:2px;border-color:#a8b89a8c;inset:7px;box-shadow:0 1px 1px #001c20,inset 0 2px 1px #d3d9ad6b,0 -1px 1px #c5d4ad40}

/* Display the complete illustration, preserving its 3:2 book-print composition. */
body[data-theme] .reading-letter .illustration{height:auto;aspect-ratio:3/2;flex:none}
body[data-theme] .reading-letter .illustration img{height:100%;width:100%;object-fit:contain}

/* Each new reading begins at its start, with no retained scroll anchor. */
html,body,.app,#readingPage,#storyPaper{overflow-anchor:none;scroll-behavior:auto}
.word-popup{left:0;top:0;bottom:auto;transform:none;width:300px;max-width:calc(100vw - 16px)}
.daily-dialog-backdrop{position:fixed;inset:0;z-index:70;background:#0710189c;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;padding:24px}
.daily-dialog-backdrop[hidden]{display:none}
.daily-dialog{position:relative;width:min(100%,360px);padding:28px 24px 24px;border:1px solid #d0c092;border-radius:22px;background:#f6ecd2;color:#334d3c;text-align:center;box-shadow:0 18px 60px #0006}
.daily-dialog-icon{font-size:31px;color:#536e52}.daily-dialog h2{font:600 21px var(--serif);margin:12px 0}.daily-dialog p{font-size:15px;line-height:1.9;margin:0 0 24px}.daily-dialog-close{position:absolute;right:9px;top:9px;width:32px;height:32px;border:0;background:transparent;font-size:24px;color:#607252}
.daily-dialog-actions{display:grid;gap:10px}.daily-dialog-actions button{min-height:44px;border:1px solid #6c805d;border-radius:23px;background:#365943;color:#fff5dd;font-size:14px;padding:10px}.daily-dialog-actions button+button{background:transparent;color:#45623e}
body[data-theme='warm'] .daily-dialog{background:#fff5dc;border-color:#b7bd8b}body[data-theme='warm'] .daily-dialog-actions button:first-child{background:#9c7149;border-color:#b18b62}
.daily-dialog-actions #useExtraCard{background:#dce9f0;border-color:#91a6b4;color:#263f52;font-weight:700}
.daily-dialog-actions #useExtraCard:disabled{background:#d0d1ce;border-color:#bfc2c0;color:#838783;opacity:1;cursor:not-allowed}

.voice-disclosure{font-size:10px;text-align:right;color:var(--muted);margin:0 3px 9px}.voice-disclosure[hidden]{display:none}

/* Memory check, book-stamped coin balance, and theme-matched treasure choice. */
.coin-total{display:inline-flex;align-items:center;gap:3px;color:#8c6528;font:700 15px/1 Georgia,serif}
.coin-icon{width:25px;height:25px;flex:none;overflow:visible}
.coin-icon circle:first-child{fill:#e7b74e;stroke:#966a27;stroke-width:1.2}
.coin-icon .coin-inner{fill:none;stroke:#ffedaa;stroke-width:1}
.coin-icon .coin-book{fill:none;stroke:#795521;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
.memory-intro{font-size:12px;line-height:1.8}
.memory-reward[hidden]{display:none}
.treasure-prompt{text-align:center;font-size:13px;color:#63714f;margin:18px 0 10px}
.treasure-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:12px 0 16px}
.treasure-chest{min-width:0;min-height:116px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:9px 4px;border:1px solid #c4b183;border-radius:14px;background:linear-gradient(150deg,#fff7e4,#ecdfbd);color:#536144;cursor:pointer;box-shadow:0 4px 10px #3b321b1c;transition:transform .2s,box-shadow .2s}
.treasure-chest:hover:not(:disabled){transform:translateY(-3px);box-shadow:0 8px 15px #3b321b2c}
.treasure-chest:disabled{cursor:default}
.chest-art{position:relative;display:block;width:72px;height:58px;perspective:140px}
.chest-lid{position:absolute;z-index:2;left:8px;top:4px;width:56px;height:23px;border:2px solid #75502b;border-radius:17px 17px 4px 4px;background:linear-gradient(180deg,#d9ad69,#a8743d);box-shadow:inset 0 3px 3px #f9e2a270,0 2px 2px #35261755;transform-origin:50% 100%}
.chest-base{position:absolute;left:8px;top:26px;width:56px;height:28px;border:2px solid #75502b;border-radius:3px 3px 8px 8px;background:linear-gradient(90deg,#9d6738,#c68d4d 48%,#9d6738);box-shadow:inset 0 3px 3px #f1cb8170,0 4px 5px #38291845}
.chest-band{position:absolute;z-index:3;left:31px;top:25px;width:10px;height:29px;border:1px solid #d5b254;border-top:0;border-bottom:0;background:#d5b2547a}
.chest-lock{position:absolute;z-index:4;left:29px;top:31px;width:14px;height:16px;display:grid;place-items:center;border:1px solid #f0d27a;border-radius:4px;background:#9d702a;color:#ffe7a4;font-size:9px}
.chest-prompt{font-size:12px;font-weight:600}
.treasure-chest.opening .chest-lid{animation:chest-open .5s ease forwards}
.treasure-chest.opened{border-color:#d7ac4c;background:linear-gradient(150deg,#fff2c6,#e9d29a);animation:chest-pop .45s ease}
.reward-amount{display:flex;align-items:center;gap:1px;font-size:14px;font-weight:700;color:#875d20}
.reward-amount .coin-icon{width:20px;height:20px}
#memoryResult{min-height:1.7em}
#memoryResult[data-state='try-again']{color:#a14b3f;font-weight:700}
#memoryResult[data-state='success']{color:#477149;font-weight:700}
#memoryResult.result-pop{animation:memory-pop .42s cubic-bezier(.2,.8,.2,1)}
.memory-question.answer-reveal-correct,.memory-question.answer-reveal-wrong{animation:answer-reveal .45s ease both;animation-delay:var(--answer-delay,0ms)}
body[data-theme='night'] .memory-sheet .coin-total{color:#fff0be}
body[data-theme='night'] .memory-sheet .coin-icon circle:first-child{fill:#e3b75b;stroke:#765122}
body[data-theme='night'] .memory-sheet .coin-icon .coin-book{stroke:#674816}
body[data-theme='night'] .memory-sheet .treasure-prompt{color:#5b6948}
body[data-theme='night'] .memory-sheet .treasure-chest{border-color:#8b784d;background:linear-gradient(145deg,#344357,#1c2938);color:#f3dfaa;box-shadow:inset 0 0 0 2px #e3c27824,0 5px 12px #0005}
body[data-theme='night'] .memory-sheet .chest-lid{border-color:#b89a58;background:linear-gradient(180deg,#526076,#263448);box-shadow:inset 0 3px 3px #d8d6c34d,0 2px 2px #08111f}
body[data-theme='night'] .memory-sheet .chest-base{border-color:#b89a58;background:linear-gradient(90deg,#1f2c40,#40506a 48%,#1f2c40);box-shadow:inset 0 3px 3px #b9b58a44,0 4px 5px #07101b}
body[data-theme='night'] .memory-sheet .chest-band{border-color:#d8bc71;background:#d8bc7185}
body[data-theme='night'] .memory-sheet .chest-lock{border-color:#e4cb84;background:#8c713c;color:#fff0bb}
body[data-theme='night'] .memory-sheet .treasure-chest.opened{background:linear-gradient(145deg,#4f5a64,#263345);border-color:#d6b65f}
body[data-theme='night'] .memory-sheet .reward-amount{color:#f5d88f}
body[data-theme='warm'] .memory-sheet .treasure-chest{border-color:#957447;background:linear-gradient(150deg,#fff1ce,#dfc38d);color:#5f4429}
body[data-theme='warm'] .memory-sheet .chest-lid{border-color:#79502c;background:linear-gradient(180deg,#d7a15c,#995f31)}
body[data-theme='warm'] .memory-sheet .chest-base{border-color:#79502c;background:linear-gradient(90deg,#9e6232,#cf9651 48%,#9e6232)}
@keyframes answer-reveal{from{opacity:.55;transform:translateY(8px) scale(.99)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes memory-pop{0%{opacity:.4;transform:translateY(5px) scale(.97)}65%{transform:translateY(-2px) scale(1.015)}100%{opacity:1;transform:none}}
@keyframes chest-open{0%{transform:rotateX(0)}70%{transform:rotateX(-135deg) translateY(-3px)}100%{transform:rotateX(-115deg) translateY(-2px)}}
@keyframes chest-pop{0%{transform:scale(.92)}65%{transform:scale(1.04)}100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){.memory-question.answer-reveal-correct,.memory-question.answer-reveal-wrong,#memoryResult.result-pop,.treasure-chest.opened{animation:none}}

.memory-sheet{padding:22px 18px;border:1px solid #d8cba3;border-radius:20px;background:#f6edd6;color:#334837;box-shadow:0 12px 30px #0003}.memory-top{display:flex;justify-content:space-between;font-size:12px;color:#697958}.memory-top b{font-size:17px;color:#9b7542}.memory-sheet h1{font:600 24px/1.5 var(--serif);margin:17px 0 8px}.memory-intro{font-size:11px;line-height:1.8;color:#6d795c;margin-bottom:22px}.memory-question{padding:17px 0;border-top:1px solid #c7c6a377}.memory-question h3{font:600 16px/1.6 Georgia,serif;margin:0 0 12px}.memory-options{display:grid;gap:8px}.memory-option{min-height:44px;padding:11px 12px;text-align:left;font:15px/1.5 Georgia,serif;color:#3b513b;border:1px solid #b2bd97;background:#fff9e9;border-radius:9px}.memory-option.chosen{border-color:#57714c;background:#dfe8c9;box-shadow:inset 0 0 0 1px #57714c}.memory-option.correct-answer{border-color:#4d754d;background:#dcebd2}.memory-option.wrong-answer{border-color:#b58063;background:#f1dfd0}.memory-explanation{font:14px/1.6 Georgia,serif;color:#596b4f;margin:10px 0 0}.memory-explanation[hidden],.memory-actions [hidden]{display:none}.memory-actions{display:grid;gap:9px}.memory-actions button{min-height:44px;padding:11px;border:1px solid #728364;border-radius:22px;background:#365944;color:#fff6df;font-size:14px}.memory-actions #memoryReturn{background:transparent;color:#536b47}.memory-actions button:disabled{opacity:.55;cursor:default}#memoryResult{font:15px/1.7 Georgia,serif;color:#526947;margin:16px 0}.memory-question [role='radio']:focus-visible{outline:3px solid #a5b17b;outline-offset:2px}
