/* Hallmark · MiniPet · v2.0.0 · shape: app screen · genre: playful
 Sunlit picture-book cottage. Cream paper, orange tokens, forest-jade actions.
 A big room, a large pet and one obvious path into the lesson.
*/
:root {
  color-scheme: light;
  --ink: #33251c;
  --muted: #71583e;
  --paper: #fff5e1;
  --paper-light: #fffcf4;
  --card: #fff9ed;
  --line: #e7d2ad;
  --jade: #265e46;
  --jade-shadow: #194433;
  --jade-light: #e1edcf;
  --orange: #e78938;
  --peach: #f5ddbe;
  --rose: #cb705f;
  --shadow: 0 4px 0 #e5c89f;
  --font: 'Nunito', ui-rounded, system-ui, -apple-system, sans-serif;
  --coin-paper: #ffebbc;
  --coin-edge: #ecc27a;
  --button-shadow: #dec29a;
  --button-hover: #fbead0;
  --menu-shadow: #58381730;
  --meter-track: #ebdcc3;
  --mood-fill: #508051;
  --home-trim: #d69e64;
  --home-wall: #ead0a3;
  --bath-trim: #90aa85;
  --bath-wall: #bad2aa;
  --room-label-shadow: #6b3a1b33;
  --care-edge: #e8cda4;
  --care-paper: #fff8e9ef;
  --care-shadow: #805a3155;
  --care-hover: #f7e2c3;
  --action-ink: #fffaf0;
  --action-hover: #2e7053;
  --dock-active-edge: #cae0b6;
  --chip-active-edge: #a8bf8d;
  --adopt-paper: #f5deba;
  --adopt-edge: #e6c595;
  --study-paper: #f6ddac;
  --study-edge: #e8c28e;
  --study-track: #ead7b4;
  --answer-paper: #fff7e6;
  --answer-hover: #f7e8cc;
  --answer-active-edge: #90af77;
  --translation-ink: #634e3a;
  --result-paper: #f5ddb4;
  --shop-hover: #fff0d6;
  --shop-active-edge: #63926a;
  --pet-preview-paper: #f4ddba;
  --outer-paper: #f1deb9;
  --outer-shadow: #251d1829;
}
* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { min-width: 280px; background: var(--paper); }
body { margin: 0; color: var(--ink); font: 600 16px/1.45 var(--font); }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { opacity: .54; cursor: not-allowed; }
button:focus-visible { outline: 3px solid var(--jade); outline-offset: 3px; }
button:not(:disabled):active { transform: translateY(2px); }
button, .merch { transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease; }
img { display: block; max-width: 100%; }
h1,h2,p { margin: 0; }
h1, h2 { text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 6vw, 2.2rem); line-height: 1.12; letter-spacing: -.035em; font-weight: 900; }
h2 { font-size: 1.2rem; line-height: 1.25; font-weight: 850; }
.app-shell {
  width: min(100%, 492px);
  min-height: 100svh;
  margin-inline: auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.app-shell main { padding: 0 clamp(12px, 3.8vw, 20px) 16px; flex: 1; }
.icon { width: 21px; height: 21px; object-fit: contain; flex: none; }
.topbar {
  position: relative; z-index: 4; min-height: 69px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) clamp(12px, 3.8vw, 20px) 8px;
}
.brand {
  display: inline-flex; gap: 8px; align-items: center; padding: 0; text-align: left;
  background: transparent; border: 0; color: var(--jade);
  font-size: 17px; line-height: .98; font-weight: 950; letter-spacing: -.055em;
}
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--jade); box-shadow: 0 3px 0 var(--jade-shadow); }
.brand-mark img { width: 23px; height: 23px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.wallet {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 63px;
  min-height: 40px; padding-inline: 12px; background: var(--coin-paper); border: 1px solid var(--coin-edge);
  border-radius: 99px; font-variant-numeric: tabular-nums;
}
.icon-button {
  min-width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--line);
  border-radius: 15px; display: grid; place-items: center; background: var(--paper-light);
  color: var(--ink); font-size: 32px; line-height: 1; box-shadow: 0 2px 0 var(--button-shadow);
}
.icon-button:hover, .chip:hover, .secondary:hover { background: var(--button-hover); }
.menu-button .room-icon { width: 23px; height: 23px; }
.game-menu {
  position: absolute; right: 14px; top: calc(100% - 4px);
  padding: 4px; display: grid; gap: 2px; min-width: 174px;
  background: var(--paper-light); box-shadow: 0 6px 18px var(--menu-shadow); border-radius: 14px;
}
.game-menu button { text-align: left; background: transparent; border: 0; padding: 8px 12px; border-radius: 9px; min-height: 44px; }
.game-menu button:hover { background: var(--peach); }
.quick-guide {
  width: min(calc(100% - 24px), 434px); max-width: none;
  max-height: calc(100svh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding: 0; overflow: hidden; color: var(--ink); background: var(--paper-light);
  border: 1px solid var(--line); border-radius: 23px;
  box-shadow: 0 12px 42px var(--menu-shadow), 0 4px 0 var(--button-shadow);
}
.quick-guide[open] { display: flex; flex-direction: column; }
.quick-guide::backdrop { background: #33251c80; }
body:has(.quick-guide[open]) { overflow: hidden; }
.guide-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px 10px;
}
.guide-head p { color: var(--muted); font-size: .76rem; font-weight: 850; }
.guide-head h2 { margin-top: 2px; color: var(--jade); font-size: 1.4rem; line-height: 1.12; }
.guide-head h2:focus { outline: none; }
.guide-close { font-size: 25px; }
.guide-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 12px 6px; }
.guide-scene {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, .66fr) minmax(0, 1.34fr);
  align-items: center; gap: 4px; min-height: 158px; padding: 8px;
  background: var(--home-wall) center 48% / cover;
  border: 1px solid var(--home-trim); border-radius: 16px;
}
.guide-pet {
  position: absolute; left: 2%; bottom: 10%; width: 31%; height: 76%;
  object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 4px 4px var(--menu-shadow));
}
.guide-callouts { grid-column: 2; display: grid; gap: 6px; }
.guide-bubble {
  position: relative; border: 1px solid var(--line); border-radius: 11px;
  padding: 5px 8px; background: var(--paper-light); box-shadow: 0 2px 0 var(--menu-shadow);
}
.guide-bubble::before {
  content: ''; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px;
  rotate: 45deg; border: solid var(--line); border-width: 0 0 1px 1px; background: var(--paper-light);
}
.guide-bubble p { font-size: .76rem; line-height: 1.23; margin-top: 3px; }
.guide-study, .guide-coin {
  width: fit-content; display: flex; align-items: center; gap: 4px;
  font-size: .76rem; line-height: 1.2; padding: 3px 6px; border-radius: 8px;
}
.guide-study { color: var(--action-ink); background: var(--jade); }
.guide-coin { color: var(--ink); background: var(--coin-paper); }
.guide-study .icon, .guide-coin .icon { width: 15px; height: 15px; }
.guide-stat { display: flex; align-items: center; gap: 5px; font-size: .79rem; }
.guide-stat .stat-icon { width: 20px; height: 20px; }
.guide-tips { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.guide-tips li {
  display: flex; align-items: center; gap: 8px; padding: 5px 7px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--card);
  font-size: .82rem; line-height: 1.22;
}
.guide-tip-art {
  display: grid; place-items: center; flex: 0 0 34px; height: 34px;
  border-radius: 9px; background: var(--paper);
}
.guide-tip-art img { width: 29px; height: 29px; }
.guide-tip-art .icon { width: 20px; height: 20px; }
.guide-tips strong { color: var(--jade); font-weight: 900; }
.guide-tips p { margin-top: 1px; }
.guide-controls { display: flex; gap: 8px; padding: 6px 12px 14px; }
.guide-controls button { min-height: 44px; font-size: .9rem; }
@media (max-height: 640px) {
  .guide-head { padding-block: 9px 8px; }
  .guide-scene { min-height: 143px; padding-block: 6px; }
  .guide-tips { gap: 4px; margin-top: 6px; }
  .guide-tips li { padding-block: 4px; }
  .guide-controls { padding-bottom: 10px; }
}
.pet-profile { display: grid; grid-template-columns: minmax(108px, .82fr) minmax(0, 1.18fr); align-items: center; gap: 12px; padding: 8px 0 12px; }
.profile-name {
  min-width: 0; width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 17px;
  padding: 4px 8px 4px 2px; display: flex; align-items: center; gap: 4px; text-align: left;
}
.profile-name img { width: 42px; height: 42px; object-fit: contain; }
.profile-name span { min-width: 0; flex: 1; }
.profile-name strong { display: block; font-size: clamp(.85rem, 4vw, 1.05rem); font-weight: 900; overflow-wrap: anywhere; line-height: 1.13; }
.profile-name small { display: block; font-size: .73rem; color: var(--muted); }
.profile-name i { font: normal 20px/1 var(--font); color: var(--jade); }
.room {
  position: relative; isolation: isolate; width: 100%; height: clamp(328px, calc(100svh - 285px), 488px);
  overflow: hidden; border: 2px solid var(--home-trim); border-radius: 25px; background: var(--home-wall); box-shadow: var(--shadow);
  touch-action: pan-y;
}
.room-bath { border-color: var(--bath-trim); background: var(--bath-wall); }
.stage, .stage-fallback, .stage canvas, .background-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage canvas { opacity: 0; pointer-events: none; }
.stage canvas.painted { opacity: 1; }
.stage-fallback { pointer-events: none; }
.background-art { object-fit: cover; }
.pet-art {
  position: absolute; width: min(56%, 255px); height: 54%; object-fit: contain; object-position: 50% 100%;
  left: 50%; bottom: 24%; translate: -50% 0; transform-origin: center bottom;
}
.pet-art.sleeping { transform: scaleY(.75) rotate(7deg); }
.pet-bounce { animation: bounce 760ms ease-in-out 1; }
@keyframes bounce {
  30% { transform: scale(1.045,.94) translateY(1px); }
  57% { transform: scale(.965,1.035) translateY(-6%); }
}
.pet-touch {
  position: absolute; z-index: 1; left: 28%; right: 28%; bottom: 24%; top: 37%;
  border: 0; background: transparent; border-radius: 38%;
}
.room-actions {
  position: absolute; z-index: 2; bottom: 10px; left: 50%; translate: -50% 0;
  display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 8px;
  width: max-content; max-width: calc(100% - 12px);
  padding: 4px; border: 1px solid var(--care-edge); border-radius: 17px; background: var(--care-paper);
  box-shadow: 0 3px 0 var(--care-shadow);
}
.room-actions button {
  display: grid; gap: 0; justify-items: center; align-content: center;
  width: 65px; max-width: 100%; grid-template-columns: minmax(0, 1fr);
  border: 0; min-height: 51px; border-radius: 10px; padding: 1px 1px 4px;
  background: transparent; font-size: .74rem; font-weight: 900;
  line-height: 1.2; text-align: center;
}
.room-home .room-actions button { width: 74px; }
.room-actions button:hover { background: var(--care-hover); }
.room-actions .item-art { width: 38px; height: 30px; }
.item-art { object-fit: contain; }
.primary,.secondary {
  min-height: 52px; border: 1px solid transparent; border-radius: 15px;
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; font-weight: 900; font-size: 1.01rem;
}
.primary { color: var(--action-ink); background: var(--jade); box-shadow: 0 4px 0 var(--jade-shadow); }
.primary:hover:not(:disabled) { background: var(--action-hover); }
.primary:disabled { box-shadow: none; }
.secondary { color: var(--jade); background: var(--card); border-color: var(--line); }
.feed-status { margin: 0; color: var(--muted); }
.feed-status strong { margin-left: .4rem; color: var(--ink); }
.food-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin: .75rem 0 .1rem; }
.food-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
.food-card {
  display: grid; gap: .25rem; min-width: 0; align-content: start;
  width: 100%; padding: .55rem .6rem; text-align: left; border-radius: 15px;
  background: var(--card); border: 1px solid var(--line); line-height: 1.25;
}
.food-card:disabled { opacity: .7; cursor: default; }
.food-card .item-art { width: 66px; height: 59px; justify-self: center; object-fit: contain; }
.food-card b, .food-card .liked { color: var(--jade-shadow); }
.food-card small { display: block; font-size: .72rem; }
.food-card .disliked { color: #8c4226; }
.food-values { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: .75rem; }
.food-free { grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: .55rem; }
.food-free .item-art { width: 42px; height: 45px; }
.food-free small { color: var(--muted); margin-top: .2rem; }
.dock {
  position: sticky; z-index: 3; bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 4px; background: var(--paper-light); border-top: 1px solid var(--line);
  padding: 4px 8px max(4px, env(safe-area-inset-bottom));
}
.dock button {
  min-height: 51px; display: grid; gap: 1px; justify-items: center; align-content: center;
  background: transparent; border: 1px solid transparent; padding: 4px; border-radius: 13px;
  color: var(--muted); font-weight: 820; font-size: .75rem;
}
.dock button[aria-current], .dock button:hover { color: var(--jade-shadow); background: var(--jade-light); border-color: var(--dock-active-edge); }
.dock .icon { width: 20px; height: 20px; }
.panel { display: grid; gap: 16px; padding: 4px 0 12px; }
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 46px; }
.panel-head .back { flex: none; }
.species,.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  min-height: 44px; padding-inline: 12px; font-weight: 820; font-size: .83rem;
}
.chip[aria-pressed="true"] { background: var(--jade-light); color: var(--jade-shadow); border-color: var(--chip-active-edge); }
.adopt-stage {
  min-height: 220px; height: clamp(220px,43svh,358px); padding: 16px 8px;
  display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 2px;
  background: var(--adopt-paper); border: 1px solid var(--adopt-edge); border-radius: 22px;
  touch-action: pan-y;
}
.adopt-stage img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.adopt-name { display:flex; justify-content: space-between; align-items:center; }
.adopt-name span { color: var(--muted); font-size: .82rem; }
.signature {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; min-height: 55px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.signature .item-art { width: 48px; height: 40px; }
.study-hero {
  display: grid; grid-template-columns: 35% 1fr; align-items: center; gap: 8px;
  padding: 16px 12px 16px; border-radius: 22px;
  background: var(--study-paper); border: 1px solid var(--study-edge);
}
.study-hero img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.study-hero p { font-size: 1rem; font-weight: 900; margin-bottom: 8px; }
.resume,.subject {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 13px; min-height: 51px;
  padding: 4px 8px; width: 100%; background: var(--card); text-align: left;
}
.resume { color: var(--jade); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.subject-list { display: grid; gap: 8px; }
.subject-row { display: flex; align-items: stretch; gap: 8px; }
.subject-row .chip { flex: none; }
.subject { justify-content: flex-start; font-weight: 880; }
.ics-semester-subject { text-align: left; }
.ics-semester-subject small { display: block; color: var(--muted); font-weight: 650; }
.subject-icon { flex: none; width: 42px; height: 42px; object-fit: contain; }
.subject-icon[src$="subject-ics-weekly.webp"] {
  padding: 2px; border-radius: 10px; background: #fff;
}
.progress-head { display: flex; justify-content: space-between; gap: 4px; font-size: .88rem; color: var(--muted); }
.progress-head > span:last-child { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.progress-head .icon { width: 17px; height: 17px; }
.question-progress { display: flex; gap: 4px; margin-top: -12px; }
.question-progress span { background: var(--study-track); border-radius: 6px; height: 7px; flex: 1; }
.question-progress .filled { background: var(--jade); }
.question-paper { background: var(--paper-light); border: 1px solid var(--line); padding: 12px; border-radius: 16px; display: grid; gap: 12px; }
.prompt { font-size: clamp(1.03rem,4.8vw,1.3rem); line-height: 1.36; }
.prompt span, .answer span span, .help span { display: block; overflow-wrap: anywhere; }
.prompt span + span { margin-top: 4px; font-weight: 700; font-size: .89em; }
.answer-list, .match > div { display: grid; gap: 8px; }
.answer {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; min-height: 48px;
  padding: 8px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--answer-paper);
  font-size: .87rem; line-height: 1.25; overflow-wrap: anywhere;
}
.answer:hover { background: var(--answer-hover); }
.answer[aria-pressed=true] { background: var(--jade-light); color: var(--jade-shadow); border-color: var(--answer-active-edge); }
.answer b { display: grid; place-items: center; width: 23px; height: 25px; flex: none; border-radius: 7px; background: var(--peach); }
.answer span span + span { margin-top: 2px; font-size: .94em; color: var(--translation-ink); }
.tile-list,.match { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.tile-list .answer { justify-content: center; font-size: 1.18rem; font-weight: 900; }
.match .answer { padding: 8px; width: 100%; }
.question-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.help {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--jade-light);
  border-radius: 13px; color: var(--jade-shadow); font-size: .86rem;
}
.help img { width: 43px; height: 43px; }
.question-feedback:empty { display: none; }
.help-copy { min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
.help-copy > * + * { margin-top: 8px; }
.hint-step strong { display: block; }
.result-deduction { font-size: .86rem; color: var(--muted); }
.result-art { display: grid; place-items: center; min-height: 195px; background: var(--result-paper); border-radius: 20px; border: 1px solid var(--line); }
.result-art img { width: min(72%,230px); }
.earned { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: 1.8rem; font-weight: 900; color: var(--jade); }
.result-message { text-align: center; font-weight: 850; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 8px; }
.merch {
  display: grid; justify-items: center; align-content: center; text-align: center; gap: 4px;
  min-height: 138px; padding: 8px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.merch:hover { background: var(--shop-hover); }
.merch[aria-pressed=true] { border: 2px solid var(--shop-active-edge); background: var(--jade-light); }
.merch .item-art { width: min(100%,106px); height: 85px; }
.merch strong { font-size: .93rem; }
.merch span,.notice { color: var(--muted); font-size: .86rem; }
.shop-selection { display: grid; gap: 12px; }
.shop-tabs { gap: 8px; }
.shop-tabs .chip { min-height: 44px; }
.accessory-shop .merch:disabled {
  background: var(--paper-light);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 1;
}
.pet-preview {
  display: grid; place-items: center; min-height: 155px; position: relative;
  background: var(--pet-preview-paper); border-radius: 18px; border: 1px solid var(--line);
}
.report-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.report-grid div { display: grid; padding: 12px; background: var(--jade-light); border-radius: 15px; }
.report-grid strong { font-size: 1.75rem; color: var(--jade); font-weight: 900; }
.report-grid span { font-size: .84rem; }
.report-xp { padding: 0 12px; border: 1px solid var(--line); background: var(--paper-light); border-radius: 14px; }
.report-xp div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; }
.report-xp div + div { border-top: 1px solid var(--line); }
@media (min-width: 650px) {
  html { background: var(--outer-paper); }
  .app-shell { box-shadow: 0 9px 44px var(--outer-shadow); }
}
@media (max-width: 359px) {
  .app-shell main { padding-inline: 8px; }
  .species .chip,.question-tools .chip { padding-inline: 8px; }
  .pet-profile { gap: 8px; }
  .answer { font-size: .81rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}


.icon-button.back::after, .chevron-left::after { content: '‹'; }
.chevron-right::after { content: '›'; }

.stage canvas.room-backdrop { opacity: 1; }
.pet-actor, .pet-actor canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pet-actor canvas[data-painted="true"] { opacity: 1; }
.pet-actor canvas[data-painted="true"] + .pet-art { visibility: hidden; }
.preview-actor .pet-art { inset: auto 0 3%; margin: auto; width: min(80%, 210px); max-height: 94%; object-fit: contain; }
.pet-preview:has(.preview-actor) { position: relative; min-height: 205px; }
.activity-list { display: grid; gap: 10px; margin-top: 12px; }
.activity-card { display:grid; grid-template-columns: 64px 1fr; align-items:center; gap:12px; text-align:left; min-height:76px; }
.activity-card > span { display:grid; gap:3px; }
.activity-card .item-art { width:58px; height:58px; }
.activity-choice { margin-top:12px; }
.option-grid { display:flex; gap:8px; flex-wrap:wrap; padding:8px 0; }
.option-grid > button { display:grid; place-items:center; min-width:66px; min-height:50px; }
.option-grid .item-art { width:44px; height:44px; }
.pet-toggle { min-height:44px; text-align:left; }
.study-pet { width: 112px; flex: 0 0 112px; }
.study-hero .study-pet .pet-preview { min-height: 112px; border: 0; background: none; overflow: visible; }
.activity-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; }
.activity-row > .activity-card { grid-column:1 / -1; width:100%; min-height:76px; justify-items:start; justify-content:start; }
.activity-row:has(.activity-more) > .activity-card { grid-column:1; }
.activity-row > .option-grid,.activity-row > .notice { grid-column:1 / -1; }
.activity-more { min-height:44px; padding-inline:10px; }

.pet-touch.husky-touch { inset: 29% 16% 17%; border-radius: 28%; }
.pet-touch-keys { position:absolute; z-index:4; top:109px; left:10px; display:flex; flex-wrap:wrap; gap:8px; max-width:calc(100% - 64px); }
.pet-touch-keys:not(:focus-within) { width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.pet-touch-keys button { min-height:44px; }
.wardrobe-cards { margin-top:14px; }
.question-pet { width:64px; flex:0 0 64px; }
.question-pet .pet-preview { min-height:64px; border:0; background:none; }

.family-form, .family-list {
  display: grid;
  gap: .8rem;
}
.family-form label {
  display: grid;
  gap: .3rem;
  font-weight: 750;
  color: var(--ink);
  font-size: .93rem;
}
.family-form input, .family-form select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .5rem .65rem;
  color: var(--ink);
  background: var(--paper-light);
  font: inherit;
  font-size: 1rem;
}
.family-form input:focus-visible, .family-form select:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}
.family-fields {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: .7rem;
}
.family-hint, .family-row small {
  color: var(--muted);
  line-height: 1.45;
}
.family-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-light);
  display: grid;
  gap: .4rem;
  padding: .8rem;
  min-width: 0;
}
.family-row strong, .gift-reveal strong { overflow-wrap: anywhere; }
.family-row small { display: block; }
.family-row progress { width: 100%; accent-color: var(--jade); }
.family-row-head, .family-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
}
.family-tabs, .wardrobe-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.gift-row {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  align-items: center;
}
.gift-row img, .gift-entry .item-art { width: 42px; height: 42px; object-fit: contain; }
.gift-reveal {
  border-radius: 16px;
  background: var(--jade-light);
  color: var(--jade-shadow);
  display: grid;
  place-items: center;
  gap: .3rem;
  text-align: center;
  padding: 1rem;
}
.gift-reveal img { width: 88px; height: 88px; object-fit: contain; }
.gift-entry { display: flex; align-items: center; justify-content: center; gap: .5rem; }

.app-welcome > main {
  display: grid;
  align-content: center;
  padding-block: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom));
}
.welcome-card {
  display: grid;
  gap: .8rem;
  align-content: start;
  justify-items: stretch;
  padding: clamp(1.1rem, 4vw, 2rem);
  max-width: 26rem;
  margin: 1.5rem auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-light);
  text-align: center;
}
.welcome-card h1, .welcome-card p { margin: 0; }
.welcome-card p { color: var(--muted); font-size: .95rem; }
.app-welcome .welcome-card { width: 100%; margin: 0 auto; }
.welcome-pet { width: clamp(132px, 44vw, 176px); height: auto; margin: 0 auto; }
.welcome-guest { min-height: 44px; background: transparent; border: 0; border-radius: 12px; color: var(--jade); text-decoration: underline; text-underline-offset: 4px; }

.study-parts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.study-parts .secondary { min-height: 52px; }
.study-topic { flex: 1; min-width: 0; justify-content: space-between; padding-inline: 12px; }
.study-topic small { white-space: nowrap; color: var(--muted); font-weight: 650; }
.study-topic:disabled { opacity: .72; }
.study-context { color: var(--muted); font-size: .88rem; }

.study-reading { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding-inline: 12px; }
.study-reading summary { cursor: pointer; padding-block: 12px; font-weight: 760; }
.study-reading p { margin-bottom: 12px; line-height: 1.5; }

.care-hud {
  position: absolute;
  z-index: 3;
  top: 7px;
  left: 7px;
  display: grid;
  grid-template-columns: repeat(4, 44px);
  gap: 3px;
  pointer-events: none;
}
.care-indicator {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
}
.care-indicator::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  border: 1px solid var(--line);
  background: var(--paper-light);
  box-shadow: 0 2px 5px var(--room-label-shadow);
}
.care-indicator:hover::before { background: var(--button-hover); }
.stat-icon {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
}
.stat-icon img { grid-area: 1 / 1; max-width: 100%; max-height: 100%; }
.stat-empty { filter: grayscale(1) sepia(.22); opacity: .45; }
.stat-color { clip-path: inset(var(--stat-empty) 0 0); }
.care-alert {
  position: absolute;
  right: 0;
  top: 0;
  padding-inline: 4px;
  background: #a43c27;
  color: var(--action-ink);
  border: 1px solid var(--paper-light);
  border-radius: 8px;
  font-size: .64rem;
  line-height: 1.2;
}
.care-fill { width: 100%; height: 7px; display: block; appearance: none; border: 0; border-radius: 8px; background: var(--meter-track); }
.care-fill::-webkit-meter-bar { height: 7px; border: 0; border-radius: 8px; background: var(--meter-track); }
.care-fill::-webkit-meter-optimum-value { background: var(--care-fill, #508051); border-radius: 8px; }
.care-fill::-moz-meter-bar { background: var(--care-fill, #508051); border-radius: 8px; }
.care-bond { --care-fill: #ff96a5; }
.care-mood { --care-fill: #ffdc68; }
.care-hunger { --care-fill: #ffae62; }
.care-hygiene { --care-fill: #8bdfff; }
.care-bathroom { --care-fill: #c7a5fa; }
.care-energy { --care-fill: #b5df72; }
.care-fun { --care-fill: #70d9cd; }
.care-dialog {
  inset: auto 0 0; width: min(100%, 492px); max-width: 100%; margin: auto auto 0;
  border: 1px solid var(--line); border-radius: 24px 24px 0 0; background: var(--paper-light); color: var(--ink); padding: 0;
}
.care-dialog::backdrop { background: #38221775; }
.care-sheet { display: grid; gap: 12px; padding: 14px 16px max(16px, env(safe-area-inset-bottom)); }
.care-sheet-head { display: flex; gap: 10px; align-items: center; }
.care-sheet-head h2 { flex: 1; }
.care-sheet-head .stat-icon { width: 38px; height: 38px; }

.app-room {
  height: 100dvh;
  min-height: 0;
  padding-top: env(safe-area-inset-top);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.app-room main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 0;
  padding: 6px 8px 6px;
}
.room-panel {
  --trim: var(--home-trim);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--card);
  border: 2px solid var(--trim);
  border-radius: 21px;
  box-shadow: var(--shadow);
}
.room-panel-bath { --trim: var(--bath-trim); }
.room-hud { position: relative; z-index: 1; padding: 4px 7px; }
.room-hud .pet-profile {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
}
.room-hud .profile-name { width: auto; min-height: 44px; padding-block: 0; border-color: transparent; background: transparent; }
.room-hud .profile-name img { width: 40px; height: 40px; flex: none; }
.room-hud .profile-name strong, .room-hud .profile-name small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.room-hud .top-actions { flex: none; }
.room-hud .wallet { min-height: 36px; gap: 5px; padding-inline: 8px; }
.room-hud .game-menu {
  top: 49px;
  right: 7px;
  z-index: 5;
  width: max-content;
  max-width: calc(100% - 14px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 66px);
  overflow: auto;
  overscroll-behavior: contain;
}
.room-hud .game-menu button { overflow-wrap: anywhere; }
.app-room .room {
  height: 100%;
  border: 0;
  border-top: 1px solid var(--trim);
  border-radius: 0 0 19px 19px;
  box-shadow: none;
}
.room-tools {
  position: absolute;
  inset: 7px 7px auto auto;
  z-index: 3;
  display: grid;
  gap: 8px;
}
.room-tools button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--jade-shadow);
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 5px var(--room-label-shadow);
}
.room-tools .room-icon { width: 32px; height: 32px; }
.room-save .room-icon { width: 27px; height: 27px; }
.room-tools .room-switch { background: var(--jade-light); }
.room-tools button:hover { background: var(--button-hover); }
.room-invite-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #a43c27; }
.room-gift { position: relative; }
.room-gift img { width: 28px; height: 28px; }
.room-gift b {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  padding: 2px;
  border-radius: 9px;
  background: var(--jade);
  color: var(--action-ink);
  font-size: .63rem;
}
.app-room .room-actions { bottom: 7px; gap: 5px; max-width: calc(100% - 12px); }
.app-room .room-actions button { min-height: 44px; }
.app-room .room-actions .item-art { height: 25px; }
.room-feedback.notice {
  position: absolute;
  z-index: 4;
  inset: auto 7px 65px;
  width: fit-content;
  max-width: calc(100% - 14px);
  margin: 0 auto;
  padding: 5px 9px;
  font-size: .8rem;
  pointer-events: none;
}
.room-study { display: flex; gap: 8px; }
.room-study button { min-width: 0; min-height: 46px; padding-block: 4px; }
.room-study .room-skill { width: auto; flex: none; font-size: .79rem; white-space: nowrap; }
.room-study .primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-room .dock { position: static; padding-top: 2px; }
.app-room .dock button { min-height: 44px; padding-block: 1px; }

@media (max-width: 340px) {
  .room-hud .top-actions { gap: 5px; }
}
@media (max-height: 600px) {
  .app-room main { gap: 6px; padding-block: 4px 5px; }
  .room-hud { padding-block: 3px; }
}
.social-panel { gap: 12px; }
.social-tabs { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); }
.social-tabs button { padding-inline: 5px; min-height: 44px; white-space: nowrap; }
.friend-code, .friend-row {
  display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.friend-code { flex-wrap: wrap; }
.friend-code > div { flex: 1; }
.friend-code small, .friend-code strong { display: block; }
.friend-code strong { letter-spacing: .09em; user-select: all; }
.friend-row button,.friend-code button { flex: none; width: auto; min-height: 44px; padding: 5px 10px; }
.friend-row .icon-button { min-width: 44px; }
.friend-avatar { width: 42px; height: 42px; object-fit: contain; }
.friend-text { display: grid; overflow-wrap: anywhere; min-width: 0; flex: 1; }
.friend-text small, .friend-code small { color: var(--muted); }
.friend-list, .season-panel, .season-packs, .season-rewards { display: grid; gap: 8px; }
.friend-star { color: #8d501a; font-size: 1.25rem; }
.friend-room {
  position: relative; min-height: 218px; overflow: hidden; border: 2px solid var(--home-trim);
  border-radius: 20px; background: var(--home-wall);
}
.friend-greet { position: absolute; width: auto; bottom: 8px; left: 8px; }
.friend-limit { color: var(--jade); font-weight: 850; }
.cabinet-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.cabinet-slot {
  min-width: 0; padding: 6px; min-height: 92px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); display: grid; align-content: center; gap: 4px; text-align: center;
}
.cabinet-slot strong { overflow-wrap: anywhere; font-size: .82rem; }
.cabinet-slot button { padding: 4px; min-height: 44px; }
.cabinet-choices { display: grid; gap: 6px; max-height: 38svh; overflow: auto; }
.cabinet-choices-pictures { grid-template-columns: repeat(3,minmax(0,1fr)); }
.cabinet-choices-pictures > p { grid-column: 1 / -1; }
.cabinet-choices-pictures button { min-width: 0; min-height: 60px; padding: 6px; }
.friend-showcase { list-style: none; margin: 0; padding: 0; }
.friend-showcase .card-picture img { width: min(100%, 68px); height: 68px; }
.cabinet-history { display: grid; gap: 4px; }
.season-title {
  display: flex; align-items: center; gap: 10px; border: 1px solid #b4c29b; border-radius: 16px;
  background: var(--jade-light); color: var(--jade-shadow); padding: 10px 12px;
}
.season-title > span { font-size: 2rem; }
.season-title > div { flex: 1; }
.season-title p { font-size: .82rem; }
.season-rounds { display: grid; gap: 7px; }
.season-rounds div { display: flex; gap: 6px; flex-wrap: wrap; }
.season-rounds .chip[data-earned="true"] { background: var(--jade-light); color: var(--jade-shadow); }
.season-packs h3, .cabinet-history h3 { margin: 4px 0; font-size: .95rem; }
.season-cards { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }
.card-picture { font-size: 1.62rem; line-height: 1; display: inline-grid; place-items: center; min-height: 36px; }
.card-picture img { width: 42px; height: 42px; object-fit: contain; }
.season-card {
  min-width: 0; min-height: 85px; display: grid; place-items: center; align-content: center; gap: 3px;
  padding: 5px 1px; border: 1px solid #d8af67; border-radius: 12px; background: var(--paper-light); line-height: 1.1;
}
.season-card:disabled { opacity: 1; cursor: default; }
.season-card[data-empty="true"] { background: #f5e9d5; border: 1px dashed #b79b73; }
.season-card[data-empty="true"] .card-picture { opacity: .4; filter: grayscale(1); }
.season-card strong { font-size: .7rem; }
.season-card small { font-size: .65rem; color: var(--muted); }
.season-rewards .friend-row[data-owned="false"] .card-picture {
  filter: grayscale(1) sepia(1) saturate(5) hue-rotate(205deg);
  opacity: .85;
}
.reward-puzzle {
  position: relative;
  display: grid;
  grid-template-rows: repeat(var(--puzzle-rows), minmax(0, 1fr));
  width: min(100%, 268px);
  aspect-ratio: 1;
  margin-inline: auto;
  border: 4px solid var(--card);
  border-radius: 18px;
  outline: 1px solid var(--line);
  overflow: hidden;
}
.reward-puzzle[data-complete="false"] {
  background: linear-gradient(140deg, #55e3e4, #a399ff 55%, #ff9de4);
}
.reward-puzzle[data-complete="false"]::before {
  position: absolute;
  inset: 0;
  content: '';
  background: var(--puzzle-art) center / 100% 100% no-repeat;
  filter: brightness(0) blur(5px);
  opacity: .23;
}
.reward-puzzle-row {
  display: grid;
  grid-template-columns: repeat(var(--puzzle-columns), minmax(0, 1fr));
}
.reward-puzzle-piece {
  position: relative;
  background: var(--card);
}
.reward-puzzle-piece[data-earned="true"]::before {
  position: absolute;
  inset: 0;
  content: '';
  background-image: var(--puzzle-art);
  background-repeat: no-repeat;
  background-size: calc(100% * var(--puzzle-columns)) calc(100% * var(--puzzle-rows));
  background-position: var(--puzzle-x) var(--puzzle-y);
}
.reward-puzzle-piece[data-earned="false"] {
  background: transparent;
}
.reward-puzzle[data-complete="false"] .reward-puzzle-piece::after {
  position: absolute;
  inset: 0;
  content: '';
  box-shadow: inset 0 0 0 1px var(--line);
}
.reward-puzzle-piece > span {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 5px;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  background: var(--jade);
  color: var(--action-ink);
  font-size: .7rem;
}
.reward-puzzle-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--jade-shadow);
}
.reward-puzzle-progress span {
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--jade-light);
  font-size: .78rem;
  font-weight: 800;
}
.season-reveal { display: grid; justify-items: center; gap: 8px; padding: 10px; animation: card-reveal 250ms ease-out both; }
.season-reveal .card-picture { font-size: 3rem; }
.season-reveal .card-picture img { width: 112px; height: 112px; }
@keyframes card-reveal { from { opacity: 0; transform: perspective(260px) rotateY(-62deg) translateY(6px); } }
.season-pack { display: flex; align-items: center; justify-content: center; gap: 8px; }
.season-pack img { width: 35px; height: 35px; object-fit: contain; }
.friend-cabinet-prop {
  position: absolute; bottom: 17%; right: 4%; width: 18%; min-width: 44px; min-height: 44px;
  border: 0; padding: 0; background: transparent;
}
.friend-cabinet-prop img { display: block; width: 100%; height: auto; filter: drop-shadow(0 3px 2px var(--room-item-shadow)); }

.cabinet-grid:has(> :nth-child(4)) { grid-template-columns: repeat(2,minmax(0,1fr)); }

.season-pack-rip { position: absolute; width: 56px; height: 56px; left: 8px; bottom: 5px; object-fit: contain; }
.season-reveal { position: relative; }
.season-reveal[data-pack] .card-picture { animation: season-card-open 315ms ease-out both; }
@keyframes season-card-open {
  0% { transform: rotateY(85deg) translateY(16px); opacity: .3; }
  100% { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .season-reveal[data-pack] .card-picture { animation: none; }
}

.duo-dialog { border:0; padding:0; position:fixed; inset:0; margin:0; width:100%; height:100dvh; max-width:none; max-height:none; background:#fff5e1; }
.duo-frame { border:0; display:block; width:100%; height:100%; }
.friend-row:has(.duo-invite) { flex-wrap:wrap; }
.friend-row .duo-invite { margin-left:auto; }
.friend-row .duo-online { color:#35684e; }

.pet-speech {
  position: absolute;
  z-index: 4;
  top: clamp(101px, 32%, 420px);
  left: 7px;
}
.pet-speech-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.pet-speech-action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 91px;
  min-width: 44px;
  min-height: 44px;
  padding: 3px 6px;
  border: 1px solid var(--home-trim);
  border-radius: 13px;
  background: var(--paper-light);
  box-shadow: 0 2px 0 var(--care-shadow);
  color: var(--jade-shadow);
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.12;
  text-align: left;
}
.pet-speech-action::after {
  content: '';
  position: absolute;
  left: 100%;
  top: calc(50% - 3px);
  width: 7px;
  height: 7px;
  translate: -4px 0;
  rotate: 45deg;
  border: solid var(--home-trim);
  border-width: 1px 1px 0 0;
  background: inherit;
  pointer-events: none;
}
.pet-speech-action .room-icon { width: 25px; height: 25px; flex: none; }

.pet-dream {
  position: absolute;
  z-index: 2;
  bottom: var(--dream-bottom, 43%);
  left: 52%;
  translate: -50%;
  width: min(133px, 39%);
  height: clamp(49px, 14%, 82px);
  color: #fffaf2;
  pointer-events: none;
}
.pet-actor:has(canvas[data-painted="true"]:not([data-pose="curl"], [data-pose="dream"], [data-pose="sleep-eye"])) .pet-dream {
  visibility: hidden;
}
.pet-dream-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 3px solid currentColor;
  border-radius: 46% 43% 40% 39% / 49% 49% 46% 46%;
  background: radial-gradient(ellipse at 50% 85%, #fffef9 4%, var(--dream-sky) 75%);
  box-shadow: 0 3px 10px #39266235, inset 0 0 16px #fff8;
  animation: dream-appear 260ms ease-out both;
}
.pet-dream img { position: absolute; object-fit: contain; filter: drop-shadow(0 3px 2px #48335a35); }
.dream-main { inset: 10% 23%; width: 54%; height: 80%; animation: dream-orbit 3s ease-in-out infinite; }
.dream-detail { width: 23%; height: 32%; animation: dream-shimmer 1.8s ease-in-out infinite alternate; }
.dream-detail-left { left: 10%; bottom: 16%; }
.dream-detail-right { right: 10%; top: 16%; animation-delay: -.9s; }
[data-dream="carrot"] .dream-main { animation: dream-hop 1.5s ease-in-out infinite; }
[data-dream="bubble"] .dream-main { animation: dream-rise 2.5s ease-in-out infinite; }
[data-dream="music"] .dream-main { animation: dream-beat 1s ease-out infinite; }
[data-dream="kite"] .dream-main { animation: dream-kite 2.8s ease-in-out infinite alternate; }
[data-dream="ball"] .dream-main { animation: dream-ball 1.7s ease-in-out infinite alternate; }
[data-dream="gift"] .dream-main { animation: dream-gift 2s ease-in-out infinite; }
[data-dream="paint"] .dream-main { animation: dream-paint 2s ease-in-out infinite; }
[data-dream="dance"] .dream-main { animation: dream-dance 1.8s ease-in-out infinite; }
[data-dream="garden"] .dream-main { animation: dream-grow 3.2s ease-out infinite; transform-origin: center bottom; }
[data-dream="garden"] .dream-detail { animation-name: dream-orbit; }
[data-dream="music"] .dream-detail, [data-dream="bubble"] .dream-detail { animation-name: dream-rise; }
@keyframes dream-appear { from { opacity: 0; transform: scale(.92); } }
@keyframes dream-orbit { 25% { transform: translate(-13%, -10%); } 75% { transform: translate(13%, 8%); } }
@keyframes dream-shimmer { from { opacity: .45; transform: scale(.76); } to { opacity: 1; transform: scale(1.1); } }
@keyframes dream-hop { 34% { transform: translateY(-14%) rotate(10deg); } 52% { transform: translateY(7%) rotate(-5deg); } }
@keyframes dream-rise { 0% { transform: translateY(15%); opacity: .28; } 35% { opacity: 1; } 100% { transform: translateY(-22%); opacity: .25; } }
@keyframes dream-beat { 18% { transform: translateY(-5%) rotate(-8deg); } 43% { transform: rotate(5deg); } }
@keyframes dream-kite { from { transform: translate(-24%, 8%) rotate(-19deg); } to { transform: translate(26%, -10%) rotate(18deg); } }
@keyframes dream-ball { from { transform: translate(-29%, 13%) rotate(-85deg); } 50% { transform: translateY(-18%) rotate(12deg); } to { transform: translate(29%, 13%) rotate(96deg); } }
@keyframes dream-gift { 22% { transform: rotate(-13deg); } 40% { transform: rotate(15deg); } 60% { transform: translateY(-11%) rotate(-4deg); } }
@keyframes dream-paint { 30% { filter: hue-rotate(35deg) drop-shadow(0 3px 2px #48335a35); } 65% { transform: rotate(8deg); filter: hue-rotate(-28deg) drop-shadow(0 3px 2px #48335a35); } }
@keyframes dream-dance { 25% { transform: translate(-18%, -6%) rotate(-24deg); } 60% { transform: translate(21%, 8%) rotate(31deg); } }
@keyframes dream-grow { 0% { transform: scale(.49); opacity: .5; } 43% { transform: scale(1.08); } 75%,100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .pet-dream-scene, .pet-dream [data-dream] img { animation: none; }
}

.grade-chooser { display: grid; gap: 8px; }
.grade-icons { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.grade-icon {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 52px;
  padding: 0; isolation: isolate; border: 2px solid var(--line); border-radius: 15px;
  background: var(--paper-light); color: var(--jade-shadow);
}
.grade-icon img {
  position: absolute; inset: 0; margin: auto; width: 40px; height: 40px;
  object-fit: contain; pointer-events: none; z-index: -1;
}
.grade-number { font-size: 1.27rem; font-weight: 1000; line-height: 1; }
.grade-icon[aria-pressed="true"] { background: var(--jade-light); border-color: var(--jade); }
.grade-check {
  position: absolute; top: -4px; right: -3px; display: grid; place-items: center;
  width: 18px; height: 18px; border: 2px solid var(--paper-light); border-radius: 50%;
  background: var(--jade); color: var(--action-ink); font-size: 11px; line-height: 1;
}
.app-primary-study .topbar { min-height: 60px; }
.app-primary-study .panel { gap: 12px; }
.primary-study-header { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 12px; }
.primary-study-progress { display: grid; gap: 6px; }
.primary-study-progress .question-progress { margin-top: 0; }
.study-listen {
  display: grid; place-items: center; width: 56px; min-height: 52px; padding: 0;
  border: 1px solid var(--coin-edge); border-radius: 16px; background: var(--coin-paper); box-shadow: var(--shadow);
}
.study-listen .study-picture { font-size: 2.15rem; }
.study-listen:hover { background: var(--button-hover); }
.study-listen[data-playing='true'] { background: var(--jade-light); border-color: var(--answer-active-edge); box-shadow: 0 0 0 2px var(--answer-active-edge); }
.primary-question { gap: 10px; }
.study-audio-error { font-size: .87rem; color: var(--muted); }
.primary-count { display: grid; gap: 6px; }
.primary-count-group { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px;
  min-height: 40px; padding: 4px; border-radius: 10px; background: var(--answer-paper); font-size: clamp(1.15rem,5.6vw,1.65rem); }
.study-picture { width: 1em; height: 1em; flex: none; object-fit: contain; }
.study-rectangle { display: block; width: 1.1em; height: .62em; background: #67a1e6; }
.primary-cue { display: flex; gap: 10px; justify-content: center; align-items: center; font-size: 1.28rem; }
.primary-cue > .study-picture { font-size: 2rem; }
.primary-question .answer { min-height: 50px; font-size: 1.04rem; font-weight: 760; }
.primary-tiles { grid-template-columns: repeat(3,minmax(0,1fr)); }
.primary-tiles .answer { flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.primary-tiles .answer > span:only-child { font-size: 1.05rem; }
.primary-choice-icon { flex: none; font-size: 1.6rem; }

.drawing-board { display: grid; gap: 12px; width: min(100%, 380px); justify-self: center; }
.drawing-paper {
  display: block; box-sizing: border-box; width: 100%; height: auto; aspect-ratio: 1;
  border: 2px solid var(--line); border-radius: 18px; background: #fffefd;
  box-shadow: var(--shadow); touch-action: none; cursor: crosshair;
}
.drawing-palette { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 2px; }
.drawing-color {
  display: grid; place-items: center; min-height: 44px; padding: 2px;
  background: transparent; border: 2px solid transparent; border-radius: 13px;
}
.drawing-color[aria-pressed="true"] { background: var(--jade-light); border-color: var(--jade); }
.drawing-color span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-size: .86rem; font-weight: 950; text-shadow: 0 1px 2px #271b15;
}
.drawing-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.drawing-actions button { min-height: 44px; padding-inline: 4px; font-size: .85rem; }
.drawing-title { margin: 0; text-align: center; color: var(--jade); font-size: 1.12rem; }
.drawing-title:focus { outline: none; }
.drawing-paper[hidden] { display: none; }
.drawing-preview { padding: 7px; border-color: var(--jade); background: var(--jade-light); cursor: auto; touch-action: auto; }
.drawing-preview-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
.music-choice { display: grid; flex: 1 0 100%; gap: 5px; font-size: .86rem; font-weight: 850; }
.music-choice select {
  min-height: 44px; min-width: 0; padding: 6px 9px; width: 100%;
  background: var(--card); color: inherit; border: 1px solid var(--line); border-radius: 10px;
  font: inherit;
}
.goal-countdown {
  position:absolute; inset:108px auto auto 8px; z-index:3;
  display:flex; align-items:center; gap:6px; padding:5px 8px 5px 5px;
  color:var(--jade-shadow); background:var(--paper-light);
  border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow);
  font-size:.78rem; white-space:nowrap; pointer-events:none;
}
.goal-countdown img { width:26px; height:26px; border-radius:5px; }
.goal-celebration {
  width:min(320px,calc(100% - 32px)); box-sizing:border-box; padding:24px;
  background:var(--card); color:var(--jade-shadow); text-align:center;
  border:2px solid var(--line); border-radius:22px; box-shadow:var(--shadow);
}
.goal-celebration::backdrop { background:var(--room-label-shadow); }
.goal-celebration img { width:72px; height:72px; border-radius:12px; }
.goal-celebration h2 { margin:12px 0 6px; }
.goal-celebration p { margin:0 0 18px; }

.goal-countdown { pointer-events:auto; max-width:calc(100% - 78px); text-align:left; }
.goal-countdown span { min-width:0; }
.goal-countdown b,.goal-countdown small,.goal-details small { display:block; }
.goal-countdown b { overflow:hidden; text-overflow:ellipsis; }
.goal-countdown img { flex:none; object-fit:contain; }
.goal-details { text-align:left; max-height:75dvh; }
.goal-details article { display:flex; align-items:center; gap:10px; margin:12px 0; }
.goal-details article img { width:42px; height:42px; object-fit:contain; flex:none; }
.goal-details article div { min-width:0; overflow-wrap:anywhere; }
.goal-details progress { display:block; max-width:100%; }
