:root {
  color-scheme: light;
  --bg: #fcf9f4;
  --paper: #fffdf8;
  --ink: #4c332b;
  --muted: #755c51;
  --line: #e6d4c4;
  --rose: #984c50;
  --rose-hover: #813d43;
  --rose-soft: #f9e6e1;
  --peach: #f8e1d2;
  --shadow: 0 7px 22px #71473311;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --ui: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-family: var(--ui);
  background: var(--bg);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, p { margin: 0; }
a { color: inherit; }
button, input, .button { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 42px; padding: .55rem .88rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 13px;
  cursor: pointer; font-size: .87rem; font-weight: 650; text-decoration: none; text-align: center;
  transition: background-color .18s, border-color .18s, transform .18s;
}
button:hover:not(:disabled), .button:hover { border-color: #bd8f7f; background: #faede3; }
button:active:not(:disabled), .button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible, .sku-choice:focus-within {
  outline: 2px solid var(--rose); outline-offset: 3px;
}
button.primary, .button.primary { color: #fffaf6; background: var(--rose); border-color: var(--rose); font-weight: 750; }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--rose-hover); border-color: var(--rose-hover); }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round;
}
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); line-height: 1.65; }
.shell { width: min(100%, 1352px); padding-inline: clamp(24px, 3.5vw, 54px); margin-inline: auto; }
.wide { width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.topbar { border-bottom: 1px solid var(--line); background: #fffaf3; padding-top: env(safe-area-inset-top); }
.header-inner {
  min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 1.2rem;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { flex: none; width: 40px; height: 40px; }
.brand strong {
  font: 800 clamp(1.28rem, 2.2vw, 1.7rem)/1.15 var(--serif);
  letter-spacing: .035em;
}
.header-actions, .room-actions { display: flex; gap: .65rem; align-items: center; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.header-actions button { white-space: nowrap; }
.product-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.product-nav a {
  display: inline-flex; align-items: center; min-height: 44px; border-radius: 12px;
  padding: .45rem .7rem; font-weight: 700; font-size: .87rem; text-decoration: none;
}
.product-nav a:hover { background: #f6eae0; }
.product-nav a[aria-current="page"] { color: var(--rose-hover); background: var(--rose-soft); }
#sound-toggle[aria-pressed="false"] { color: var(--muted); background: #f5ede1; }
#rooms-open { background: var(--rose-soft); border-color: #e9bfb8; color: var(--rose-hover); }
#rooms-open:hover { background: #f5d9d3; border-color: #d59b92; }
.share-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .45rem .9rem;
  padding: .65rem .8rem; border: 1px solid #e8bc82; border-radius: 13px;
  background: #fff2d9; color: #70441f; font-size: .8rem; text-align: start;
}
.share-tools[data-live="true"] { background: #f3f6e9; border-color: #cfd9b8; color: #425634; }
.dialog .share-tools { margin-block: .65rem; }
.share-link {
  flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; text-underline-offset: 3px;
}
.share-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.share-actions button { min-height: 36px; padding: .35rem .65rem; }
.share-actions [data-share-start] { border-color: #e1b279; color: #693d1b; }
.share-tools .feedback { margin: 0; }
.share-tools .feedback { flex-basis: 100%; }
.share-tools .feedback:empty { display: none; }

.studio { flex: 1; padding-block: clamp(12px, 2vw, 24px) 28px; }
.landing { margin-bottom: 10px; }
.landing h1 {
  font: 800 clamp(1.32rem, 2.55vw, 2rem)/1.18 var(--serif); letter-spacing: .015em;
  text-wrap: balance;
}
.landing h1 span { color: var(--rose); }
.welcome-panel {
  display: grid; justify-items: center; gap: .8rem; margin-inline: auto; padding: clamp(24px, 7vw, 72px) 18px;
  text-align: center; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow);
}
.welcome-panel h1 { font-family: var(--serif); }
.desk-welcome-inline { margin-bottom: 10px; }
.pet-access-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.personal-progress {
  display: grid; gap: .28rem; padding: .55rem 1rem .8rem;
  color: var(--muted); font-size: .8rem; font-weight: 650;
}
.personal-progress progress { width: 100%; height: .65rem; accent-color: var(--rose); }
.room-bar {
  margin-bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.room-code {
  color: var(--muted); font-size: .77rem; font-weight: 700; white-space: nowrap;
  background: #f5ede1; padding: .28rem .56rem; border-radius: 999px;
}
.room-actions button { min-height: 36px; padding-block: .35rem; background: transparent; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(275px, 1fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.pet-column { min-width: 0; }

.pet-photo { position: relative; }
.photo-bar {
  position: absolute; inset: 13px 15px auto; z-index: 1; display: flex;
  align-items: center; justify-content: space-between; gap: 8px; pointer-events: none;
}
.photo-bar > span, .photo-stats .generation {
  border-radius: 999px; padding: .25rem .58rem; background: #fff7eae8; color: #614b3f;
  font-size: .71rem; font-weight: 650;
}
#connection { display: flex; align-items: center; gap: .36rem; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #b5773e; }
#connection[data-state="online"] .status-dot { background: #628054; }
.generation { white-space: nowrap; }
.photo-stats { justify-content: flex-end; }
#growth { pointer-events: auto; }
.photo-stats, .card-stamps { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .65rem; }
.growth-stamp, .shiny-stamp {
  display: inline-block; padding: .18rem .55rem; border-radius: 999px;
  background: #f8e8dc; color: #754941; font-size: .76rem; font-weight: 750; white-space: nowrap;
}
.shiny-stamp {
  background: linear-gradient(115deg, #f4cd8c, #fff0b4 35%, #f0d7f7 68%, #f8d891);
  border: 1px solid #ddb46e; color: #614029;
}
.card-stamps { margin-top: .48rem; }
.stage {
  position: relative; width: 100%; aspect-ratio: 1.65; min-height: 280px; overflow: hidden;
  background: #f2c8b2 url("/static/studio-backdrop.jpg") center 65% / cover no-repeat;
}
.mascot-stage { position: absolute; inset: 0; }
.desk-stage { display: flex; flex-direction: column; padding: 52px 12px 10px; }
.desk-pets {
  flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(130px, 1fr); gap: 10px; overflow-y: auto; scrollbar-width: thin;
}
.desk-seat {
  min-width: 0; display: grid; grid-template-rows: auto minmax(68px, 1fr) auto;
  align-items: center; text-align: center; border-radius: 18px;
  background: #fff7e8c9; border: 1px solid #fff3e7; color: #683e37;
}
.desk-seat:only-child { grid-column: 1 / -1; width: min(100%, 300px); justify-self: center; }
.desk-label { display: grid; padding: 6px 8px 0; line-height: 1.15; min-width: 0; }
.desk-label small { color: #805044; font-size: .71rem; }
.desk-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-scene { position: relative; align-self: stretch; }
.desk-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem; padding: 0 4px 4px; }
.desk-actions button { min-height: 32px; padding: 2px 6px; font-size: .75rem; }
.stage canvas, .mini-scene canvas, .overlay-scene canvas {
  display: block; width: 100%; height: 100%; position: absolute; inset: 0;
}
.stage canvas { touch-action: pan-y; }
.pet-target, .pet-target:hover:not(:disabled), .pet-target:active:not(:disabled) {
  position: absolute; z-index: 1; left: var(--hit-x, 50%); top: var(--hit-y, 60%);
  width: var(--hit-w, 120px); height: var(--hit-h, 120px); min-height: 0;
  padding: 0; border: 0; border-radius: 50%; transform: translate(-50%, -50%);
  background: transparent; cursor: grab; touch-action: none; -webkit-touch-callout: none;
}
.pet-target:active:not(:disabled), .dragging .pet-target { cursor: grabbing; }
.pet-reaction {
  position: absolute; z-index: 2; top: 12%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 14px); padding: .42rem .75rem;
  background-color: #fff5dc; color: #794945; border: 1px solid #ebc7a2;
  border-radius: 999px; box-shadow: 0 3px 8px #653c3140;
  font-size: .84rem; font-weight: 750; text-align: center; pointer-events: none; white-space: normal;
}
.pet-reaction.beat-ready { background: #fff1ba; border-color: #ce925b; }
.reacting > .bubble, .reacting > #mini-bubble { visibility: hidden; }
.companion-note {
  position: absolute; z-index: 3; transform: translate(-50%, -50%) rotate(-12deg);
  min-height: 30px; width: 32px; padding: 0; font-size: 1rem;
  border-radius: 10px 13px 9px 13px; background: #fff6de; box-shadow: 0 3px 8px #73504545;
}
.companion-note:active:not(:disabled) { transform: translate(-50%, -45%) rotate(-8deg); }
.note-reader {
  position: absolute; z-index: 4; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(245px, calc(100% - 16px)); padding: .65rem 2rem .65rem .85rem;
  background: #fff7e5; border: 1px solid #dec1ad; border-radius: 14px;
  box-shadow: 0 5px 18px #55382942; color: #69483e; font-size: .83rem; overflow-wrap: anywhere;
}
.note-reader p { margin-top: .25rem; }
.note-reader button {
  position: absolute; top: .28rem; right: .28rem; width: 26px; min-height: 26px; padding: 0; background: transparent;
}
.bubble, .overlay-bubble {
  border: 1px solid #e8c5b1; border-radius: 19px; padding: .58rem .86rem;
  background: #fff8e9; color: var(--ink); box-shadow: 0 4px 12px #793d311a;
  font-size: clamp(.8rem, 1.18vw, 1.02rem); line-height: 1.45; font-weight: 620; overflow-wrap: anywhere;
}
.bubble {
  position: absolute; z-index: 1; top: 12%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 58%; max-height: 29%; text-align: center;
}
.bubble::after, .overlay-bubble::after {
  content: ""; position: absolute; width: 10px; height: 10px; bottom: -6px; left: calc(50% - 5px);
  background: #fff8e9; border-right: 1px solid #e8c5b1; border-bottom: 1px solid #e8c5b1;
  transform: rotate(45deg); border-radius: 0 0 3px;
}
.bubble.long { overflow-y: auto; }
.bubble:not(.long) { pointer-events: none; }
.bubble.long::after { content: none; }
.photo-caption {
  display: flex; align-items: baseline; gap: .7rem 1.25rem; flex-wrap: wrap;
  padding: .82rem 1.1rem; border-top: 1px solid var(--line);
}
.photo-caption > span:not(#signature) { display: flex; align-items: baseline; gap: .48rem; }
.photo-caption small { color: var(--muted); white-space: nowrap; }
.photo-caption strong { font-size: .98rem; }
#pet-name { overflow-wrap: anywhere; }
.photo-caption .mood { margin-left: auto; }
.photo-caption .mood strong { color: #843f45; font-size: .83rem; }
#signature { color: #84542a; font-size: .81rem; overflow-wrap: anywhere; }
.focus-status { color: #674979; font-size: .81rem; }

.companion-controls, .studio-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
:is(.companion-controls, .studio-actions) button { min-height: 38px; padding: .38rem .7rem; border-radius: 999px; white-space: nowrap; }
.studio-actions .icon { width: 16px; height: 16px; }
.footer .quiet { margin: 0; white-space: nowrap; font-size: .78rem; }

.lineage { min-width: 0; display: flex; flex-direction: column; }
.panel-heading {
  display: flex; align-items: center; gap: .63rem; min-height: 63px;
  padding: .8rem 1.15rem .67rem; border-bottom: 1px dashed var(--line);
}
.panel-heading h2 { font: 800 clamp(1.28rem, 2.4vw, 1.8rem)/1.2 var(--serif); letter-spacing: .055em; }
.panel-heading .icon { width: 25px; height: 25px; color: #9b6455; transform: rotate(-7deg); }
#lineage-count { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.lineage-list {
  display: grid; gap: 11px; align-content: start; padding: 17px; margin: 0; list-style: none;
  overflow: auto; max-height: min(480px, 51vw);
}
.lineage-list:empty { padding: 0; }
.lineage-item {
  width: 100%; display: grid; grid-template-columns: clamp(64px, 6.5vw, 94px) minmax(0, 1fr) 15px;
  gap: .85rem; align-items: center; text-align: left; padding: 8px; background: #fff9ee;
  box-shadow: 0 3px 0 #ecdac955;
}
.lineage-picture {
  display: block; width: 100%; height: auto; aspect-ratio: 1;
  background: var(--peach); border-radius: 8px;
}
.lineage-copy { display: grid; gap: .21rem; min-width: 0; }
.lineage-item strong { font-size: clamp(.93rem, 1.35vw, 1.08rem); line-height: 1.3; }
.lineage-item small { font-size: .72rem; color: var(--rose-hover); }
.lineage-item .summary {
  color: var(--muted); line-height: 1.48; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow-wrap: anywhere; font-weight: 500;
}
.lineage-item .icon { width: 16px; color: #a56e5d; }
.empty { color: var(--muted); padding: 40px 25px; font-size: .9rem; text-align: center; }

.footer { margin-top: auto; color: var(--muted); }
.footer > .shell { min-height: 57px; display: flex; align-items: center; gap: 1rem; font-size: .77rem; }
.team { display: inline-flex; gap: .46rem; align-items: center; white-space: nowrap; font-weight: 700; }
.team i { width: 19px; height: 19px; background: url("/static/soot.svg") center / contain no-repeat; }
.footer-rule { min-width: 15px; flex: 1; height: 1px; background: var(--line); }

.dialog {
  color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 23px;
  padding: 1.55rem; width: min(440px, calc(100% - 28px)); max-height: calc(100% - 26px);
  box-shadow: 0 25px 90px #47302e36; overflow-y: auto;
}
.dialog::backdrop { background: #45322e65; }
.dialog h2 { margin: 0 34px .55rem 0; font: 800 1.55rem/1.22 var(--serif); }
.dialog > .muted { margin-bottom: 1rem; font-size: .87rem; }
.mac-install-dialog { width: min(720px, calc(100% - 28px)); padding: .7rem; }
.mac-install-dialog > .mac-install-hint { margin: 0 0 .45rem; }
.mac-install-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
#mac-install-command {
  border-radius: 10px 0 0 10px; padding: .45rem .65rem; background: #f6eee5; border-color: var(--line);
  font: .85rem/1.5 ui-monospace, monospace;
}
#mac-install-copy { min-width: 4.8rem; border-radius: 0 10px 10px 0; }
.close-bar { position: absolute; top: 12px; right: 12px; }
.icon-button { min-height: 34px; padding: 5px; color: var(--muted); border-radius: 50%; }
.join-form, .stack { display: grid; gap: .58rem; margin-top: .9rem; }
.inline-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }
.claim-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(6.5rem, .54fr); gap: .5rem; }
.pin-tools { margin-top: .6rem; }
.pin-badge { padding: .15rem .5rem; border-radius: 999px; background: #e6eee2; color: #38563d; font-size: .78rem; }
#pin-tag { color: var(--muted); font-size: .82rem; }
input, select {
  width: 100%; padding: .67rem .72rem; min-height: 42px; border: 1px solid #cfb8aa; border-radius: 10px;
  background: #fffefc; color: var(--ink); font-size: .9rem;
}
input::placeholder { color: var(--muted); }
label { font-size: .88rem; font-weight: 675; }
label small { color: var(--muted); margin-left: .35rem; font-weight: 500; }
.feedback { color: var(--rose-hover); font-size: .82rem; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.dialog .feedback { margin-top: .45rem; }
.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(455px, 100%); border-radius: 23px 0 0 23px; }
.drawer fieldset { border: 0; margin: 0 0 .3rem; padding: 0; min-inline-size: 0; }
.feed-options { display: grid; gap: .58rem; }
.wardrobe-list { display: grid; gap: .5rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.outfit {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: .6rem;
  align-items: center; min-height: 67px; padding: .38rem .55rem; border: 1px solid var(--line);
  border-radius: 13px; background: #fff8ef;
}
.outfit[data-active] { border-color: #d2a39b; background: #fbebe5; }
.outfit-preview {
  display: grid; place-items: center; width: 54px; height: 54px; overflow: hidden;
  border-radius: 10px; background: radial-gradient(ellipse at 45% 20%, #f6ece2, #e8ddd7);
}
.outfit-preview canvas { display: block; width: 100%; height: 100%; }
.outfit[data-locked] .outfit-preview::after {
  content: ""; width: 32px; height: 26px; border-radius: 56% 53% 47% 45%;
  background: #b397966e; box-shadow: 0 3px 7px #a88c8a40, -5px 9px 0 -7px #b397966e, 6px 9px 0 -7px #b397966e;
}
.outfit-copy { display: grid; justify-items: start; gap: .24rem; font-size: .85rem; }
.outfit button { min-height: 34px; padding: .26rem .48rem; font-size: .75rem; }
.outfit .outfit-snack { justify-content: flex-start; text-align: left; }
.outfit button[aria-pressed="true"] { background: #f5e2f3; border-color: #d3abd2; color: #6b3c66; }
.outfit[data-active] .outfit-wear:disabled { opacity: 1; color: var(--rose-hover); background: #f6ded7; }
.sku-list { display: grid; gap: .45rem; }
.sku-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: .62rem; padding: .58rem .65rem; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; background: #fff8ef; scroll-margin-block: .75rem;
}
.sku-choice:has(:checked) { background: var(--rose-soft); border-color: #b67770; }
.sku-choice input { min-height: auto; width: 15px; height: 15px; padding: 0; margin: 0; accent-color: var(--rose); }
.sku-choice input:focus-visible { outline: none; }
.sku-choice span { display: grid; gap: .17rem; }
.sku-choice small { color: var(--muted); font-size: .76rem; margin: 0; line-height: 1.38; }
.sku-choice .price { color: var(--rose-hover); font-size: .87rem; }
.resume { color: var(--rose-hover); }
.pay-dialog {
  text-align: center;
  border-color: #dfc4a7;
  background: repeating-linear-gradient(0deg, #a36f3710 0 1px, transparent 1px 6px), #fffaee;
}
.pay-dialog h2 { margin-right: 0; }
.pay-mark {
  display: grid; place-items: center; margin: 0 auto .55rem; border-radius: 50%;
  width: 40px; height: 40px; color: var(--rose); background: var(--rose-soft); border: 1px solid #ebc9c0;
}
.receipt-lines { margin: .9rem 0; border-block: 1px dashed #b99172; padding-block: .6rem; }
.receipt-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding-block: .26rem; }
.receipt-lines dt { color: var(--muted); white-space: nowrap; }
.receipt-lines dd { margin: 0; font-weight: 750; text-align: right; }
.receipt-total dd { font-size: 1.7rem; color: var(--rose-hover); }
.qr-code { display: block; width: 100%; aspect-ratio: 1; margin-inline: auto; background: #fff; }
.pay-scan { margin: .65rem 0 .85rem; font-size: .9rem; font-weight: 650; }
.pay-scan .qr-code { width: min(100%, 310px); }
#pay-official-qr { margin: 0 auto .45rem; }
.pay-scan figcaption { margin-top: .36rem; }
#mock-scan { margin-bottom: .85rem; }
#checkout { margin-bottom: .55rem; }
.quiet { min-height: 37px; background: transparent; border-color: transparent; color: var(--muted); margin-top: .45rem; }
.invite-dialog { text-align: center; }
.invite-dialog h2 { margin-right: 0; }
.invite-dialog .qr-code { width: min(100%, 245px); margin-block: .85rem .5rem; }
.invite-code { font-weight: 750; letter-spacing: .045em; overflow-wrap: anywhere; }
.invite-dialog #copy-room { margin-top: .8rem; }
.projection-invite {
  align-self: start; display: grid; gap: .65rem; padding: clamp(14px, 2vw, 26px);
  background: #fffaf1; text-align: center;
}
.projection-invite h2 { font: 800 clamp(1.2rem, 2.5vw, 1.8rem)/1.15 var(--serif); }
.projection-invite .qr-code { max-width: 345px; }
.projection-invite .feedback, .pay-scan .feedback, .invite-dialog .feedback { margin: 0; }
.projection-invite .feedback:empty, .pay-scan .feedback:empty, .invite-dialog .feedback:empty { display: none; }
.metrics-dialog { width: min(520px, calc(100% - 26px)); }
.metrics-table { width: 100%; margin-block: .85rem; border-collapse: collapse; font-size: .87rem; }
.metrics-table th, .metrics-table td { padding: .52rem .28rem; border-bottom: 1px solid var(--line); text-align: right; }
.metrics-table th:first-child { text-align: left; }
.metrics-table thead th { color: var(--rose-hover); }
.metrics-table tbody th { font-weight: 600; }
.card-dialog { width: min(710px, calc(100% - 26px)); }
.card-dialog h2 { margin-bottom: .85rem; }
.card-detail { display: grid; grid-template-columns: minmax(145px, .95fr) minmax(0, 1fr); gap: 1.15rem; align-items: center; }
#card-milestones { display: contents; }
#card-dress { margin-top: .45rem; }
#card-art { display: block; width: 100%; height: auto; border-radius: 11px; background: var(--peach); box-shadow: var(--shadow); }
.card-story { padding-left: 1.35rem; margin: .8rem 0 1rem; }
.card-story li { padding-left: .2rem; margin-bottom: .6rem; font-size: .86rem; line-height: 1.55; overflow-wrap: anywhere; }
.card-story li::marker { color: var(--rose); }
#card-feeder { overflow-wrap: anywhere; font-size: .83rem; }
.toast {
  position: fixed; bottom: 16px; left: 50%; z-index: 3; transform: translateX(-50%);
  max-width: calc(100% - 22px); padding: .62rem .9rem; border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow); color: var(--ink); background: var(--paper); font-size: .88rem;
}

.mini { width: 100%; min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 8px; gap: 7px; background: var(--bg); }
.mini-head, .mini-foot { display: flex; align-items: center; justify-content: space-between; gap: .35rem; }
.mini-head strong { margin-right: auto; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-head span { font-size: .72rem; white-space: nowrap; color: var(--rose-hover); }
.mini-scene { position: relative; min-height: 100px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
#mini-bubble {
  position: absolute; right: 5px; top: 5px; max-width: 36%; padding: .3rem .45rem; border-radius: 9px;
  background: #fff8e9; color: var(--ink); font-size: .67rem; overflow-wrap: anywhere;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.mini-foot span { color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.mini-foot button { flex: none; min-height: 31px; padding: .32rem .6rem; font-size: .75rem; }

.overlay { display: none; }
html.overlay-mode, .overlay-mode body {
  background: transparent !important; overflow: hidden; width: 100%; height: 100%; min-height: 0;
}
.overlay-mode body > :not(.overlay, .icon-library) { display: none !important; }
.overlay-mode .overlay {
  --milestone-bottom: 188px;
  position: relative; display: block;
  width: min(300px, 100%); height: min(280px, 100%); margin: auto auto 0;
  user-select: none; -webkit-user-select: none;
}
.overlay-mode .overlay.feeding { width: min(430px, 100%); height: min(540px, 100%); }
.overlay .snack-popover {
  --snack-width: 328px; --snack-height: calc(100% - 160px); bottom: 151px; right: 12px;
}
[data-overlay-side="left"] .overlay .snack-popover { right: auto; left: 12px; }
#overlay-speech {
  --speech-inset: calc(50% + 4px);
  position: absolute; z-index: 2; right: var(--speech-inset); bottom: 190px;
  width: min(120px, max(0px, calc(100% - var(--speech-inset) - 8px)));
  display: grid; align-items: end; justify-items: end; pointer-events: none;
}
[data-overlay-side="left"] #overlay-speech { right: auto; left: var(--speech-inset); justify-items: start; }
#overlay-speech :is(.overlay-bubble, .pet-reaction) {
  grid-area: 1 / 1; position: relative; inset: auto; width: max-content; max-width: 100%;
  padding: .37rem .63rem; border-radius: 15px; font-size: .72rem; text-align: center;
  overflow-wrap: anywhere;
}
.overlay-bubble {
  opacity: 0; transform: translateY(4px); transition: opacity .35s, transform .35s;
}
.overlay-bubble span {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.overlay-bubble.visible { opacity: 1; transform: translateY(0); }
#overlay-speech .pet-reaction { transform: none; }
.overlay:has(.reacting) .overlay-bubble:not(.interaction-error) { opacity: 0; }
.overlay:has(.overlay-bubble.visible.interaction-error) #overlay-speech .pet-reaction { visibility: hidden; }
.overlay:has(#overlay-milestone:not([hidden])) #overlay-speech {
  top: calc(100% - var(--milestone-bottom) + 6px); bottom: auto;
}
#overlay-milestone {
  position: absolute; z-index: 2; bottom: var(--milestone-bottom); left: 50%; translate: -50% 0;
  width: max-content; max-width: calc(100% - 24px); min-height: 30px; padding: 4px 11px;
  color: #704a21; background: #fff4d9; border-color: #e7c484; border-radius: 999px;
  box-shadow: 0 3px 10px #7750202e; font-size: .72rem;
}
#overlay-milestone:hover { background: #ffebbf; border-color: #d6a75f; }
.overlay-scene {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  width: min(220px, 100%); height: min(170px, calc(100% - 34px));
  pointer-events: none;
}
.overlay-scene canvas { filter: drop-shadow(0 4px 4px #492c2750); pointer-events: none; }
.overlay-scene :is(.pet-target, .companion-note, .note-reader) { pointer-events: auto; }
.overlay-toolbar {
  position: absolute; z-index: 1; bottom: 16px; left: 50%; translate: -50% 0;
  display: inline-flex; align-items: center; gap: 3px; height: 28px; max-width: calc(100% - 12px); white-space: nowrap;
  border: 1px solid #e8d1c0; padding: 2px 3px; border-radius: 999px; background: rgba(255, 251, 245, 0.90);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 3px 9px #57392a24; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.overlay:has(.overlay-scene .pet-target:focus-visible, .overlay-toolbar :focus-visible) .overlay-toolbar,
.overlay.host-hover .overlay-toolbar {
  opacity: 1; pointer-events: auto;
}
.overlay-toolbar button { min-height: 22px; padding: 2px 7px; border: 0; border-radius: 999px; font-size: .7rem; }
#overlay-info { position: relative; min-width: 0; gap: 0; color: #785348; background: transparent; }
#overlay-name { max-width: 6em; overflow: hidden; text-overflow: ellipsis; }
#overlay-level { white-space: pre; }
#overlay-info.unread::after {
  content: ""; position: absolute; top: 1px; right: 1px; width: 5px; height: 5px;
  border-radius: 50%; background: #c68a3c; box-shadow: 0 0 0 1px #fff1d7;
}
#overlay-feed { flex: none; gap: 4px; }
#overlay-feed .icon { width: 13px; height: 13px; }
#overlay-close { flex: none; width: 22px; padding: 0; color: #8a675a; background: transparent; }
#overlay-close .icon { width: 11px; height: 11px; }
#overlay-info:hover:not(:disabled), #overlay-close:hover { background: #f7e9df; }
@media (prefers-reduced-motion: reduce) {
  .overlay-toolbar { transition: none; }
}

body.present .lineage, body.present .footer, body.present .room-actions,
body.present .landing { display: none; }
body.present .studio { width: min(100%, 1540px); padding-block: 13px; }
body.present .room-bar { margin-bottom: 12px; }
body.present .studio-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 821px) {
  body.present .studio-grid:has(.projection-invite:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) clamp(230px, 26vw, 385px);
  }
}
body.present .stage { aspect-ratio: initial; height: max(280px, calc(100dvh - 270px)); }
#present[aria-pressed="true"] { background: var(--rose-soft); border-color: #b67770; }

@media (min-width: 821px) {
  body:not(.present) .stage { max-height: max(310px, calc(100svh - 295px)); }
}
@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; gap: .25rem 1rem; padding-block: .45rem; }
  .product-nav { flex-basis: 100%; order: 1; }
  .studio-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lineage-list { max-height: 430px; }
  .lineage-item { grid-template-columns: 68px minmax(0, 1fr) 15px; }
  .stage { aspect-ratio: 1.65; }
}
@media (max-width: 640px) {
  .shell { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .header-inner { flex-wrap: wrap; gap: 5px; padding-block: 6px; min-height: 0; }
  .brand { gap: .44rem; }
  .brand img { width: 35px; height: 35px; }
  .header-actions { margin-inline-start: auto; }
  .header-actions, .room-actions { gap: .38rem; }
  .header-actions button, .room-actions button { font-size: .74rem; padding: .38rem .48rem; }
  .header-actions .icon, .room-actions .icon { width: 16px; height: 16px; }
  .header-actions button, .studio button:not(.pet-target), .dialog button, .dialog .button, .footer button {
    min-width: 44px; min-height: 44px;
  }
  .studio { padding-top: 8px; }
  .product-nav { gap: .05rem .2rem; }
  .product-nav a { font-size: .74rem; padding-inline: .32rem; }
  .room-code { padding-inline: .34rem; }
  .room-actions { flex-wrap: wrap; }
  body:not(.present) .stage { height: clamp(165px, 33svh, 275px); min-height: 0; aspect-ratio: auto; }
  body:not(.present) .desk-stage { height: clamp(220px, 36svh, 300px); }
  .desk-stage { padding: 44px 7px 7px; }
  .desk-pets { gap: 6px; }
  .bubble { top: 16%; max-width: 73%; }
  .photo-bar { inset: 9px 9px auto; }
  .photo-caption { padding: .48rem .65rem; gap: .25rem .65rem; }
  .photo-caption strong { font-size: .84rem; }
  .photo-caption small { font-size: .68rem; }
  .companion-controls { margin-top: 7px; }
  .companion-controls button { padding-inline: .6rem; }
  .note-reader { padding-right: 3rem; }
  .panel { border-radius: 18px; }
  .lineage-list { padding: 10px; }
  .footer > .shell { gap: .25rem; flex-wrap: wrap; padding-block: .35rem calc(.35rem + env(safe-area-inset-bottom)); }
  .footer .quiet { padding-inline: .35rem; }
  .footer-rule { display: none; }
  .card-detail { grid-template-columns: minmax(0, 1fr); }
  #card-art { max-width: 225px; margin-inline: auto; }
  .dialog { padding: 1.15rem; }
  .dialog input:not([type="radio"]) { min-height: 44px; font-size: 1rem; }
  .dialog .close-bar { inset: 5px 7px auto auto; }
  .feed-sheet[open] {
    position: fixed; inset: auto 0 0; display: flex; flex-direction: column; margin: 0;
    width: 100%; max-width: 100%; height: auto; max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
    border-radius: 22px 22px 0 0; padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }
  .feed-sheet .stack { display: flex; flex-direction: column; min-height: 0; margin-top: .45rem; }
  .feed-sheet .feed-options { min-height: 0; overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
  .feed-sheet .sku-choice { min-height: 44px; padding-block: .38rem; }
  .feed-sheet .sku-choice small { overflow-wrap: anywhere; }
  .feed-sheet #submit-order { flex-shrink: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
