/* Pear Presser — reflex mini-games: Perfect Press, Pear Drop, Juice Rush.
 * Builds on the .mg-* shell and the .pp-* base rules in style.css. */

/* ---------- Perfect Press ---------- */
.pp-wrap { justify-content: space-between; padding: 10px 12px 12px; gap: 8px; touch-action: none; }
.pp-wrap::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s; }
.pp-wrap.pp-s2::before { opacity: 1; background: radial-gradient(circle at 50% 40%, rgba(255,214,90,0), rgba(255,170,40,.34)); }
.pp-wrap.pp-s3::before { opacity: 1; background: radial-gradient(circle at 50% 40%, rgba(255,120,90,0), rgba(232,52,36,.46)); animation: pp-heat 1.1s ease-in-out infinite alternate; }
@keyframes pp-heat { from { opacity: .65; } to { opacity: 1; } }
.pp-wrap > * { position: relative; }

.pp-head { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 7px; flex: none; }
.pp-stage { display: flex; align-items: center; gap: 8px; max-width: 100%; background: var(--cream); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); padding: 3px 12px 3px 4px; font-family: var(--display); font-weight: 600; font-size: 14px; line-height: 1.2; }
.pp-stage b { background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pp-s2 .pp-stage b { background: #c26a00; } .pp-s3 .pp-stage b { background: #c2261a; }
.pp-stage span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pp-stage em { font-style: normal; font-size: 12.5px; white-space: nowrap; background: #ffe873; border: 2px solid var(--ink); border-radius: 999px; padding: 0 7px; margin-right: -7px; }
.pp-rounds { gap: 6px; flex-wrap: wrap; }
.pp-rounds span { display: flex; gap: 4px; padding: 3px 5px; border-radius: 999px; background: rgba(16,30,10,.22); border: 2px solid transparent; }
.pp-rounds span.on { background: rgba(255,255,255,.42); border-color: var(--ink); }
.pp-rounds i { width: 12px; height: 12px; border-width: 2px; background: rgba(255,255,255,.45); transition: transform .2s cubic-bezier(.3,1.8,.5,1), background-color .15s; }
.pp-rounds i.dbl { width: 21px; border-radius: 999px; }
.pp-rounds i.now { background: #fff; transform: scale(1.25); }

.pp-scene { position: relative; flex: 1 1 0; min-height: 0; width: 100%; display: grid; place-items: center; }
.pp-pear { width: min(58vw, 240px, 30vh); aspect-ratio: 1; display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pp-scene .pp-rating { position: absolute; left: 0; right: 0; bottom: 2px; min-height: 0; font-size: 28px; line-height: 1; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; }
.pp-scene .pp-rating.show { animation: pp-rate .95s cubic-bezier(.3,1.6,.5,1) both; }
.pp-rating small { font-size: 13px; font-weight: 600; color: #fff; -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; letter-spacing: .01em; }
@keyframes pp-rate { 0% { transform: scale(.5); opacity: 0; } 18% { transform: scale(1.08); opacity: 1; } 30%, 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(1) translateY(-6px); opacity: 0; } }
.pp-banner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; z-index: 2; }
.pp-banner.show { animation: pp-banner 1.6s ease-out both; }
.pp-banner > div { background: var(--cream); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink); padding: 10px 16px 12px; text-align: center; display: flex; flex-direction: column; gap: 2px; max-width: min(100%, 270px); }
.pp-banner small { font-family: var(--display); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.pp-banner b { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.1; }
.pp-banner span { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); text-wrap: balance; }
@keyframes pp-banner { 0% { opacity: 0; transform: scale(.6); } 12% { opacity: 1; transform: scale(1.04); } 18%, 84% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.96) translateY(-10px); } }

.pp-gauge { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 6px; flex: none; }
.pp-meter { background: linear-gradient(90deg, #ff6b5a, #ffb03d 22%, #ffd95a 50%, #ffb03d 78%, #ff6b5a); transition: filter .2s; }
.pp-meter::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(35,52,26,.28) 0 2px, transparent 2px 10%); pointer-events: none; }
.pp-meter.is-idle .pp-zone { opacity: 0; }
.pp-meter.is-idle .pp-needle { opacity: .45; }
.pp-zone { left: 0; will-change: transform; transition: opacity .15s, filter .15s; }
.pp-zone.is-next { filter: saturate(.35) brightness(1.08); opacity: .62; }
.pp-zone.is-now { box-shadow: 0 0 0 2px #fff, 0 0 12px 3px rgba(255,255,255,.8); z-index: 1; }
.pp-zone.is-hit { filter: brightness(1.25); }
.pp-zone.is-missed { filter: grayscale(.9); opacity: .7; }
.pp-zone[data-n]::before { content: attr(data-n); position: absolute; z-index: 2; top: 2px; left: 50%; width: 17px; height: 17px; margin-left: -8.5px; border-radius: 50%; background: var(--ink); color: #fff; font-family: var(--display); font-weight: 700; font-size: 12px; line-height: 17px; text-align: center; }
.pp-zone.is-hit[data-n]::before { content: "✓"; background: #2e9e4f; }
.pp-needle { z-index: 3; width: 9px; margin-left: -4.5px; background: var(--ink); border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--ink); }
.pp-timer { height: 9px; border-radius: 999px; border: 2px solid var(--ink); background: rgba(16,30,10,.3); overflow: hidden; }
.pp-timer i { display: block; height: 100%; background: #fff; border-radius: 999px; transform-origin: left center; will-change: transform; }
.pp-timer.warn i { background: #ff6b5a; }
.pp-btn { touch-action: none; }
@media (max-height: 620px) {
  .pp-wrap { padding: 8px 10px 10px; gap: 6px; }
  .pp-meter { height: 44px; }
  .pp-btn { min-height: 56px; font-size: 23px; }
  .pp-scene .pp-rating { font-size: 24px; }
  .pp-banner b { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .pp-wrap.pp-s3::before { animation: none; } }

/* ---------- Pear Drop ---------- */
.mg-stat.pd-lives b { color: #f0364a; letter-spacing: 1px; }
.mg-stat.pd-lives.warn { background: #ffd9d2; }

/* stage 4: final squeeze */
.pp-wrap.pp-s4::before { background: radial-gradient(circle at 50% 40%, rgba(230,110,255,0), rgba(176,40,214,.5)); }
.pp-s4 .pp-stage b { background: #8a1fb0; }

/* ---------- arcade shell: pause, carried score ---------- */
.mg-track-risk { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 999px; transition: width .2s;
  background: repeating-linear-gradient(115deg, rgba(255,232,115,.85) 0 5px, rgba(255,255,255,.35) 5px 10px); }
.mg-track-fill { position: relative; }
.mg-mark.maybe { filter: grayscale(.25) opacity(.9); transform: translateX(-50%) scale(1.1); }
.mg-paused { cursor: pointer; z-index: 7; background: rgba(16,30,10,.72); }
.mg-overlay.inline-confirm { z-index: 7; background: rgba(16,30,10,.72); }
.mg-pause-ico { font-size: 46px; line-height: 1; }
.mg-recount { background: rgba(16,30,10,.35); }
#mg-root, #mg-root canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
/* what is on the play field stays hidden while a run waits, so a pause is never a free look */
#mg-root.is-paused .xp-gems { visibility: hidden; }
#mg-root.is-paused .jr-cv { visibility: hidden; }
/* small phones: the four stat tiles stay on one row, so the play field keeps its height */
@media (max-width: 370px) {
  .mg-stats { gap: 4px; flex-wrap: nowrap; padding-left: calc(6px + var(--sal)); padding-right: calc(6px + var(--sar)); }
  .mg-stat { min-width: 0; flex: 0 1 auto; padding: 2px 7px 3px; }
  .mg-stat.pd-lives b { letter-spacing: 0; font-size: 14px; line-height: 21px; display: block; white-space: nowrap; }
}
/* a phone on its side (or a very short window) is too low for the games: ask for more height instead of showing a broken board */
.mg-rotate { display: none; }
@media (orientation: landscape) and (max-height: 430px) {
  .mg-rotate { display: grid; place-items: center; position: fixed; inset: 0; z-index: 60; padding: 16px; background: rgba(16,30,10,.94); color: #fff; text-align: center; font-family: var(--display); }
  .mg-rotate div { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 420px; }
  .mg-rotate span { font-size: 54px; line-height: 1; animation: mg-turn 2.4s ease-in-out infinite; }
  .mg-rotate b { font-size: 22px; font-weight: 700; }
  .mg-rotate small { font-family: inherit; font-size: 14px; font-weight: 500; opacity: .85; }
}
@keyframes mg-turn { 0%, 20% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .mg-rotate span { animation: none; } }
/* cards taller than the play field (small phones, long prize lists): start at the top, scroll all the way,
 * and keep the main button in reach at the bottom edge */
.mg-overlay { display: flex; flex-direction: column; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.mg-overlay > .mg-sheet { margin: auto; flex: none; }
.mg-intro #mg-go, .mg-result .btn-row { position: sticky; bottom: 0; z-index: 1; }
.mg-intro #mg-go { box-shadow: 0 4px 0 var(--ink), 0 7px 0 6px var(--cream), 0 -10px 10px 4px var(--cream); }
.mg-result .btn-row { background: var(--cream); padding-bottom: 5px; margin-bottom: -5px; box-shadow: 0 7px 0 6px var(--cream), 0 -10px 10px 4px var(--cream); }
