/* どうぶつ じむしょ
   いろは 6しょく。テンプレっぽい「クリーム地 + テラコッタ」を さけ、
   かべは あさの みずいろ、つくえは あかみを ぬいた きいろい き、かみは ほぼ しろ。 */
:root {
  --wall: #BFE3E0;
  --wall-deep: #A6D3D2;
  --paper: #FFFDF3;
  --desk: #B77C46;
  --desk-dark: #8A5A31;
  --ink: #3E2C23;
  --berry: #F0688F;
  --leaf: #5FB86B;
  --sun: #FFCB45;
  --stamp-red: #E24B63;

  /* まるい かたちに あう まるゴシック 1しゅるい だけ。がいぶフォントは よみこまない */
  --round: "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "Hiragino Maru Gothic Pro",
           "Yu Gothic", "YuGothic", "M PLUS Rounded 1c", "Rounded Mplus 1c",
           system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--round);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.sr {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.room {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  cursor: pointer;
}

/* ---------- かべ ---------- */

.wall {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background:
    radial-gradient(120% 90% at 78% 6%, #E7F6F3 0%, rgba(231,246,243,0) 58%),
    linear-gradient(var(--wall) 0%, var(--wall-deep) 100%);
}

.window {
  position: absolute;
  top: clamp(8px, 3vh, 34px);
  left: clamp(10px, 4vw, 60px);
  width: clamp(70px, 14vmin, 150px);
  height: auto;
  opacity: .95;
}

.plaque {
  position: absolute;
  top: clamp(92px, 19vmin, 200px);
  left: clamp(10px, 4vw, 60px);
  transform: rotate(-2deg);
  margin: 0;
  padding: .35em .9em .45em;
  border: 5px solid var(--desk-dark);
  border-radius: 14px;
  background: var(--desk);
  color: var(--paper);
  font-size: clamp(14px, 2.4vmin, 24px);
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  letter-spacing: .06em;
  box-shadow: 0 5px 0 rgba(62, 44, 35, .18);
}
.plaque span { display: block; }

/* おとなの そうさ。ちいさく、すみに */
.grownup {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 6;
  display: flex;
  gap: 8px;
}

.gbtn {
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  padding: 7px 12px;
  border: 2px solid rgba(62, 44, 35, .35);
  border-radius: 999px;
  background: rgba(255, 253, 243, .72);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.gbtn:hover { background: rgba(255, 253, 243, .95); }
.gbtn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.gstate { font-size: 11px; opacity: .7; }

/* ---------- どうぶつ ---------- */

.critters {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(4px, 3vw, 54px);
}

.critter {
  position: relative;
  margin: 0;
  text-align: center;
}

.critter svg[role="img"] {
  display: block;
  width: auto;
  /* たかさ だけで きめると せまい はばで 3にんが がめんから はみだす。
     よこはば（27vw ≒ 3にんぶん + すきま）でも あたまうちに する。 */
  height: min(clamp(96px, 25vh, 250px), 27vw);
  overflow: visible;
}

.critter figcaption {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 10px 3px;
  border-radius: 999px;
  background: rgba(255, 253, 243, .8);
  font-size: clamp(10px, 1.5vmin, 14px);
  letter-spacing: .08em;
  white-space: nowrap;
}

.critter .food {
  position: absolute;
  left: 50%;
  top: 44%;
  width: clamp(30px, 6vmin, 58px);
  height: auto;
  transform: translate(-50%, 6px) scale(.2);
  opacity: 0;
  pointer-events: none;
}
.critter.eating .food {
  animation: food-in 2.6s ease both;
}
@keyframes food-in {
  0%   { transform: translate(-50%, 30px) scale(.2); opacity: 0; }
  14%  { transform: translate(-50%, 0) scale(1); opacity: 1; }
  80%  { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -4px) scale(.5); opacity: 0; }
}

/* いつもの いきづかい と まばたき。おさえめに */
.cbody { animation: breathe 3.6s ease-in-out infinite; transform-box: view-box; transform-origin: 100px 214px; }
.critter:nth-child(2) .cbody { animation-delay: -1.2s; }
.critter:nth-child(3) .cbody { animation-delay: -2.4s; }
@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.015, .985); }
}

.eye { animation: blink 5.5s steps(1, end) infinite; transform-box: fill-box; transform-origin: center; }
.critter:nth-child(2) .eye { animation-delay: -2s; }
.critter:nth-child(3) .eye { animation-delay: -3.7s; }
@keyframes blink {
  0%, 95%  { transform: scaleY(1); }
  96%, 98% { transform: scaleY(.12); }
  99%,100% { transform: scaleY(1); }
}

.ear { transform-box: view-box; }
.critter.react .ear-l { animation: ear-l .5s ease; }
.critter.react .ear-r { animation: ear-r .5s ease; }
.critter.react .cbody { animation: hop .5s ease; }
@keyframes ear-l { 0%,100% { transform: rotate(0); } 40% { transform: rotate(-17deg); } }
@keyframes ear-r { 0%,100% { transform: rotate(0); } 40% { transform: rotate(17deg); } }
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  28%      { transform: translateY(-13px) scale(.97, 1.04); }
  62%      { transform: translateY(0) scale(1.04, .95); }
}

.critter.cheer .cbody { animation: cheer .9s ease; }
@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0); }
  20%      { transform: translateY(-24px) rotate(-5deg); }
  45%      { transform: translateY(0) rotate(3deg); }
  70%      { transform: translateY(-13px) rotate(-2deg); }
}

.critter.eating .mouth { animation: chew .34s ease-in-out 7; transform-box: fill-box; transform-origin: center top; }
@keyframes chew { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(.62) translateY(1px); } }

.tail { transform-box: view-box; }
.critter.react .tail { animation: wag .5s ease; }
@keyframes wag { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-13deg); } }

/* よこ・たて への うごき（やじるしキー） */
.critters.lean-l { transform: translateX(-22px) rotate(-1.5deg); }
.critters.lean-r { transform: translateX(22px) rotate(1.5deg); }
.critters.bow    { transform: translateY(14px); }
.critters { transition: transform .28s cubic-bezier(.34,1.56,.64,1); }

/* ---------- つくえ ---------- */

.desk {
  position: relative;
  flex: 0 0 auto;
  height: clamp(210px, 40vh, 360px);
  z-index: 2;
}

.desk-lip {
  height: clamp(14px, 2.2vh, 22px);
  background: var(--desk);
  border-top: 4px solid var(--desk-dark);
  border-bottom: 4px solid var(--desk-dark);
  box-shadow: 0 -8px 18px rgba(62, 44, 35, .13);
}

.desk-top {
  position: relative;
  height: calc(100% - clamp(14px, 2.2vh, 22px));
  padding: clamp(8px, 2vh, 20px) clamp(8px, 3vw, 40px)
           max(clamp(8px, 2vh, 20px), env(safe-area-inset-bottom));
  background:
    repeating-linear-gradient(96deg, rgba(255,253,243,.05) 0 3px, rgba(62,44,35,.05) 3px 9px),
    linear-gradient(var(--desk) 0%, var(--desk-dark) 100%);
}

.scene { height: 100%; }
.scene[hidden] { display: none !important; }

.scene-work {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto minmax(64px, 1fr);
  align-items: center;
  justify-items: center;
  gap: clamp(6px, 2vw, 30px);
}

.desk-left, .desk-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.desk-right { flex-direction: row; align-items: flex-end; gap: clamp(4px, 1.4vw, 16px); }

.pile {
  position: relative;
  width: clamp(38px, 7vmin, 66px);
  height: clamp(48px, 9vmin, 84px);
}
.pile i {
  position: absolute;
  inset: 0;
  border: 3px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(62, 44, 35, .2);
}
.pile i::after {
  content: "";
  position: absolute;
  right: 14%;
  top: 16%;
  width: 40%;
  height: 40%;
  border: 3px solid var(--stamp-red);
  border-radius: 50%;
  opacity: .75;
}

.count {
  margin: 0;
  color: rgba(255, 253, 243, .9);
  font-size: clamp(11px, 1.7vmin, 16px);
  letter-spacing: .06em;
}

.paper-slot {
  display: grid;
  place-items: center;
  height: 100%;
  width: 100%;
}

.paper {
  position: relative;
  height: 100%;
  aspect-ratio: 1 / 1.24;
  max-width: 100%;
  transform: rotate(-1.6deg);
}
.paper.fly { animation: paper-fly .52s cubic-bezier(.5,-0.2,.7,1) forwards; }
@keyframes paper-fly {
  0%   { transform: rotate(-1.6deg) translate(0,0) scale(1); opacity: 1; }
  30%  { transform: rotate(4deg) translate(0,-26px) scale(1.04); opacity: 1; }
  100% { transform: rotate(-24deg) translate(-46vw, -34vh) scale(.24); opacity: 0; }
}
.paper.arrive { animation: paper-arrive .34s cubic-bezier(.34,1.4,.64,1) both; }
@keyframes paper-arrive {
  0%   { transform: rotate(6deg) translateY(64px) scale(.9); opacity: 0; }
  100% { transform: rotate(-1.6deg) translateY(0) scale(1); opacity: 1; }
}

.sheet {
  position: relative;
  height: 100%;
  width: 100%;
  padding: clamp(6px, 1.4vh, 14px);
  border-radius: 4px;
  background:
    repeating-linear-gradient(var(--paper) 0 calc(25% - 2px), rgba(62,44,35,.1) calc(25% - 2px) 25%),
    var(--paper);
  box-shadow: 0 6px 0 rgba(62, 44, 35, .22), 0 14px 26px rgba(62, 44, 35, .22);
  overflow: hidden;
}

.chars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  height: 100%;
  place-items: center;
}
.chars span {
  font-size: clamp(15px, 4.4vh, 44px);
  line-height: 1;
  animation: land .3s cubic-bezier(.34,1.7,.64,1) both;
}
@keyframes land {
  0%   { transform: translateY(-16px) scale(1.7) rotate(-8deg); opacity: 0; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

.hint {
  position: absolute;
  inset: auto 0 clamp(8px, 2vh, 18px);
  margin: 0;
  text-align: center;
  font-size: clamp(11px, 1.9vmin, 17px);
  color: rgba(62, 44, 35, .55);
  transition: opacity .3s;
}
.hint.gone { opacity: 0; }

.mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
}
.mark svg {
  width: 56%;
  height: auto;
  font-family: var(--round);
  transform: rotate(-11deg);
}
.mark.on { animation: stamp-down .5s cubic-bezier(.3,1.7,.6,1) both; }
@keyframes stamp-down {
  0%   { opacity: 0; transform: scale(2.6) rotate(9deg); }
  55%  { opacity: 1; transform: scale(.92) rotate(0deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.stamp {
  width: clamp(26px, 5vmin, 46px);
  height: auto;
  transform-origin: 50% 100%;
}
.stamp.press { animation: stamp-lift .5s ease; }
@keyframes stamp-lift {
  0%, 100% { transform: translateY(0) rotate(0); }
  35%      { transform: translateY(-18px) rotate(-14deg); }
  60%      { transform: translateY(3px) rotate(0); }
}

.cup {
  width: clamp(28px, 5.4vmin, 50px);
  height: auto;
}

/* ---------- ぽんっ と でる もじ ---------- */

.pops, .sparks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.pop {
  position: absolute;
  left: 50%;
  top: 38%;
  margin: 0;
  font-size: clamp(84px, 25vmin, 250px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  white-space: nowrap;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  animation: pop var(--dur, 900ms) cubic-bezier(.3,.9,.4,1) forwards;
  text-shadow: 0 8px 0 rgba(62, 44, 35, .17);
}
.pop.word { font-size: clamp(46px, 13vmin, 130px); }

@keyframes pop {
  0%   { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(.15) rotate(var(--rot)); opacity: 0; }
  16%  { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(1.2) rotate(calc(var(--rot) * -.35)); opacity: 1; }
  30%  { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(1) rotate(0deg); opacity: 1; }
  55%  { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--ox) + var(--dx)), calc(var(--oy) + var(--dy))) scale(.1) rotate(14deg); opacity: 0; }
}

.spark {
  position: absolute;
  width: clamp(10px, 2vmin, 20px);
  height: clamp(10px, 2vmin, 20px);
  border-radius: 40% 60% 55% 45%;
  animation: spark .9s ease-out forwards;
}
@keyframes spark {
  0%   { transform: translate(0,0) scale(.3); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(1.1) rotate(180deg); opacity: 0; }
}

.shout {
  position: fixed;
  left: 50%;
  top: 30%;
  z-index: 6;
  margin: 0;
  padding: .18em .7em .26em;
  border-radius: 999px;
  background: var(--sun);
  border: 5px solid var(--ink);
  color: var(--ink);
  font-size: clamp(26px, 7vmin, 74px);
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0) scale(.4);
}
.shout.on { animation: shout 1.15s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes shout {
  0%   { opacity: 0; transform: translate(-50%, 26px) scale(.4) rotate(-6deg); }
  16%  { opacity: 1; transform: translate(-50%, 0) scale(1.06) rotate(2deg); }
  26%  { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); }
  80%  { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(.9); }
}

/* ---------- よこむき・ちいさい がめん ---------- */

@media (max-width: 560px) {
  /* せまい がめんでは かんばんを だす ばしょが ない。モードの バーが なまえの やくめを する */
  .plaque { display: none; }
  .window { width: 62px; }
  .modes { top: 46px; }
  .critters { gap: 0; }
  .scene-work { grid-template-columns: minmax(40px, .7fr) auto minmax(40px, .7fr); }
  .count { font-size: 10px; }
  .numboard { top: 38%; }
}

@media (max-height: 480px) {
  .desk { height: 48vh; }
  .numboard .num { font-size: clamp(56px, 20vh, 150px); }
  .critter svg[role="img"] { height: clamp(90px, 30vh, 160px); }
  .plaque { display: none; }
}

/* ---------- うごきを へらす せってい ---------- */

@media (prefers-reduced-motion: reduce) {
  .cbody, .eye, .clouds { animation: none !important; }
  .critters { transition: none; }
  .critter.eating .food,
  .critter.eating .mouth,
  .critter.react .ear-l,
  .critter.react .ear-r,
  .critter.react .cbody,
  .critter.cheer .cbody,
  .critter.react .tail { animation-duration: .01ms; }
  .pop {
    animation: pop-plain var(--dur, 900ms) linear forwards;
  }
  @keyframes pop-plain {
    0%   { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(1); opacity: 0; }
    18%  { opacity: 1; }
    70%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--ox)), var(--oy)) scale(1); opacity: 0; }
  }
  .chars span, .paper.fly, .paper.arrive, .mark.on, .stamp.press, .spark {
    animation-duration: .12s;
  }
  .shout.on { animation: shout-plain 1.15s linear both; }
  @keyframes shout-plain {
    0% { opacity: 0; transform: translate(-50%, 0) scale(1); }
    10%, 85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, 0) scale(1); }
  }
}

/* ================= あそびかたの きりかえ ================= */

.modes {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  /* left:50% だけだと はばが はんぶんに おさえられ、ボタンの もじが おりかえる */
  width: max-content;
  max-width: calc(100vw - 20px);
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 253, 243, .72);
  box-shadow: 0 3px 0 rgba(62, 44, 35, .12);
}

.mode {
  padding: 8px 16px 9px;
  border: 3px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(13px, 2vmin, 19px);
  line-height: 1;
  letter-spacing: .06em;
  white-space: nowrap;
  cursor: pointer;
}
.mode:hover { background: rgba(62, 44, 35, .08); }
.mode.on {
  background: var(--sun);
  border-color: var(--ink);
}
.mode:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ================= すうじあそび ================= */

.numboard {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  z-index: 3;
}

.numboard .num {
  margin: 0;
  padding: .02em .3em .12em;
  border: 8px solid var(--desk-dark);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(72px, 20vh, 200px);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  box-shadow: 0 10px 0 rgba(62, 44, 35, .2), 0 20px 34px rgba(62, 44, 35, .18);
}
.numboard.next .num { animation: num-in .5s cubic-bezier(.34,1.6,.64,1) both; }
@keyframes num-in {
  0%   { transform: scale(.3) rotate(-14deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.numboard.nudge .num { animation: num-nudge .34s ease; }
@keyframes num-nudge {
  0%, 100% { transform: scale(1) rotate(0); }
  40%      { transform: scale(1.06) rotate(1.5deg); }
}

/* まる と ばつ は がめん いっぱいに だす */
.verdict {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}
.verdict svg { width: min(74vmin, 620px); height: auto; overflow: visible; }
.verdict .ring { fill: none; stroke-width: 22; stroke-linecap: round; }
.verdict.maru .ring { stroke: var(--leaf); }
.verdict.batsu .ring { stroke: #7FB6C9; }

.verdict.maru { animation: verdict-maru 1.05s ease-out both; }
.verdict.maru .ring {
  stroke-dasharray: 640;
  stroke-dashoffset: 640;
  animation: draw .38s cubic-bezier(.4,.1,.3,1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes verdict-maru {
  0%   { opacity: 0; transform: scale(.7); }
  10%  { opacity: 1; transform: scale(1.04); }
  22%  { transform: scale(1); }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.12); }
}

.verdict.batsu { animation: verdict-batsu .72s ease-out both; }
@keyframes verdict-batsu {
  0%   { opacity: 0; transform: scale(.8) rotate(-6deg); }
  14%  { opacity: 1; transform: scale(1) rotate(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: scale(.96); }
}

/* かみふぶき */
.confetti {
  position: absolute;
  top: -6vh;
  width: clamp(9px, 1.6vmin, 16px);
  height: clamp(14px, 2.6vmin, 26px);
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(112vh) rotate(var(--spin)); opacity: .9; }
}

.scene-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.6vh, 16px);
  padding: clamp(6px, 1.6vh, 16px) 0;
}

.ask {
  margin: 0;
  color: rgba(255, 253, 243, .95);
  font-size: clamp(14px, 2.4vmin, 22px);
  letter-spacing: .06em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(4px, .9vw, 12px);
}
.chips button {
  width: clamp(34px, 6.6vmin, 62px);
  height: clamp(40px, 7.6vmin, 70px);
  border: 4px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(18px, 3.4vmin, 34px);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(62, 44, 35, .3);
}
.chips button:hover { background: #FFF6D9; }
.chips button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(62, 44, 35, .3); }
.chips button:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }

.answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 16px);
}

.abtn {
  padding: 9px 18px 10px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(13px, 2vmin, 18px);
  line-height: 1;
  cursor: pointer;
}
.abtn:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.abtn.tiny {
  padding: 6px 12px 7px;
  font-size: clamp(11px, 1.6vmin, 14px);
  background: rgba(255, 253, 243, .78);
}

.byparent { display: flex; gap: 8px; }

/* ================= ごはんモードの いれもの ================= */

.scene-meal { position: relative; }
.mealhost { position: relative; height: 100%; width: 100%; }
.mealwait {
  margin: 0;
  padding-top: 2em;
  text-align: center;
  color: rgba(255, 253, 243, .85);
  font-size: clamp(13px, 2vmin, 18px);
}

@media (prefers-reduced-motion: reduce) {
  .numboard.next .num,
  .numboard.nudge .num,
  .verdict.maru .ring { animation-duration: .12s; }
  .verdict.maru { animation: verdict-plain 1.05s linear both; }
  .verdict.batsu { animation: verdict-plain .72s linear both; }
  @keyframes verdict-plain {
    0% { opacity: 0; transform: none; }
    8%, 82% { opacity: 1; transform: none; }
    100% { opacity: 0; transform: none; }
  }
  .confetti { animation-duration: .3s; }
}

/* せまい がめんの ちょうせい。うしろの きそくを うわがき する ため さいごに おく */
@media (max-width: 560px) {
  .modes { top: 46px; padding: 4px; gap: 4px; }
  .window { top: 96px; }   /* モードの バーに かぶらない いちへ */
  .mode { padding: 7px 12px 8px; }
  .numboard { top: 40%; }
  .numboard .num { border-width: 6px; border-radius: 18px; }
  .chips button { border-width: 3px; }
}

/* ================= すすみぐあい と ごほうび ================= */

.progress {
  display: flex;
  gap: clamp(3px, .6vw, 8px);
}
.progress i {
  width: clamp(10px, 1.6vmin, 16px);
  height: clamp(10px, 1.6vmin, 16px);
  border: 2px solid rgba(255, 253, 243, .75);
  border-radius: 50%;
  background: transparent;
}
.progress i.on {
  background: var(--sun);
  border-color: var(--ink);
  animation: dot-in .4s cubic-bezier(.34,1.7,.64,1) both;
}
@keyframes dot-in {
  0%   { transform: scale(.2); }
  100% { transform: scale(1); }
}

.mealnote {
  position: absolute;
  left: 50%;
  top: clamp(4px, 1.4vh, 14px);
  transform: translateX(-50%);
  margin: 0;
  color: rgba(255, 253, 243, .95);
  font-size: clamp(14px, 2.4vmin, 22px);
  letter-spacing: .06em;
  pointer-events: none;
}

.abtn.replay {
  position: absolute;
  right: clamp(6px, 1.6vw, 18px);
  bottom: max(clamp(6px, 1.6vh, 16px), env(safe-area-inset-bottom));
  z-index: 4;
}

@media (prefers-reduced-motion: reduce) {
  .progress i.on { animation-duration: .12s; }
}

/* ごはんの ばめんは モジュールが 3にんを つくえの うえに かく。
   へやの 3にんを そのまま だすと おなじ どうぶつが 2くみ ならぶので かくす。 */
.room.mode-meal .critters { display: none; }
/* ごはんは たくさんの どうぶつが ならぶ ので、がめんの ほとんどを つくえに する。
   へやの かざり（かんばん・まど）は かくし、モードの バーと おとなの ボタンは のこす。 */
.room.mode-meal .desk { height: clamp(320px, 82vh, 1100px); }
.room.mode-meal .plaque,
.room.mode-meal .window { display: none; }
.room.mode-meal .desk-top {
  padding: clamp(4px, 1vh, 12px) clamp(4px, 1vw, 16px)
           max(clamp(4px, 1vh, 12px), env(safe-area-inset-bottom));
}
