@font-face { font-family: 'Bowlby One'; src: url('fonts/BowlbyOne-Regular.woff2') format('woff2'); font-display: swap; }
:root { --brown: #5a2d14; --cream: #f6e6c2; --pink: #f3a6b0; --pink2: #d27a8a; --mint: #a6d8c4; --ink: #3a1d0d; --red: #d2362b; --gold: #ffd23f; --shadow: rgba(58, 29, 13, 0.55); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe3dc; overscroll-behavior: none; font-family: 'Bowlby One', 'Arial Rounded MT Bold', Arial, sans-serif; color: var(--brown); }
body { position: fixed; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }
#app { position: absolute; inset: 0; }
#c, #mapc { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#hintc { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 8; pointer-events: none; }


.chip, .rb {
  position: absolute; width: 48px; height: 48px; border: 0; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); color: var(--brown); text-decoration: none; cursor: pointer;
  box-shadow: 0 0 0 3px var(--brown), 0 4px 0 3px var(--shadow); transition: transform 0.08s, box-shadow 0.08s; z-index: 6;
}
.chip img.ic { width: 32px; height: 32px; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.chip:active, .rb:active { transform: translateY(3px); box-shadow: 0 0 0 3px var(--brown), 0 1px 0 3px var(--shadow); }
.chip:focus-visible, .rb:focus-visible, .slot:focus-visible, .stop:focus-visible, #plunger:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
#hud > * { pointer-events: auto; }
#home { top: calc(10px + env(safe-area-inset-top, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
#mapBtn { top: calc(10px + env(safe-area-inset-top, 0px)); left: calc(66px + env(safe-area-inset-left, 0px)); }
#mute { top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); }
#bookBtn { top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(66px + env(safe-area-inset-right, 0px)); }
#mute img.off { display: none; }
#mute[aria-pressed="true"] img.on { display: none; }
#mute[aria-pressed="true"] img.off { display: block; width: 38px; height: 38px; }
.mapmode #mapBtn, .mapmode #meter { display: none; }
body:not(.mapmode) #bookBtn { display: none; }


#meter { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); height: 48px; display: flex; align-items: center; gap: 4px; pointer-events: none; }
#meter .burst { width: 44px; height: 44px; object-fit: contain; flex: none; margin-right: -8px; z-index: 1; pointer-events: none; }
#meter .bar { position: relative; flex: 1 1 auto; min-width: 54px; height: 24px; border-radius: 14px; background: var(--ink); box-shadow: 0 0 0 4px var(--cream), 0 0 0 7px var(--brown), 0 4px 0 7px var(--shadow); overflow: hidden; }
#meter .bar i { position: absolute; inset: 0; transform-origin: 0 0; transform: scaleX(0); background: linear-gradient(90deg, #ffb02a, #ff6a2a 60%, #d2362b); border-radius: 12px; }
#meter .bar i::after { content: ''; position: absolute; left: 0; right: 0; top: 4px; height: 4px; background: rgba(255, 255, 255, 0.28); }
#meter .bar s { position: absolute; top: 1px; bottom: 1px; width: 2px; background: rgba(251, 240, 212, 0.7); }
#stars { display: flex; flex: none; gap: 0; margin-left: 8px; }
.star { display: block; width: 24px; height: 24px; background: url('assets/icons/star-off.webp') center / contain no-repeat; }
.star.on { background-image: url('assets/icons/star-on.webp'); }
#stars i.pop { animation: starpop 0.5s ease-out; }
#stars { align-items: center; }
@keyframes starpop { 0% { transform: scale(1); } 40% { transform: scale(1.7) rotate(-14deg); } 100% { transform: scale(1); } }


.panel { position: absolute; z-index: 5; background: var(--pink); box-shadow: inset 0 0 0 5px var(--cream), inset 0 0 0 7px var(--pink2); }
#plunger { position: absolute; z-index: 3; background: transparent; border: 0; border-radius: 12px; padding: 0; min-width: 44px; min-height: 44px; }
#tray .pips { position: absolute; display: flex; gap: 8px; justify-content: center; pointer-events: none; }
#tray .pips i { width: 12px; height: 12px; border-radius: 50%; background: var(--cream); box-shadow: 0 0 0 2px var(--brown); }
#tray .pips i.on { background: var(--ink); }
#tray .slots { position: absolute; display: grid; place-items: center; }
.slot {
  position: relative; border: 0; padding: 0; border-radius: 50%; background: var(--mint); cursor: grab; touch-action: none;
  box-shadow: 0 0 0 4px var(--cream), 0 5px 0 4px rgba(90, 40, 16, 0.35); transition: transform 0.08s, filter 0.2s;
}
.slot img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); width: 78%; height: 78%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.slot:active { transform: translateY(3px); }
.slot.full img { opacity: 0.45; }
.slot.wig { animation: wig 0.3s; }
@keyframes wig { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.slot.locked { background: #c7d6cf; cursor: not-allowed; }
.slot.locked img:not(.padl) { filter: brightness(0) opacity(0.28); }
.slot .lock { position: absolute; right: -6px; bottom: -6px; min-width: 38px; height: 24px; padding: 0 6px 0 3px; border-radius: 12px; background: var(--cream); box-shadow: 0 0 0 2px var(--brown); font-size: 13px; line-height: 24px; text-align: center; color: var(--brown); display: none; align-items: center; justify-content: center; gap: 1px; }
.slot .lock .star { width: 17px; height: 17px; }
.slot img.padl { position: absolute; left: 50%; top: 50%; width: 52%; height: auto; transform: translate(-50%, -54%); display: none; }
.slot.locked img.padl { display: block; }
.slot.locked .lock { display: flex; }
.slot.fresh { animation: fresh 0.9s ease-out 2; }
@keyframes fresh { 0% { box-shadow: 0 0 0 4px var(--cream), 0 0 0 4px var(--gold); } 60% { box-shadow: 0 0 0 4px var(--cream), 0 0 0 16px rgba(255, 210, 63, 0); } }
.dim .slot { opacity: 0.35; pointer-events: none; }


#results .rtop { position: absolute; display: flex; align-items: center; justify-content: center; gap: 14px; pointer-events: none; }
.rstars { display: flex; }
.rstars .star { width: 38px; height: 38px; }
.rstars .star.on { animation: starpop 0.6s ease-out; }
.rpoints { display: flex; align-items: center; gap: 14px; font-size: 26px; color: var(--brown); text-shadow: 0 2px 0 var(--cream); }
.rpoints i { flex: none; width: 34px; height: 34px; background: url('assets/icons/record.webp') center / contain no-repeat; animation: nudge 1s ease-in-out infinite; }
#results .rbtns { position: absolute; display: flex; align-items: center; justify-content: center; gap: 10px; }
.rb { position: relative; flex: none; z-index: 1; }
.rb img.ic { width: 32px; height: 32px; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.rb.big { width: 62px; height: 62px; background: var(--mint); animation: nudge 1.6s ease-in-out infinite; }
.rb.big img.ic { width: 42px; height: 42px; }
@keyframes nudge { 50% { transform: scale(1.06); } }
.rb[disabled] { opacity: 0.4; cursor: default; }
.rb.glow { background: var(--gold); animation: nudge 1.2s ease-in-out infinite; }


#map { position: absolute; inset: 0; z-index: 2; }
#stops { position: absolute; inset: 0; }
.stop { position: absolute; transform: translate(-50%, -88%); border: 0; background: transparent; padding: 0; cursor: pointer; display: block; text-align: center; touch-action: manipulation; }
.stop img { display: block; width: 100%; height: auto; pointer-events: none; filter: drop-shadow(0 4px 0 rgba(58, 29, 13, 0.4)); }
.stop .fb { display: block; width: 100%; aspect-ratio: 1; border-radius: 18px; border: 3px solid var(--brown); }
.stop .tag { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); display: flex; gap: 1px; padding: 3px 8px; background: var(--cream); border-radius: 14px; box-shadow: 0 0 0 3px var(--brown), 0 3px 0 3px var(--shadow); white-space: nowrap; }
.stop .tag .star { width: 22px; height: 22px; }
.stop.locked img { filter: grayscale(1) brightness(1.1) contrast(0.8) drop-shadow(0 4px 0 rgba(58, 29, 13, 0.4)); opacity: 0.75; }
.stop .need { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); min-width: 54px; height: 54px; border-radius: 27px; padding: 0 10px; background: var(--cream); box-shadow: 0 0 0 3px var(--brown), 0 4px 0 3px var(--shadow); display: none; align-items: center; justify-content: center; gap: 4px; font-size: 20px; color: var(--brown); }
.stop .need .star { width: 24px; height: 24px; }
.stop.locked .need { display: flex; }
.stop.here::after { content: ''; position: absolute; left: 50%; top: -18px; width: 16px; height: 16px; margin-left: -8px; background: var(--red); border-radius: 50%; box-shadow: 0 0 0 3px var(--cream); animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.stop.shake { animation: wig 0.3s; }
.stop .rec { position: absolute; right: -6px; top: 6px; min-width: 38px; padding: 2px 6px; background: var(--red); color: var(--cream); border-radius: 12px; font-size: 11px; box-shadow: 0 0 0 2px var(--cream); }


#book { position: absolute; inset: 0; z-index: 9; background: rgba(58, 29, 13, 0.55); display: grid; place-items: center; padding: 14px; }
#book .sheet { position: relative; width: min(100%, 520px); max-height: 100%; overflow: auto; background: var(--cream); border-radius: 22px; box-shadow: 0 0 0 5px var(--brown), 0 8px 0 5px var(--shadow); padding: 16px 14px 14px; touch-action: pan-y; }
#book .sheet .bhead { position: sticky; top: -16px; z-index: 3; display: flex; justify-content: flex-end; margin: -16px -14px 6px; padding: 12px 14px 8px; background: var(--cream); border-radius: 22px 22px 0 0; box-shadow: 0 6px 0 -3px var(--cream), 0 8px 8px -6px rgba(58, 29, 13, 0.35); }
#book .sheet #bookClose { position: relative; display: grid; }
#bookRows { display: grid; gap: 10px; }
.brow { display: flex; align-items: center; gap: 10px; padding: 8px; background: #fbf3dc; border-radius: 16px; box-shadow: inset 0 0 0 3px #e3cf9c; }
.brow img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.brow .fb { width: 56px; height: 56px; border-radius: 12px; flex: none; border: 3px solid var(--brown); }
.brow .st { display: flex; gap: 10px; margin-left: auto; }
.sticker { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--c, #ccc) 26%, #fff7e0); box-shadow: 0 0 0 4px #fff7e0, 0 0 0 7px var(--brown), 0 4px 0 7px var(--shadow); }
.sticker img { width: 42px; height: 42px; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.sticker.off { background: transparent; box-shadow: 0 0 0 3px #d9c58f; border: 3px dashed #bda66a; }
.sticker.off img { opacity: 0.28; filter: grayscale(1) sepia(0.4); }
.sticker.new { animation: starpop 0.7s ease-out 3; }
#toast { position: absolute; left: 50%; z-index: 8; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; background: var(--cream); border-radius: 30px; box-shadow: 0 0 0 3px var(--brown), 0 4px 0 3px var(--shadow); animation: toastin 0.45s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none; }
#toast img { width: 36px; height: 36px; object-fit: contain; }
#toast .sticker { width: 42px; height: 42px; }
#toast .sticker img { width: 32px; height: 32px; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 24px) scale(0.6); } }
#film { position: absolute; inset: 0; z-index: 7; pointer-events: none; box-shadow: inset 0 38px 0 -2px #1c0e06, inset 0 -38px 0 -2px #1c0e06; }
#film::after { content: ''; position: absolute; left: 50%; top: 52px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--cream); animation: bob 0.8s ease-in-out infinite; }
#snap { position: absolute; z-index: 9; left: 14px; top: 78px; width: 92px; padding: 6px 6px 16px; background: var(--cream); border-radius: 6px; box-shadow: 0 0 0 3px var(--brown), 0 6px 0 3px var(--shadow); transform: rotate(-5deg); pointer-events: none; animation: snapin 2.6s ease-out forwards; }
#snap img { display: block; width: 100%; height: 110px; object-fit: cover; object-position: center top; background: #e3cf9c; }
#snap .tick { position: absolute; right: -16px; bottom: -16px; width: 46px; height: auto; }
@keyframes snapin { 0% { opacity: 0; transform: translate(40px, 120px) rotate(14deg) scale(1.9); } 14% { opacity: 1; transform: rotate(-5deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(-5deg) translateY(-10px); } }
.shot { animation: shot 0.35s ease-out; }
@keyframes shot { 0% { filter: brightness(2.4); } 100% { filter: none; } }
@media (prefers-reduced-motion: reduce) { .rb.big, .rpoints i, .stop.here::after, #film::after, #snap { animation: none; } }


#found { position: absolute; z-index: 8; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; pointer-events: none; }
#found .fp { width: var(--pop, 78px); height: var(--pop, 78px); border-radius: 50%; background: var(--cream); box-shadow: 0 0 0 4px var(--brown), 0 6px 0 4px var(--shadow); display: grid; place-items: center; animation: foundin 0.5s cubic-bezier(.2, .9, .3, 1); }
#found .fp.out { opacity: 0; transform: translateY(-10px) scale(0.85); transition: opacity 0.35s, transform 0.35s; }
#found .fp img { width: calc(var(--pop, 78px) * 0.8); height: calc(var(--pop, 78px) * 0.8); object-fit: contain; }
@keyframes foundin { 0% { transform: scale(0.2) rotate(-14deg); opacity: 0; } 70% { transform: scale(0.98) rotate(3deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.found { display: grid; gap: 8px; margin-top: 6px; }
.fgroup { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #fbf3dc; border-radius: 14px; box-shadow: inset 0 0 0 3px #e3cf9c; }
.fhead { display: flex; flex-direction: column; align-items: center; width: 46px; flex: none; font-size: 12px; line-height: 1; }
.fhead img { width: 38px; height: 38px; object-fit: contain; }
.fitems { display: flex; flex-wrap: wrap; gap: 6px; }
.fd { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff7e0; box-shadow: 0 0 0 3px var(--brown); }
.fd img { width: 34px; height: 34px; object-fit: contain; pointer-events: none; }
.fd.off { background: transparent; box-shadow: 0 0 0 2px #d9c58f; border: 2px dashed #bda66a; }
.fd.off img { opacity: 0.22; filter: grayscale(1) sepia(0.4); }
