/* 宠物小屋 (spec §47): the child's pet room (pets/room.js, stage.js) and the child home's 宠物窗台
   (views/pets-strip.js). The ceremony, naming and certificate: pets-ceremony.css; the parents' page: pets-parent.css.
   Light only (spec §45).
   Everything that moves moves with transform and opacity (spec §47.12). Side-by-side cards and buttons are equal
   (grids of minmax(0, 1fr), spec §12). Buttons: pressed the moment a finger is down, no long-press menu or
   magnifier on the iPad (spec §47.5). */
:root {
  --pt-wall-1: #EAF3FC;
  --pt-wall-2: #DCEAF8;
  --pt-floor-1: #F4E3C7;
  --pt-floor-2: #EAD1AA;
  --pt-floor-line: rgba(160, 112, 52, 0.12);
  --pt-night-1: #3A3F78;
  --pt-night-2: #5A5A92;
  --pt-night-floor: #6E5F86;
  --pt-ink: var(--ink);
  --pt-card: rgba(255, 255, 255, 0.92);
  --pt-card-line: rgba(42, 30, 53, 0.06);
  --pt-shadow: 0 1px 2px rgba(62, 40, 20, 0.06), 0 8px 22px rgba(62, 40, 20, 0.10);
  --pt-press-shadow: 0 1px 2px rgba(62, 40, 20, 0.08);
  --pt-bar-bg: rgba(42, 30, 53, 0.08);
  --pt-food: #FF9F1C;
  --pt-food-soft: #FFF0D6;
  --pt-joy: #F25F8C;
  --pt-joy-soft: #FFE3EC;
  --pt-energy: #3BAA6E;
  --pt-energy-soft: #DDF3E6;
  --pt-clean: #3D8BF2;
  --pt-clean-soft: #E2EEFF;
  --pt-grow: #F2704A;
  --pt-grow-soft: var(--peach-soft);
  --pt-star: #FFC233;
  --pt-star-soft: #FFF3C4;
  --pt-sleep: #7B6CD9;
  --pt-sleep-soft: #ECE8FF;
  --pt-act-h: 96px;
  --pt-chip-h: 52px;
  --pt-gap: 14px;
  /* every other colour of this sheet */
  --pt-white: #FFFFFF;
  --pt-grow-light: #FFB08F;
  --pt-skirting: #F7E9D2;
  --pt-night-line: rgba(255, 255, 255, 0.05);
  --pt-night-skirting: #7D6E96;
  --pt-night-veil: rgba(34, 36, 92, 0.5);
  --pt-spinner-track: rgba(242, 112, 74, 0.2);
  --pt-food-light: #FFC56B;
  --pt-joy-light: #FF9DBB;
  --pt-energy-light: #8EDB9F;
  --pt-clean-light: #8CCBFF;
  --pt-floor-shadow: rgba(110, 70, 30, 0.24);
  --pt-floor-shadow-0: rgba(110, 70, 30, 0);
  --pt-lid-default: #F4A259;
  --pt-lash: rgba(70, 40, 20, 0.55);
  --pt-reading-ring: rgba(255, 194, 51, 0.6);
  --pt-star-ink: #C98A00;
  --pt-badge-ink: #3A2600;
  --pt-badge-shadow: rgba(200, 130, 0, 0.35);
  --pt-ceremony-1: #E9E2F6;
  --pt-ceremony-2: #F6E6D8;
  --pt-glow: rgba(255, 226, 122, 0.85);
  --pt-glow-0: rgba(255, 226, 122, 0);
  --pt-strip-mid: #FFF6F1;
  --pt-strip-art-1: #FFE9DD;
  --pt-strip-art-2: #EAF3FC;
  --pt-star-chip-ink: #7A5300;
  --pt-star-glow-0: rgba(255, 194, 51, 0);
  --pt-star-glow: rgba(255, 194, 51, 0.35);
}

/* ---------- the room ---------- */
.pt-room {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "meters" "scene" "actions";
  gap: var(--pt-gap);
  padding: calc(var(--safe-top) + 14px) calc(var(--safe-right) + 18px) calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 18px);
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--pt-floor-line) calc(25% - 1px) 25%) 0 100% / 100% 36% no-repeat,
    linear-gradient(180deg, var(--pt-wall-1) 0%, var(--pt-wall-2) 63.5%, var(--pt-skirting) 63.5%, var(--pt-floor-1) 66%, var(--pt-floor-2) 100%);
  color: var(--pt-ink);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color var(--dur-3) var(--ease-out);
}
.pt-room.is-night {
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--pt-night-line) calc(25% - 1px) 25%) 0 100% / 100% 36% no-repeat,
    linear-gradient(180deg, var(--pt-night-1) 0%, var(--pt-night-2) 63.5%, var(--pt-night-skirting) 63.5%, var(--pt-night-floor) 100%);
}
/* The room pack's wall and floor tiles (spec §47.24.9): the wall down to 64%, the floor under it; at night a soft
   blue veil over both (the grid's children sit above it). */
.pt-room.has-room-art {
  background:
    var(--pt-floor-img) repeat-x left bottom / auto 37%,
    var(--pt-wall-img) repeat-x left top / auto 64%,
    var(--pt-floor-2);
}
.pt-room > * { position: relative; z-index: 1; }
.pt-room::before { content: ""; position: absolute; inset: 0; z-index: 0; background: var(--pt-night-veil); opacity: 0; pointer-events: none; transition: opacity 900ms var(--ease-out); }
.pt-room.has-room-art.is-night::before { opacity: 1; }
/* 睡一会儿 and 玩够了: the same veil, lighter (the drawn wall too). */
.pt-room.is-dim::before { opacity: 0.42; }
.pt-room[data-state="loading"]::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  border: 4px solid var(--pt-spinner-track);
  border-top-color: var(--pt-grow);
  animation: pt-spin 0.9s linear infinite;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }

/* The top bar: 回到主页 | the name and stage | the sound switch. */
.pt-top { grid-area: top; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--pt-gap); min-width: 0; }
.pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--pt-chip-h);
  padding: 0 20px;
  border-radius: var(--r-pill);
  background: var(--pt-card);
  box-shadow: var(--pt-shadow);
  color: var(--pt-ink);
  font-size: 19px;
  font-weight: 800;
  text-decoration: none;
  min-width: 0;
}
.pt-chip svg { width: 24px; height: 24px; flex: none; }
.pt-home { justify-self: start; transition: transform var(--dur-1) var(--ease-out); }
.pt-home:active { transform: scale(0.96); }
.pt-title { justify-self: center; max-width: 100%; border: 0; font: inherit; font-size: 19px; font-weight: 800; -webkit-touch-callout: none; touch-action: manipulation; }
.pt-name { font-size: 24px; font-weight: 900; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stage-tag:empty { display: none; }
.pt-stage-tag {
  flex: none;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--peach-soft);
  color: var(--peach-ink);
  font-size: 15px;
  font-weight: 800;
}
.pt-top-tools { justify-self: end; display: flex; gap: 12px; }
.pt-round {
  display: grid;
  place-items: center;
  width: var(--pt-chip-h);
  height: var(--pt-chip-h);
  border: 0;
  border-radius: 50%;
  background: var(--pt-card);
  box-shadow: var(--pt-shadow);
  color: var(--pt-ink);
  transition: transform var(--dur-1) var(--ease-out);
}
.pt-round svg { width: 26px; height: 26px; }
.pt-round:active { transform: scale(0.94); }
.pt-round[hidden] { display: none; }
/* 「商店」 and 「衣柜」 resting with the room (bedtime, 玩够了): dimmed like the care buttons; a tap says why. */
.pt-round[aria-disabled="true"] { opacity: 0.6; }

/* The four numbers and the growth bar: soft colours, never red, never blinking (spec §47.4). */
.pt-meters { grid-area: meters; display: grid; gap: 10px; min-width: 0; }
.pt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.pt-stat, .pt-growth {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: var(--r-m);
  background: var(--pt-card);
  box-shadow: var(--pt-shadow);
  color: var(--pt-ink);
  font: inherit;
  text-align: left;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 140ms var(--ease-spring);
}
/* Tapped or held, they are read out (spec §47.9): pressed the next frame, the reading ring while held. */
.pt-stat.is-pressed, .pt-growth.is-pressed, .pt-quiet.is-pressed, .pt-title.is-pressed, .pt-home.is-pressed, .pt-round.is-pressed { transform: scale(0.97); transition: none; }
.pt-stat.is-reading, .pt-growth.is-reading, .pt-title.is-reading, .pt-home.is-reading, .pt-round.is-reading { box-shadow: 0 0 0 4px var(--pt-reading-ring), var(--pt-shadow); }
.pt-stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--pt-food-soft); color: var(--pt-food); }
.pt-stat-icon svg { width: 24px; height: 24px; }
.pt-stat-body { display: grid; gap: 6px; min-width: 0; }
.pt-stat-label, .pt-growth-text { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-bar { position: relative; display: block; height: 10px; border-radius: var(--r-pill); background: var(--pt-bar-bg); overflow: hidden; }
.pt-bar-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pt-food-light), var(--pt-food));
  transform: scaleX(0.5);
  transform-origin: left center;
  transition: transform 700ms var(--ease-out);
}
.pt-stat[data-stat="joy"] .pt-stat-icon { background: var(--pt-joy-soft); color: var(--pt-joy); }
.pt-stat[data-stat="joy"] .pt-bar-fill { background: linear-gradient(90deg, var(--pt-joy-light), var(--pt-joy)); }
.pt-stat[data-stat="energy"] .pt-stat-icon { background: var(--pt-energy-soft); color: var(--pt-energy); }
.pt-stat[data-stat="energy"] .pt-bar-fill { background: linear-gradient(90deg, var(--pt-energy-light), var(--pt-energy)); }
.pt-stat[data-stat="clean"] .pt-stat-icon { background: var(--pt-clean-soft); color: var(--pt-clean); }
.pt-stat[data-stat="clean"] .pt-bar-fill { background: linear-gradient(90deg, var(--pt-clean-light), var(--pt-clean)); }
.pt-growth .pt-stat-icon { background: var(--pt-grow-soft); color: var(--pt-grow); }
.pt-growth .pt-bar-fill { background: linear-gradient(90deg, var(--pt-grow-light), var(--pt-grow)); }
.pt-stat.is-low .pt-stat-icon { animation: none; }

/* The pet's corner of the room. */
.pt-scene { grid-area: scene; position: relative; min-height: 0; min-width: 0; }
/* The toys and room things it keeps (room-items.js), behind the frame on the wall and the pet; never in the way of a tap. */
.pt-things { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.pt-petbox { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.pt-say {
  position: absolute;
  top: 2%;
  right: 0;
  z-index: 3;
  display: grid;
  gap: 4px;
  max-width: min(44%, 380px);
  padding: 14px 20px;
  border-radius: var(--r-l);
  background: var(--pt-white);
  box-shadow: var(--shadow-2);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.4;
  animation: pt-pop-in 260ms var(--ease-spring);
}
.pt-say::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 34px;
  width: 18px;
  height: 18px;
  background: var(--pt-white);
  transform: rotate(45deg);
  border-radius: 4px;
}
.pt-say[hidden] { display: none; }
.pt-say-who { position: relative; color: var(--peach-ink); font-size: 15px; }
.pt-say-who:empty { display: none; }
.pt-say-text { position: relative; }
@keyframes pt-pop-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.pt-mood {
  position: absolute;
  left: calc(50% + 8%);
  top: 6%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  background: var(--pt-white);
  box-shadow: var(--shadow-2);
  color: var(--pt-grow);
  animation: pt-float 3s ease-in-out infinite;
}
.pt-mood[hidden] { display: none; }
.pt-mood svg { width: 30px; height: 30px; }
@keyframes pt-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- the pet (stage.js) ---------- */
.pt-stage { position: relative; flex: none; width: 420px; height: 420px; touch-action: none; -webkit-user-select: none; user-select: none; transition: transform 900ms var(--ease-out); }
.pt-shadow {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 3%;
  height: 7%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--pt-floor-shadow), var(--pt-floor-shadow-0));
}
.pt-motion, .pt-breath, .pt-idle, .pt-tail, .pt-body, .pt-headgrp, .pt-head, .pt-pose, .pt-acc-back, .pt-acc-front, .pt-acc-head, .pt-acc-pose, .pt-lids { position: absolute; inset: 0; width: 100%; height: 100%; }
.pt-pose-frame { position: absolute; inset: 0; isolation: isolate; }
.pt-idle { isolation: isolate; }
.pt-headfloat { position: absolute; inset: 0; }
.pt-stage.is-layered .pt-body { animation: pt-body-breathe var(--pt-breathe-time) ease-in-out infinite; }
.pt-stage.is-layered .pt-headfloat { animation: pt-head-breathe var(--pt-breathe-time) ease-in-out var(--pt-head-breathe-delay) infinite; }
.pt-stage.is-calm .pt-body, .pt-stage.is-calm .pt-headfloat,
.pt-stage.is-reduced .pt-body, .pt-stage.is-reduced .pt-headfloat { animation: none; }
.pt-stage.is-acting .pt-body, .pt-stage.is-acting .pt-headfloat,
.pt-stage.is-paused .pt-body, .pt-stage.is-paused .pt-headfloat { animation-play-state: paused; }
@keyframes pt-body-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.002, 1.004); } }
@keyframes pt-head-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.12%); } }
.pt-acc-head, .pt-acc-pose { pointer-events: none; }
/* What it wears (wear.js placementStyle: left / top on the anchor, a width, rotate + translate from its attach point). */
.pt-stage img.pt-wear { position: absolute; max-width: none; height: auto; object-fit: fill; transform-origin: 0 0; }
/* A treat's bite flying into its mouth (stage.toss). */
.pt-stage img.pt-bite { position: absolute; z-index: 2; width: 16%; height: auto; pointer-events: none; }
.pt-motion { will-change: transform; }
.pt-headgrp, .pt-tail { will-change: transform; }
.pt-breath { animation: pt-breathe 3.4s ease-in-out infinite; }
.pt-stage.is-asleep .pt-breath { animation: pt-breathe-deep 4.5s ease-in-out infinite; }
.pt-stage.is-paused .pt-breath, .pt-room .pt-stage.is-paused * { animation-play-state: paused; }
/* Stills and video share this parent. Keep its phase: removing breathing for a clip snapped height by up to 1.6%. */
.pt-stage.is-reduced .pt-breath { animation: none; }
/* The mirror uses still idle layers; reset breathing without pausing expression motion. */
.pt-stage.is-mirroring .pt-body,
.pt-stage.is-mirroring .pt-headfloat,
.pt-stage.is-mirroring .pt-breath { animation: none; }
@keyframes pt-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.007, 1.016); } }
@keyframes pt-breathe-deep { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.014, 1.032); } }
.pt-stage img { display: block; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.pt-pose { opacity: 0; }
.pt-lid {
  position: absolute;
  border-radius: 50%;
  background: var(--pt-lid, var(--pt-lid-default));
  box-shadow: inset 0 -3px 0 var(--pt-lash);
  transform: scaleY(0);
  transform-origin: 50% 0;
}
.pt-blink { position: absolute; opacity: 0; }
.pt-prop { position: absolute; left: -6%; bottom: 4%; width: 30%; height: 30%; object-fit: contain; pointer-events: none; }
.pt-clip { position: absolute; display: block; pointer-events: none; object-fit: contain; background: transparent; }
.pt-fx { position: absolute; left: -15%; top: -15%; width: 130%; height: 130%; pointer-events: none; }

/* ---------- the buttons (press.js) ---------- */
.pt-actions { grid-area: actions; display: grid; gap: 8px; min-width: 0; }
.pt-quiet { justify-self: center; max-width: 100%; margin: 0; padding: 4px 14px; border: 0; border-radius: var(--r-pill); background: none; font: inherit; text-align: center; font-size: 19px; font-weight: 800; color: var(--pt-ink); -webkit-touch-callout: none; touch-action: manipulation; }
.pt-room.is-night .pt-quiet { color: var(--pt-white); }
.pt-quiet[hidden] { display: none; }
.pt-acts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--pt-gap); align-items: stretch; }
.pt-act {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-width: 0;
  min-height: var(--pt-act-h);
  padding: 10px 6px;
  border: 0;
  border-radius: var(--r-l);
  background: var(--pt-white);
  box-shadow: var(--pt-shadow);
  color: var(--pt-ink);
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform 140ms var(--ease-spring), box-shadow 140ms var(--ease-out), opacity var(--dur-2) var(--ease-out);
}
/* Pressed: the very next frame, no delay going down. */
.pt-act.is-pressed { transform: scale(0.94) translateY(2px); box-shadow: var(--pt-press-shadow); transition: none; }
.pt-act.is-bounce { animation: pt-bounce 320ms var(--ease-spring); }
.pt-act.is-reading { box-shadow: 0 0 0 4px var(--pt-reading-ring), var(--pt-shadow); }
.pt-act[data-mode="asleep"] { opacity: 0.6; }
.pt-act[data-mode="tomorrow"] .pt-act-label { font-size: 17px; color: var(--text-2); }
@keyframes pt-bounce { 0% { transform: scale(1); } 35% { transform: scale(0.92); } 70% { transform: scale(1.04); } 100% { transform: scale(1); } }
.pt-act-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--pt-food-soft); color: var(--pt-food); }
.pt-act-icon svg { width: 30px; height: 30px; }
.pt-act[data-action="star"] .pt-act-icon { background: var(--pt-star-soft); color: var(--pt-star-ink); }
.pt-act[data-action="play"] .pt-act-icon { background: var(--pt-joy-soft); color: var(--pt-joy); }
.pt-act[data-action="bath"] .pt-act-icon { background: var(--pt-clean-soft); color: var(--pt-clean); }
.pt-act[data-action="nap"] .pt-act-icon, .pt-act[data-action="wake"] .pt-act-icon { background: var(--pt-sleep-soft); color: var(--pt-sleep); }
.pt-act-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pt-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--pineapple);
  color: var(--pt-badge-ink);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 2px 6px var(--pt-badge-shadow);
}
.pt-badge[hidden] { display: none; }

/* Landscape iPad (1180×820, 1024×768): the numbers in a column on the left, so the pet keeps its height. */
@media (orientation: landscape) and (min-width: 900px) {
  .pt-room {
    grid-template-columns: var(--pt-meter-column) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top top" "meters scene" "actions actions";
  }
  .pt-meters { align-content: start; }
  .pt-stats { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 1fr; }
  .pt-growth-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
  :root { --pt-act-h: 88px; }
}
/* A phone (a parent looking, or a small screen): smaller, everything still fits. */
@media (max-width: 600px) {
  :root { --pt-act-h: 78px; --pt-chip-h: 44px; --pt-gap: 10px; }
  .pt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pt-act { font-size: 16px; }
  .pt-act-icon { width: 42px; height: 42px; }
  .pt-chip { font-size: 16px; padding: 0 14px; }
  .pt-name { font-size: 20px; }
  /* Three round buttons on the right (商店, 衣柜, the sound switch): 回到主页 is its house only (its name when held,
     its aria-label), the name in the middle takes what is left. */
  .pt-top { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pt-home { justify-content: center; width: var(--pt-chip-h); padding: 0; border-radius: 50%; }
  .pt-home span { display: none; }
  .pt-top-tools { gap: 8px; }
  .pt-title { gap: 6px; padding: 0 10px; }
  .pt-title .pt-stage-tag { padding: 2px 8px; font-size: 13px; }
  .pt-say { font-size: 17px; max-width: 60%; }
}

/* 宠物小屋关着, the room could not be opened, or it waits (night before the ceremony, the gift on its way). Tapped
   or held, its words are read out. */
.pt-off { grid-row: 2 / -1; align-self: center; justify-self: center; display: grid; justify-items: center; gap: 10px; padding: 32px; border: 0; border-radius: var(--r-xl); background: var(--pt-card); box-shadow: var(--pt-shadow); color: var(--pt-ink); font: inherit; text-align: center; font-size: 18px; -webkit-touch-callout: none; touch-action: manipulation; }
.pt-off.is-pressed { transform: scale(0.98); }
.pt-off.is-reading { box-shadow: 0 0 0 4px var(--pt-reading-ring), var(--pt-shadow); }
.pt-scene--wait { grid-area: 2 / 1 / -1 / -1; display: grid; place-items: center; }
.pt-scene--wait .pt-off { grid-row: auto; }
.pt-off strong { font-size: 24px; }
.pt-off-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--peach-soft); color: var(--peach-ink); }
.pt-off-icon svg { width: 40px; height: 40px; }
/* 作业做完才能玩 (§55): what is still to hand in, under the pet's words, and the way to the homework page. */
.pt-scene--wait:has(.pt-hw) { overflow-y: auto; padding: 16px 0; }
.pt-hw { display: grid; justify-items: stretch; gap: 14px; width: min(560px, calc(100% - 32px)); }
.pt-hw .pt-off { justify-self: stretch; padding: 24px; }
.pt-hw-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pt-hw-item { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 18px; border-radius: var(--r-l); background: var(--pt-card); box-shadow: var(--pt-shadow); color: var(--pt-ink); font-size: 22px; font-weight: 700; }
.pt-hw-subject { flex: none; padding: 4px 12px; border-radius: var(--r-pill); background: var(--peach-soft); color: var(--peach-ink); font-size: 18px; }
.pt-hw-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pt-hw-tag { flex: none; padding: 4px 12px; border-radius: var(--r-pill); background: var(--coral-soft); color: var(--coral); font-size: 18px; }
.pt-hw-more { margin: 0; text-align: center; font-size: 18px; color: var(--pt-ink); }
.pt-hw-go { min-height: 64px; font-size: 24px; }
.pt-hw-go svg { width: 28px; height: 28px; }

/* ---------- the child home's 宠物窗台 (views/pets-strip.js) ---------- */
.pts {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) minmax(0, 46%);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  max-height: 120px;
  padding: 8px 16px 8px 10px;
  border-radius: var(--r-xl);
  background: linear-gradient(110deg, var(--pt-white) 0%, var(--pt-strip-mid) 60%, var(--peach-soft) 100%);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.pts-art { position: relative; width: 104px; height: 104px; border-radius: var(--r-l); background: radial-gradient(circle at 50% 80%, var(--pt-strip-art-1), var(--pt-strip-art-2) 72%); }
.pts-pet { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: contain; transform-origin: 50% 92%; animation: pt-breathe 3.4s ease-in-out infinite; }
.pts-pet.is-gift { animation: pts-wiggle 2.8s ease-in-out infinite; }
.pts-pet.is-gift.is-still { animation: none; }
.pts-pet.is-asleep { animation: pt-breathe-deep 4.5s ease-in-out infinite; }
@keyframes pts-wiggle { 0%, 70%, 100% { transform: rotate(0deg); } 76% { transform: rotate(-5deg); } 82% { transform: rotate(5deg); } 88% { transform: rotate(-3deg); } 94% { transform: rotate(2deg); } }
.pts-mood { position: absolute; right: -4px; top: -2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--pt-white); box-shadow: var(--shadow-1); color: var(--pt-grow); }
.pts-mood[hidden] { display: none; }
.pts-mood svg { width: 20px; height: 20px; }
.pts-middle { display: grid; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; -webkit-touch-callout: none; touch-action: manipulation; }
.pts-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pts-name { font-size: 24px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pts-tag { flex: none; padding: 2px 10px; border-radius: var(--r-pill); background: var(--peach-soft); color: var(--peach-ink); font-size: 14px; font-weight: 800; }
.pts-tag:empty { display: none; }
.pts-star { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--pt-star-soft); color: var(--pt-star-chip-ink); font-size: 14px; font-weight: 800; }
.pts-star[hidden] { display: none; }
.pts-star svg { width: 16px; height: 16px; }
/* New star food glows: a ring drawn once (::after), only its opacity and size move (the compositor's work; a moving
   box-shadow is painted again in every frame). Paused while the sill is off the screen or the page hidden. */
.pts-star { position: relative; }
.pts-star.is-new::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 6px var(--pt-star-glow); opacity: 0; pointer-events: none; animation: pts-glow 1.8s ease-in-out infinite; }
@keyframes pts-glow { 0%, 100% { opacity: 0; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1); } }
.pts.is-unseen .pts-star.is-new::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .pts-star.is-new::after { animation: none; opacity: 1; transform: none; } }
.pts-bar { height: 10px; }
/* The gift (by day, waiting for the morning, on its way) has no growth yet: no empty bar. */
.pts:is([data-state="gift"], [data-state="gift-night"], [data-state="coming"], [data-state="homework"]) .pts-bar { visibility: hidden; }
.pts-bar .pt-bar-fill { background: linear-gradient(90deg, var(--pt-grow-light), var(--pt-grow)); }
.pts-line { font-size: 15px; font-weight: 700; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pts-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.pts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 64px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--cta-1), var(--cta-2) 55%, var(--cta-3));
  box-shadow: var(--shadow-cta);
  color: var(--cta-text);
  font: inherit;
  font-size: 19px;
  font-weight: 900;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  transition: transform var(--dur-1) var(--ease-out);
}
.pts-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pts-btn svg { width: 24px; height: 24px; flex: none; }
.pts-btn:active, .pts-btn.is-pressed { transform: scale(0.96); }
.pts-btn.is-reading { box-shadow: 0 0 0 4px var(--pt-reading-ring), var(--shadow-cta); }
.pts-btn[hidden] { display: none; }
.pts-slot { min-height: 64px; }
.pts[data-state="off"] { display: none; }
@media not all and (min-width: 700px) {
  .pts { grid-template-columns: 88px minmax(0, 1fr); max-height: none; }
  .pts-art { width: 88px; height: 88px; }
  .pts-actions { grid-column: 1 / -1; }
  .pts-slot:empty { display: none; }
  .pts-actions:has(> .pts-slot:empty) { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .pt-breath, .pt-stage.is-layered .pt-body, .pt-stage.is-layered .pt-headfloat, .pts-pet, .pts-pet.is-gift, .pts-pet.is-asleep, .pt-mood, .pts-star.is-new { animation: none; }
  .pt-act.is-bounce { animation: none; }
}

/* Rest words stay readable and tappable, including when captions are switched off (§52). */
.pt-quiet { font-size: var(--pet-rest-font); min-height: var(--pet-rest-target); }

/* Room play: return stays outside the scrolling game cards. */
.pt-play-layer { position: absolute; inset: 0; z-index: 8; isolation: isolate; }
.pt-play-layer--menu { background: var(--pt-card); display: grid; place-items: center; overflow: hidden; padding: calc(var(--pt-play-back-h) + var(--gutter) * 2) var(--gutter) var(--gutter); }
.pt-play-back { position: absolute; top: var(--gutter); left: var(--gutter); z-index: 2; min-width: var(--pt-play-target); min-height: var(--pt-play-back-h); }
.pt-play-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; align-items: stretch; gap: var(--gap); width: min(100%, var(--pt-play-menu-w)); max-height: 100%; overflow-y: auto; }
.pt-play-choices .pt-play-choice { min-height: var(--pt-play-menu-min); padding: var(--pt-play-menu-pad); gap: var(--pt-play-menu-pad); }
.pt-play-choice { display: grid; place-items: center; align-content: center; gap: var(--gap); min-width: 0; min-height: var(--pt-play-target); height: 100%; padding: var(--card-pad); border: 0; border-radius: var(--r-l); background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); font: inherit; font-weight: 800; touch-action: manipulation; }
.pt-play-choice.is-pressed, .pt-play-back.is-pressed { transform: scale(.97); }
.pt-touch { position: absolute; inset: 0; z-index: 3; touch-action: none; }
.pt-touch[hidden] { display: none; }
.pt-touch-part { position: absolute; min-height: var(--pt-play-touch-min); min-width: var(--pt-play-touch-min); border: 0; padding: 0; border-radius: 50%; background: var(--pt-play-clear); touch-action: none; -webkit-touch-callout: none; }
.pt-room.is-playing .pt-say { z-index: 9; pointer-events: none; }
.pt-room.is-playing .pt-acts { pointer-events: none; }

@media (min-width: 700px) {
  .pt-play-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .pt-play-choice.is-pressed, .pt-play-back.is-pressed { transform: none; }
}

/* Invisible hit areas never paint a pressed, held or pointer-focus shape. */
:is(.pt-touch-part, .pts-life .pt-stage, .ptc-btn, .pts-middle, .pt-basket),
:is(.pt-touch-part, .pts-life .pt-stage, .ptc-btn, .pts-middle, .pt-basket):is(:active, :focus, :focus-visible, .is-pressed, .is-reading) {
  appearance: none;
  -webkit-appearance: none;
  background: var(--pt-play-clear);
  border: 0;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
/* Decorated certificate/English cards retain their art, with no pointer-focus ring. */
:root[data-input-mode=pointer] :is(.ptc-frame, .en-board, .ptk-entry-btn):focus {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
:root:not([data-input-mode=pointer]) :is(.pt-touch-part, .pts-life .pt-stage, .ptc-btn, .pts-middle, .pt-basket, .ptc-frame, .en-board, .ptk-entry-btn):focus-visible {
  outline: var(--pt-play-border) solid var(--focus);
  outline-offset: var(--pt-play-border);
}
