@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/fredoka.woff2) format('woff2');
}

:root {
  --pink: #ff5fa2;
  --pink-soft: #ff8fc7;
  --cream: #fff6e6;
  --ink: #4a3a5e;
  --sky: #8fd3fe;
  --mint: #7fdccb;
  --lemon: #ffd23f;
  --btn: clamp(46px, 13.5vh, 66px);
  --font: 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --emoji: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #ffd9ec; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; overflow: hidden; }
.screen.show { display: block; }
.screen.overlay { z-index: 50; }
.screen.show.enter { animation: screen-in .35s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ buttons */
.hud { position: absolute; display: flex; gap: 10px; align-items: center; z-index: 20; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud.top-left { left: calc(12px + var(--sl)); top: calc(10px + var(--st)); }
.hud.top-right { right: calc(12px + var(--sr)); top: calc(10px + var(--st)); }
.hud.bottom-left { left: calc(12px + var(--sl)); bottom: calc(10px + var(--sb)); }
.hud-btn {
  position: relative; width: var(--btn); height: var(--btn); border-radius: 50%; background: #fff;
  font-family: var(--emoji); font-size: calc(var(--btn) * .5); line-height: 1;
  box-shadow: 0 5px 0 rgba(74, 58, 94, .18), 0 8px 16px rgba(74, 58, 94, .18);
  display: grid; place-items: center; transition: transform .12s;
}
.hud-btn:active { transform: translateY(3px) scale(.95); }
.hud-btn.on { background: var(--lemon); }
.hud-btn.hot { background: #fff3b0; animation: pulse .5s ease-in-out infinite alternate; }
.badge { position: absolute; right: -4px; top: -4px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--pink); color: #fff; font: 700 14px/24px var(--font); }
.pill-btn {
  padding: 10px 22px; border-radius: 999px; background: #fff; font-weight: 600; font-size: 18px; color: var(--ink);
  box-shadow: 0 4px 0 rgba(74, 58, 94, .18); transition: transform .12s; white-space: nowrap;
}
.pill-btn:active { transform: translateY(3px); }
.pill-btn.ok { background: #5fd068; color: #fff; }
.pill-btn.danger { background: #ff5d6c; color: #fff; position: relative; overflow: hidden; }
.pill-btn.danger::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .45); transform: scaleX(0); transform-origin: left; }
.pill-btn.danger.holding::after { transform: scaleX(1); transition: transform 1.6s linear; }
.big-btn {
  padding: 14px 54px; border-radius: 999px; background: linear-gradient(#7be07f, #45c257); color: #fff; font-weight: 700;
  font-size: clamp(26px, 7vh, 40px); letter-spacing: .5px; box-shadow: 0 8px 0 #2f9a42, 0 16px 26px rgba(47, 154, 66, .35);
  animation: pulse 1s ease-in-out infinite alternate; text-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}
.big-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #2f9a42; animation: none; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); } }

/* ------------------------------------------------------------ title */
#title { background: linear-gradient(#8fd3fe 0%, #c9e9ff 38%, #ffe3f1 62%, #ffc4e1 100%); }
.title-sky { position: absolute; inset: 0; background:
  radial-gradient(ellipse 60% 26% at 20% 108%, #7fdc9a 0 99%, transparent 100%),
  radial-gradient(ellipse 60% 30% at 78% 112%, #ff9ecb 0 99%, transparent 100%),
  radial-gradient(ellipse 50% 22% at 50% 106%, #ffd76a 0 99%, transparent 100%); }
#title-floaters span { position: absolute; font-family: var(--emoji); animation: floaty 3s ease-in-out infinite alternate; opacity: .95; }
.title-card { position: absolute; left: 6%; top: 50%; transform: translateY(-52%); width: min(56%, 620px); display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 4vh, 28px); z-index: 2; }
.logo { display: flex; flex-direction: column; align-items: center; line-height: .95; transform: rotate(-3deg); }
.logo-top { font-weight: 700; font-size: clamp(30px, 9.5vh, 64px); color: #fff; -webkit-text-stroke: 10px #5b6ef5; paint-order: stroke fill; text-shadow: 0 6px 0 rgba(60, 60, 140, .25); }
.logo-main { font-weight: 700; font-size: clamp(44px, 16vh, 108px); color: #fff; -webkit-text-stroke: 14px var(--pink); paint-order: stroke fill; text-shadow: 0 8px 0 rgba(180, 40, 110, .3); white-space: nowrap; }
.title-note { margin: 0; font-size: clamp(12px, 3.4vh, 17px); font-weight: 500; color: #7a5a8a; background: rgba(255, 255, 255, .7); padding: 6px 16px; border-radius: 999px; }
#title-hero { position: absolute; right: 5%; bottom: 3%; height: 82%; aspect-ratio: 260 / 320; z-index: 1; }
#title-hero svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 12px 10px rgba(120, 60, 100, .22)); }
#title-hero .wave { animation: hero-bob 1.6s ease-in-out infinite alternate; transform-origin: 50% 100%; width: 100%; height: 100%; }
@keyframes hero-bob { from { transform: rotate(-2.5deg) translateY(0); } to { transform: rotate(2.5deg) translateY(-8px); } }
.install { position: absolute; right: calc(14px + var(--sr)); top: calc(12px + var(--st)); z-index: 3; }

/* ------------------------------------------------------------ map */
#map { background: #8fd3fe; }
#map-art { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; scrollbar-width: none; overscroll-behavior: contain; }
#map-art::-webkit-scrollbar { display: none; }
#map-art svg { display: block; height: 100%; width: auto; }
.place { cursor: pointer; }
.place .pin { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .15s; }
.place:active .pin, .place.go .pin { transform: scale(1.1); }
.map-arrow { position: absolute; top: 50%; margin-top: calc(var(--btn) / -2); z-index: 20; animation: pulse .8s ease-in-out infinite alternate; }
.map-arrow.left { left: calc(10px + var(--sl)); }
.map-arrow.right { right: calc(10px + var(--sr)); }
.brand { background: rgba(255, 255, 255, .92); padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: clamp(15px, 4.6vh, 22px); color: var(--pink); box-shadow: 0 4px 0 rgba(74, 58, 94, .15); }
.brand span { color: #5b6ef5; }
.map-hint { position: absolute; left: calc(14px + var(--sl)); bottom: calc(12px + var(--sb)); transform-origin: 0 100%; background: rgba(255, 255, 255, .92); padding: 8px 20px; border-radius: 999px; font-weight: 600; font-size: clamp(14px, 4.2vh, 19px); animation: pulse 1s ease-in-out infinite alternate; pointer-events: none; }

/* ------------------------------------------------------------ scene */
#scene { background: #2d3142; }
#viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.bg { position: absolute; left: 0; top: 0; }
.bg svg { display: block; }
.emo { font-family: var(--emoji); }
.nightshade { position: absolute; inset: 0; background: rgba(24, 22, 84, .52); opacity: 0; transition: opacity .5s; pointer-events: none; }
.night .nightshade { opacity: 1; }
.fxlayer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }

.fix, .ent { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.ent.drag { will-change: transform; }
.fix > svg, .ent svg.ch { position: absolute; overflow: visible; pointer-events: none; }
.fix svg svg { overflow: hidden; }
.fix svg *, .ent svg.ch * { pointer-events: visiblePainted; }
.fix.ghost svg *, .fix.glow svg * { pointer-events: none; }
.fix svg text { pointer-events: none; }
.fix.glow { opacity: .45; transition: opacity .4s; }
.night .fix.glow { opacity: 1; }
.fix.glow.day { opacity: .45; }

.ent .inner, .ent .hopper { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.item .g {
  position: absolute; text-align: center; font-family: var(--emoji); white-space: nowrap; transform-origin: 50% 100%;
  text-shadow: 0 4px 4px rgba(40, 30, 60, .2); transition: transform .12s; cursor: grab;
}
.item::before { content: ''; position: absolute; left: -38px; top: -76px; width: 76px; height: 82px; }
.item.drag .g { transform: scale(1.2) rotate(-6deg); text-shadow: 0 14px 10px rgba(40, 30, 60, .22); }
.item.press .g { transform: scale(1.1); }
.item[data-bites="1"] .g { -webkit-mask-image: radial-gradient(circle at 84% 20%, transparent 27%, #000 28%); mask-image: radial-gradient(circle at 84% 20%, transparent 27%, #000 28%); }
.item[data-bites="2"] .g { -webkit-mask-image: radial-gradient(circle at 80% 26%, transparent 38%, #000 39%); mask-image: radial-gradient(circle at 80% 26%, transparent 38%, #000 39%); }
.item[data-bites="3"] .g { -webkit-mask-image: radial-gradient(circle at 74% 30%, transparent 50%, #000 51%); mask-image: radial-gradient(circle at 74% 30%, transparent 50%, #000 51%); }
.item[data-bites="4"] .g { -webkit-mask-image: radial-gradient(circle at 70% 32%, transparent 60%, #000 61%); mask-image: radial-gradient(circle at 70% 32%, transparent 60%, #000 61%); }
.ent.float > .g, .ent.float > .inner { animation: floaty 2.2s ease-in-out infinite alternate; }
@keyframes floaty { from { transform: translateY(-5px) rotate(-3deg); } to { transform: translateY(5px) rotate(3deg); } }

.char svg.ch { cursor: grab; }
.tube { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.tube svg { position: absolute; left: -72px; top: -30px; overflow: visible; pointer-events: none; }
.tube svg * { pointer-events: visiblePainted; cursor: grab; }
.char.drag .hopper { animation: dangle .45s ease-in-out infinite alternate; transform-origin: 0 -150px; }
@keyframes dangle { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
.hop { animation: hop .45s ease-out; }
@keyframes hop { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.1, .88); } 50% { transform: translateY(-34px) scale(.95, 1.08); } 80% { transform: translateY(0) scale(1.08, .92); } 100% { transform: none; } }
.squash { animation: squash .28s ease-out; }
@keyframes squash { 0% { transform: scale(1.16, .84); } 60% { transform: scale(.96, 1.05); } 100% { transform: none; } }
.spin { animation: spin .7s ease-in-out; }
@keyframes spin { to { transform: rotate(720deg); } }
.item .g.hop, .item .g.squash, .item .g.spin { transform-origin: 50% 100%; }
.item .g.spin { transform-origin: 50% 50%; }

.inner.anim-swing { animation: swing 1.3s ease-in-out infinite alternate; transform-origin: 0 var(--pv); }
@keyframes swing { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
.inner.anim-bob { animation: boat 1.7s ease-in-out infinite alternate; }
@keyframes boat { from { transform: translateY(-5px); } to { transform: translateY(6px); } }
.inner.anim-rock { animation: rock 1.4s ease-in-out infinite alternate; transform-origin: 0 var(--pv); }
@keyframes rock { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.inner.anim-seesaw { animation: seesaw 1.2s ease-in-out infinite alternate; transform-origin: var(--px) var(--pv); }
@keyframes seesaw { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.inner.anim-carousel { animation: carousel 1.6s ease-in-out infinite alternate; }
@keyframes carousel { from { transform: translateX(-64px); } to { transform: translateX(64px); } }
.inner.anim-spring { animation: spring .5s ease-in-out infinite alternate; transform-origin: 0 var(--pv); }
@keyframes spring { from { transform: rotate(-9deg); } to { transform: rotate(9deg) translateY(-6px); } }
.a-rock { animation: rock 1.4s ease-in-out infinite alternate; }
.a-seesaw { animation: seesaw 1.2s ease-in-out infinite alternate; }
.a-carousel { animation: carousel 1.6s ease-in-out infinite alternate; }
.a-spring { animation: spring .5s ease-in-out infinite alternate; }
.a-rise { animation: a-rise 1.8s linear infinite; }
@keyframes a-rise { from { transform: translateY(0); opacity: .9; } to { transform: translateY(-70px); opacity: 0; } }
.word { position: absolute; transform: translate(-50%, -100%); background: #fff; color: var(--ink); padding: 6px 22px; border-radius: 999px; font: 700 34px/1.2 var(--font); white-space: nowrap; pointer-events: none; box-shadow: 0 4px 0 rgba(74, 58, 94, .18); animation: wordpop 1.7s ease-out forwards; }
@keyframes wordpop { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.5); } 12%, 80% { opacity: 1; transform: translate(-50%, -100%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -130%) scale(1); } }

/* faces */
.ch .e-closed, .ch .e-happy, .ch .e-wide, .ch .m-open, .ch .m-chew, .ch .m-flat, .ch .m-yuck, .ch .blush { display: none; }
.ch .legs-sit { display: none; }
.ch[data-pose="sit"] .legs-stand, [data-pose="sit"] > .inner .legs-stand { display: none; }
[data-pose="sit"] > .inner .legs-sit { display: inline; }
.ch .blink { animation: blink 4.2s infinite; transform-box: fill-box; transform-origin: 50% 60%; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
[data-face="happy"] > .inner .e-def, [data-face="chew"] > .inner .e-def { display: none; }
[data-face="happy"] > .inner .e-happy, [data-face="chew"] > .inner .e-happy { display: inline; }
[data-face="happy"] > .inner .m-def, [data-face="chew"] > .inner .m-def, [data-face="sleep"] > .inner .m-def, [data-face="wow"] > .inner .m-def, [data-face="yuck"] > .inner .m-def { display: none; }
[data-face="happy"] > .inner .m-open, [data-face="wow"] > .inner .m-open { display: inline; }
[data-face="chew"] > .inner .m-chew { display: inline; animation: chew .2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes chew { from { transform: scale(1, 1); } to { transform: scale(1.15, .35); } }
[data-face="sleep"] > .inner .e-def, [data-face="yuck"] > .inner .e-def, [data-face="wow"] > .inner .e-def { display: none; }
[data-face="sleep"] > .inner .e-closed, [data-face="yuck"] > .inner .e-closed { display: inline; }
[data-face="sleep"] > .inner .m-flat { display: inline; }
[data-face="wow"] > .inner .e-wide, [data-face="wow"] > .inner .blush { display: inline; }
[data-face="yuck"] > .inner .m-yuck { display: inline; }
.ch .tail { animation: wag .5s ease-in-out infinite alternate; transform-origin: 38px -30px; }
@keyframes wag { from { transform: rotate(-9deg); } to { transform: rotate(12deg); } }

.tag {
  position: absolute; left: 0; top: 8px; transform: translateX(-50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap;
  background: #fff; padding: 3px 14px; border-radius: 999px; font: 700 20px/1.3 var(--font); color: var(--ink); box-shadow: 0 3px 0 rgba(74, 58, 94, .16);
}
.tag.show { animation: tag 1.8s ease-out; }
@keyframes tag { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 10%, 80% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; transform: translateX(-50%) scale(.9); } }
.say { position: absolute; transform: translate(-50%, 0); font: 44px/1 var(--emoji); pointer-events: none; animation: say 1.7s ease-out forwards; }
@keyframes say { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.4); } 15%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -20px) scale(1); } }
.zzz { position: absolute; font: 34px/1 var(--emoji); pointer-events: none; animation: zzz 2.2s ease-in-out infinite; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 10px) scale(.6); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(26px, -40px) scale(1.15); } }
.puff { position: absolute; font-family: var(--emoji); line-height: 1; pointer-events: none; margin: -.5em 0 0 -.5em; animation: puff .9s ease-out forwards; }
@keyframes puff { 0% { opacity: 1; transform: translate(0, 0) scale(.4); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(1.15); } }
.flash { position: absolute; inset: 0; background: #fff; pointer-events: none; z-index: 30; animation: flash .32s ease-out forwards; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* little looping animations used inside the scenery */
.a-bob { animation: a-bob 1.4s ease-in-out infinite alternate; }
@keyframes a-bob { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
.a-pulse { animation: a-pulse .7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes a-pulse { from { opacity: .65; transform: scale(.94); } to { opacity: 1; transform: scale(1.05); } }
.a-flick { animation: a-flick .16s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes a-flick { from { transform: scale(1, .8); } to { transform: scale(.9, 1.12); } }
.a-flow { animation: a-flow .35s linear infinite; }
@keyframes a-flow { to { stroke-dashoffset: -38; } }
.a-spin { animation: a-spin .8s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes a-spin { to { transform: rotate(360deg); } }
.a-spin-slow { animation: a-spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
.a-tvx { animation: a-tvx 4s linear infinite; }
@keyframes a-tvx { from { transform: translateX(-50px); } to { transform: translateX(280px); } }
.a-swing { animation: swing 1.3s ease-in-out infinite alternate; }
.a-boat { animation: boat 1.7s ease-in-out infinite alternate; }
.a-drift { animation: a-drift 60s linear infinite; }
@keyframes a-drift { from { transform: translateX(-300px); } to { transform: translateX(1900px); } }
.a-surge { animation: a-surge 2.3s linear both; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes a-surge {
  0% { transform: translateX(var(--x0)) scaleY(.3); opacity: 0; }
  18% { transform: translateX(calc(var(--x0) + var(--dx) * .18)) scaleY(1); opacity: 1; }
  78% { transform: translateX(calc(var(--x0) + var(--dx) * .78)) scaleY(.8); opacity: 1; }
  100% { transform: translateX(calc(var(--x0) + var(--dx))) scaleY(.25); opacity: 0; }
}
.a-wave { animation: a-wave 2.6s ease-in-out infinite alternate; }
@keyframes a-wave { from { transform: translateX(-18px); } to { transform: translateX(18px); } }
.a-sway { animation: a-sway 2.8s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes a-sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
.a-flutter { animation: a-flutter 9s ease-in-out infinite alternate; }
@keyframes a-flutter { 0% { transform: translate(0, 0); } 25% { transform: translate(120px, -50px); } 50% { transform: translate(260px, 10px); } 75% { transform: translate(380px, -70px); } 100% { transform: translate(520px, -10px); } }
.a-twinkle { animation: a-pulse 1.2s ease-in-out infinite alternate; }

.scene-name { background: rgba(255, 255, 255, .92); padding: 6px 18px; border-radius: 999px; font-weight: 600; font-size: clamp(14px, 4.4vh, 20px); box-shadow: 0 4px 0 rgba(74, 58, 94, .15); }

/* characters tray */
.tray {
  position: absolute; left: calc(var(--btn) + 26px + var(--sl)); right: calc(12px + var(--sr)); bottom: calc(8px + var(--sb)); z-index: 20;
  display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: rgba(255, 255, 255, .94); border-radius: 26px;
  box-shadow: 0 5px 0 rgba(74, 58, 94, .15), 0 10px 20px rgba(74, 58, 94, .2); overflow-x: auto; overflow-y: hidden; touch-action: pan-x; scrollbar-width: none;
  animation: tray-in .25s ease-out;
}
.tray::-webkit-scrollbar { display: none; }
@keyframes tray-in { from { transform: translateY(120%); } to { transform: none; } }
.head-btn { flex: 0 0 auto; width: calc(var(--btn) * 1.05); display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; font-weight: 600; }
.head-btn .face { width: calc(var(--btn) * .95); height: calc(var(--btn) * .95); border-radius: 50%; background: #e9f6ff; border: 4px solid #fff; box-shadow: 0 0 0 3px #d8e4f0; overflow: hidden; display: block; }
.head-btn .face svg { width: 100%; height: 100%; display: block; }
.head-btn.here .face { box-shadow: 0 0 0 3px #5fd068; background: #e3f8e0; }
.head-btn:active .face { transform: scale(.93); }
.head-btn .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-btn.tool .face { display: grid; place-items: center; font: calc(var(--btn) * .42)/1 var(--emoji); background: #fff3b0; }

.panel {
  position: absolute; right: calc(12px + var(--sr)); top: calc(var(--btn) + 22px + var(--st)); z-index: 21; width: min(330px, 60vw);
  background: rgba(255, 255, 255, .96); border-radius: 24px; padding: 12px; box-shadow: 0 5px 0 rgba(74, 58, 94, .15), 0 10px 22px rgba(74, 58, 94, .22);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.panel .slot { aspect-ratio: 1; border-radius: 16px; background: #f1ecf7; display: grid; place-items: center; font: clamp(22px, 7vh, 34px)/1 var(--emoji); }
.panel .slot.full { background: #fff3b0; }
.panel .slot.full:active { transform: scale(.92); }
.panel .hint { grid-column: 1 / -1; text-align: center; font-size: 13px; font-weight: 500; color: #8a7a9a; margin: 0; }
.toast { position: absolute; left: 50%; top: calc(var(--btn) + 26px); transform: translateX(-50%); z-index: 25; background: var(--ink); color: #fff; padding: 8px 20px; border-radius: 999px; font-weight: 600; font-size: 17px; pointer-events: none; white-space: nowrap; animation: screen-in .2s ease-out; }

/* ------------------------------------------------------------ character studio */
#editor { background: linear-gradient(135deg, #ffe3f1, #dff1ff); display: none; flex-direction: column; }
#editor.show { display: flex; }
.ed-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--st)) calc(12px + var(--sr)) 6px calc(12px + var(--sl)); }
.ed-roster { flex: 1; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px; touch-action: pan-x; scrollbar-width: none; }
.ed-roster::-webkit-scrollbar { display: none; }
.ed-roster .head-btn { --btn: clamp(40px, 11vh, 56px); }
.ed-roster .head-btn.sel .face { box-shadow: 0 0 0 4px var(--pink); }
.ed-roster .nm { display: none; }
.ed-body { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 0 calc(12px + var(--sr)) calc(10px + var(--sb)) calc(12px + var(--sl)); }
.ed-stage { flex: 0 0 30%; max-width: 300px; min-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(255, 255, 255, .7); border-radius: 26px; padding: 8px; min-height: 0; }
.ed-preview { flex: 1; min-height: 0; width: 100%; position: relative; }
.ed-preview::before { content: ''; position: absolute; left: 22%; right: 22%; bottom: 3%; height: 7%; border-radius: 50%; background: rgba(74, 58, 94, .14); }
.ed-preview svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ed-name { width: 100%; max-width: 220px; text-align: center; font: 700 clamp(16px, 5vh, 22px) var(--font); color: var(--ink); border: 3px solid #e3d8f0; border-radius: 999px; padding: 4px 10px; background: #fff; outline: none; user-select: text; -webkit-user-select: text; }
.ed-name:focus { border-color: var(--pink-soft); }
.ed-name[readonly] { border-color: transparent; background: transparent; }
.ed-actions { display: flex; gap: 10px; --btn: clamp(38px, 10.5vh, 52px); }
.ed-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-tabs { display: flex; gap: 8px; --btn: clamp(40px, 11.5vh, 58px); }
.ed-tabs .hud-btn.sel { background: var(--pink-soft); transform: scale(1.06); }
.ed-options { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; background: rgba(255, 255, 255, .7); border-radius: 26px; padding: 10px 12px; touch-action: pan-y; }
.ed-options h3 { margin: 4px 2px 6px; font-size: 15px; font-weight: 600; color: #8a7a9a; text-transform: uppercase; letter-spacing: .6px; }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sw { width: clamp(34px, 10vh, 46px); height: clamp(34px, 10vh, 46px); border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 0 2px #dcd3e6; }
.sw.sel { box-shadow: 0 0 0 4px var(--pink); transform: scale(1.08); }
.th { width: clamp(58px, 17vh, 84px); height: clamp(58px, 17vh, 84px); border-radius: 18px; background: #fff; box-shadow: 0 0 0 2px #e6deef; overflow: hidden; display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.th svg { width: 100%; height: 100%; display: block; }
.th.sel { box-shadow: 0 0 0 4px var(--pink); }
.th.txt { width: auto; padding: 0 16px; height: clamp(38px, 11vh, 48px); border-radius: 999px; }

/* ------------------------------------------------------------ modals */
.modal { position: absolute; inset: 0; z-index: 60; background: rgba(74, 58, 94, .45); display: grid; place-items: center; padding: 12px; }
.modal-card { background: #fff; border-radius: 28px; padding: 16px 22px; width: min(440px, 94vw); max-height: 96%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; align-items: stretch; box-shadow: 0 10px 0 rgba(74, 58, 94, .2); touch-action: pan-y; }
.modal-card h2 { margin: 0; text-align: center; font-size: 24px; color: var(--pink); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 18px; font-weight: 500; }
.switch { width: 62px; height: 34px; border-radius: 17px; background: #d9d2e3; position: relative; transition: background .15s; }
.switch::after { content: ''; position: absolute; left: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 2px 3px rgba(0, 0, 0, .2); }
.switch.on { background: #5fd068; }
.switch.on::after { transform: translateX(28px); }
.fine { margin: 2px 0; font-size: 13px; font-weight: 400; color: #8a7a9a; text-align: center; line-height: 1.35; }
.modal-card .pill-btn.ok { align-self: center; }
.new-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.new-grid .th { width: 100%; height: auto; aspect-ratio: 1; flex-direction: column; }
.new-grid span { display: block; text-align: center; font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ------------------------------------------------------------ rotate hint */
#rotate { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: linear-gradient(#ff8fc7, #ffc4e1); color: #fff; font-weight: 600; font-size: 22px; text-align: center; padding: 20px; }
#rotate p { margin: 0; text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.rotate-phone { font: 84px/1 var(--emoji); animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 900px) { #rotate { display: flex; } }

@media (prefers-reduced-motion: reduce) {
  .big-btn, .map-hint, #title-floaters span { animation: none; }
}
