/* Web絵本の見た目と動き。テーマは「あたたかい紙と、やわらかな光」：クリーム色の紙、影はふんわり、線は細く、動きはなめらかに弾む */
:root {
  --c: #ff7a59;          /* 場面の色 */
  --ink: #3a3330;        /* 文字 */
  --paper: #fdf8ef;
  --line: rgba(58,51,48,.14);
  --shadow: 0 10px 28px rgba(80,55,30,.14), 0 2px 6px rgba(80,55,30,.08);
  --grid: rgba(58,51,48,0);
  --yellow: #f7c948;
  --mint: #3aa982;
  --coral: #e8675a;
  --pop: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
  --body: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.22, .9, .24, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #efe6d8 url('assets/tex/paper-grain.jpg'); background-size: 360px; background-blend-mode: multiply;
  font-family: var(--body); font-weight: 700; color: var(--ink); overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.grid-bg { background: var(--paper) url('assets/tex/paper-grain.jpg'); background-size: 320px; background-blend-mode: multiply; }
#book { position: relative; max-width: 480px; height: 100svh; margin: 0 auto; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.on { display: flex; }

/* PC：左に説明、右に本（シールのカード） */
.pc-side { display: none; }
@media (min-width: 980px) {
  body { display: flex; align-items: center; justify-content: center; gap: 56px; min-height: 100vh; }
  #book { margin: 0; flex: 0 0 440px; height: min(100svh - 56px, 880px); border: 0; border-radius: 28px; box-shadow: var(--shadow); }
  .pc-side { display: block; width: 360px; }
  .pc-side .tag { display: inline-block; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--yellow); font-family: var(--pop); font-weight: 900; font-size: 13px; }
  .pc-side h1 { font-family: var(--pop); font-weight: 900; font-weight: 400; font-size: 40px; line-height: 1.35; margin: 18px 0 12px; }
  .pc-side p { font-size: 16px; line-height: 1.9; margin: 0 0 18px; }
  .pc-side ol { list-style: none; padding: 0; margin: 0; counter-reset: c; }
  .pc-side li { counter-increment: c; display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 2px dashed rgba(35,38,58,.18); font-size: 15px; }
  .pc-side li::before { content: counter(c); flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--pop); font-weight: 900; font-size: 13px; }
  .pc-side small { display: block; margin-top: 18px; font-size: 13px; opacity: .7; }
}

/* ---------- 上のバー（もくじ・すすみ具合・音） ---------- */
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 12px 12px 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .toc, .hud .snd { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hud .toc { height: 40px; padding: 0 14px 0 10px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); box-shadow: var(--shadow); display: flex; align-items: center; gap: 6px; font-family: var(--pop); font-weight: 900; font-size: 13px; }
.hud .toc svg { width: 20px; height: 20px; }
.hud .dots { flex: 1; display: flex; justify-content: center; gap: 5px; }
.hud .dots i { width: 9px; height: 9px; border-radius: 6px; background: rgba(255,255,255,.75); box-shadow: 0 1px 4px rgba(80,55,30,.2); transition: width .4s var(--spring), background .3s; }
.hud .dots i.done { background: color-mix(in srgb, var(--c) 55%, #fff); }
.hud .dots i.now { width: 26px; background: var(--c); }
.hud .snd { width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; }
.hud .snd svg { width: 20px; height: 20px; }
.hud .toc:active, .hud .snd:active { transform: translateY(3px); box-shadow: none; }
.hud.off .dots, .hud.off .toc { visibility: hidden; }

/* ---------- ボタン ---------- */
.pill { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 330px; height: 62px; border-radius: 999px; border: 0; background: var(--c); color: #fff; font-family: var(--pop); font-weight: 900; font-size: 19px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.pill svg { width: 24px; height: 24px; flex: 0 0 auto; }
.pill:active { transform: translateY(5px); box-shadow: var(--shadow); }
.pill.white { background: #fff; color: var(--ink); }
.pill.yellow { background: var(--yellow); color: var(--ink); }
.pill[disabled] { opacity: .45; }
.textlink { font-family: var(--pop); font-weight: 900; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 8px; }
.textlink svg { width: 18px; height: 18px; }

/* ---------- 表紙 ---------- */
.cover { align-items: center; padding: 18px 20px 22px; overflow: hidden; background-size: cover; background-position: center bottom; }
.cover.has-art .ring::before { display: none; }
.cover .bgv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.cover > *:not(.bgv) { position: relative; z-index: 1; }
.cover .title { color: var(--ink); }
.cover .badge { align-self: flex-start; margin-top: 2px; padding: 5px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--yellow); font-family: var(--pop); font-weight: 900; font-size: 12px; }
.cover .title { margin: 14px 0 0; text-align: center; font-weight: 400; line-height: 1; }
.cover .title .ln { display: inline-block; margin: 4px 2px; padding: 8px 16px 10px; background: #fff; border: 0; border-radius: 16px; box-shadow: var(--shadow); font-family: var(--pop); font-weight: 900; font-size: clamp(30px, 9.6vw, 44px); white-space: nowrap; }
.cover .title .ln:nth-of-type(1) { transform: rotate(-3deg); }
.cover .title .ln:nth-of-type(2) { transform: rotate(2deg); background: #fff3c4; }
.cover .title .ln:nth-of-type(3) { transform: rotate(-1.5deg); }
.cover .sub { margin: 14px 0 0; font-size: 15px; }
.ring { position: relative; flex: 1; width: 100%; min-height: 200px; margin: 6px 0 8px; container-type: size; }
.ring::before { content: ''; position: absolute; left: 50%; top: 50%; width: min(80cqw, 94cqh); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff8e6, color-mix(in srgb, var(--c) 35%, #fff4dc)); }
.ring .actor { bottom: 6%; }
.cover .btns { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.cover .resume { font-family: var(--pop); font-weight: 900; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }

@media (max-height: 720px) {
  .cover { padding-top: 12px; padding-bottom: 14px; }
  .cover .title .ln { font-size: min(9vw, 5.2vh); padding: 6px 12px 8px; }
  .cover .sub { margin-top: 8px; font-size: 13px; }
  .pill { height: 52px; font-size: 17px; }
  .cover .btns { gap: 9px; }
  .tagcard .portrait { width: 96px; height: 96px; }
  .tagcard { padding-top: 28px; }
}
/* ---------- なふだ（名前とにがおえ） ---------- */
.setup { align-items: center; padding: 66px 20px 20px; overflow-y: auto; }
.tagcard { position: relative; width: 100%; max-width: 360px; margin-top: 18px; padding: 34px 20px 22px; background: #fff; border: 0; border-radius: 22px; box-shadow: var(--shadow); text-align: center; }
.tagcard::before { content: ''; position: absolute; top: 12px; left: 50%; width: 46px; height: 10px; margin-left: -23px; border-radius: 6px; background: #f3efe4; border: 1.5px solid var(--line); }
.tagcard .clip { position: absolute; top: -22px; left: 50%; width: 30px; height: 34px; margin-left: -15px; border: 0; border-bottom: 0; border-radius: 14px 14px 0 0; }
.tagcard h2 { margin: 0 0 6px; font-family: var(--pop); font-weight: 900; font-weight: 400; font-size: 21px; }
.tagcard .portrait { width: 132px; height: 132px; margin: 6px auto 10px; border-radius: 50%; background: var(--c); border: 0; overflow: hidden; }
.tagcard .portrait .pp { width: 100%; height: 100%; }
.tagcard label { display: block; margin: 14px 0 6px; font-family: var(--pop); font-weight: 900; font-size: 14px; text-align: left; }
.name-input { width: 100%; height: 56px; padding: 0 16px; border-radius: 14px; border: 0; background: var(--paper); font-family: var(--pop); font-weight: 900; font-size: 22px; color: var(--ink); outline: none; -webkit-user-select: text; user-select: text; }
.name-input::placeholder { color: #b9b4a6; }
.name-input:focus { background: #fff8d6; }
.tagcard .hint { margin: 6px 0 0; font-size: 13px; text-align: left; opacity: .75; white-space: pre-wrap; }
.avatars { display: flex; justify-content: space-between; gap: 10px; }
.avatars button { flex: 1; aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--paper); overflow: hidden; transition: transform .35s var(--spring), background .2s; }
.avatars button .pp { width: 100%; height: 100%; }
.avatars button.on { background: var(--yellow); transform: scale(1.08) rotate(-4deg); box-shadow: var(--shadow); }
.setup .go { margin-top: 22px; }
.setup .back { margin-top: 8px; }

/* ---------- 場面 ---------- */
.stage { position: relative; flex: 1; overflow: hidden; }
.world { position: absolute; left: 0; bottom: 0; width: 100%; aspect-ratio: 480 / 600; transform-origin: 0 0; transition: transform .7s var(--smooth); }
.world .set { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.actor { position: absolute; transform: translateX(-50%); transform-origin: 50% 100%; }
.actor .pp, .ring .pp { display: block; width: 100%; overflow: visible; }

.actor.flip .pp { transform: scaleX(-1); }
.actor.flip .fxs { transform: scaleX(-1); transform-origin: 100px 0; }
.actor.hide { display: none; }

/* 吹き出し（会話のカード） */
.talk { position: relative; z-index: 20; flex: 0 0 auto; margin: -30px 12px 14px; background: rgba(255,255,255,.97); padding: 14px 16px 10px; background: #fff; border: 0; border-radius: 22px; box-shadow: var(--shadow); font-size: clamp(17px, 4.9vw, 21px); line-height: 1.7; letter-spacing: .03em; }
.talk::before, .talk::after { content: ''; position: absolute; left: var(--tail, 50%); width: 0; height: 0; transition: left .5s var(--smooth); }
.talk::before { display: none; }
.talk::after { top: -15px; margin-left: -12px; border: 12px solid transparent; border-bottom: 16px solid #fff; border-top: 0; }
.talk.narr { background: #fff7df; }
.talk.narr::after { display: none; }
.talk.narr::before, .talk.narr::after { display: none; }
.talk .who { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.talk .who .name { padding: 3px 12px; border-radius: 999px; background: var(--c); color: #fff; border: 0; font-family: var(--pop); font-weight: 900; font-size: 13px; line-height: 1.4; }
.talk .who:empty { display: none; }
.talk .text { min-height: 3.4em; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.talk.narr .text { text-align: center; }
.talk .text .rb { background: linear-gradient(transparent 58%, var(--yellow) 58%); padding: 0 2px; }
.talk.narr .text .rb { background: linear-gradient(transparent 58%, #fff 58%); }
.talk .ch { opacity: 0; }
.talk .ch.on { opacity: 1; }
.nav { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.nav .back { font-family: var(--pop); font-weight: 900; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 10px 6px; opacity: .7; }
.nav .back svg { width: 18px; height: 18px; }
.nav .next { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 18px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--pop); font-weight: 900; font-size: 15px; transition: transform .15s; }
.nav .next b { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); display: grid; place-items: center; }
.nav .next b svg { width: 18px; height: 18px; }
.nav .next:active { transform: scale(.95); }
.nav .next[disabled] { opacity: .25; }
.nav .next.wait b { animation: nudge 1.4s var(--smooth) infinite; }
@keyframes nudge { 0%, 60%, 100% { transform: translateX(0); } 80% { transform: translateX(5px); } }

/* 選ぶ問題 */
.choices { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; word-break: keep-all; overflow-wrap: anywhere; }
.choices button { min-height: 54px; padding: 9px 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line); font-size: clamp(15px, 4.4vw, 18px); line-height: 1.45; text-align: left; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.choices button .mk { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--pop); font-weight: 900; font-size: 14px; transform: rotate(-6deg); }
.choices button.ok { background: #dff6ec; border-color: var(--mint); }
.choices button.ok .mk { background: var(--mint); }
.choices button.ng { background: #ffe6e1; border-color: var(--coral); animation: shake .45s ease 1; }
.choices button.ng .mk { background: var(--coral); }
.choices button[disabled] { opacity: .5; }
.choices button.ok[disabled], .choices button.ng[disabled] { opacity: 1; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.reply { margin-top: 10px; white-space: pre-wrap; word-break: keep-all; }

/* 全部えらぶカード */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; word-break: keep-all; overflow-wrap: anywhere; }
.cards.cols3 { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.cards button { position: relative; min-height: 56px; padding: 6px 4px; border-radius: 12px; background: var(--paper); border: 2.5px dashed rgba(35,38,58,.45); font-size: clamp(13.5px, 3.9vw, 17px); line-height: 1.35; transition: transform .3s var(--spring); }
.cards button.on { border: 1.5px solid var(--line); background: var(--yellow); transform: rotate(-2deg); }
.cards button.good { border: 2.5px solid var(--mint); background: #dff6ec; }
.cards button.bad { border: 2.5px solid var(--coral); background: #ffe6e1; }
.check-btn { margin-top: 10px; width: 100%; height: 50px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--pop); font-weight: 900; font-size: 16px; }
.retry-btn { margin-top: 10px; height: 46px; padding: 0 22px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-family: var(--pop); font-weight: 900; font-size: 15px; }

/* シール（できたこと） */
.stamp-pop { position: absolute; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(255,253,246,.6); pointer-events: none; }
.sticker { position: relative; width: 230px; height: 230px; display: grid; place-items: center; text-align: center; animation: stickIn .7s var(--spring) both; }
.sticker::before { content: ''; position: absolute; inset: 0; background: #fff; clip-path: polygon(50% 0%, 61% 32%, 96% 32%, 68% 53%, 79% 88%, 50% 67%, 21% 88%, 32% 53%, 4% 32%, 39% 32%); }
.sticker { filter: drop-shadow(0 10px 18px rgba(120,80,20,.25)); }
.sticker::after { content: ''; position: absolute; inset: 9px; background: linear-gradient(160deg, #ffe08a, #f2b632); clip-path: polygon(50% 0%, 61% 32%, 96% 32%, 68% 53%, 79% 88%, 50% 67%, 21% 88%, 32% 53%, 4% 32%, 39% 32%); }
.sticker div { position: relative; z-index: 1; margin-top: 18px; }
.sticker small { display: block; font-family: var(--pop); font-weight: 900; font-size: 12px; }
.sticker span { display: block; font-family: var(--pop); font-weight: 900; font-size: 19px; line-height: 1.3; word-break: keep-all; }
@keyframes stickIn { from { transform: scale(0) rotate(-60deg); } to { transform: scale(1) rotate(-8deg); } }

/* 章の見出し（下からせり上がるカード） */
.chapter { position: absolute; inset: 0; z-index: 44; display: grid; place-items: center; background: var(--c); animation: slideUp .6s var(--smooth) both; cursor: pointer; }
.chapter.out { animation: slideAway .5s var(--smooth) both; }
.chapter .card { width: calc(100% - 48px); max-width: 360px; padding: 50px 22px 26px; background: #fff; border: 0; border-radius: 24px; box-shadow: var(--shadow); text-align: center; position: relative; word-break: keep-all; }
.chapter .num { position: absolute; top: -34px; left: 50%; width: 68px; height: 68px; margin-left: -34px; border-radius: 50%; background: var(--yellow); border: 0; display: grid; place-items: center; font-family: var(--pop); font-weight: 900; font-size: 28px; }
.chapter small { display: block; font-size: 14px; opacity: .7; }
.chapter b { display: block; margin-top: 6px; font-family: var(--pop); font-weight: 900; font-weight: 400; font-size: clamp(24px, 7vw, 30px); line-height: 1.45; }
.chapter .tap { margin-top: 14px; font-size: 13px; opacity: .6; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slideAway { to { transform: translateY(-100%); } }

/* よみおわり（シールちょう） */
.ending { overflow-y: auto; padding: 66px 18px 26px; align-items: center; }
.ending .ribbon { padding: 8px 22px; background: var(--ink); color: #fff; border-radius: 10px; font-family: var(--pop); font-weight: 900; font-size: 15px; transform: rotate(-2deg); }
.cert { width: 100%; max-width: 380px; margin-top: 14px; padding: 18px 16px; border-radius: 22px; background: #fff; border: 0; box-shadow: var(--shadow); text-align: center; }
.cert h2 { margin: 4px 0 8px; font-family: var(--pop); font-weight: 900; font-weight: 400; font-size: clamp(22px, 6.6vw, 28px); }
.cert .who { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 6px 0; font-family: var(--pop); font-weight: 900; font-size: 22px; }
.cert .who .face { width: 70px; height: 70px; border-radius: 50%; background: var(--c); border: 0; overflow: hidden; }
.cert .who .pp { width: 100%; height: 100%; }
.cert p { margin: 6px 0; font-size: 15px; line-height: 1.75; white-space: pre-wrap; word-break: keep-all; }
.cert .stamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 10px; }
.cert .stamps div { position: relative; aspect-ratio: 1; display: grid; place-items: center; font-family: var(--pop); font-weight: 900; font-size: 11px; line-height: 1.3; word-break: keep-all; text-align: center; padding: 22% 12% 4%; }
.cert .stamps div::before { content: ''; position: absolute; inset: 0; background: var(--yellow); clip-path: polygon(50% 0%, 61% 32%, 96% 32%, 68% 53%, 79% 88%, 50% 67%, 21% 88%, 32% 53%, 4% 32%, 39% 32%); }
.cert .stamps div span { position: relative; }
.cert .stamps div:nth-child(odd) { transform: rotate(-6deg); } .cert .stamps div:nth-child(even) { transform: rotate(5deg); }
.cert .stamps div.off::before { background: #e8e3d6; }
.cert .stamps div.off { color: #a8a294; }
.ending .btns { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; margin-top: 22px; }

/* もくじ（左から出る引き出し）・保護者の方へ（下から出る） */
.sheet { position: absolute; inset: 0; z-index: 60; display: none; background: rgba(35,38,58,.4); }
.sheet.on { display: block; }
.sheet .panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(86%, 360px); overflow-y: auto; background: var(--paper); border-right: 3px solid var(--ink); padding: 22px 18px; animation: drawer .4s var(--smooth) both; }
.sheet .panel.bottom { top: auto; right: 0; width: auto; max-height: 82%; border-right: 0; border-top: 3px solid var(--ink); border-radius: 26px 26px 0 0; animation: rise .4s var(--smooth) both; }
@keyframes drawer { from { transform: translateX(-100%); } }
@keyframes rise { from { transform: translateY(100%); } }
.sheet .panel h3 { margin: 0 0 12px; font-family: var(--pop); font-weight: 900; font-weight: 400; font-size: 19px; }
.sheet .menu-list a, .sheet .menu-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 4px; border-bottom: 2px dashed rgba(35,38,58,.18); font-size: 16px; text-align: left; color: inherit; text-decoration: none; word-break: keep-all; }
.sheet .menu-list .no { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--pop); font-weight: 900; font-size: 13px; }
.sheet .menu-list .done .no { background: var(--mint); }
.sheet .close { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); font-size: 20px; }
.parent { font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif; font-weight: 400; font-size: 15px; line-height: 1.85; -webkit-user-select: text; user-select: text; }
.parent h3 { font-family: var(--pop); font-weight: 900; font-weight: 400; }
.parent h4 { margin: 18px 0 6px; font-size: 16px; }
.parent ul { padding-left: 1.2em; margin: 6px 0; }

/* よみこみ・縦むき */
.loading { position: absolute; inset: 0; z-index: 90; display: grid; place-items: center; text-align: center; font-family: var(--pop); font-weight: 900; font-size: 15px; transition: opacity .4s; }
.loading .pp { width: 120px; margin: 0 auto 6px; }
.loading .dots3 i { display: inline-block; width: 8px; height: 8px; margin: 0 3px; border-radius: 50%; background: var(--ink); animation: bounce .9s ease-in-out infinite; }
.loading .dots3 i:nth-child(2) { animation-delay: .15s; } .loading .dots3 i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-8px); } }
.loading.out { opacity: 0; pointer-events: none; }
.rotate-warn { position: fixed; inset: 0; z-index: 99; display: none; place-items: center; text-align: center; font-family: var(--pop); font-weight: 900; font-size: 17px; line-height: 1.9; padding: 20px; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) { .rotate-warn { display: grid; } }

/* ---------- キャラの部品と動き（なめらかに弾む） ---------- */
.pp g { transform-box: view-box; }
.pp-eyes-smile, .pp-brows-sad, .pp-mouth-smile, .pp-mouth-o, .pp-mouth-sad, .fx { display: none; }
.pp-all { transform-origin: 100px 290px; animation: breathe 2.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .985); } }
.pp-icon .pp-all { animation: none; }
.pp-eyes-open { transform-box: fill-box; transform-origin: center; animation: blink 4.6s infinite; animation-delay: var(--d, 0s); }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.pp-tail { animation: wag 1.6s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }
.pp-rabbit .pp-ears { animation: earwig 3s ease-in-out infinite; }
@keyframes earwig { 0%, 80%, 100% { transform: rotate(0); } 90% { transform: rotate(-6deg); } }
.pp-robot .pp-light { animation: glow 1.4s ease-in-out infinite alternate; }
@keyframes glow { from { opacity: 1; } to { opacity: .4; } }
.pp g.pp-arm, .pp g.pp-leg, .pp g.pp-head { transition: transform .45s var(--spring); }
/* 表情 */
.f-smile .pp-eyes-open, .f-smile .pp-mouth-n { display: none; }
.f-smile .pp-eyes-smile, .f-smile .pp-mouth-smile { display: inline; }
.f-sad .pp-brows-sad, .f-sad .pp-mouth-sad { display: inline; }
.f-sad .pp-mouth-n { display: none; }
.f-surprise .pp-mouth-n { display: none; }
.f-surprise .pp-mouth-o { display: inline; }
.f-surprise .pp-eyes-open { animation: none; transform: scale(1.22); }
/* 話しているあいだ口がパクパク */
.is-talk .pp-mouth-o { display: inline; animation: mouthOpen .3s steps(1) infinite; }
.is-talk .pp-mouth-n, .is-talk .pp-mouth-smile, .is-talk .pp-mouth-sad { animation: mouthShut .3s steps(1) infinite; }
@keyframes mouthOpen { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes mouthShut { 0% { opacity: 1; } 50% { opacity: 0; } }
.is-talk .pp-all { animation: talkBob .5s ease-in-out infinite; }
@keyframes talkBob { 50% { transform: translateY(-3px) scale(1.01, .99); } }
/* ポーズ */
.p-wave .pp-arm-r { animation: waveR .9s ease-in-out infinite alternate; }
@keyframes waveR { from { transform: rotate(-135deg); } to { transform: rotate(-168deg); } }
.p-wave-l .pp-arm-l { animation: waveL .9s ease-in-out infinite alternate; }
@keyframes waveL { from { transform: rotate(135deg); } to { transform: rotate(168deg); } }
.p-cheer .pp-arm-r { transform: rotate(-158deg); } .p-cheer .pp-arm-l { transform: rotate(158deg); }
.p-cheer .pp-all { animation: hopUp .7s var(--spring) infinite alternate; }
@keyframes hopUp { from { transform: translateY(0); } to { transform: translateY(-16px); } }
.p-jump .pp-all { animation: jumpB .8s ease-in-out infinite; }
.p-jump .pp-arm-r { transform: rotate(-150deg); } .p-jump .pp-arm-l { transform: rotate(150deg); }
@keyframes jumpB { 0%, 100% { transform: translateY(0) scale(1.04, .96); } 45% { transform: translateY(-40px) scale(.97, 1.03); } }
.p-oneleg .pp-leg-r { transform: rotate(-72deg); }
.p-oneleg .pp-arm-r { transform: rotate(-84deg); } .p-oneleg .pp-arm-l { transform: rotate(84deg); }
.p-oneleg .pp-all { animation: teeter 1.6s ease-in-out infinite alternate; transform-origin: 87px 290px; }
@keyframes teeter { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
.p-point-r .pp-arm-r { transform: rotate(-96deg); }
.p-point-l .pp-arm-l { transform: rotate(96deg); }
.p-think .pp-arm-r { transform: rotate(148deg); }
.p-think .pp-head { transform: rotate(-7deg); }
.p-shake .pp-head { animation: shakeH .5s ease-in-out infinite alternate; }
@keyframes shakeH { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.p-nod .pp-head { animation: nodH .6s ease-in-out infinite alternate; }
@keyframes nodH { from { transform: translateY(0) rotate(0); } to { transform: translateY(6px) rotate(3deg); } }
.p-sad .pp-head { transform: translateY(6px) rotate(5deg); }
.p-sad .pp-arm-r { transform: rotate(10deg); } .p-sad .pp-arm-l { transform: rotate(-10deg); }
.p-sad .pp-all { animation: none; }
.p-stop .pp-arm-r { transform: rotate(-120deg); } .p-stop .pp-arm-l { transform: rotate(120deg); }
.p-stop .pp-all { animation: none; }
.p-hold .pp-arm-r { transform: rotate(-40deg); } .p-hold .pp-arm-l { transform: rotate(40deg); }
.p-run .pp-leg-l { animation: legA .35s ease-in-out infinite alternate; } .p-run .pp-leg-r { animation: legA .35s ease-in-out infinite alternate-reverse; }
.p-run .pp-arm-l { animation: legA .35s ease-in-out infinite alternate-reverse; } .p-run .pp-arm-r { animation: legA .35s ease-in-out infinite alternate; }
@keyframes legA { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
/* 絵のキャラ：腕や頭の部品はないので、体全体でゆらす */
.pp-sprite .pp-all { transform-origin: 240px 655px; }
.pp-sprite.p-shake .pp-all { animation: spShake .5s ease-in-out infinite alternate; }
@keyframes spShake { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.pp-sprite.p-nod .pp-all { animation: spNod .6s ease-in-out infinite alternate; }
@keyframes spNod { to { transform: translateY(6px) scale(1.01, .985); } }
.pp-sprite.p-wave .pp-all, .pp-sprite.p-wave-l .pp-all { animation: spRock 1s ease-in-out infinite alternate; }
@keyframes spRock { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
.pp-sprite.p-cheer .pp-all { animation: spHop .7s var(--spring) infinite alternate; }
@keyframes spHop { to { transform: translateY(-26px); } }
.pp-sprite.p-jump .pp-all { animation: spJump .8s ease-in-out infinite; }
@keyframes spJump { 0%, 100% { transform: translateY(0) scale(1.03, .97); } 45% { transform: translateY(-60px) scale(.98, 1.02); } }
.pp-sprite.p-sad .pp-all { animation: none; transform: translateY(6px) scale(1, .98); }
.pp-sprite.is-talk .pp-all { animation: spTalk .5s ease-in-out infinite; }
@keyframes spTalk { 50% { transform: translateY(-5px) scale(1.012, .99); } }
.pp-sprite .pp-shadow { animation: none !important; }
/* 気持ちの飾り */
.x-happy .fx-happy, .x-sad .fx-sad, .x-bang .fx-bang, .x-sweat .fx-sweat, .x-q .fx-q, .x-idea .fx-idea, .x-note .fx-note { display: inline; animation: fxP .9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes fxP { from { transform: scale(.92); } to { transform: scale(1.12) translateY(-3px); } }
/* 出てくる */
.in-pop { animation: popIn .6s var(--spring) both; }
@keyframes popIn { from { transform: translateX(-50%) scale(0); } to { transform: translateX(-50%) scale(1); } }
.in-left { animation: inL .7s var(--smooth) both; }
@keyframes inL { from { transform: translateX(-260%); } to { transform: translateX(-50%); } }
.in-right { animation: inR .7s var(--smooth) both; }
@keyframes inR { from { transform: translateX(220%); } to { transform: translateX(-50%); } }
.in-drop { animation: inD .7s var(--spring) both; }
@keyframes inD { from { transform: translate(-50%, -120%); } to { transform: translate(-50%, 0); } }
/* 背景の動き（ゆっくり） */
.an-cloud { animation: cloudX 6s ease-in-out infinite alternate; }
.an-cloud.d2 { animation-delay: -3s; }
@keyframes cloudX { from { transform: translateX(0); } to { transform: translateX(calc(var(--dx, 16px) * 2)); } }
.an-bob { animation: bobS 3s ease-in-out infinite alternate; }
@keyframes bobS { to { transform: translateY(-6px); } }
.an-sway { animation: sway 3s ease-in-out infinite alternate; transform-box: view-box; }
.an-sway.d2 { animation-delay: -1.5s; }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
.an-swing { animation: swing 2.4s ease-in-out infinite alternate; transform-box: view-box; }
@keyframes swing { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
.an-blink { animation: glow 1.6s ease-in-out infinite alternate; }
.an-blink.d2 { animation-delay: -.8s; }
.an-confetti { animation: confetti 2s ease-in-out infinite alternate; }
@keyframes confetti { to { transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  .pp *, .pp-all, .set *, .an-cloud { animation: none !important; transition: none !important; }
  .world { transition: none; }
}
