/* MRCシール帳 — 子ども用画面
   前提: 縦持ちスマホ・375px幅で横スクロールを出さない／ボタンは最低64px角／文字は原則ひらがな
   配色は oral-check（保護者向けセルフチェック）と同系の暖色に寄せてある */

:root {
  --teal: #2e8fa0;
  --orange: #f2a65a;
  --bg: #fff8ee;
  --card: #ffffff;
  --ink: #40352c;
  --ink-weak: #8b7e72;
  --line: #ecd9c0;
  --done: #cfe7dd;
  --gold1: #ffd76e;
  --gold2: #fff3c4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Maru Gothic", system-ui, -apple-system, "Hiragino Maru Gothic ProN", sans-serif;
  font-weight: 500;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body { padding: 12px 12px 28px; }

.screen { max-width: 480px; margin: 0 auto; }
[hidden] { display: none !important; }

/* ── ① トークンなし ───────────────────────────── */
.notoken-card {
  margin-top: 22vh;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
}
.notoken-mark { font-size: 54px; line-height: 1; }
.notoken-text { font-size: 20px; line-height: 1.8; margin: 14px 0 0; }

/* ── ② だれ？ ────────────────────────────────── */
.pick-title { font-size: 28px; text-align: center; margin: 18vh 0 18px; }
.pick-list { display: grid; gap: 14px; }
.pick-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 84px; padding: 12px 18px;
  font: inherit; font-size: 24px; font-weight: 700; color: var(--ink);
  background: var(--card); border: 3px solid var(--orange); border-radius: 20px;
  cursor: pointer;
}
.pick-face {
  width: 56px; height: 56px; flex: 0 0 56px;
  border-radius: 50%; background: var(--gold2);
  display: grid; place-items: center; font-size: 28px;
}

/* ── ③ キャラの列 ────────────────────────────── */
.chara-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; margin-bottom: 10px;
}
.chara {
  background: var(--card); border: 2px solid var(--line); border-radius: 16px;
  padding: 6px 4px 8px; text-align: center; position: relative;
}
.chara img { width: 100%; max-width: 72px; height: auto; display: block; margin: 0 auto; }
.chara.sleeping img { opacity: .38; }
.chara .zzz {
  position: absolute; top: 2px; right: 6px;
  font-size: 13px; color: var(--ink-weak);
}
.bar { height: 7px; border-radius: 99px; background: #f0e6d8; margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.bar.full > i { background: var(--gold1); }

/* ── 集合絵ボタン ────────────────────────────── */
.btn-shugo {
  display: block; width: 100%; min-height: 56px; margin: 0 0 12px;
  font: inherit; font-size: 19px; font-weight: 700; color: #5a4632;
  background: linear-gradient(180deg, var(--gold2), var(--gold1));
  border: 3px solid #f0c04b; border-radius: 18px; cursor: pointer;
}

/* ── 台紙（カレンダー）──────────────────────── */
.sheet {
  background: var(--card); border: 3px solid var(--line); border-radius: 20px;
  padding: 10px 8px 12px; margin-bottom: 14px;
}
.sheet.perfect {
  border-color: var(--gold1);
  box-shadow: 0 0 0 3px var(--gold2), 0 0 18px rgba(255, 200, 80, .55);
  animation: kira 2.4s ease-in-out infinite;
}
@keyframes kira {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold2), 0 0 10px rgba(255, 200, 80, .35); }
  50%      { box-shadow: 0 0 0 3px var(--gold2), 0 0 22px rgba(255, 200, 80, .75); }
}
.sheet-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-head span { text-align: center; font-size: 11px; color: var(--ink-weak); }
.cell {
  position: relative; aspect-ratio: 1 / 1;
  border: 1.5px solid var(--line); border-radius: 9px; background: #fffdf9;
  padding: 1px;
}
.cell.blank { border: none; background: none; }
.cell.future { opacity: .45; }
.cell.today { border: 3px solid var(--orange); }
.cell .d { position: absolute; top: 1px; left: 3px; font-size: 9px; color: var(--ink-weak); }
/* 1マスに最大4枚。日付の数字を避けて上を9px空け、各シールは自分の1/4マスに収める
   （高さで溢れると下の行のマスにはみ出すため、width指定ではなく max-width/max-height で入れる） */
.stickers {
  position: absolute; inset: 0; display: grid;
  /* minmax(0,…) が要る：1fr の自動最小値は画像の min-content（＝原寸）なので、
     ただの 1fr だとトラックが画像の高さまで広がり、下のマスへはみ出す */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  place-items: center; padding: 9px 2px 2px; gap: 1px;
}
.stickers img { max-width: 100%; max-height: 100%; width: auto; height: auto; min-width: 0; min-height: 0; }
/* 1枚だけの日はマス全体を使う。2枚の日は左右に1枚ずつ（どちらも小さくなりすぎないように） */
.stickers.n1 img { grid-column: 1 / -1; grid-row: 1 / -1; }
.stickers.n2 img { grid-row: 1 / -1; }

/* ── 今日の体操カード ────────────────────────── */
.cards { display: grid; gap: 12px; }
.card {
  display: grid; grid-template-columns: 62px 1fr; gap: 10px; align-items: center;
  background: var(--card); border: 3px solid var(--line); border-radius: 20px; padding: 12px;
}
.card.done { background: var(--done); border-color: #a9cfc1; }
.card .thumb { width: 62px; height: 62px; object-fit: contain; }
.card .name { font-size: 21px; font-weight: 700; line-height: 1.3; }
.card .cue { font-size: 14px; color: var(--ink-weak); margin-top: 2px; line-height: 1.4; }
.btn-done {
  grid-column: 1 / -1; min-height: 64px; margin-top: 6px;
  font: inherit; font-size: 25px; font-weight: 700; color: #fff;
  background: var(--teal); border: none; border-radius: 16px; cursor: pointer;
  box-shadow: 0 4px 0 #24707d;
}
.btn-done:active { transform: translateY(3px); box-shadow: 0 1px 0 #24707d; }
.btn-done[disabled] {
  background: #b9cfc8; color: #f4fffb; box-shadow: none; transform: none; cursor: default;
}
.all-done { text-align: center; font-size: 22px; font-weight: 700; color: var(--teal); margin: 16px 0 0; }

.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 22px; font-size: 11px; color: var(--ink-weak);
}
.btn-switch {
  font: inherit; font-size: 12px; color: var(--ink-weak);
  background: none; border: 1px solid var(--line); border-radius: 99px; padding: 8px 12px; cursor: pointer;
}

/* ── 演出 ────────────────────────────────────── */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.fly-layer img { position: fixed; width: 44px; height: 44px; will-change: transform; }

.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(255, 248, 238, .72);
}
.overlay-dark { background: rgba(38, 30, 22, .82); }
#joy-img { width: min(72vw, 300px); height: auto; animation: bounce .55s ease-in-out 2; }
@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30%      { transform: translateY(-16px) scale(1.06); }
  60%      { transform: translateY(0) scale(.98); }
}
.evolve-box { text-align: center; }
#evolve-img { width: min(72vw, 300px); height: auto; animation: shine .8s ease-out; }
@keyframes shine {
  0%   { transform: scale(.7); filter: brightness(2.2); opacity: 0; }
  60%  { transform: scale(1.08); filter: brightness(1.3); opacity: 1; }
  100% { transform: scale(1); filter: none; }
}
.evolve-text { font-size: 26px; font-weight: 700; color: #fff8ee; margin: 14px 0 0; }
.evolve-tap { font-size: 13px; color: #e8dccd; margin: 10px 0 0; }
#shugo-img { width: min(94vw, 720px); height: auto; border-radius: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #40352c; color: #fff8ee; font-size: 15px;
  padding: 12px 18px; border-radius: 99px; z-index: 90;
}

/* 動きを抑える設定の端末では、移動・点滅をやめて結果だけ見せる */
@media (prefers-reduced-motion: reduce) {
  .sheet.perfect { animation: none; }
  #joy-img, #evolve-img { animation: none; }
  .fly-layer { display: none; }
}
