/* Pirate Seas treasure map (ages/pirate-map.js). Everything is laid out on a 1000-unit-wide sheet and scaled by --pm-k, so the
   same numbers work on any screen: .pm-wide is the 16:10 stage (1000 x 625), .pm-tall the upright phone (1000 x 1800). */
#stage.pm-stage.tall { aspect-ratio: 1000/1880; width: min(100%, calc((100dvh - 16px) * .5319)); }
.pm-root { --pm-min: 15px; position: absolute; left: 0; top: 0; width: 1000px; height: 625px; transform-origin: 0 0; transform: scale(var(--pm-k, .8)); overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif; color: #3a2412; touch-action: manipulation; transition: opacity .45s; }
.pm-root.pm-tall { height: 1880px; }
.pm-root * { box-sizing: border-box; }
.pm-root img { -webkit-user-drag: none; user-select: none; }
.pm-sway { position: absolute; inset: 0; transform-origin: 50% 60%; animation: pmSway 9s ease-in-out infinite; }
@keyframes pmSway { 0%, 100% { transform: rotate(-.3deg) translateY(0); } 50% { transform: rotate(.3deg) translateY(2px); } }
.pm-deck { position: absolute; left: -30px; top: 0; width: 1060px; height: 625px; pointer-events: none; }
.pm-tall .pm-deck { height: 1880px; }

/* the map on the deck */
.pm-paper { position: absolute; left: 14px; top: 112px; width: 500px; height: 500px; transition: opacity .45s; }
.pm-tall .pm-paper { left: 18px; top: 178px; width: 964px; height: 964px; }
.pm-piece, .pm-map, .pm-extra, .pm-over { position: absolute; left: -26px; top: -26px; width: calc(100% + 52px); height: calc(100% + 52px); pointer-events: none; }
.pm-piece.out { opacity: 0; transform: scale(1.1) rotate(-4deg); }
.pm-extra.out { opacity: 0; }
.pm-extra.in { opacity: 1; transition: opacity .9s .5s ease; }
.pm-piece.in { opacity: 1; transition: opacity .5s ease, transform 1s cubic-bezier(.2, 1.15, .3, 1); transform: none; }
.pm-grid { position: absolute; left: 34px; top: 34px; width: 432px; height: 432px; display: grid; grid-template-columns: repeat(var(--pm-n, 9), 1fr); grid-template-rows: repeat(var(--pm-n, 9), 1fr); }
.pm-tall .pm-grid { left: 56px; top: 56px; width: 852px; height: 852px; }
.pm-cell { display: block; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) { .pm-cell:hover { background: rgba(255, 232, 150, .3); box-shadow: inset 0 0 0 2px rgba(255, 196, 70, .75); } }
.pm-tide { position: absolute; inset: 0; pointer-events: none; border-radius: 8px; opacity: 0; transition: box-shadow 1.1s ease, opacity .6s; }

.pm-flag { position: absolute; transform: translate(-50%, -91%); aspect-ratio: 60/90; pointer-events: none; z-index: 6; animation: pmDrop .3s cubic-bezier(.3, 1.7, .5, 1); }
.pm-flag svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 3px rgba(30, 14, 0, .4)); }
.pm-flag-cloth { transform-origin: 32px 20px; animation: pmWave 1.1s ease-in-out infinite alternate; }
@keyframes pmDrop { from { transform: translate(-50%, -190%) scale(.8); opacity: 0; } to { transform: translate(-50%, -91%); opacity: 1; } }
@keyframes pmWave { from { transform: skewY(-5deg) scaleX(1); } to { transform: skewY(5deg) scaleX(.9); } }
.pm-pit { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border-radius: 50%; pointer-events: none; z-index: 4;
  background: radial-gradient(circle at 50% 56%, #1f1008 0 34%, #5c3a1e 52%, #c79d58 74%, rgba(199, 157, 88, 0) 100%); animation: pmPit .35s ease-out; }
.pm-pit b { position: absolute; right: -14%; top: -20%; display: flex; align-items: center; justify-content: center; min-width: max(calc(var(--pm-cell, 40px) * .5), calc(var(--pm-min) * 1.5)); height: max(calc(var(--pm-cell, 40px) * .5), calc(var(--pm-min) * 1.5)); padding: 0 .12em; border-radius: 999px; background: #fff6dc; border: 3px solid var(--pm-rc, #c4392b); color: #3a2412;
  font: 400 max(calc(var(--pm-cell, 40px) * .34), var(--pm-min))/1 'Lilita One', Impact, sans-serif; text-align: center; box-shadow: 0 2px 4px rgba(30, 14, 0, .4); }
@keyframes pmPit { from { transform: translate(-50%, -50%) scale(.2); } to { transform: translate(-50%, -50%) scale(1); } }
.pm-ping { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; border-radius: 50%; border: 4px solid #ffd95a; box-shadow: 0 0 18px 4px rgba(255, 217, 90, .9), inset 0 0 14px rgba(255, 217, 90, .7); pointer-events: none; z-index: 5; }
.pm-ping.hold { animation: pmPulse 1.1s ease-in-out infinite; }
.pm-ping.once { animation: pmPing 1.3s ease-out 1 forwards; }
@keyframes pmPulse { 0%, 100% { transform: translate(-50%, -50%) scale(.92); opacity: .8; } 50% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } }
@keyframes pmPing { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; } }
.pm-shov { position: absolute; aspect-ratio: 44/90; transform-origin: 50% 100%; transform: translate(-30%, -96%) rotate(30deg); z-index: 7; pointer-events: none; animation: pmDig .35s ease-in-out 2; filter: drop-shadow(0 4px 3px rgba(30, 14, 0, .4)); }
.pm-shov svg { width: 100%; height: 100%; }
@keyframes pmDig { 0%, 100% { transform: translate(-30%, -96%) rotate(34deg); } 55% { transform: translate(-30%, -86%) rotate(-4deg); } }

/* the chest, the bottle */
.pm-chest { position: absolute; transform: translate(-50%, -62%); aspect-ratio: 200/160; z-index: 8; pointer-events: none; animation: pmChestIn .5s cubic-bezier(.2, 1.6, .4, 1); }
.pm-chest svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 6px rgba(30, 14, 0, .4)); }
@keyframes pmChestIn { from { transform: translate(-50%, -20%) scale(.2); opacity: 0; } to { transform: translate(-50%, -62%) scale(1); opacity: 1; } }
.pm-lid, .pm-lid-back, .pm-gold { transform-box: view-box; }
.pm-lid { transform-origin: 100px 72px; }
.pm-lid-back { opacity: 0; transform-origin: 100px 72px; }
.pm-gold, .pm-cglow { opacity: 0; transform-origin: 100px 74px; }
.pm-chest.open .pm-lid { animation: pmLid .5s .15s ease-in forwards; }
.pm-chest.open .pm-lid-back { animation: pmLidBack .5s .3s ease-out forwards; }
.pm-chest.open .pm-gold { animation: pmGold .55s .3s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.pm-chest.open .pm-cglow { animation: pmGlow 1.6s .3s ease-out forwards; }
@keyframes pmLid { 0% { transform: none; opacity: 1; } 100% { transform: translateY(-40px) scaleY(.12); opacity: 0; } }
@keyframes pmLidBack { 0% { opacity: 0; transform: translateY(8px) scaleY(.2); } 100% { opacity: 1; transform: none; } }
@keyframes pmGold { 0% { opacity: 0; transform: scale(.5) translateY(14px); } 100% { opacity: 1; transform: none; } }
@keyframes pmGlow { 0% { opacity: 0; transform: scale(.4); } 40% { opacity: 1; } 100% { opacity: .35; transform: scale(1.1); } }
.pm-burst { position: absolute; left: 50%; top: 36%; width: 200%; transform: translate(-50%, -50%) scale(.2); opacity: 0; pointer-events: none; z-index: 2; }
.pm-chest.open .pm-burst { animation: pmBurst 1.3s .35s ease-out forwards; }
@keyframes pmBurst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(-20deg); } 22% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5) rotate(14deg); } }
.pm-rays { position: absolute; left: 50%; top: 36%; width: 280%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; z-index: -1; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 120, .6) 0 7deg, rgba(255, 226, 120, 0) 7deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 8%, transparent 66%); mask-image: radial-gradient(circle, #000 8%, transparent 66%); }
.pm-chest.open .pm-rays { animation: pmRays 3s .3s linear forwards; }
@keyframes pmRays { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(0) scale(.5); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(60deg) scale(1.2); } }
.pm-chest.sub { opacity: .0; animation: none; }
.pm-chest.sub.rise { opacity: .9; animation: pmRise 1s ease-out forwards; }
.pm-chest.sub svg { filter: saturate(.7) brightness(.85) drop-shadow(0 0 8px rgba(40, 170, 200, .9)); }
.pm-chest.sub .pm-gold { opacity: 1; }
.pm-chest.sub .pm-lid { transform: translateY(-40px) scaleY(.12); opacity: 0; }
.pm-chest.sub .pm-lid-back { opacity: 1; }
@keyframes pmRise { from { transform: translate(-50%, -20%) scale(.6); opacity: 0; } to { transform: translate(-50%, -62%) scale(1); opacity: .9; } }
.pm-bottle { position: absolute; aspect-ratio: 100/170; transform: translate(-50%, -70%) scale(.2); opacity: 0; z-index: 8; pointer-events: none; transition: transform .6s cubic-bezier(.2, 1.5, .4, 1), opacity .3s; }
.pm-bottle svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 5px 4px rgba(30, 14, 0, .4)); }
.pm-bottle.up { opacity: 1; transform: translate(-50%, -92%) scale(1) rotate(8deg); }
.pm-bottle.mark { opacity: .95; transform: translate(-50%, -66%) scale(.62) rotate(8deg); }

/* the clue scroll */
.pm-scroll { position: absolute; left: 556px; top: 120px; width: 430px; height: 290px; padding: 36px 22px 26px; border-radius: 4px; z-index: 3; transition: opacity .45s;
  background: linear-gradient(90deg, rgba(110, 60, 14, .32), rgba(255, 255, 255, 0) 7%, rgba(255, 255, 255, 0) 93%, rgba(110, 60, 14, .34)), linear-gradient(#f5e6ba, #ebd59c 55%, #e3c58a);
  box-shadow: 0 12px 24px rgba(30, 14, 0, .55), inset 0 0 40px rgba(150, 100, 40, .25); }
.pm-scroll.bottle { background: linear-gradient(90deg, rgba(40, 90, 70, .3), rgba(255, 255, 255, 0) 7%, rgba(255, 255, 255, 0) 93%, rgba(40, 90, 70, .32)), linear-gradient(#eaf0c6, #dbe0a4 55%, #cdd592); }
.pm-roll { position: absolute; left: -16px; right: -16px; height: 30px; border-radius: 15px; background: linear-gradient(#7a4a1e, #d9a85e 30%, #f6d68e 48%, #c18b45 68%, #6b3f1a); box-shadow: 0 5px 8px rgba(30, 14, 0, .45); }
.pm-roll.t { top: -15px; } .pm-roll.b { bottom: -15px; }
.pm-roll::before, .pm-roll::after { content: ''; position: absolute; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, #5a3414 0 22%, #c9944f 24% 50%, #7a4a1e 52%); border: 2px solid #3a2412; }
.pm-roll::before { left: -8px; } .pm-roll::after { right: -8px; }
.pm-sc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font: 400 max(24px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; color: #8a3d12; letter-spacing: 1px; }
.pm-worth { display: flex; align-items: center; gap: 6px; padding: 2px 14px 2px 4px; border-radius: 999px; background: rgba(255, 255, 255, .42); color: #3a2412; font: 400 max(25px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; letter-spacing: 0; transition: color .3s; }
.pm-worth.low { color: #961d12; }
.pm-coin { display: inline-block; width: 28px; height: 28px; flex: 0 0 28px; } .pm-coin svg { width: 100%; height: 100%; display: block; }
.pm-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.pm-lines.go, .pm-scroll.unroll .pm-lines { animation: pmUnroll .8s ease-out; }
@keyframes pmUnroll { from { clip-path: inset(0 0 100% 0); opacity: .2; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.pm-lines li { display: flex; align-items: center; gap: 10px; font: 800 max(22.5px, var(--pm-min))/1.16 'Nunito', sans-serif; color: #3a2412; }
.pm-num { flex: 0 0 34px; height: 34px; border-radius: 50%; display: block; text-align: center; font: 400 max(21px, var(--pm-min))/34px 'Lilita One', Impact, sans-serif; font-style: normal; color: #fff6dc;
  background: radial-gradient(circle at 35% 30%, #ea5d4e, #a8231a); box-shadow: 0 3px 0 #6a140e, inset 0 2px 3px rgba(255, 255, 255, .4); }
.pm-num.pm-sh { background: radial-gradient(circle at 35% 30%, #ffe28a, #d99a22); box-shadow: 0 3px 0 #8a5410, inset 0 2px 3px rgba(255, 255, 255, .5); padding: 5px 0 0; }
.pm-num.pm-sh svg { height: 24px; width: auto; transform: rotate(28deg); }
.pm-final { font-family: 'Lilita One', Impact, sans-serif !important; font-weight: 400 !important; color: #8c1810 !important; font-size: max(27px, var(--pm-min)) !important; letter-spacing: .5px; }
.pm-lm { display: inline-flex; align-items: center; gap: 3px; padding: 0 8px 0 3px; border-radius: 9px; cursor: pointer; background: rgba(255, 214, 110, .6); border-bottom: 3px solid #c98a2c; font-weight: 900; }
.pm-lmic { height: 1.55em; width: 1.55em; margin: -.25em 0; }
.pm-dir { color: #961d12; font-weight: 900; letter-spacing: .5px; }
.pm-n { display: inline-block; padding: 0 9px; border-radius: 9px; color: #fff6dc; background: linear-gradient(#3d86a6, #245f7a); font: 400 .98em/1.25 'Lilita One', Impact, sans-serif; }
.pm-sea { color: #0d5271; font-weight: 900; }
.pm-nw { white-space: nowrap; }

/* buttons */
.pm-btns { position: absolute; left: 556px; top: 428px; width: 430px; height: 76px; display: flex; gap: 10px; z-index: 3; transition: opacity .45s; }
.pm-walk { flex: 1.12 1 0; }
.pm-btn { position: relative; flex: 1 1 0; min-width: 0; white-space: nowrap; border-radius: 14px; border: 3px solid #4a2a10; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 4px 8px; color: #fff3d6;
  background: linear-gradient(#955823, #6a3e17); box-shadow: 0 6px 0 #4a2a10, 0 11px 16px rgba(20, 8, 0, .45), inset 0 2px 0 rgba(255, 225, 170, .55); font-family: 'Lilita One', Impact, sans-serif; touch-action: manipulation; transition: filter .2s, transform .08s; }
.pm-btn::before, .pm-btn::after { content: ''; position: absolute; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a8, #b8841c); box-shadow: 0 1px 1px rgba(0, 0, 0, .5); }
.pm-btn::before { left: 6px; } .pm-btn::after { right: 6px; }
.pm-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #4a2a10, 0 5px 8px rgba(20, 8, 0, .4), inset 0 2px 0 rgba(255, 225, 170, .55); }
.pm-btn:disabled { filter: grayscale(.5) brightness(.78); cursor: default; }
.pm-btn .pm-ic { flex: 0 0 26px; width: 26px; } .pm-btn .pm-ic svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.pm-btn .pm-bt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.pm-btn b { font: 400 max(21px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; letter-spacing: .5px; }
.pm-btn small { font: 800 max(13px, var(--pm-min))/1.1 'Nunito', sans-serif; color: #fff3d6; margin-top: 2px; }
.pm-dig { flex: 1.45 1 0; color: #4a2308; background: linear-gradient(#ffe088, #e39f26); box-shadow: 0 6px 0 #8a5410, 0 11px 16px rgba(20, 8, 0, .45), inset 0 2px 0 rgba(255, 255, 255, .6); border-color: #6a3c10; }
.pm-dig .pm-ic { flex-basis: 34px; width: 34px; } .pm-dig .pm-ic svg { transform: rotate(24deg); }
.pm-dig b { font-size: max(32px, var(--pm-min)); } .pm-dig small { color: #4a2308; }
.pm-dig.ready { animation: pmReady 1.1s ease-in-out infinite; }
@keyframes pmReady { 0%, 100% { box-shadow: 0 6px 0 #8a5410, 0 11px 16px rgba(20, 8, 0, .45), 0 0 0 0 rgba(255, 224, 120, .0), inset 0 2px 0 rgba(255, 255, 255, .6); } 50% { box-shadow: 0 6px 0 #8a5410, 0 11px 16px rgba(20, 8, 0, .45), 0 0 26px 6px rgba(255, 224, 120, .85), inset 0 2px 0 rgba(255, 255, 255, .6); } }

/* the always-visible rule card */
.pm-rules { position: absolute; left: 556px; top: 524px; width: 430px; height: 90px; padding: 14px 84px 8px 16px; border-radius: 12px; z-index: 3; color: #ffe9c0; background: linear-gradient(rgba(36, 20, 8, .62), rgba(24, 12, 4, .7)); border: 2px solid rgba(255, 225, 170, .28); box-shadow: inset 0 0 18px rgba(0, 0, 0, .35); transition: opacity .45s; }
.pm-rules h4 { position: absolute; top: -.8em; left: 14px; margin: 0; padding: 3px 11px; border-radius: 999px; font: 400 max(12px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; letter-spacing: 2px; color: #4a2308; background: linear-gradient(#ffe088, #e39f26); box-shadow: 0 2px 0 #8a5410; }
.pm-rules ul { list-style: none; margin: 0; padding: 0; font: 700 max(15.5px, var(--pm-min))/1.26 'Nunito', sans-serif; }
.pm-rules li::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #ffd270; vertical-align: 1px; }

/* HUD: a plaque on the sea, right of the shell's top-left chips (the shell also keeps its sound buttons in the bottom-right corner, so the rules card leaves that corner empty) */
.pm-hud { position: absolute; left: 490px; top: 8px; width: 404px; display: flex; gap: 6px; pointer-events: none; z-index: 10; }
.pm-route, .pm-bank, .pm-shovs { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 10px; border-radius: 999px; background: rgba(26, 18, 48, .78); border: 2px solid #e9b84f; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.pm-route { flex: 1 1 auto; justify-content: space-between; } .pm-route img { display: none; }
.pm-rt { font: 400 max(16px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; color: #ffe9b0; letter-spacing: .8px; white-space: nowrap; }
.pm-dots { white-space: nowrap; } .pm-dots i { display: inline-block; width: 13px; height: 13px; margin-left: 4px; border-radius: 50%; border: 2px solid #e9b84f; background: rgba(255, 255, 255, .15); vertical-align: middle; }
.pm-dots i.done { background: radial-gradient(circle at 35% 30%, #fff3a8, #e9a82a); } .pm-dots i.cur { background: #ffe9b0; box-shadow: 0 0 10px #ffe9b0; }
.pm-bank b { font: 400 max(21px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; color: #ffe9b0; min-width: 2.3ch; }
.pm-bank .pm-coin { width: 22px; height: 22px; flex-basis: 22px; }
.pm-streak { font: 400 max(13px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; font-style: normal; color: #3a2200; background: linear-gradient(#ffe088, #f0b23a); border-radius: 999px; padding: 3px 7px; animation: pmStreak 1.6s ease-in-out infinite; white-space: nowrap; }
.pm-sk { display: none; }
@keyframes pmStreak { 50% { transform: scale(1.08); } }
.pm-sl { display: none; }
.pm-sv { display: flex; gap: 3px; align-items: center; } .pm-sv span { display: block; width: 15px; transition: opacity .4s, filter .4s, transform .4s; } .pm-sv span svg { width: 100%; height: auto; display: block; }
.pm-sv span.used { opacity: .22; filter: grayscale(1); transform: rotate(25deg) translateY(4px); }

/* the parrot and its speech */
.pm-parrot { position: absolute; left: 910px; top: -4px; width: 68px; z-index: 12; cursor: pointer; pointer-events: auto; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .4)); transform-origin: 50% 90%; animation: pmTilt 3.4s ease-in-out infinite; }
.pm-parrot svg { display: block; width: 100%; height: auto; }
.pm-parrot.hop { animation: pmHop .5s ease-out 1, pmTilt 3.4s 0.5s ease-in-out infinite; }
@keyframes pmTilt { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg); } }
@keyframes pmHop { 0% { transform: translateY(0); } 30% { transform: translateY(-14px) rotate(-4deg); } 60% { transform: translateY(2px); } 100% { transform: translateY(0); } }
.pm-bubble { position: absolute; right: 96px; top: 58px; max-width: 400px; padding: 8px 15px; border-radius: 16px; z-index: 13; pointer-events: none; opacity: 0; transform: scale(.85); transform-origin: 100% 0; transition: opacity .2s, transform .25s cubic-bezier(.2, 1.5, .4, 1);
  background: #fff8e6; border: 3px solid #3a2412; box-shadow: 0 5px 0 rgba(58, 36, 18, .5); font: 800 max(18px, var(--pm-min))/1.22 'Nunito', sans-serif; color: #3a2412; text-align: left; }
.pm-bubble.on { opacity: 1; transform: none; }
.pm-bubble::after { content: ''; position: absolute; right: -12px; top: 10px; width: 18px; height: 18px; background: #fff8e6; border-right: 3px solid #3a2412; border-top: 3px solid #3a2412; transform: rotate(45deg); }

/* round card, floating numbers, the fail panel, the win banner, effects */
.pm-splash { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; z-index: 15; text-align: center; padding: 14px 34px 18px; min-width: 440px; max-width: 760px;
  background: linear-gradient(#80501f, #5c3515); border: 5px solid #3a2412; border-radius: 18px; box-shadow: 0 8px 0 #2a160a, 0 20px 40px rgba(0, 0, 0, .55), inset 0 3px 0 rgba(255, 225, 170, .45); }
.pm-splash.show { animation: pmSplash 2.1s ease both; }
.pm-splash { display: flex; align-items: center; gap: 18px; }
.pm-splash img { height: 92px; width: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .5)); }
.pm-splash h2 { margin: 0; font: 400 54px/1 'Lilita One', Impact, sans-serif; color: #ffd270; letter-spacing: 2px; text-shadow: 0 4px 0 #5a2c0c, 0 0 18px rgba(255, 190, 80, .5); }
.pm-splash p { margin: 6px 0 0; font: 800 max(24px, var(--pm-min))/1.25 'Nunito', sans-serif; color: #fff0d0; }
@keyframes pmSplash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 18% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -58%) scale(.96); } }
.pm-pop { position: absolute; transform: translate(-50%, -50%); z-index: 16; pointer-events: none; font: 400 44px/1 'Lilita One', Impact, sans-serif; color: #ffd95a; text-shadow: 0 3px 0 #6a3a08, 0 0 14px rgba(0, 0, 0, .55); animation: pmPop 1.4s ease-out forwards; }
.pm-pop.bad { color: #ff6a5a; text-shadow: 0 3px 0 #5a0e08, 0 0 12px rgba(0, 0, 0, .5); font-size: max(40px, var(--pm-min)); } .pm-pop.big { font-size: 78px; }
@keyframes pmPop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -200%) scale(1); } }
.pm-fail { position: absolute; left: 556px; top: 120px; width: 430px; height: 494px; z-index: 14; display: none; padding: 26px 26px 22px; border-radius: 18px; color: #fff3d6; text-align: left;
  background: linear-gradient(#2c1a0e, #1a0f08); border: 4px solid #ffd270; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.pm-fail.show { display: flex; flex-direction: column; justify-content: center; gap: 12px; animation: pmFailIn .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pmFailIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-fail h3 { margin: 0; font: 400 50px/1 'Lilita One', Impact, sans-serif; color: #ffd270; text-shadow: 0 4px 0 #5a2c0c; }
.pm-fail p { margin: 0; font: 700 max(21px, var(--pm-min))/1.3 'Nunito', sans-serif; } .pm-fail b { color: #ffe9b0; }
.pm-fail .pm-ans { font-size: max(19px, var(--pm-min)); color: #ffe0b0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); }
.pm-fail .pm-got { font-size: max(17px, var(--pm-min)); opacity: .85; }
.pm-again { align-self: flex-start; margin-top: 4px; border: 0; border-radius: 999px; cursor: pointer; padding: 13px 38px; font: 400 max(30px, var(--pm-min))/1 'Lilita One', Impact, sans-serif; letter-spacing: 1px; color: #3a1c00; background: linear-gradient(120deg, #ffe3a8, #f0b75e); box-shadow: 0 6px 0 #8a5a1c; touch-action: manipulation; }
.pm-again:active { transform: translateY(4px); box-shadow: 0 2px 0 #8a5a1c; }
.pm-finish { position: absolute; left: 50%; top: 40%; width: 380px; transform: translate(-50%, -50%) scale(.2); opacity: 0; z-index: 15; pointer-events: none; animation: pmFin 1.9s ease both; }
.pm-finish img { width: 100%; display: block; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); }
@keyframes pmFin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(-8deg); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); } 40% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -54%) scale(1); } }
.pm-fx { position: absolute; left: 0; top: 0; width: 1000px; height: 625px; pointer-events: none; z-index: 18; }
.pm-tall .pm-fx { height: 1880px; }
.pm-root.fadeout .pm-paper, .pm-root.fadeout .pm-scroll, .pm-root.fadeout .pm-btns, .pm-root.fadeout .pm-rules { opacity: 0; }
.pm-root.failing .pm-scroll, .pm-root.failing .pm-btns, .pm-root.failing .pm-rules { visibility: hidden; }

/* ── upright phone: 1000 x 1800, the map on top, then the scroll, the buttons and the rules, all bigger ── */
.pm-tall .pm-hud { left: 0; top: 0; width: auto; right: 0; gap: 8px; padding: 8px 12px; }
.pm-tall .pm-route, .pm-tall .pm-bank, .pm-tall .pm-shovs { height: 76px; padding: 0 14px; gap: 8px; }
.pm-tall .pm-route { padding-left: 8px; justify-content: flex-start; flex: 0 0 auto; } .pm-tall .pm-route img { display: block; height: 70px; width: auto; }
.pm-tall .pm-rt { font-size: max(27px, var(--pm-min)); } .pm-tall .pm-dots i { width: 19px; height: 19px; margin-left: 5px; }
.pm-tall .pm-bank b { font-size: max(36px, var(--pm-min)); } .pm-tall .pm-bank .pm-coin { width: 40px; height: 40px; flex-basis: 40px; }
.pm-tall .pm-streak { font-size: max(26px, var(--pm-min)); padding: 5px 12px; }
.pm-tall .pm-sv span { width: 26px; } .pm-tall .pm-sv { gap: 5px; }
.pm-tall .pm-parrot { left: 888px; top: 6px; width: 100px; }
.pm-tall .pm-bubble { right: 120px; top: 96px; max-width: 800px; padding: 14px 24px; font-size: max(32px, var(--pm-min)); border-radius: 24px; }
.pm-tall .pm-bubble::after { top: 22px; }
.pm-tall .pm-scroll { left: 18px; top: 1170px; width: 964px; height: 398px; padding: 50px 38px 42px; }
.pm-tall .pm-sc-head { font-size: max(36px, var(--pm-min)); margin-bottom: 10px; } .pm-tall .pm-worth { font-size: max(36px, var(--pm-min)); padding: 3px 20px 3px 6px; } .pm-tall .pm-coin { width: 42px; height: 42px; flex-basis: 42px; }
.pm-tall .pm-roll { height: 40px; border-radius: 20px; } .pm-tall .pm-roll.t { top: -20px; } .pm-tall .pm-roll.b { bottom: -20px; }
.pm-tall .pm-roll::before, .pm-tall .pm-roll::after { width: 32px; height: 32px; top: 3px; }
.pm-tall .pm-lines { gap: 6px; } .pm-tall .pm-lines li { font-size: max(35px, var(--pm-min)); gap: 16px; } .pm-tall .pm-num { flex-basis: 46px; height: 46px; font-size: max(29px, var(--pm-min)); line-height: 46px; }
.pm-tall .pm-num.pm-sh svg { height: 34px; } .pm-tall .pm-final { font-size: max(38px, var(--pm-min)) !important; }
.pm-tall .pm-btns { left: 18px; top: 1584px; width: 964px; height: 104px; gap: 14px; }
.pm-tall .pm-btn { border-radius: 20px; gap: 12px; } .pm-tall .pm-btn .pm-ic { flex-basis: 42px; width: 42px; } .pm-tall .pm-btn b { font-size: max(36px, var(--pm-min)); } .pm-tall .pm-btn small { font-size: max(27px, var(--pm-min)); margin-top: 3px; }
.pm-tall .pm-dig b { font-size: 48px; } .pm-tall .pm-dig .pm-ic { flex-basis: 44px; width: 44px; }
.pm-tall .pm-rules { left: 18px; top: 1698px; width: 964px; height: 176px; padding: 18px 150px 18px 22px; }
.pm-tall .pm-rules h4 { display: none; } .pm-tall .pm-rules ul { font-size: max(31px, var(--pm-min)); line-height: 1.22; } .pm-tall .pm-rules li:nth-child(n+4) { display: none; } .pm-tall .pm-rules li::before { width: 12px; height: 12px; margin-right: 12px; }
.pm-tall .pm-splash { top: 38%; min-width: 760px; padding: 24px 40px 26px; gap: 28px; } .pm-tall .pm-splash img { height: 170px; } .pm-tall .pm-splash h2 { font-size: 84px; } .pm-tall .pm-splash p { font-size: max(40px, var(--pm-min)); }
.pm-tall .pm-pop { font-size: 80px; } .pm-tall .pm-pop.bad { font-size: 72px; } .pm-tall .pm-pop.big { font-size: 130px; }
.pm-tall .pm-fail { left: 18px; top: 1170px; width: 964px; height: 690px; padding: 36px 40px; gap: 16px; }
.pm-tall .pm-fail h3 { font-size: 78px; } .pm-tall .pm-fail p { font-size: max(36px, var(--pm-min)); } .pm-tall .pm-fail .pm-ans { font-size: max(33px, var(--pm-min)); } .pm-tall .pm-fail .pm-got { font-size: max(30px, var(--pm-min)); }
.pm-tall .pm-again { font-size: 52px; padding: 20px 60px; }
.pm-tall .pm-finish { width: 640px; top: 30%; }


/* ── Ron's sprites (the code-drawn SVG pieces above are the fallback) ── */
img.pm-sp { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.pm-coin img.pm-sp { height: 100%; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45)); }
.pm-btn .pm-ic img.pm-sp { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .35)); }
.pm-dig .pm-ic img.pm-sp { transform: none; }
.pm-num.pm-sh img.pm-sp { height: 25px; width: auto; }
.pm-tall .pm-num.pm-sh img.pm-sp { height: 36px; }
.pm-sv span img.pm-sp { filter: brightness(1.12) drop-shadow(0 0 1px #000) drop-shadow(0 1px 0 rgba(0, 0, 0, .5)); }
.pm-sv:has(img.pm-sp) span { width: 19px; }
.pm-tall .pm-sv:has(img.pm-sp) span { width: 31px; }
.pm-walk .pm-ic img.pm-sp { filter: brightness(1.12) contrast(1.1) drop-shadow(0 0 1.5px #2a1608) drop-shadow(0 2px 0 rgba(0, 0, 0, .4)); }
.pm-parrot.sp { left: 886px; top: 1px; width: 86px; }
.pm-parrot.sp + .pm-bubble { right: 112px; }
.pm-tall .pm-parrot.sp { left: 872px; top: 12px; width: 120px; }
.pm-tall .pm-parrot.sp + .pm-bubble { right: 140px; }
.pm-flag.sp { aspect-ratio: 219/220; transform: translate(-42%, -82%); animation: pmDropSp .32s cubic-bezier(.3, 1.6, .5, 1); }
.pm-flag.sp img.pm-sp { filter: drop-shadow(0 3px 3px rgba(30, 14, 0, .35)); transform-origin: 42% 82%; animation: pmFlagSway 2.6s ease-in-out infinite alternate; }
@keyframes pmDropSp { from { transform: translate(-42%, -190%) scale(.8); opacity: 0; } to { transform: translate(-42%, -82%); opacity: 1; } }
@keyframes pmFlagSway { from { transform: rotate(-1.6deg); } to { transform: rotate(2deg); } }
.pm-shov.sp { aspect-ratio: 286/257; transform-origin: 45% 78%; transform: translate(-45%, -78%); animation: pmDigSp .75s ease-in-out 1 forwards; }
.pm-shov.sp img.pm-sp { filter: drop-shadow(0 4px 3px rgba(30, 14, 0, .35)); }
@keyframes pmDigSp { 0% { transform: translate(-45%, -135%) scale(.9); opacity: 0; } 20% { transform: translate(-45%, -78%) scale(1); opacity: 1; } 38% { transform: translate(-45%, -94%) rotate(-4deg); } 56% { transform: translate(-45%, -78%) rotate(1deg); } 78% { transform: translate(-45%, -88%); } 100% { transform: translate(-45%, -78%); opacity: 1; } }
.pm-chest.sp { aspect-ratio: 287/244; transform: translate(-50%, -58%); }
.pm-chest.sp img.pm-sp { position: absolute; left: 0; bottom: 0; filter: drop-shadow(0 6px 6px rgba(30, 14, 0, .4)); }
.pm-chest.sp .pm-ch-c { width: 98.6%; left: .7%; }
.pm-chest.sp .pm-ch-o { opacity: 0; transform-origin: 50% 92%; }
.pm-chest.sp.open .pm-ch-c { animation: pmClosedOut .22s .16s ease-in forwards; }
.pm-chest.sp.open .pm-ch-o { animation: pmOpenIn .5s .2s cubic-bezier(.2, 1.7, .4, 1) forwards; }
@keyframes pmClosedOut { to { opacity: 0; transform: scale(.96, 1.05); } }
@keyframes pmOpenIn { 0% { opacity: 0; transform: scale(.84, .7); } 100% { opacity: 1; transform: none; } }
.pm-chest.sp.sub .pm-ch-o { display: none; }
.pm-chest.sp.sub .pm-ch-c { opacity: 1; animation: none; filter: saturate(.7) brightness(.85) drop-shadow(0 0 8px rgba(40, 170, 200, .9)); }
.pm-chest.sp.sub.rise { animation: pmRiseSp 1s ease-out forwards; }
@keyframes pmRiseSp { from { transform: translate(-50%, -20%) scale(.6); opacity: 0; } to { transform: translate(-50%, -58%) scale(1); opacity: .92; } }
@keyframes pmChestInSp { from { transform: translate(-50%, -20%) scale(.2); opacity: 0; } to { transform: translate(-50%, -58%) scale(1); opacity: 1; } }
.pm-chest.sp:not(.sub) { animation-name: pmChestInSp; }
.pm-bottle.sp { aspect-ratio: 183/234; }
.pm-bottle.sp img.pm-sp { filter: drop-shadow(0 5px 4px rgba(30, 14, 0, .4)); }
.pm-bottle.sp.up { transform: translate(-50%, -90%) scale(1); }
.pm-bottle.sp.mark { transform: translate(-50%, -64%) scale(.62); }


/* ── every word at least 12.5 real pixels (--pm-min): what that costs the layout ── */
.pm-rfull { display: inline; } .pm-rshort { display: none; }
.pm-rules .pm-merge { display: none; }
/* a landscape phone (stage under 0.7 scale): the route reads "ROUND 1/3", the rules card is one merged line, and the buttons drop their icons so the words fit */
.pm-cramp .pm-rfull { display: none; } .pm-cramp .pm-rshort { display: inline; }
.pm-cramp .pm-dots { display: none; }
.pm-cramp .pm-btn .pm-ic { display: none; }
.pm-cramp .pm-rules { top: auto; bottom: 8px; height: auto; min-height: 72px; padding: 12px 16px 10px; }
.pm-cramp .pm-rules h4 { display: none; }
.pm-cramp .pm-rules li:not(.pm-merge) { display: none; } .pm-cramp .pm-rules li.pm-merge { display: block; }
.pm-cramp .pm-rules li.pm-merge::before { display: none; }

@media (prefers-reduced-motion: reduce) { .pm-sway, .pm-parrot, .pm-dig.ready, .pm-flag-cloth, .pm-streak { animation: none !important; } }
