/* こども課 */
:root {
  --bg: #fff7e6;
  --ink: #3a2e1f;
  --sub: #8a7a63;
  --card: #ffffff;
  --line: #f0dfc0;
  --primary: #ff8a3d;
  --primary-ink: #ffffff;
  --ok: #2fbf71;
  --ng: #ff5d5d;
  --star: #ffc61a;
  --kanji: "Klee One", "YuKyokasho", "UD Digi Kyokasho N-R", "Hiragino Mincho ProN", serif;
  --ui: "Hiragino Maru Gothic ProN", "Zen Maru Gothic", "M PLUS Rounded 1c", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: radial-gradient(#f6e3bd 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--ui);
  -webkit-text-size-adjust: 100%;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

/* ヘッダー */
.bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
.bar-home { display: flex; align-items: center; gap: 8px; border: 0; background: none; font-size: 18px; font-weight: 800; padding: 4px; }
.plate { display: inline-block; background: #ff9ec4; color: #fff; font-size: 13px; font-weight: 800; padding: 2px 8px; border-radius: 3px; transform: rotate(-5deg); box-shadow: 1px 2px 3px rgba(0,0,0,.15); }
.bar-sound { border: 2px solid var(--line); background: var(--card); border-radius: 999px; width: 44px; height: 44px; font-size: 20px; }
.bar-sound[aria-pressed="false"] { opacity: .5; }

main { max-width: 480px; margin: 0 auto; padding: 0 16px 32px; }
[hidden] { display: none !important; }

/* ボタン */
.big-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: 12px 0; padding: 16px; border: 3px solid var(--line); border-radius: 22px; background: var(--card); font-size: 22px; font-weight: 800; box-shadow: 0 4px 0 var(--line); }
.big-btn small { font-size: 13px; font-weight: 600; color: var(--sub); }
.big-btn.primary { background: var(--primary); border-color: #e9732a; color: var(--primary-ink); box-shadow: 0 4px 0 #d9661f; }
.big-btn.primary small { color: rgba(255,255,255,.9); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }

/* はじめ */
.title { text-align: center; font-size: 26px; margin: 28px 0 6px; line-height: 1.3; }
.title span { display: inline-block; font-family: var(--kanji); font-size: 64px; letter-spacing: .1em; color: var(--primary); }
.stars-total { text-align: center; color: var(--sub); margin: 0 0 18px; font-weight: 700; }

/* もんだい */
.dots { display: flex; justify-content: center; gap: 8px; list-style: none; padding: 0; margin: 4px 0 12px; }
.dots li { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dots li.done { background: var(--ok); }
.dots li.now { background: var(--primary); transform: scale(1.25); }
.card { position: relative; height: 210px; background: var(--card); border: 3px solid var(--line); border-radius: 28px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-pic { font-size: 96px; line-height: 1; text-align: center; transition: transform .45s ease, opacity .45s ease; padding: 0 10px; }
.card-pic.count { font-size: 40px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px 10px; }
.card-pic.small { font-size: 72px; }
.card-kanji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--kanji); font-weight: 600; font-size: 150px; color: var(--ink); opacity: 0; transform: scale(.2) rotate(-20deg); pointer-events: none; }
.card.morph .card-pic { transform: scale(.2) rotate(30deg); opacity: 0; }
.card.morph .card-kanji { animation: pop .6s .25s cubic-bezier(.2,1.5,.4,1) forwards; }
@keyframes pop { to { opacity: 1; transform: scale(1) rotate(0); } }
.sparkle { position: absolute; inset: 0; pointer-events: none; }
.sparkle span { position: absolute; font-size: 26px; opacity: 0; animation: twinkle 1s ease-out forwards; }
@keyframes twinkle { 0% { opacity: 0; transform: scale(.3); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4) translateY(-20px); } }

.word { display: block; margin: 14px auto 0; border: 0; background: none; font-size: 34px; font-weight: 800; letter-spacing: .08em; }
.word .speaker { font-size: 20px; vertical-align: middle; }
.hint { text-align: center; margin: 0; min-height: 1.4em; color: var(--sub); font-size: 15px; font-weight: 700; }
.prompt { text-align: center; margin: 6px 0 10px; font-size: 18px; font-weight: 800; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice { aspect-ratio: 1; border: 3px solid var(--line); border-radius: 22px; background: var(--card); font-family: var(--kanji); font-weight: 600; font-size: 64px; line-height: 1; box-shadow: 0 5px 0 var(--line); }
.choice:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.choice.ok { background: var(--ok); border-color: #22a35e; color: #fff; box-shadow: 0 5px 0 #1d8a4f; }
.choice.ng { background: #ffe3e3; border-color: var(--ng); color: #c9a7a7; animation: shake .4s; box-shadow: none; }
.choice:disabled { cursor: default; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.next { margin-top: 18px; }

/* けっか */
.result-title { text-align: center; font-size: 30px; margin: 30px 0 4px; }
.result-stars { text-align: center; font-size: 34px; margin: 0 0 8px; letter-spacing: .1em; }
.new-stickers { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0 16px; }
.new-stickers .sticker { animation: stick .6s cubic-bezier(.2,1.6,.4,1) both; }
.new-stickers p { width: 100%; text-align: center; margin: 0; font-weight: 800; color: var(--primary); }
@keyframes stick { from { transform: scale(2.2) rotate(-25deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }

/* シール */
.sticker { position: relative; line-height: 1; flex: none; width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 3px dashed var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--kanji); font-weight: 600; font-size: 36px; color: #d9cdb8; }
.sticker .s-pic { position: absolute; right: -4px; bottom: -4px; font-size: 22px; font-family: var(--ui); }
.sticker .s-stars { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-family: var(--ui); font-size: 10px; color: var(--star); letter-spacing: 0; }
.sticker.doing { border-style: solid; color: var(--ink); background: #fffdf8; }
.sticker.done { border: 3px solid #fff; color: #fff; box-shadow: 0 3px 6px rgba(0,0,0,.18); transform: rotate(-4deg); }
.sticker.done:nth-child(5n+1) { background: #ff8a3d; }
.sticker.done:nth-child(5n+2) { background: #2fbf71; }
.sticker.done:nth-child(5n+3) { background: #4aa3ff; }
.sticker.done:nth-child(5n+4) { background: #ff6fa8; }
.sticker.done:nth-child(5n+5) { background: #a77bff; }
.sticker.later { border-style: dotted; background: transparent; color: #eadfcb; }

.book-title { text-align: center; font-size: 26px; margin: 16px 0 2px; }
.book-note { text-align: center; color: var(--sub); font-size: 13px; margin: 0 0 14px; font-weight: 700; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); grid-auto-rows: 80px; gap: 12px 8px; justify-items: center; align-items: center; }
.book-grid .sticker { border-width: 3px; cursor: pointer; }
.book-legend { font-size: 11px; color: var(--sub); text-align: center; margin: 16px 0; line-height: 2; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin: 0 2px 0 8px; }
.lg-done { background: #ff8a3d; }
.lg-doing { border: 2px solid var(--line); background: #fffdf8; }
.lg-next { border: 2px dotted var(--line); }
.parents { margin-top: 20px; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; font-size: 13px; color: var(--sub); user-select: text; -webkit-user-select: text; }
.parents summary { font-weight: 800; cursor: pointer; }
.reset-btn { border: 2px solid var(--ng); color: var(--ng); background: #fff; border-radius: 10px; padding: 6px 12px; font-weight: 700; }

/* 大きく見る */
.modal { position: fixed; inset: 0; background: rgba(58,46,31,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal[hidden] { display: none; }
.modal-body { width: 100%; max-width: 360px; background: var(--card); border-radius: 28px; padding: 20px; text-align: center; }
.modal-pic { font-size: 56px; min-height: 1em; }
.modal-kanji { font-family: var(--kanji); font-weight: 600; font-size: 140px; line-height: 1.1; }
.modal-yomi { font-size: 20px; font-weight: 800; margin: 4px 0 8px; }
