:root {
  color-scheme: light;
  --sky: #edf5f8;
  --ink: #294957;
  --muted: #5b737d;
  --yellow: #f8d368;
  --rose: #a55f6e;
  --line: #cbdce0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--sky);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 20px; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--rose); outline-offset: 6px; }
button { cursor: pointer; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.page-shell { width: min(1200px, calc(100% - 112px)); margin: 0 auto; }

.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 116px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 600; }
.wordmark svg { color: #b2882f; }
.header-note { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 18px; }
.header-note svg { color: var(--rose); }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 18px; max-width: 100%; }
.header-player { max-width: 300px; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.change-player { min-height: 44px; padding: 9px 14px; border: 1px solid #99afb7; border-radius: 22px; background: #f8fcfd; color: var(--ink); font-size: 17px; }
.welcome-view { max-width: 780px; margin: 35px auto 65px; padding: 40px; border: 2px solid #c6dce2; border-radius: 32px; background: #f9fcfd; text-align: center; }
.welcome-sun { display: block; margin: 0 auto 25px; color: #b2882f; }
.welcome-view h1 { font-family: inherit; font-size: clamp(32px, 4vw, 46px); font-weight: 700; letter-spacing: -1px; line-height: 1.3; }
.welcome-view > p { margin: 22px 0 30px; font-size: 24px; line-height: 1.7; }
.player-form { display: flex; flex-direction: column; gap: 17px; max-width: 440px; margin: 0 auto; }
.player-form label { text-align: left; font-size: 22px; }
.player-form input { width: 100%; min-height: 74px; padding: 12px 18px; border: 2px solid #90aeb9; border-radius: 15px; background: #fffdf6; color: var(--ink); font: inherit; font-size: 30px; }
.player-form input:focus-visible { outline: 3px solid #b2882f; outline-offset: 4px; }
.player-form input[aria-invalid="true"] { border-color: #a34145; }
.player-error { margin: 0; color: #96383d; font-size: 20px; line-height: 1.6; text-align: left; }
.cancel-player { min-height: 48px; padding: 8px; border: 0; background: none; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; font-size: 18px; line-height: 1.5; }
[data-child-name] { overflow-wrap: anywhere; }
#greeting-title [data-child-name] { display: inline-block; max-width: 100%; font-size: clamp(42px, 6.5vw, 92px); letter-spacing: -.04em; }
#greeting-title:focus { outline: none; }

.greeting { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 22px; padding: 29px 0 47px; }
.greeting-copy { min-width: 0; padding: 0 0 7px 23px; }
.intro { display: flex; align-items: center; gap: 10px; margin: 0 0 23px; font-size: 18px; color: var(--muted); }
.intro-line { width: 22px; height: 1px; background: #91a8b0; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(68px, 7.5vw, 105px); font-weight: 400; line-height: 1.1; letter-spacing: -5px; }
.title-dot { color: var(--ink); }
.greeting-message { max-width: 510px; margin: 29px 0 31px; color: var(--ink); font-size: 25px; line-height: 1.65; }
.desktop-break { display: none; }
.greeting-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.wish-button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; min-height: 62px; padding: 16px 23px; border: 1px solid var(--ink); border-radius: 12px; background: var(--ink); color: #fffdf5; font-size: 20px; font-weight: 600; transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.wish-button:hover { background: #365c6b; box-shadow: 0 5px 0 #c9dbe0; transform: translateY(-2px); }
.wish-button:active { transform: translateY(0); box-shadow: none; }
.wish-button svg { flex-shrink: 0; color: #f1dcb4; }
.button-note { margin: 16px 0 0; font-size: 18px; color: var(--muted); }
.illustration { position: relative; min-width: 0; }
.sunshine-scene { display: block; width: 100%; height: auto; overflow: visible; }
.illustration-caption { margin: -2px 0 0; text-align: center; font-size: 20px; line-height: 1.6; color: var(--muted); }

.closing-note { display: flex; align-items: center; justify-content: center; gap: 17px; padding: 29px 23px 34px; }
.closing-note p { margin: 0; font-size: 22px; line-height: 1.6; }
.closing-note svg { flex-shrink: 0; }
.closing-rule { flex: 1; max-width: 180px; height: 1px; background: var(--line); }
footer { padding: 26px 0 28px; text-align: center; font-size: 16px; line-height: 1.8; color: var(--muted); }
footer > span { margin-left: 4px; }

.wish-dialog { width: min(580px, calc(100% - 36px)); max-height: calc(100dvh - 48px); margin: auto; padding: 42px 40px 33px; overflow-y: auto; border: 1px solid #d2ddd8; border-radius: 150px 150px 18px 18px; background: #fcfbf3; color: var(--ink); text-align: center; box-shadow: 0 24px 100px #183a4a30; }
.wish-dialog::backdrop { background: #29495777; backdrop-filter: blur(5px); }
.wish-dialog[open] { animation: open-wish 260ms ease-out; }
.close-button { position: absolute; top: 71px; right: 28px; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.close-button:hover { background: #e9eddf; }
.wish-flower { margin: 0 auto 18px; }
.wish-flower svg { display: block; margin: auto; }
.wish-dialog h2 { margin: 0 0 23px; font-family: Georgia, "Times New Roman", serif; font-size: 37px; font-weight: 400; line-height: 1.2; letter-spacing: -1.5px; }
.wish-dialog p { margin: 0; font-size: 22px; line-height: 1.7; color: var(--ink); }
.wish-dialog .wish-signoff { margin-top: 22px; color: var(--ink); }
.wish-heart { display: block; margin: 25px auto 0; color: var(--rose); }
body:has(.wish-dialog[open]) { overflow: hidden; }

.play-button { display: inline-flex; justify-content: center; align-items: center; gap: 14px; min-height: 68px; padding: 17px 24px; border: 2px solid #bc9437; border-radius: 14px; background: var(--yellow); color: #29414b; font-size: 23px; font-weight: 700; line-height: 1.4; box-shadow: 0 4px 0 #d7af49; }
.play-button:hover { background: #ffe08b; }
.play-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #d7af49; }
.play-button span { white-space: nowrap; font-size: 27px; }
.language-button { background: #e0d8f3; border-color: #9983b5; box-shadow: 0 4px 0 #b5a3cd; }
.language-button:hover { background: #ece5fb; }
.spelling-button { background: #d9ead2; border-color: #819e74; box-shadow: 0 4px 0 #a2bc96; }
.spelling-button:hover { background: #e7f2e0; }
.alphabet-button { background: #f5dacb; border-color: #bd917c; box-shadow: 0 4px 0 #d5ad97; }
.alphabet-button:hover { background: #ffe7d9; }
.alphabet-help { margin: 0 auto 24px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 16px; background: #f7fbfc; }
.alphabet-help summary { cursor: pointer; font-size: 21px; line-height: 1.6; }
.alphabet-help summary:focus-visible { outline: 3px solid var(--rose); outline-offset: 6px; }
.alphabet-strip { margin: 16px 0 0; font-size: 27px; font-weight: 700; line-height: 1.8; word-spacing: 9px; text-align: center; }
.word-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 25px auto 30px; max-width: 640px; }
.word-button { min-height: 78px; padding: 12px; font-size: 29px; overflow-wrap: anywhere; }
.ordered-title { margin: 0 0 15px; font-size: 24px; }
.ordered-words { max-width: 440px; margin: 0 auto; padding-left: 40px; text-align: left; }
.ordered-words li { min-height: 53px; margin-top: 9px; padding: 9px 16px; border-bottom: 2px dashed #bfced0; color: var(--muted); font-size: 26px; line-height: 1.4; }
.ordered-words .placed-word { border-bottom-style: solid; border-color: #a2bc96; color: #325c28; background: #e8f0df; border-radius: 9px; }
.word-display { margin: 25px 0; font-size: clamp(34px, 6vw, 58px); font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.word-sentence { max-width: 680px; margin: 0 auto 25px; font-size: 25px; line-height: 1.7; text-wrap: pretty; }
.letter-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; }
.letter-button { min-width: 82px; min-height: 85px; padding: 10px 15px; }
.accent-options { gap: 12px; }
.accent-syllable { display: inline-flex; align-items: center; gap: 3px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.accent-syllable .letter-button { min-width: 48px; min-height: 72px; padding: 5px 8px; font-size: 38px; }
.consonant { min-width: 24px; font-size: 38px; text-align: center; }
.game-view { max-width: 900px; margin: 0 auto; padding-bottom: 36px; }
.back-button { min-height: 52px; padding: 10px 0; background: none; border: 0; color: var(--ink); font-size: 20px; text-decoration: underline; text-underline-offset: 5px; }
.game-heading { text-align: center; margin: 12px 0 26px; }
.game-heading > svg { color: #ae842c; }
.game-heading h2 { margin: 12px 0; font-size: clamp(30px, 4vw, 42px); line-height: 1.3; }
.game-heading p { margin: 0; font-size: 23px; line-height: 1.6; }
.game-progress { text-align: center; margin: 0 0 16px; font-size: 21px; line-height: 1.5; }
.flower-progress { display: flex; justify-content: center; gap: 12px; margin: 0 auto 24px; font-size: 31px; }
.empty-flower { color: #718b91; }
.math-card { padding: 30px; background: #fffdf6; border: 2px solid #d4dfd5; border-radius: 28px; text-align: center; }
.game-instruction { margin: 0; font-size: 23px; line-height: 1.5; }
.equation { margin: 24px 0 30px; font-family: "Trebuchet MS", "Segoe UI", sans-serif; font-size: clamp(44px, 8vw, 76px); font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.answer-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; max-width: 540px; margin: 0 auto; }
.answer-button { min-height: 100px; padding: 12px; border: 3px solid #90aeb9; border-radius: 18px; background: #edf5f8; color: var(--ink); font-size: 44px; font-weight: 700; }
.answer-button:hover:not(:disabled) { background: #dcecf2; border-color: var(--ink); }
.answer-button:disabled { opacity: .45; cursor: default; }
.answer-button.correct-answer { opacity: 1; border-color: #527e47; background: #e2efd8; color: #325c28; }
.game-feedback { min-height: 36px; margin: 26px 0 0; font-size: 24px; font-weight: 700; line-height: 1.5; }
.game-feedback.is-correct { color: #325c28; }
.game-hint { max-width: 580px; margin: 16px auto 0; font-size: 22px; line-height: 1.7; }
.next-button { margin-top: 22px; }
.game-reassurance { margin: 24px 0 0; text-align: center; font-size: 20px; line-height: 1.6; }
.game-complete { padding: 36px 24px; border-radius: 28px; background: #fffdf6; border: 2px solid #d4dfd5; text-align: center; }
.finish-flowers { font-size: 55px; }
.game-complete h3 { margin: 22px 0; font-size: 40px; }
.game-complete p { font-size: 24px; line-height: 1.6; }
.game-complete .play-button { margin-top: 15px; }

@keyframes open-wish {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1500px) {
  .page-shell { padding-top: 18px; }
  .greeting { padding-top: 55px; padding-bottom: 75px; }
}

@media (max-width: 1050px) {
  .page-shell { width: calc(100% - 64px); }
  .greeting { gap: 0; padding-top: 30px; }
  .greeting-copy { padding-left: 0; }
  h1 { font-size: clamp(64px, 8.5vw, 86px); letter-spacing: -4px; }
  .intro { max-width: 330px; font-size: 18px; }
  .intro-line { flex-shrink: 0; }
  .greeting-message { font-size: 24px; }
  .desktop-break { display: none; }
  .illustration-caption { font-size: 20px; }
  .closing-note { padding-right: 0; padding-left: 0; gap: 13px; }
  .closing-note p { font-size: 21px; }
  .play-button { font-size: 21px; }
}

@media (max-width: 700px) {
  .page-shell { width: calc(100% - 40px); }
  .site-header { min-height: 82px; }
  .site-header { flex-wrap: wrap; gap: 15px; padding-block: 20px; }
  .header-actions { margin-left: auto; gap: 12px; }
  .header-actions .header-note { display: none; }
  .change-player { font-size: 16px; }
  .welcome-view { margin: 20px auto 35px; padding: 30px 18px; }
  .welcome-view > p { font-size: 22px; }
  .player-form label { font-size: 21px; }
  #greeting-title [data-child-name] { font-size: clamp(42px, 13vw, 80px); }
  .wordmark { font-size: 18px; gap: 8px; }
  .wordmark svg { width: 25px; height: 25px; }
  .header-note { font-size: 0; gap: 0; }
  .header-note svg { width: 20px; height: 20px; }
  .greeting { grid-template-columns: 1fr; padding: 32px 0 18px; gap: 25px; }
  .greeting-copy { padding: 0; text-align: center; }
  .intro { justify-content: center; max-width: none; margin-bottom: 21px; font-size: 18px; line-height: 1.5; }
  .intro-line { width: 17px; }
  h1 { font-size: clamp(66px, 14vw, 94px); line-height: 1.07; letter-spacing: -3.5px; }
  .greeting-message { max-width: 420px; margin: 23px auto; font-size: 23px; line-height: 1.65; text-wrap: pretty; }
  .greeting-actions { align-items: stretch; max-width: 390px; margin: 0 auto; }
  .wish-button { min-height: 62px; padding: 14px 15px; font-size: 20px; }
  .button-note { font-size: 18px; line-height: 1.6; }
  .play-button { padding: 16px 12px; font-size: 21px; gap: 8px; }
  .play-button span { font-size: 23px; }
  .illustration { width: min(100%, 410px); margin: 0 auto; }
  .illustration-caption { font-size: 20px; margin-top: -4px; }
  .closing-note { flex-wrap: wrap; gap: 10px; padding: 25px 0 13px; }
  .closing-note svg { width: 27px; height: 27px; }
  .closing-note p { width: 100%; order: 1; text-align: center; font-size: 21px; line-height: 1.7; text-wrap: balance; }
  .closing-rule { max-width: 76px; }
  footer { padding: 22px 0 23px; font-size: 16px; }
  footer > span { display: block; margin: 0; }
  .wish-dialog { padding: 39px 26px 29px; border-top-left-radius: 120px; border-top-right-radius: 120px; }
  .close-button { top: 54px; right: 18px; }
  .wish-dialog h2 { font-size: 32px; }
  .wish-dialog p { font-size: 21px; }
  .game-heading p, .game-instruction { font-size: 21px; }
  .game-heading h2 { font-size: 29px; }
  .game-progress { font-size: 19px; }
  .flower-progress { font-size: 24px; gap: 5px; }
  .math-card { padding: 24px 14px; border-radius: 22px; }
  .answer-options { gap: 10px; }
  .answer-button { min-height: 80px; padding: 8px; font-size: 36px; border-radius: 14px; }
  .game-feedback { font-size: 22px; }
  .game-hint { font-size: 20px; }
  .game-reassurance { font-size: 19px; }
  .game-complete h3 { font-size: 31px; }
  .game-complete p { font-size: 22px; }
  .word-sentence { font-size: 22px; }
  .letter-options { gap: 9px; }
  .letter-options .letter-button { min-width: 64px; min-height: 76px; padding: 8px 10px; font-size: 34px; }
  .accent-options { gap: 10px; }
  .accent-syllable .letter-button { min-width: 44px; min-height: 66px; padding: 4px 6px; font-size: 32px; }
  .consonant { min-width: 20px; font-size: 32px; }
  .alphabet-help { padding: 16px; }
  .alphabet-help summary { font-size: 20px; }
  .alphabet-strip { font-size: 25px; word-spacing: 6px; }
  .word-options { grid-template-columns: 1fr; gap: 12px; }
  .word-button { min-height: 66px; font-size: 27px; }
  .ordered-words { padding-left: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
