@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: #2a2140; --cream: #fff8e8; --sun: #ffc23d; --mint: #34c98b; --tomato: #ff6b4a; --letters: 'andika', 'Century Gothic', system-ui, sans-serif; }
* { 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: var(--ink); 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 square, stepped pixel look */
.pbox, .pbtn, .say-box, .hpbox, .wordbtn, .opts button, .shopitem {
  background: var(--cream); box-shadow: 0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink), 4px 8px 0 #0004;
}
.pbox { padding: 2px 8px; font-size: 18px; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.pbox img { width: 22px; height: 22px; }
.pbtn { width: 46px; height: 46px; font-size: 24px; display: grid; place-items: center; position: relative; flex: none; }
.pbtn:active { transform: translateY(3px); }
.pbtn b { position: absolute; right: -8px; bottom: -8px; background: var(--sun); 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-cards { margin-left: auto; }
.area-name { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 4px 16px; font-size: 22px; z-index: 5; opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
.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: #fff8e8d9; box-shadow: 0 0 0 4px var(--ink); font-size: 26px; touch-action: none; }
.dpad button.on { background: var(--sun); }
.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: var(--tomato); color: #fff; font-size: 42px; border-radius: 50%; box-shadow: 0 0 0 5px var(--ink), 0 8px 0 5px #0005; z-index: 6; }
.abtn:active { transform: translateY(4px); }
@media (max-width: 480px) { .dpad { width: 156px; height: 156px; } .abtn { width: 78px; height: 78px; font-size: 36px; } .pbox { font-size: 15px; padding: 1px 5px; } .hud { gap: 10px; } .pbtn { width: 40px; height: 40px; font-size: 20px; } }

.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; font-size: .6em; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.abtn.rod { font-size: 44px; background: #4aa8ff; animation: rodpulse 1s steps(3) infinite; }
@keyframes rodpulse { 50% { transform: scale(1.08); } }
.fish-cue { position: absolute; left: 50%; top: calc(50% + 44px); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 2px 18px; font-size: 26px; z-index: 7; pointer-events: none; }
.fish-cue.now { background: var(--sun); color: var(--ink); font-size: 44px; animation: rodpulse .4s steps(2) infinite; box-shadow: 0 0 0 5px var(--ink); }
.fish-cue[hidden] { display: none; }

/* ───────── battle ───────── */
#battle { display: none; flex-direction: column; background: var(--ink); }
#battle[data-active] { display: flex; }
.field { position: relative; flex: 1; min-height: 0; overflow: hidden; background: linear-gradient(var(--sky1, #9fe0ff) 0 46%, var(--ground, #7ed56a) 46% 100%); }
.sprite { position: absolute; image-rendering: pixelated; }
.foe, .foe-spot { width: min(34vmin, 260px); height: min(34vmin, 260px); }
.foe { right: 8%; top: 8%; }
.mine { left: 8%; bottom: 3%; width: min(38vmin, 290px); height: min(38vmin, 290px); transform: scaleX(-1); opacity: 0; }
.mine.out { opacity: 1; }
.me { left: 14%; bottom: 6%; width: min(19vmin, 140px); height: min(24vmin, 175px); }
.field::before, .field::after { content: ''; position: absolute; border-radius: 50%; background: #0002; }
.field::before { right: 7%; top: calc(8% + min(26vmin, 200px)); width: min(36vmin, 270px); height: min(8vmin, 60px); }
.field::after { left: 7%; bottom: 1%; width: min(42vmin, 320px); height: min(9vmin, 70px); }
.hpbox { position: absolute; padding: 4px 10px 8px; width: min(44vw, 300px); z-index: 2; }
.hpbox.them { left: 14px; top: 16px; }
.mine-box { right: 14px; bottom: 16px; opacity: 0; transition: opacity .3s; }
.mine-box.out { opacity: 1; }
.hpbox b { display: flex; justify-content: space-between; font-size: clamp(18px, 3vw, 24px); align-items: baseline; }
.hpbox small { font-size: .7em; font-weight: 700; }
.meter { height: 12px; box-shadow: 0 0 0 3px var(--ink); background: #ddd; margin-top: 3px; }
.meter i { display: block; height: 100%; width: 100%; background: var(--mint); transition: width .5s steps(8); }
.them .meter i { background: var(--tomato); }

.panel { position: relative; flex: none; background: var(--cream); box-shadow: 0 -6px 0 var(--ink); 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: #5a5078; }
.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(--sun); } }
.tools { display: flex; justify-content: center; gap: 18px; margin-top: 2px; }
.tools[hidden], .tools .pbtn[hidden] { display: none; }
.field-text { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--ink); color: #fff; padding: 6px 18px; font-size: clamp(22px, 4vw, 36px); z-index: 4; white-space: nowrap; }
.pow { position: fixed; font-size: 56px; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; pointer-events: none; z-index: 40; }
.thrown { position: fixed; width: 56px; height: 56px; z-index: 40; pointer-events: none; image-rendering: pixelated; }

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

/* ───────── title ───────── */
#title { background: linear-gradient(#2d2a6b 0, #5a4fc4 45%, #8fd17a 45%, #5cb85c 100%); text-align: center; }
.logo { margin: 0; padding-top: max(5vh, env(safe-area-inset-top)); color: #fff; font-size: clamp(50px, 10vw, 104px); line-height: .92; text-shadow: 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 4px 0 var(--ink), 0 -4px 0 var(--ink), 4px 4px 0 var(--ink), -4px 4px 0 var(--ink), 0 9px 0 var(--ink); }
.logo span { display: block; font-size: .46em; color: var(--sun); margin-bottom: .15em; }
.parade { display: flex; justify-content: center; gap: 2vmin; margin: 3vh auto 2vh; height: min(28vmin, 200px); }
.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 { width: 110px; height: 110px; background: var(--sun); box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink), -6px 0 0 var(--ink), 6px 0 0 var(--ink), 6px 12px 0 #0005; font-size: 50px; }
.play:active { transform: translateY(4px); }
.play.small { width: 84px; height: 84px; font-size: 38px; }
.credit { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); color: #fff; font-size: 15px; text-decoration: none; }
.grownup { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); color: #fff; font-size: 14px; text-decoration: underline; }

/* ───────── make your character ───────── */
#maker { background: #5a4fc4; color: #fff; overflow-y: auto; touch-action: pan-y; }
.maker-body { min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 14px 24px; }
.maker-body h2 { margin: 0; font-size: clamp(32px, 7vw, 52px); }
.big-me { position: static; width: 128px; height: 160px; }
.opts { display: flex; flex-direction: column; gap: 14px; width: min(640px, 100%); }
.optrow { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.opts button { width: 56px; height: 56px; padding: 0; display: grid; place-items: center; overflow: hidden; }
.opts button img { width: 40px; height: 50px; }
.opts button[aria-pressed=true] { box-shadow: 0 -4px 0 var(--sun), 0 4px 0 var(--sun), -4px 0 0 var(--sun), 4px 0 0 var(--sun), 0 0 0 8px var(--ink); }

/* ───────── pop-ups ───────── */
.overlay { position: absolute; inset: 0; background: #2a2140e6; 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(640px, 100%); max-height: 100%; color: #fff; text-align: center; }
.ov-body h2 { margin: 0; font-size: clamp(28px, 6vw, 42px); }
.ov-mon { width: min(36vmin, 220px); height: min(36vmin, 220px); }
.ov-money { display: flex; gap: 14px; color: var(--ink); }
.ov-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; color: var(--ink); }
.sum { font-size: clamp(44px, 11vw, 80px); line-height: 1; }
.bed { color: var(--ink); position: relative; width: min(84vw, 340px); left: auto; }
.shelf { display: flex; justify-content: center; gap: 18px; }
.shopitem { color: var(--ink); padding: 10px 20px; display: flex; flex-direction: column; align-items: center; min-width: 136px; }
.shopitem:active { transform: translateY(3px); }
.shopitem .row { display: flex; gap: 2px; min-height: 40px; }
.shopitem img { width: 36px; height: 36px; }
.shopitem b { font-size: 40px; line-height: 1; }
.shopitem span { font-size: 20px; color: #148a5a; }

/* cards */
.card { --c: #8be08b; width: 100%; aspect-ratio: 5 / 7; background: var(--c); box-shadow: 0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink); padding: 6px; color: var(--ink); text-align: left; display: flex; flex-direction: column; position: relative; cursor: pointer; }
.card .face { flex: 1; min-height: 0; background: var(--cream); box-shadow: inset 0 0 0 3px var(--ink); display: flex; flex-direction: column; padding: 3px; }
.card .top { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 5px; gap: 3px; }
.card .nm { font-size: 1.35em; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .hpv { font-size: .78em; color: #c2453b; white-space: nowrap; }
.card .art { flex: 1; min-height: 0; margin: 0 3px; background: var(--bg, #e3ffe3); box-shadow: inset 0 0 0 2px var(--ink); display: grid; place-items: center; }
.card .art img { width: 88%; height: 88%; object-fit: contain; }
.card .bot { display: flex; justify-content: space-between; padding: 2px 5px; font-size: .8em; }
.card.a1 { --c: #8be08b; --bg: #e3ffe3; } .card.a2 { --c: #5fb07a; --bg: #d9f2e0; } .card.a3 { --c: #6fd0e8; --bg: #e0f7ff; } .card.a4 { --c: #ff9a6b; --bg: #fff0e3; } .card.a0 { --c: #ffd96b; --bg: #fff8d9; }
.card.a5 { --c: #a8d8f0; --bg: #eef8ff; } .card.a6 { --c: #8ab86a; --bg: #eaf5da; } .card.a7 { --c: #8a7ae0; --bg: #ecebff; } .card.a8 { --c: #4ad0c8; --bg: #e0fbf8; } .card.a9 { --c: #e8603a; --bg: #ffe9dc; }
.card.longname .top { flex-direction: column; align-items: flex-start; gap: 0; }
.card.longname .nm { font-size: 1.05em; max-width: 100%; }
.card.boss, .card.rare { --c: #ffc23d; --bg: #fff3c9; }
.card.boss::after, .card.rare::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, #ffffffa0 45%, transparent 60%); animation: shine 2.8s steps(14) infinite; pointer-events: none; }
@keyframes shine { from { transform: translateX(-60%); } 60%, to { transform: translateX(60%); } }
.card.unknown { cursor: default; }
.card.unknown .art img { filter: brightness(0); opacity: .2; }
.card.partner { outline: 5px solid var(--sun); outline-offset: 5px; }
.bigcard { width: min(60vw, 280px); font-size: 22px; flex: none; }
.newtag { background: var(--tomato); color: #fff; padding: 2px 14px; font-size: 22px; box-shadow: 0 0 0 4px var(--ink); }
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); 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; }
.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; }

.confetti { position: fixed; top: -20px; width: 12px; height: 12px; z-index: 70; pointer-events: none; }
.spark { position: fixed; font-size: 28px; z-index: 70; pointer-events: none; }
.loading { position: absolute; inset: 0; background: #5a4fc4; 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; } }
