@font-face { font-family: 'andika'; src: url('../munch/fonts/andika-bold.woff2') format('woff2'); font-weight: 700 900; font-display: block; }
@font-face { font-family: 'andika'; src: url('../munch/fonts/andika-regular.woff2') format('woff2'); font-weight: 400 600; font-display: block; }

:root { --ink: #3a1a5c; --paper: #fff6fc; --pink: #ff5ab0; --hot: #ff3f9a; --lilac: #b98aff; --sky: #5ad8f0; --mint: #5fe0a6; --lemon: #ffe14a; --letters: 'andika', 'Century Gothic', system-ui, sans-serif;
  --rainbow: linear-gradient(90deg, #ff4fa3, #ff7ad9, #c86bff, #7a7bff, #45c8ff, #3fe8c8, #b6f25a, #ffe14a, #ffa84a); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--letters); font-weight: 700; color: var(--ink); background: #ffb0dc; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
img, canvas { image-rendering: pixelated; }
#app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; }
.screen[data-active] { display: block; }

/* the frame everything wears: a stepped plum outline, a white inner line and a candy shine */
.pbox, .pbtn, .say-box, .wordbtn, .opts button, .shopitem, .friendship {
  background: linear-gradient(#ffffff, #fff0fa);
  box-shadow: inset 0 0 0 2px #fff, inset 0 -3px 0 2px #ffc8e8, 0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink), 3px 6px 0 #3a1a5c44;
}
.pbox { padding: 3px 9px; font-size: 18px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.pbox img { width: 26px; height: 26px; }
.pbtn { width: 46px; height: 46px; font-size: 24px; display: grid; place-items: center; position: relative; flex: none; }
.pbtn img { width: 30px; height: 30px; }
.pbtn:active { transform: translateY(3px); }
.pbtn b { position: absolute; right: -8px; bottom: -8px; background: var(--pink); color: #fff; box-shadow: 0 0 0 3px var(--ink); font-size: 13px; padding: 0 4px; line-height: 1.3; }

/* ───────── walking ───────── */
#map { position: absolute; left: 0; top: 0; }
.hud { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; z-index: 5; flex-wrap: wrap; }
.hud #to-album { margin-left: auto; }
.area-name { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); background: linear-gradient(90deg, #ff5ab0, #b070ff); color: #fff; padding: 5px 18px; font-size: 22px; z-index: 5; opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; box-shadow: 0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink); }
.area-name.show { opacity: 1; }

.dpad { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); width: 186px; height: 186px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); z-index: 6; touch-action: none; }
.dpad button { background: #fff6fcd9; color: var(--pink); box-shadow: 0 0 0 3px var(--ink); font-size: 26px; touch-action: none; }
.dpad button.on { background: var(--pink); color: #fff; }
.dpad [data-dir=up] { grid-area: 1 / 2; } .dpad [data-dir=left] { grid-area: 2 / 1; } .dpad [data-dir=right] { grid-area: 2 / 3; } .dpad [data-dir=down] { grid-area: 3 / 2; }
.abtn { position: absolute; right: max(26px, env(safe-area-inset-right)); bottom: max(46px, env(safe-area-inset-bottom)); width: 92px; height: 92px; background: radial-gradient(circle at 35% 30%, #ff9ad5, #ff3f9a 70%); color: #fff; font-size: 42px; border-radius: 50%; box-shadow: 0 0 0 4px var(--ink), 0 7px 0 4px #3a1a5c55; z-index: 6; display: grid; place-items: center; }
.abtn img { width: 62px; height: 62px; }
.abtn:active { transform: translateY(4px); }
@media (max-width: 480px) { .dpad { width: 156px; height: 156px; } .abtn { width: 78px; height: 78px; font-size: 36px; } .abtn img { width: 52px; height: 52px; } .pbox { font-size: 15px; padding: 2px 6px; } .hud { gap: 10px; } .pbtn { width: 40px; height: 40px; font-size: 20px; } }

@media (max-height: 480px) { .dpad { width: 132px; height: 132px; font-size: 20px; } .dpad button { font-size: 20px; } .abtn { width: 72px; height: 72px; font-size: 32px; bottom: max(24px, env(safe-area-inset-bottom)); } .abtn img { width: 48px; height: 48px; } .pbox { font-size: 15px; padding: 2px 6px; } .pbtn { width: 38px; height: 38px; font-size: 19px; } .area-name { top: 62px; font-size: 18px; } }

.say-box { position: absolute; left: 22px; right: 22px; top: 120px; z-index: 8; padding: 14px 20px; font-size: clamp(20px, 3.4vw, 30px); line-height: 1.25; max-width: 760px; margin: 0 auto; cursor: pointer; }
.say-box::after { content: '♥'; float: right; color: var(--pink); font-size: .8em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.abtn.shell { background: radial-gradient(circle at 35% 30%, #d6faff, #45c8ff 70%); animation: pulse 1s steps(3) infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.shell-cue { position: absolute; left: 50%; top: calc(50% + 50px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 2px 18px; font-size: 26px; z-index: 7; pointer-events: none; }
.shell-cue.now { background: var(--lemon); color: var(--ink); font-size: 44px; animation: pulse .4s steps(2) infinite; box-shadow: 0 0 0 4px var(--ink); }
.shell-cue[hidden] { display: none; }

/* ───────── reading to a friend ───────── */
#meet { display: none; flex-direction: column; background: var(--ink); }
#meet[data-active] { display: flex; }
.field { position: relative; flex: 1; min-height: 0; overflow: hidden; container-type: size; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.sprite { position: absolute; image-rendering: pixelated; }
.foe { left: 72%; top: 68%; width: min(62cqh, 46cqw); height: min(62cqh, 46cqw); transform: translate(-50%, -88%); transition: opacity .25s; }
.me { left: 18%; top: 90%; height: min(46cqh, 38cqw); width: auto; transform: translate(-50%, -92%); }
.mine { left: 37%; top: 95%; width: min(30cqh, 26cqw); height: min(30cqh, 26cqw); transform: translate(-50%, -90%) scaleX(-1); }
.friendship { position: absolute; left: 12px; top: max(10px, env(safe-area-inset-top)); padding: 5px 12px 7px; z-index: 2; max-width: calc(100% - 24px); }
.friendship b { display: block; font-size: clamp(18px, 3vw, 24px); line-height: 1.15; margin-bottom: 2px; }
.hearts { display: flex; flex-wrap: wrap; gap: 1px; }
.hearts img { width: clamp(22px, 4vw, 32px); height: clamp(22px, 4vw, 32px); }
.hearts img.pop { animation: heartpop .4s steps(5); }
@keyframes heartpop { 40% { transform: scale(1.5); } }

.panel { position: relative; flex: none; background: radial-gradient(circle at 20% 20%, #fff 0 1px, transparent 2px) 0 0 / 22px 22px, linear-gradient(#ffe6f6, #f6e0ff); box-shadow: 0 -4px 0 var(--ink), inset 0 4px 0 #fff; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); min-height: 214px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.prompt { text-align: center; font-size: clamp(30px, 8vw, 58px); line-height: 1.05; min-height: 1em; }
.prompt.note { font-size: clamp(20px, 4vw, 30px); color: #7a4a9a; }
.choices { display: flex; justify-content: center; align-items: stretch; flex-wrap: wrap; gap: 16px; margin: 4px 0; }
.wordbtn { min-width: 110px; padding: 10px 18px; font-size: clamp(32px, 7vw, 52px); line-height: 1.1; text-align: center; }
.wordbtn.long { min-width: 0; padding: 8px 12px; font-size: clamp(25px, 6vw, 42px); }
.wordbtn:active { transform: translateY(3px); }
.wordbtn.pic { font-size: clamp(44px, 10vw, 72px); }
.wordbtn.wrong { opacity: .35; pointer-events: none; animation: wob .35s; }
.wordbtn.hint { animation: glow .8s steps(3) infinite; }
@keyframes wob { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes glow { 50% { background: var(--lemon); } }
.tools { display: flex; justify-content: center; gap: 18px; margin-top: 2px; }
.tools[hidden], .tools .pbtn[hidden] { display: none; }
.thrown { position: fixed; width: 52px; height: 52px; z-index: 40; pointer-events: none; image-rendering: pixelated; }
@media (max-height: 520px) and (min-width: 560px) {
  #meet[data-active] { flex-direction: row; }
  .panel { width: 46%; min-height: 0; box-shadow: -4px 0 0 var(--ink), inset 4px 0 0 #fff; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px 14px; gap: 6px; }
  .prompt { font-size: clamp(26px, 8vh, 44px); }
  .wordbtn { min-width: 84px; padding: 6px 12px; font-size: clamp(24px, 9vh, 40px); }
  .wordbtn.pic { font-size: clamp(32px, 12vh, 54px); }
  .choices { gap: 12px; }
}

.flash { position: absolute; inset: 0; background: #fff0fa; z-index: 60; opacity: 0; pointer-events: none; }

/* ───────── title ───────── */
#title { text-align: center; overflow: hidden; }
#title-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.logo { position: relative; margin: 0; padding-top: max(3vh, env(safe-area-inset-top)); font-size: clamp(56px, 12.5vw, 118px); line-height: .9; }
.logo span { display: table; margin: 0 auto -.2em; padding: 0 .08em .2em; background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)) drop-shadow(0 5px 0 var(--ink)); }
.parade { position: relative; display: flex; justify-content: center; gap: 1vmin; margin: 2vh auto 1vh; height: min(25vmin, 190px); }
.parade img { height: 100%; animation: hop 1.2s steps(4) infinite; }
.parade img:nth-child(2n) { animation-delay: .3s; } .parade img:nth-child(3n) { animation-delay: .6s; }
@keyframes hop { 50% { transform: translateY(-10px); } }
.play { position: relative; width: 110px; height: 110px; background: radial-gradient(circle at 35% 30%, #ff9ad5, #ff3f9a 70%); color: #fff; box-shadow: inset 0 0 0 3px #ffd6ec, 0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink), 4px 9px 0 #3a1a5c55; font-size: 50px; }
.play:active { transform: translateY(4px); }
.play.small { width: 84px; height: 84px; font-size: 38px; flex: none; }
.credit { position: absolute; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); color: var(--ink); font-size: 15px; text-decoration: none; }
.prompt.picq { font-size: clamp(48px, min(14vw, 16vh), 96px); }
.prompt img.who { height: clamp(44px, 9vh, 72px); width: auto; image-rendering: pixelated; vertical-align: middle; }
.voices { position: absolute; left: 12px; top: max(12px, env(safe-area-inset-top)); color: var(--ink); font-size: 14px; }
.grownup { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); color: var(--ink); font-size: 14px; text-decoration: underline; }

/* ───────── getting dressed ───────── */
#maker { background: linear-gradient(#ff9ad5, #b98aff 70%, #7a7bff); color: #fff; overflow-y: auto; touch-action: pan-y; }
.maker-body { min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 14px 24px; }
.maker-body h2 { margin: 0; font-size: clamp(30px, 7vw, 48px); text-shadow: 0 3px 0 var(--ink); }
.big-me { position: static; height: min(26vh, 190px); width: auto; flex: none; filter: drop-shadow(0 6px 0 #3a1a5c44); }
.opts { display: flex; flex-direction: column; gap: 14px; width: min(680px, 100%); }
.optrow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 11px; }
.opts button { width: 54px; height: 54px; padding: 0; display: grid; place-items: center; overflow: hidden; font-size: 22px; }
.opts button img { height: 50px; }
.opts button[aria-pressed=true] { box-shadow: inset 0 0 0 2px #fff, 0 -3px 0 var(--lemon), 0 3px 0 var(--lemon), -3px 0 0 var(--lemon), 3px 0 0 var(--lemon), 0 0 0 7px var(--ink); }

/* ───────── pop-ups ───────── */
.overlay { position: absolute; inset: 0; background: linear-gradient(#5a2a9acc, #3a1a5cf0); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; touch-action: pan-y; }
.overlay[hidden] { display: none; }
.ov-body { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(680px, 100%); max-height: 100%; color: #fff; text-align: center; }
.ov-body h2 { margin: 0; font-size: clamp(28px, 6vw, 42px); }
.ov-money { display: flex; gap: 14px; color: var(--ink); }
.ov-row { display: flex; gap: 16px; color: var(--ink); align-items: center; flex-wrap: wrap; justify-content: center; }
.ov-row .pbtn { width: auto; min-width: 56px; padding: 0 14px; }

/* boutique */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px; width: 100%; color: var(--ink); overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; touch-action: pan-y; flex: 1; min-height: 0; }
.shopitem { padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; }
.shopitem:active { transform: translateY(3px); }
.shopitem img { height: 76px; }
.shopitem b { font-size: 14px; line-height: 1.1; min-height: 2.2em; display: grid; place-items: center; }
.shopitem span { font-size: 17px; color: #a03ad0; display: flex; align-items: center; gap: 3px; }
.shopitem span img { width: 18px; height: 18px; }
.shopitem.owned span { color: #1fa86a; }
.shopitem.wearing span { color: var(--hot); }
.shopitem.wearing { background: linear-gradient(#fff9c8, #ffe878); }

/* friend cards: foil stickers */
.card { --c: #ff9ad5; --bg: #ffe6f6; width: 100%; aspect-ratio: 5 / 7; background: var(--c); box-shadow: inset 0 0 0 2px #ffffff99, 0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink); padding: 6px; color: var(--ink); text-align: left; display: flex; flex-direction: column; position: relative; cursor: pointer; }
.card .face { position: relative; overflow: hidden; flex: 1; min-height: 0; background: var(--paper); box-shadow: inset 0 0 0 2px var(--ink); display: flex; flex-direction: column; padding: 3px; }
.card .top { padding: 2px 5px; }
.card .nm { display: block; font-size: 1.3em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .art { flex: 1; min-height: 0; margin: 0 3px; background: radial-gradient(circle at 50% 45%, #fff 0, var(--bg) 62%); box-shadow: inset 0 0 0 2px var(--ink); display: grid; place-items: center; }
.card .art img { width: 92%; height: 92%; object-fit: contain; }
.card .bot { display: flex; justify-content: space-between; padding: 2px 5px; font-size: .8em; color: #c83a90; }
.card.l0 { --c: #ffc34a; --bg: #fff3c8; } .card.l1 { --c: #7af0c8; --bg: #e6fff6; } .card.l2 { --c: #b98aff; --bg: #f0e6ff; } .card.l3 { --c: #5ae0e8; --bg: #e0ffff; } .card.l4 { --c: #ff9ad5; --bg: #fff0c8; }
.card.l5 { --c: #a6dcff; --bg: #f0f8ff; } .card.l6 { --c: #5ae0c0; --bg: #e0fff6; } .card.l7 { --c: #7a6adf; --bg: #e6e0ff; } .card.l8 { --c: #c86bff; --bg: #f6e6ff; } .card.l9 { --c: #ff7ad9; --bg: #fff0fa; }
.card.longname .nm { font-size: 1.02em; line-height: 1.65; }
.card.guardian, .card.rare { background: var(--rainbow); }
.card.guardian .face::after, .card.rare .face::after, .card.partner .face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, #ffffffb0 45%, transparent 60%); animation: shine 2.8s steps(14) infinite; pointer-events: none; }
@keyframes shine { from { transform: translateX(-70%); } 60%, to { transform: translateX(70%); } }
.card.unknown { cursor: default; background: #d6c0e8; }
.card.unknown .art img { filter: brightness(0) invert(.55) sepia(1) hue-rotate(230deg); opacity: .5; }
.card.partner { outline: 4px solid var(--lemon); outline-offset: 4px; }
.bigcard { width: min(60vw, 280px); font-size: 22px; flex: none; }
.newtag { background: var(--pink); color: #fff; padding: 2px 14px; font-size: 22px; box-shadow: 0 0 0 3px var(--ink); }
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 18px; width: 100%; padding: 10px; overflow-y: auto; font-size: 14px; -webkit-overflow-scrolling: touch; touch-action: pan-y; flex: 1; min-height: 0; }
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; width: 100%; font-size: 15px; padding: 0 6px; }

.confetti { position: fixed; top: -20px; z-index: 70; pointer-events: none; image-rendering: pixelated; }
.spark { position: fixed; z-index: 70; pointer-events: none; image-rendering: pixelated; width: 24px; height: 24px; }
.loading { position: absolute; inset: 0; background: linear-gradient(#ff9ad5, #b98aff); display: grid; place-items: center; z-index: 100; transition: opacity .3s; }
.loading.gone { opacity: 0; pointer-events: none; }
.dots { display: flex; gap: 10px; }
.dots i { width: 18px; height: 18px; background: #fff; animation: dot 1s steps(3) infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
