/* おにぎりばぁ! あそべるえほん */
/* Layout: 絵本のページ色がそのまま画面の地色になる。スマホ1カラム(最大580px)、PCは左余白に「あそびかた」をsticky */
:root{
  --page:#ADDCEE;            /* いまのページの色(JSで切り替え、絵本の枠の中だけ) */
  --base:#F7F5EE;            /* 外側の固定色:ごはんの白 */
  --ink:#1E1A18;             /* 絵本の文字の黒 */
  --paper:#FFFFFF;
  --soft:#ECE8DC;
  --voice:#E2F2F7;            /* よんだ人の こえ:表紙の水色をうすく */
  --f-pop:"Mochiy Pop One","Hiragino Maru Gothic ProN",sans-serif;
  --f-body:"Zen Maru Gothic","Hiragino Maru Gothic ProN","Hiragino Sans",sans-serif;
  color-scheme:light;
}
body{background:var(--base);color:var(--ink);font-family:var(--f-body);font-weight:500;font-size:16px;line-height:1.9;
  transition:background-color .6s ease;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
*{box-sizing:border-box}
.layout{display:grid;gap:20px;max-width:580px;margin:0 auto;padding-block:20px 48px;
  grid-template-areas:"hero" "howto" "game" "rest"}
.hero{grid-area:hero}.howto{grid-area:howto}.game{grid-area:game}.rest{grid-area:rest}
.rest{display:grid;gap:40px;margin-top:20px}
@media (min-width:1024px){
  /* PC:あそびかた(260px固定)+ゲームを ひとかたまりにして中央へ */
  .layout{max-width:1068px;grid-template-columns:260px minmax(0,760px);column-gap:48px;gap:32px;padding-block:28px 64px;
    grid-template-areas:". hero" "howto game" ". rest"}
}

.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.hero{display:grid;gap:4px}
.eyebrow{margin:0;font-size:18px;font-weight:700;letter-spacing:.08em}
.hero h1{margin:0;font-family:var(--f-pop);font-weight:400;font-size:clamp(36px,13vw,64px);line-height:1.15;white-space:nowrap}
.lead{margin:0;font-size:15px;font-weight:700}
h2{font-family:var(--f-pop);font-weight:400;font-size:24px;margin:0 0 12px;
	line-height: 1.2em;
  word-break:keep-all;overflow-wrap:anywhere} /* 見出しはスペースの位置でだけ改行(狭すぎる時だけ保険で途中改行) */
.nw{display:inline-block} /* 意味のかたまり。改行するなら このかたまりの間で */

/* あそびかた:どの幅でも同じ箱。PCは左の余白へ移動するだけ */
.howto{background:var(--soft);border-radius:20px;padding:16px 18px;font-size:15px}
.howto h2{margin-bottom:8px}
.steps{margin:0;padding:0;list-style:none;display:grid;gap:8px}
.steps li{display:grid;grid-template-columns:40px minmax(0,1fr);gap:10px;align-items:center;line-height:1.6}
.steps .ico{width:40px;height:40px;display:grid;place-items:center;font-size:24px;line-height:1;background:var(--paper);border-radius:50%}
.steps .ico svg{width:30px;height:30px;display:block}
@media (min-width:1024px){
  .howto{align-self:start;position:sticky;top:32px;padding:20px 22px}
  .steps{gap:10px}
}

/* ステージ:絵本の見開きそのまま */
.stage{position:relative;aspect-ratio:16/9;max-width:100%;border-radius:16px;overflow:hidden;background:var(--page);
  box-shadow:0 0 0 6px var(--ink);transition:background-color .6s}
/* たたいている間は おにぎりだけ(左ページは「ばぁ」で出す) */
.stage.page .base{display:none}
/* スマホ縦用:上に文字、下におにぎり */
.pt,.pb,.pcov{display:none}
@media (max-width:600px){
  .stage{aspect-ratio:9/14;width:min(100%,calc((100vh - 175px) * 9 / 14));width:min(100%,calc((100svh - 175px) * 9 / 14));margin-inline:auto}
  .status{font-size:15px}
  .go{font-size:15px;padding:6px 14px}
  .collect{gap:4px;margin-top:8px}
  .collect .slot{max-width:40px;border-width:2px;font-size:14px;margin-bottom:2px}
  .collect li{font-size:10px;line-height:1.3}
  .stage>img{display:none!important}
  .pt,.pb,.pcov{display:block;position:absolute;left:0;right:0}
  .pt{top:3%;height:34%;padding-inline:5%}
  .pb{bottom:3%;height:60%}
  .pcov{inset:8% 4%}
  .pt img,.pb img,.pcov img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;user-select:none;-webkit-user-drag:none}
  .pt img{position:static}
  .pb img{object-position:50% 100%;transform-origin:50% 92%}
  .pb .o{opacity:0}
  .stage.cover .pt,.stage.cover .pb,.stage.page .pcov,.stage.opened .pcov,.stage.ending .pt,.stage.ending .pb,.stage.ending .pcov{display:none}
  .stage.cover .pcov img{animation:breathe 2.4s ease-in-out infinite;transform-origin:50% 90%}
  .stage.cover.tap .pcov img{animation:squish .22s ease-out}
  .stage.tap .pb .h{animation:squish .22s ease-out}
  .stage.lv2 .pb .h{animation:wiggle .45s ease-in-out infinite}
  .stage.lv2.tap .pb .h{animation:squish .22s ease-out}
  .stage.opened .pb .h{opacity:0;transition:opacity .25s}
  .stage.opened .pb .o{opacity:1;animation:baa .55s cubic-bezier(.3,1.6,.5,1)}
  .stage.page:not(.opened) .pt{visibility:hidden}
  .stage.opened .pt img{animation:baa .55s cubic-bezier(.3,1.6,.5,1)}
  .stage.turn .pt img,.stage.turn .pb .h{animation:turn .45s ease-out}
  .stage .hit{top:auto;bottom:0;width:100%;height:66%}
  .stage.cover .hit{height:100%}
  .stage .nigero{left:8%;top:10%;font-size:clamp(30px,11vw,52px)}
}
.stage>img{position:absolute;inset:0;width:100%;height:100%;display:block;user-select:none;-webkit-user-drag:none}
.stage .oni{clip-path:inset(0 0 0 50%);transform-origin:73% 84%}
.stage .open{opacity:0}
/* ページ切り替えのフェードは「おにぎりだけの層」にだけかける(隠れている「ばぁ」の画像が一瞬見えないように) */
.stage.turn .oni{animation:turn .45s ease-out}
@keyframes turn{from{opacity:0}to{opacity:1}}
.stage.tap .oni{animation:squish .22s ease-out}
.stage.lv2 .oni{animation:wiggle .45s ease-in-out infinite}
.stage.lv2.tap .oni{animation:squish .22s ease-out}
.stage.opened .base,.stage.opened .oni{opacity:0;transition:opacity .25s}
.stage.opened .open{opacity:1;animation:baa .55s cubic-bezier(.3,1.6,.5,1)}
@keyframes squish{40%{transform:scale(1.05,.92)}100%{transform:none}}
@keyframes wiggle{25%{transform:rotate(-1.6deg)}75%{transform:rotate(1.6deg)}}
@keyframes baa{from{transform:scale(.94)}to{transform:none}}

/* 表紙 */
.stage.cover .oni,.stage.cover .open{display:none}
.stage.cover .base{animation:breathe 2.4s ease-in-out infinite;transform-origin:50% 88%}
.stage.cover.tap .base{animation:squish .22s ease-out}
@keyframes breathe{50%{transform:scale(1.02,.985)}}

.hit{all:unset;position:absolute;top:0;right:0;width:50%;height:100%;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;z-index:2}
.stage.cover .hit{width:100%}
.hint{display:none;position:absolute;left:50%;bottom:6%;z-index:5;margin:0;transform:translateX(-50%);pointer-events:none;
  background:var(--paper);border:3px solid var(--ink);border-radius:999px;padding:4px 16px;font-weight:700;font-size:15px;white-space:nowrap;animation:nudge 1.2s ease-in-out infinite}
.stage.cover .hint{display:block}
@keyframes nudge{50%{transform:translate(-50%,-6px)}}
.hit:focus-visible{outline:4px dashed var(--ink);outline-offset:-10px;border-radius:14px}
.stage.opened .hit,.stage.ending .hit{display:none}
.pon{position:absolute;z-index:3;font-family:var(--f-pop);font-size:22px;color:var(--ink);pointer-events:none;animation:float .7s ease-out forwards}
@keyframes float{to{transform:translateY(-36px);opacity:0}}

/* たたいている間の ことば「おにぎり おにぎり いない いない」:PCは左ページ、スマホはおにぎりの上 */
.stage{container-type:inline-size}
.inai{display:none;position:absolute;z-index:3;margin:0;left:13%;top:50%;transform:translateY(-50%);pointer-events:none;
  font-family:var(--f-body);font-weight:700;font-size:3.6cqw;line-height:2;letter-spacing:.06em;white-space:nowrap;color:var(--ink)}
.stage.page:not(.opened) .inai{display:block;animation:turn .45s ease-out}
@media (max-width:600px){
  .stage .inai{left:0;right:0;top:12%;transform:none;text-align:center;font-size:6.4cqw;line-height:1.9}
}

/* ラスト:おかずが にげる */
.crew{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);aspect-ratio:1396/619;display:none}
.stage.ending>img{display:none}
.stage.ending .crew{display:block}
.owari{display:none;position:absolute;left:0;right:0;bottom:7%;margin:0;text-align:center;font-family:var(--f-body);font-weight:700;font-size:clamp(16px,2.6vw,26px);letter-spacing:.3em;color:var(--ink)}
.stage.ending .owari{display:block;animation:turn 1s ease-out 2.8s both}
.nigero{display:none;position:absolute;left:6%;top:6%;margin:0;font-family:var(--f-pop);font-size:clamp(28px,8vw,64px);line-height:1;color:var(--ink);transform:rotate(-6deg)}
.stage.ending .nigero{display:block;animation:word .6s cubic-bezier(.3,1.6,.5,1) both}
@keyframes word{from{opacity:0;transform:rotate(-6deg) scale(.4)}}
.r{all:unset;position:absolute;left:var(--l);top:var(--t);width:var(--w);cursor:pointer;
  animation:runIn 2.4s cubic-bezier(.2,.7,.3,1) var(--d) both;-webkit-tap-highlight-color:transparent}
.r img{width:100%;display:block;animation:hop .3s ease-in-out var(--d) 8 alternate}
.r:focus-visible{outline:3px dashed var(--ink);outline-offset:4px;border-radius:8px}
.r.jump img{animation:jump .5s cubic-bezier(.3,1.6,.5,1)}
.r.tako img{animation:hop .3s ease-in-out var(--d) 8 alternate,bob 1.6s ease-in-out 2.6s infinite}
.r.tako.jump img{animation:jump .5s cubic-bezier(.3,1.6,.5,1)}
@keyframes runIn{from{left:-30%}}
@keyframes hop{to{transform:translateY(-14%)}}
@keyframes bob{50%{transform:translateY(-8%)}}
@keyframes jump{40%{transform:translateY(-30%) scale(1.05,.95)}}

.bar{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px;min-height:46px}
.status{margin:0;font-size:17px;font-weight:700;line-height:1.5;flex:1 1 0;min-width:0}
.go{flex:none;padding:8px 18px}
.btn{font:inherit;font-weight:700;border-radius:999px;cursor:pointer;padding:8px 22px}
.go{background:var(--ink);color:var(--paper);border:3px solid var(--ink)}
.sound{position:absolute;top:10px;right:10px;z-index:6;background:var(--paper);color:var(--ink);border:3px solid var(--ink);font-size:13px;padding:2px 12px}
.sound[aria-pressed="false"]{background:var(--paper);opacity:.7}
.btn:focus-visible{outline:3px solid var(--paper);outline-offset:3px}
.next{margin:12px 0 0;text-align:center;min-height:52px}

.collect{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin:16px 0 0;padding:0;list-style:none}
.collect li{text-align:center;font-size:12px;line-height:1.4;font-weight:700;min-width:0}
.collect .slot{width:100%;max-width:60px;aspect-ratio:1;margin:0 auto 4px;border-radius:50%;border:3px dashed var(--ink);
  display:grid;place-items:center;font-family:var(--f-pop);font-size:18px;opacity:.4;background:transparent}
.collect .slot img{width:70%;height:70%;object-fit:contain;display:none}
.collect li.got .slot{border-style:solid;opacity:1;background:var(--paper)}
.collect li.got .slot img{display:block}
.collect li.got .slot span{display:none}
.collect li:not(.got) .name{visibility:hidden}

/* ここから下:ゲームの外 */
.sec{display:grid;gap:12px}
.sec p{margin:0;max-width:38em}
.about{border-top:3px solid var(--ink);padding-top:32px}
.rec{margin:0;padding:0;list-style:none;display:grid;gap:8px}
.rec li{display:grid;grid-template-columns:32px minmax(0,1fr);gap:8px;align-items:center;background:var(--paper);border-radius:14px;padding:10px 14px;line-height:1.6}
.rec .e{font-size:22px;text-align:center}
.card{background:var(--paper);border-radius:24px;padding:24px 22px;display:grid;gap:16px}
/* 表紙を左にfloatして、文章が画像の下まで回り込むように */
.bookrow{display:flow-root}
.bookrow .covimg{float:left;width:140px;margin:4px 18px 8px 0}
@media (max-width:440px){.bookrow .covimg{width:110px;margin-right:14px}}
.bookrow-txt p{margin:0 0 10px}
.bookrow-txt dl{display:block;font-size:14px;line-height:1.8}
.bookrow-txt dt{display:inline;font-weight:700}
.bookrow-txt dt::after{content:":"}
.bookrow-txt dd{display:inline;margin:0}
.bookrow-txt dd::after{content:"\A";white-space:pre}
.covimg{width:100%;aspect-ratio:1;border-radius:8px;overflow:hidden;background:#ADDCEE;box-shadow:0 0 0 2px var(--ink)}
.covimg img{width:100%;height:100%;object-fit:contain;display:block}
dl{margin:0;display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 14px;font-size:14px}
dt{font-weight:700}dd{margin:0}
.link{justify-self:center;display:inline-block;text-decoration:none;font-weight:700;color:var(--paper);background:var(--ink);border-radius:999px;padding:8px 22px}
.link:focus-visible{outline:3px solid var(--ink);outline-offset:3px}
.shop{margin:0;display:grid;grid-template-columns:84px minmax(0,1fr);gap:14px;align-items:center;border:2px dashed var(--ink);border-radius:16px;padding:12px 16px;font-size:15px;line-height:1.7}
.shop img{width:100%;height:auto;display:block}
.shop a{display:inline-block;margin-top:2px;color:var(--ink);font-weight:700}
.voice{margin:0;display:grid;gap:10px}
.voice-label{margin:0;font-weight:700;font-size:14px}
.voice-bubble{position:relative;margin:0;background:var(--voice);border-radius:20px;padding:18px 20px 16px 44px;font-size:15px;line-height:1.85;display:grid;gap:8px}
.voice-bubble::before{content:"“";position:absolute;left:12px;top:2px;font-family:var(--f-pop);font-size:44px;line-height:1;opacity:.35}
.voice-bubble::after{content:"";position:absolute;left:30px;bottom:-12px;border:12px solid transparent;border-top-color:var(--voice);border-bottom:0}
.voice-bubble p{margin:0}
.voice-who{display:flex;align-items:center;gap:10px;margin-left:14px;font-size:14px;line-height:1.5}
.voice-who img{width:40px;height:40px;object-fit:contain;background:var(--soft);border-radius:50%;padding:4px}
.voice-who small{font-size:12px}
/* プロフィール・しっぽ:画像を左にfloatして、文章を下まで回り込ませる */
.prof,.shippo{display:flow-root}
.flow-txt p{margin:0 0 8px}
.flow-txt p:last-child{margin-bottom:0}
.prof img{float:left;width:88px;height:88px;margin:4px 16px 8px 0;border-radius:50%;background:var(--soft);display:block}
.prof .nm{margin:0;font-family:var(--f-pop);font-size:20px;line-height:1.3}
.prof .motto{font-weight:700;font-size:16px;line-height:1.8}
.prof .role{margin:0 0 6px;font-size:13px;font-weight:700}
.stat{display:inline-flex;align-items:baseline;gap:6px;margin:4px 0;background:var(--soft);border-radius:12px;padding:6px 14px;font-weight:700}
.stat b{font-family:var(--f-pop);font-weight:400;font-size:24px;font-variant-numeric:tabular-nums}
.shippo img{float:left;width:150px;height:auto;margin:0 16px 8px 0;display:block}
@media (max-width:440px){.shippo img{width:110px;margin-right:12px}}
.shippo .nm{margin:0;font-family:var(--f-pop);font-size:20px;line-height:1.3}
.cta{display:grid;gap:10px;justify-items:center;text-align:center}
.cta a{display:block;max-width:420px;width:100%;border-radius:12px;overflow:hidden;box-shadow:0 6px 0 rgba(0,0,0,.22),0 10px 18px rgba(0,0,0,.12);transition:transform .15s,box-shadow .15s}
.cta a:hover{transform:translateY(-2px);box-shadow:0 8px 0 rgba(0,0,0,.22),0 14px 22px rgba(0,0,0,.14)}
.cta a:active{transform:translateY(5px);box-shadow:0 1px 0 rgba(0,0,0,.22),0 3px 6px rgba(0,0,0,.1)}
.cta a:focus-visible{outline:3px solid var(--ink);outline-offset:4px}
.cta img{display:block;width:100%;height:auto}
.cta p{margin:0;font-weight:700}
/* フッター(画面の端から端まで) */
.site-footer{margin-left:calc(-1 * max(16px,env(safe-area-inset-left,0px)));margin-right:calc(-1 * max(16px,env(safe-area-inset-right,0px)));
  padding:36px max(16px,env(safe-area-inset-right,0px)) calc(28px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));
  background:var(--ink);color:var(--paper);text-align:center;display:grid;gap:10px;font-size:14px}
.site-footer p{margin:0}
.site-footer a{color:var(--paper)}
.site-footer a:focus-visible{outline:2px solid var(--paper);outline-offset:3px}
.footer-title{font-family:var(--f-pop);font-size:16px}
.footer-keywords{font-size:12px;opacity:.75}
.footer-sns{margin:6px 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;justify-content:center;gap:14px}
.footer-sns a{width:44px;height:44px;display:grid;place-items:center;background:var(--paper);border-radius:50%;color:var(--ink);font-size:11px;font-weight:700;text-decoration:none;transition:transform .15s}
.footer-sns a:hover{transform:translateY(-2px)}
.footer-sns img{width:24px;height:24px;object-fit:contain;display:block}
.footer-small{font-size:12px}
.footer-copy{font-size:12px;opacity:.75;margin-top:6px}

@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
