/* 941 × 1672 shell. Each hero family shares one canvas size and position. */
#screen-my-buddy{align-items:center;justify-content:center;height:var(--buddy-viewport-height,100dvh);background:#a4d96c;isolation:isolate;overflow:clip;}
#screen-my-buddy::before{content:"";position:absolute;inset:-24px;z-index:-1;background:url("images/my-buddy/03_NEW_PRODUCTION_ASSETS/01_Scene_Background/SW_MB_Scene01_Sunny_Meadow.png?v=20260923.1") center/cover;filter:blur(16px);}
.buddy-stage{position:relative;flex:none;height:min(100%,var(--buddy-stage-height,177.68vw));max-width:100%;aspect-ratio:941/1672;container-type:inline-size;overflow:clip;color:#552408;font-family:"Baloo 2","Nunito",sans-serif;}
.buddy-stage [hidden]{display:none!important;}
.buddy-background{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
.buddy-stage img{user-select:none;pointer-events:none;}
.buddy-stage button:focus-visible{outline:.45cqw solid #6c421d;outline-offset:.4cqw;}
/* Header controls and footer reuse the current Profile classes and coordinates. */
.buddy-header h1{position:absolute;left:20cqw;top:calc(var(--buddy-visible-top,47.815630cqw) - 50px);width:60cqw;transform:translateY(-100%);display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.05;}
#buddy-name{position:relative;max-width:100%;padding:.6cqw;font-family:"Baloo 2","Nunito",sans-serif;font-size:10cqw;font-weight:800;line-height:1.05;overflow-wrap:anywhere;color:#f3727e;-webkit-text-stroke:0;text-shadow:none;pointer-events:auto;}
#buddy-name::after{content:"";position:absolute;left:-10%;bottom:0;width:120%;aspect-ratio:2172/724;transform:translateY(50%);background:#ffc438;-webkit-mask:url("images/stickerbook/SW_SB_BrushUnderline_SHAPE_FINAL.png?v=20260923.1") center/contain no-repeat;mask:url("images/stickerbook/SW_SB_BrushUnderline_SHAPE_FINAL.png?v=20260923.1") center/contain no-repeat;pointer-events:none;}
.buddy-name-letter{color:var(--buddy-name-ink);-webkit-text-fill-color:var(--buddy-name-ink);-webkit-text-stroke:.7cqw #fff9ed;paint-order:stroke fill;}
.buddy-star-art{display:inline-block;position:relative;width:6cqw;height:6cqw;flex:none;}
.buddy-star-art img{position:absolute;inset:-.6cqw;width:7.2cqw;height:7.2cqw;}
.buddy-speech{position:absolute;left:var(--buddy-speech-left,72cqw);top:calc(var(--buddy-speech-center-y,35.26cqw) - 7.5cqw);width:25cqw;height:15cqw;padding:1.2cqw;display:flex;justify-content:center;align-items:center;text-align:center;font-size:3.6cqw;font-weight:700;line-height:1.1;z-index:3;pointer-events:none;}
/* One continuous outline joins the rounded frame to its sharp lower-left tail. */
.buddy-speech-frame{position:absolute;inset:0;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 .4cqw .3cqw #61331912);}
#buddy-speech-shape{fill:#fff9ed;stroke:#dbc6aa;stroke-width:6;stroke-linejoin:miter;}
.buddy-speech-rim{fill:none;stroke:#f5e5cc;stroke-width:2;stroke-linejoin:miter;}
#buddy-speech{position:relative;width:85%;transform:translate(.6cqw,-.4cqw) rotate(-1deg);}
.buddy-hero{position:absolute;left:10cqw;top:37.2cqw;width:80cqw;height:59cqw;z-index:2;touch-action:manipulation;}
.buddy-egg{position:absolute;left:8cqw;top:0;width:64cqw;height:64cqw;object-fit:contain;z-index:2;}
.buddy-hatch-shells img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}
.buddy-shell-top{z-index:1;}
.buddy-hatch-glow{position:absolute;left:29cqw;top:15cqw;width:22cqw;height:16cqw;border-radius:50%;background:radial-gradient(ellipse,#fffbd3 8%,#ffe49a88 42%,#ffc45b00 72%);z-index:1;pointer-events:none;}
.buddy-nest{position:absolute;left:-3.6cqw;top:12.7cqw;width:87.2cqw;height:auto;z-index:1;}
/* Same nest bitmap at the same size: rear rim behind egg, front rim in front. */
.buddy-nest-front{z-index:3;clip-path:inset(64% 0 0 0);}
.buddy-hatchling{position:absolute;left:13.75cqw;top:7cqw;width:52.5cqw;height:52.5cqw;}
.buddy-hero.reacting{animation:buddy-bounce .65s ease;}
.buddy-hero.feeding{animation:buddy-feed .75s ease;}
/* Hatch only its independent layers. The Hero and both Nest anchors stay fixed. */
.buddy-hero.hatching .buddy-hatch-shells{animation:buddy-shell-shake 350ms ease;}
.buddy-hero.hatching .buddy-shell-top{animation:buddy-shell-lift 1850ms ease-in-out forwards;}
.buddy-hero.hatching .buddy-shell-base{animation:buddy-shell-fade 1850ms ease-in-out forwards;}
.buddy-hero.hatching .buddy-hatch-glow{animation:buddy-warm-glow 1850ms ease-in-out forwards;}
.buddy-hero.hatching .buddy-hatchling{animation:buddy-emerge 1850ms ease-in-out forwards;z-index:1;}
.buddy-hero.hatching .buddy-nest{animation:buddy-shell-fade 1850ms ease-in-out forwards;}
.buddy-hero.celebrating .buddy-hatchling{animation:buddy-celebrate 800ms ease;}
/* The current 8% content margins and Hero anchor stay in stage coordinates. */
.buddy-controls{position:absolute;left:8cqw;top:calc(96cqw + 7px);width:84cqw;aspect-ratio:726/452;container-type:inline-size;z-index:3;--buddy-unit:calc(100cqw / 726);}
/* Every local coordinate, size, radius and gap below uses this same W / 726 unit. */
.buddy-growth{position:absolute;inset:0;pointer-events:none;}
.buddy-growth-copy{position:absolute;left:calc(224 * var(--buddy-unit));top:0;width:calc(283 * var(--buddy-unit));height:calc(68 * var(--buddy-unit));margin:0;padding:0;border-radius:calc(34 * var(--buddy-unit));background:#fff9edef;font-size:calc(42 * var(--buddy-unit));font-weight:700;line-height:1;}
.buddy-growth-copy .buddy-star-art{position:absolute;left:calc(46 * var(--buddy-unit));top:calc(8 * var(--buddy-unit));width:calc(51 * var(--buddy-unit));height:calc(50 * var(--buddy-unit));}
#buddy-progress-text{position:absolute;left:calc(108 * var(--buddy-unit));top:calc(12 * var(--buddy-unit));width:calc(133 * var(--buddy-unit));height:calc(44 * var(--buddy-unit));display:flex;align-items:center;justify-content:center;white-space:nowrap;}
.buddy-progress{position:absolute;left:calc(68 * var(--buddy-unit));top:calc(65 * var(--buddy-unit));width:calc(593 * var(--buddy-unit));height:calc(62 * var(--buddy-unit));padding:0;border:0;border-radius:calc(31 * var(--buddy-unit));background:#fff9ed;box-shadow:inset 0 0 0 calc(2 * var(--buddy-unit)) #d9b994,0 calc(4 * var(--buddy-unit)) calc(3 * var(--buddy-unit)) #61331915;}
.buddy-progress-track{position:absolute;left:calc(10 * var(--buddy-unit));top:calc(10 * var(--buddy-unit));width:calc(573 * var(--buddy-unit));height:calc(42 * var(--buddy-unit));border-radius:calc(21 * var(--buddy-unit));overflow:hidden;}
#buddy-progress-fill{height:100%;background:linear-gradient(#ffe660,#ffbf28);transition:width .45s ease;width:0;}
.buddy-feed{position:absolute;left:calc(49 * var(--buddy-unit));top:calc(143 * var(--buddy-unit));width:calc(631 * var(--buddy-unit));height:calc(130 * var(--buddy-unit));padding:0;border:0;border-radius:calc(65 * var(--buddy-unit));background:linear-gradient(#ffec86,#ffd442);box-shadow:inset 0 0 0 calc(2.5 * var(--buddy-unit)) #d59b31,inset 0 calc(2 * var(--buddy-unit)) #fff9c7,0 calc(5 * var(--buddy-unit)) calc(2 * var(--buddy-unit)) #b67f2240;font-size:calc(54 * var(--buddy-unit));font-weight:800;touch-action:none;-webkit-user-select:none;-webkit-touch-callout:none;user-select:none;}
.buddy-feed .buddy-star-art{position:absolute;left:calc(68 * var(--buddy-unit));top:calc(26 * var(--buddy-unit));width:calc(78 * var(--buddy-unit));height:calc(78 * var(--buddy-unit));}
.buddy-feed-balance{position:absolute;left:calc(159 * var(--buddy-unit));top:calc(39 * var(--buddy-unit));width:calc(88 * var(--buddy-unit));height:calc(52 * var(--buddy-unit));display:flex;align-items:center;justify-content:center;background:transparent;font-size:min(calc(40 * var(--buddy-unit)),calc(120 * var(--buddy-unit) / var(--buddy-balance-digits,1)));font-weight:800;line-height:1;white-space:nowrap;}
.buddy-feed-label{position:absolute;left:calc(272 * var(--buddy-unit));top:calc(31 * var(--buddy-unit));width:calc(303 * var(--buddy-unit));height:calc(68 * var(--buddy-unit));display:flex;align-items:center;justify-content:center;line-height:1;white-space:nowrap;}
.buddy-control-art img{position:absolute;inset:auto;object-fit:contain;}
.buddy-feed:disabled{opacity:.74;cursor:default;}
.buddy-feed:active:not(:disabled){transform:translateY(.4cqw);}
.buddy-help{position:absolute;width:1px;height:1px;padding:0;border:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.buddy-worlds{position:absolute;left:calc(32 * var(--buddy-unit));top:calc(294 * var(--buddy-unit));width:calc(667 * var(--buddy-unit));height:calc(158 * var(--buddy-unit));padding:0;border:0;border-radius:calc(42 * var(--buddy-unit));background:#fff9ed;box-shadow:inset 0 0 0 calc(2 * var(--buddy-unit)) #dec59e,0 calc(4 * var(--buddy-unit)) calc(3 * var(--buddy-unit)) #61331915;text-align:left;}
.buddy-worlds-logo{position:absolute;left:calc(26 * var(--buddy-unit));top:calc(22 * var(--buddy-unit));width:calc(242 * var(--buddy-unit));height:calc(120 * var(--buddy-unit));}
.buddy-worlds-divider{position:absolute;left:calc(288 * var(--buddy-unit));top:calc(29 * var(--buddy-unit));width:calc(2 * var(--buddy-unit));height:calc(103 * var(--buddy-unit));background:#dec59e;}
.buddy-worlds-copy{position:absolute;left:calc(317 * var(--buddy-unit));top:calc(48 * var(--buddy-unit));width:calc(249 * var(--buddy-unit));height:calc(64 * var(--buddy-unit));display:flex;align-items:center;justify-content:flex-start;font-size:calc(24 * var(--buddy-unit));font-weight:700;line-height:1.2;white-space:nowrap;}
.buddy-worlds-scenes{position:absolute;left:calc(317 * var(--buddy-unit));top:calc(22 * var(--buddy-unit));width:calc(249 * var(--buddy-unit));height:calc(120 * var(--buddy-unit));display:flex;align-items:center;gap:calc(9 * var(--buddy-unit));pointer-events:none;}
.buddy-worlds-scene{display:flex;align-items:center;justify-content:center;flex:1;min-width:0;height:100%;border:calc(1.5 * var(--buddy-unit)) solid #dec59e;border-radius:calc(10 * var(--buddy-unit));background:#fff8e9;overflow:hidden;}
.buddy-worlds-scene img{display:block;width:100%;height:100%;object-fit:contain;}
.buddy-worlds-arrow{position:absolute;left:calc(582 * var(--buddy-unit));top:calc(49 * var(--buddy-unit));width:calc(65 * var(--buddy-unit));height:calc(65 * var(--buddy-unit));display:grid;place-items:center;border-radius:50%;background:linear-gradient(#ffec86,#ffd442);box-shadow:inset 0 0 0 calc(2 * var(--buddy-unit)) #d59b31;}
.buddy-worlds-arrow svg{width:calc(18 * var(--buddy-unit));height:calc(28 * var(--buddy-unit));fill:none;stroke:#8c441a;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;}
.buddy-worlds:disabled{cursor:default;}
.buddy-worlds:active:not(:disabled){transform:scale(.98);}
.buddy-effects{position:absolute;inset:0;z-index:5;pointer-events:none;}
.buddy-flying-star{position:absolute;left:27cqw;top:117cqw;width:8cqw;height:8cqw;animation:buddy-star-flight .75s ease-in forwards;}
.buddy-flying-star:nth-child(2){animation-delay:.08s;left:45cqw;}
.buddy-flying-star:nth-child(3){animation-delay:.16s;left:62cqw;}
.buddy-hero.feeding-continuous{animation:buddy-feed var(--buddy-feed-beat,630ms) ease infinite;}
.buddy-effects.is-continuous .buddy-flying-star{animation-duration:.7s;animation-iteration-count:infinite;}
.buddy-dialog{border:2px solid #dec59e;border-radius:24px;margin:auto;width:min(90vw,440px);padding:24px;background:#fff9ed;color:#552408;font:600 18px "Nunito",sans-serif;box-shadow:0 12px 50px #44240930;}
.buddy-dialog::backdrop{background:#3a39154f;backdrop-filter:blur(3px);}
.buddy-dialog h2{font:800 30px "Baloo 2",sans-serif;margin-bottom:12px;line-height:1.1;}
.buddy-dialog p{line-height:1.5;}
.buddy-dialog label{display:block;margin-bottom:8px;}
.buddy-dialog input{width:100%;padding:12px;border:2px solid #dec59e;border-radius:12px;background:white;color:#552408;font:700 22px "Nunito",sans-serif;user-select:text;}
#buddy-name-count{font-size:14px;margin-top:6px;}
.buddy-dialog-status{color:#a43b26;font-size:15px;min-height:24px;margin-top:6px;}
.buddy-dialog-actions{display:flex;gap:12px;justify-content:flex-end;margin-top:18px;}
.buddy-dialog-actions button{min-height:44px;padding:10px 16px;border-radius:12px;background:#eddfc9;font-weight:800;}
.buddy-dialog-actions button:last-child{background:#ffd653;}
@keyframes buddy-bounce{0%,100%{transform:translateY(0);}40%{transform:translateY(-1.8cqw) rotate(-1deg);}70%{transform:translateY(-.5cqw) rotate(1deg);}}
@keyframes buddy-feed{0%,100%{transform:rotate(0);}30%{transform:rotate(-1.5deg);filter:drop-shadow(0 0 2cqw #ffec7a);}60%{transform:rotate(1.5deg);}}
@keyframes buddy-shell-shake{0%,100%{transform:rotate(0);}20%,60%{transform:rotate(-1.4deg);}40%,80%{transform:rotate(1.4deg);}}
@keyframes buddy-shell-lift{0%,19%{transform:translateY(0);opacity:1;}43%,66%{transform:translateY(-3cqw);opacity:1;}88%,100%{transform:translateY(-3cqw);opacity:0;}}
@keyframes buddy-shell-fade{0%,66%{opacity:1;}90%,100%{opacity:0;}}
@keyframes buddy-warm-glow{0%{opacity:0;transform:scale(.8);}35%,65%{opacity:1;transform:scale(1.3);}100%{opacity:0;transform:scale(1.4);}}
@keyframes buddy-emerge{0%,38%{opacity:0;transform:translateY(13cqw);clip-path:inset(0 0 70% 0);}43%{opacity:1;clip-path:inset(0 0 70% 0);}68%{opacity:1;transform:translateY(0);clip-path:inset(0 0 60% 0);}90%,100%{opacity:1;transform:translateY(0);clip-path:inset(0);}}
@keyframes buddy-celebrate{0%,100%{transform:translateY(0);}35%{transform:translateY(-2cqw);}65%{transform:translateY(-.5cqw);}}
@keyframes buddy-star-flight{0%{opacity:1;transform:translate(0,0) scale(1);}85%{opacity:1;}100%{opacity:0;left:46cqw;top:65cqw;transform:rotate(30deg) scale(.4);}}
@media(prefers-reduced-motion:reduce){.buddy-hero,.buddy-flying-star,.buddy-hero.hatching *,.buddy-hero.celebrating *{animation:none!important;}#buddy-progress-fill{transition:none;}.buddy-flying-star{display:none;}.buddy-hero.hatching .buddy-hatchling{opacity:0;}.buddy-hatch-glow{display:none;}}

/* Buddy identity belongs with its name, separate from the player's avatar. */
#buddy-rename-dialog{max-height:92dvh;overflow-y:auto;}
.buddy-avatar-setting{display:flex;align-items:center;gap:16px;padding:10px 14px;margin:0 0 18px;border:2px solid #dec59e;border-radius:16px;background:#fff;}
.buddy-avatar-setting img{display:block;width:86px;height:86px;object-fit:contain;flex:none;}
.buddy-avatar-setting-label{display:block;font-size:14px;color:#81634c;margin-bottom:4px;}
.buddy-avatar-setting strong{display:block;font-size:20px;}
@media(max-height:580px){.buddy-avatar-setting{margin-bottom:10px;padding:6px 12px;}.buddy-avatar-setting img{width:60px;height:60px;}}

/* Anchor the meadow behind the character and keep the art fixed during scroll. */
html:not([data-ui-platform="ipad"]) body #screen-my-buddy {
  --buddy-meadow: url("ui-assets/my-buddy-habitat-20261118/my-buddy-phone.png");
  --buddy-meadow-height: max(134%, calc(100vw * 1846 / 852));
}
html[data-ui-platform="ipad"] body #screen-my-buddy {
  --buddy-meadow: url("ui-assets/my-buddy-habitat-20261118/my-buddy-portrait.png");
  --buddy-meadow-height: max(122%, calc(100vw * 1448 / 1086));
}
html:not([data-ui-platform="ipad"]) body #screen-my-buddy,
html[data-ui-platform="ipad"] body #screen-my-buddy {
  background: #b8df70 var(--buddy-meadow) center bottom / auto var(--buddy-meadow-height) no-repeat !important;
}
@media (orientation: landscape) {
  html[data-ui-platform="ipad"] body #screen-my-buddy {
    --buddy-meadow: url("ui-assets/my-buddy-habitat-20261118/my-buddy-landscape.png");
    --buddy-meadow-height: max(100%, calc(100vw * 1024 / 1536));
  }
}
#screen-my-buddy::before,
#screen-my-buddy .buddy-background {
  display: none !important;
}
