.pet-page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pet-page-head h2 { font-size: 16px; margin: 0; }
.pet-message { min-height: 22px; color: var(--teal-dark); font-size: 13px; line-height: 1.7; margin: 8px 0; }
[data-pet-body] { display: grid; gap: 22px; }
.pet-hero { display: grid; grid-template-columns: 1fr 360px; color: #fff; background: #1f3a3c; }
.pet-hero-copy { padding: 40px; }
.pet-hero-copy h1 { margin: 0 0 18px; font-size: clamp(27px, 3.4vw, 39px); letter-spacing: -.03em; }
.pet-hero-copy > p { max-width: 460px; color: #d1e1de; line-height: 1.8; font-size: 15px; }
.pet-hero-copy .eyebrow { color: #ade0cc; font-size: 11px; }
.pet-balance { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 5px 20px; margin: 30px 0 23px; border-top: 1px solid #45615e; padding-top: 22px; }
.pet-balance > span { color: #d1e1de; font-size: 13px; }
.pet-balance strong { color: #f6d780; font-size: 37px; font-variant-numeric: tabular-nums; }
.pet-balance small { color: #b8ceca; font-size: 11px; grid-column: 1 / -1; }
.pet-hero-copy .pet-fair-play { max-width: 410px; font-size: 12px; color: #b8ceca; }
.pet-habitat { position: relative; display: grid; justify-items: center; align-content: center; padding: 22px; background: #e8ecdd; color: #244844; text-align: center; overflow: hidden; }
.pet-habitat::before { content: ''; position: absolute; width: 180px; height: 180px; top: 25px; right: -100px; border-radius: 50%; border: 25px solid #d9e1cb; }
.pet-habitat-label { align-self: start; justify-self: start; font-size: 10px; letter-spacing: .12em; color: #657866; }
.pet-actor { width: 300px; max-width: 100%; position: relative; display: grid; justify-items: center; gap: 8px; }
.pet-avatar { display: block; width: 100%; height: auto; }
.bongo-cat-avatar { position: relative; width: 100%; aspect-ratio: 800 / 450; overflow: hidden; isolation: isolate; }
.bongo-cat-layer { position: absolute; inset: 0; display: block; background-repeat: no-repeat; background-position: 0 0; background-size: 100% auto; pointer-events: none; }
.bongo-cat-instrument { z-index: 5; }
.bongo-cat-bongo { background-image: url('/bongo-cat/bongo.png'); }
.bongo-cat-keyboard { background-image: url('/bongo-cat/keyboard.png'); }
.bongo-cat-haohao-keyboard, .bongo-cat-starlight-keyboard { z-index: 15; }
.bongo-cat-haohao-keyboard { background-image: url('/bongo-cat/haohao-keyboard.png'); }
.bongo-cat-starlight-keyboard { background-image: url('/bongo-cat/starlight-keyboard.png'); }
.bongo-cat-cymbal { background-image: url('/bongo-cat/cymbal.png'); }
.bongo-cat-marimba { background-image: url('/bongo-cat/marimba.png'); }
.bongo-cat-tambourine { background-image: url('/bongo-cat/tambourine.png'); }
.bongo-cat-cowbell { background-image: url('/bongo-cat/cowbell.png'); }
.bongo-cat-head { z-index: 10; background-image: url('/bongo-cat/cat.png'); }
.bongo-cat-head-haohao-cat { background-image: url('/bongo-cat/haohao-cat.png'); background-size: 100% 100%; }
.bongo-cat-head-starlight-cat { background-image: url('/bongo-cat/starlight-cat.png'); background-size: 100% 100%; }
.bongo-cat-head-haohao-cat + .bongo-cat-mouth, .bongo-cat-head-starlight-cat + .bongo-cat-mouth { display: none; }
.bongo-cat-bundle-image { z-index: 10; background-size: contain; background-position: center; }
.bongo-cat-bundle-haohao-set .bongo-cat-bundle-image { background-image: url('/bongo-cat/haohao-set.png'); }
.bongo-cat-bundle-starlight-set .bongo-cat-bundle-image { background-image: url('/bongo-cat/starlight-set.png'); }
.typing-pet .bongo-cat-bundle-image { transition: transform 110ms ease-out; transform-origin: 50% 82%; }
.typing-pet.is-left-down .bongo-cat-bundle-image { transform: translateY(2px) rotate(-.6deg) scaleY(var(--pet-power-scale, 1)); }
.typing-pet.is-right-down .bongo-cat-bundle-image { transform: translateY(2px) rotate(.6deg) scaleY(var(--pet-power-scale, 1)); }
.typing-pet.is-typing .bongo-cat-bundle-image { filter: brightness(1.03); }
.bongo-cat-mouth { z-index: 20; background-image: url('/bongo-cat/mouth.png'); background-size: 200% auto; }
.bongo-cat-paw-left, .bongo-cat-paw-right { z-index: 30; background-size: 200% auto; }
.bongo-cat-paw-left { background-image: url('/bongo-cat/paw-left.png'); }
.bongo-cat-paw-right { background-image: url('/bongo-cat/paw-right.png'); }
.bongo-cat-key-state { display: none; }
.bongo-cat-stage-2 { filter: saturate(1.08) hue-rotate(8deg); }
.bongo-cat-stage-3 { filter: saturate(1.16) hue-rotate(18deg); }
.bongo-cat-focus-glow { position: absolute; inset: 14% 20% 18%; z-index: 35; border: 2px solid rgba(255, 222, 128, .45); border-radius: 50%; opacity: var(--pet-focus-opacity, .08); box-shadow: 0 0 16px rgba(255, 212, 92, .55); pointer-events: none; }
.pet-accessory-icon > .bongo-shop-preview { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
.bongo-shop-preview img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.bongo-shop-preview-instrument, .bongo-shop-preview-cat { position: absolute; inset: 0; }
.bongo-shop-preview-bundle { object-fit: contain; }
.pet-accessory-icon > span:not(.bongo-shop-preview) { z-index: 1; }
.pet-name { display: grid; gap: 6px; }
.pet-name strong { font-size: 21px; }
.pet-name span { color: #526c5f; font-size: 12px; }
.pet-habitat .button { margin-top: 12px; color: #244844; }
.pet-greeting { font-size: 11px; color: #526c5f; min-height: 18px; margin: 3px 0 0; }
.pet-actor.is-greeting .bongo-cat-avatar { transform-origin: 50% 100%; animation: pet-greet 1.2s ease-in-out; }
.pet-panel { padding: 26px; background: var(--paper); border: 1px solid var(--line); min-width: 0; }
.pet-panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.pet-panel-head > div { min-width: 0; }
.pet-panel-head > button { flex: 0 0 auto; }
.pet-panel h2 { margin: 0 0 16px; font-size: 20px; }
.pet-panel .eyebrow { margin-bottom: 7px; }
.pet-accessory-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.pet-accessory-card { display: grid; align-content: start; gap: 14px; min-width: 0; padding: 14px; border: 1px solid var(--line); }
.pet-accessory-card.owned { border-color: #aed5c8; background: #fafffc; }
.pet-accessory-icon { position: relative; background: #f1f3ec; height: 95px; display: grid; place-items: center; }
.pet-accessory-icon svg { width: 92px; max-height: 90px; }
.pet-accessory-icon > span { position: absolute; top: 6px; left: 8px; color: #68776a; font-size: 10px; }
.pet-accessory-card h3 { margin: 0 0 8px; font-size: 14px; }
.pet-accessory-card h3 small { color: var(--teal-dark); font-size: 10px; font-weight: 400; margin-left: 8px; }
.pet-accessory-card p { min-height: 36px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.pet-accessory-card .button { width: 100%; min-height: 36px; padding: 6px; font-size: 12px; }
.pet-rewards h2 { font-size: 17px; }
.pet-rewards p { font-size: 13px; }
.pet-page button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
@keyframes pet-greet { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-7px) rotate(-5deg); } 60% { transform: translateY(-7px) rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .pet-actor.is-greeting .bongo-cat-avatar { animation: none; } }
@media (max-width: 950px) { .pet-hero { grid-template-columns: 1fr 300px; }.pet-hero-copy { padding: 26px; }.pet-accessory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .pet-hero { grid-template-columns: minmax(0, 1fr); }.pet-hero-copy { padding: 24px 20px; }.pet-panel { padding: 20px 14px; }.pet-panel-head { flex-wrap: wrap; gap: 8px; }.pet-habitat { padding: 18px; }.pet-actor { width: 260px; }.pet-accessory-grid { gap: 10px; }.pet-accessory-card { padding: 10px; }.pet-accessory-card p { min-height: 42px; } }

/* A normal-flow companion: never covers the question, input or mobile controls. */
.typing-pet-host { margin: 14px 0 0; }
.typing-pet { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; gap: 16px; padding: 4px 20px 4px 12px; min-width: 0; border: 1px solid #cfdcd0; background: #f1f5ec; color: #285047; }
.typing-pet-art { min-width: 0; pointer-events: none; }
.typing-pet-copy { min-width: 0; padding: 10px 0; }
.typing-pet-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.typing-pet-heading > span { font-size: 10px; letter-spacing: .12em; color: #61775f; }
.typing-pet-heading button { border: 1px solid #94b8a4; background: transparent; color: #286956; border-radius: 4px; padding: 5px 9px; min-height: 30px; font-size: 11px; cursor: pointer; }
.typing-pet-heading button:hover { background: #e0ecde; }
.typing-pet-heading button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.typing-pet .typing-pet-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 7px 0 5px; line-height: 1.4; }
.typing-pet-name strong { font-size: 18px; overflow-wrap: anywhere; }
.typing-pet-name span { color: #50664e; font-size: 12px; }
.typing-pet .typing-pet-status { margin: 0; font-size: 12px; line-height: 1.6; color: #50664e; min-height: 20px; }
.typing-pet-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; color: #61775f; font-size: 10px; margin-top: 7px; font-variant-numeric: tabular-nums; }
.typing-pet[data-enabled="false"] .typing-pet-art { opacity: .5; }
.typing-pet[data-enabled="false"] .typing-pet-heading button { background: #fff; }
.typing-pet .bongo-cat-avatar { contain: layout paint; transform: translateZ(0); backface-visibility: hidden; }
.typing-pet .bongo-cat-paw-left, .typing-pet .bongo-cat-paw-right { transition: transform 55ms ease-out; transform-origin: 50% 78%; will-change: transform; contain: strict; }
.typing-pet.is-left-down .bongo-cat-paw-left,
.typing-pet.is-right-down .bongo-cat-paw-right,
.typing-pet.is-typing .bongo-cat-mouth { background-position-x: 100%; }
.typing-pet.is-left-down .bongo-cat-paw-left,
.typing-pet.is-right-down .bongo-cat-paw-right { transform: translateZ(0) scaleY(var(--pet-power-scale, 1)); }
.pet-typing-lab { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 28px; align-items: center; }
.pet-typing-lab > div { min-width: 0; }
.pet-typing-lab h2 { margin-bottom: 12px; }
.pet-typing-lab p { font-size: 13px; line-height: 1.8; }
.pet-typing-lab .field { margin: 12px 0 0; }
.pet-typing-lab .field input { font-size: 16px; }
.pet-typing-lab .typing-pet-host { margin: 0; }
.pet-typing-lab .typing-pet { grid-template-columns: 124px minmax(0, 1fr); padding-right: 12px; gap: 10px; }
#ranked-answer-form .typing-pet-host { margin: 0 0 18px; }
@media (max-width: 950px) {
  .pet-typing-lab { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 640px) {
  .typing-pet, .pet-typing-lab .typing-pet { grid-template-columns: 88px minmax(0, 1fr); gap: 9px; padding: 4px 10px 4px 4px; }
  .typing-pet-name strong { font-size: 16px; }
  .typing-pet .typing-pet-name { gap: 4px 7px; margin-top: 5px; }
  .typing-pet-name span, .typing-pet .typing-pet-status { font-size: 11px; }
  .typing-pet-foot { gap: 3px 8px; }
  .typing-pet-heading button { padding: 5px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-pet .bongo-cat-paw-left, .typing-pet .bongo-cat-paw-right, .typing-pet .bongo-cat-mouth, .typing-pet .bongo-cat-bundle-image { transition: none; }
}
