/* Pumpkin Pitch — sunset over the farm.
   The same dusk sky as the other pumpkin games behind everything (a fixed
   SVG). Play is one full-screen transparent canvas over a CSS grass band,
   with a light DOM HUD on top. Safe areas follow the house convention. */

:root {
  --pp-ink: #1b233e;
  --pp-navy: #1b233e;
  --pp-cream: #fff6e5;
  --pp-cream-soft: #ffe6c2;
  --pp-orange: #f39422;
  --pp-teal: #176877;
  --pp-teal-edge: #124b56;
  --pp-sky1: #2b2456;
  --pp-sky2: #7a4a8f;
  --pp-sky3: #f08c4a;
  --pp-grass: #5fa64b;
  --pp-grass-dark: #4b8a3b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: Nunito, system-ui, -apple-system, sans-serif;
  color: var(--pp-ink);
  background: linear-gradient(180deg, var(--pp-sky1) 0%, var(--pp-sky2) 45%, var(--pp-sky3) 100%);
  -webkit-text-size-adjust: 100%;
}
body { overscroll-behavior: none; min-height: 100svh; -webkit-tap-highlight-color: transparent; }

/* Rob's Hall of the Mountain King panorama (HOTMK-BG-3), standing on the grass. */
.pp-scenery {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: #0c0529 url("../../../assets/pumpkins/bg/castle-3.jpg") 70% 100% / cover no-repeat;
}
/* Upright: "cover" blew the castle up to the full height of the phone. Stand
   it on the grass at half height; its sky's top colour fills above. */
@media (orientation: portrait) { .pp-scenery { background-size: auto 52svh; } }
.pp-scenery svg { width: 100%; height: 100%; display: block; }
.pp-bat { animation: pp-fly 46s ease-in-out infinite alternate; }
@keyframes pp-fly { from { transform: translate(-40px, 10px); } to { transform: translate(80px, -24px); } }
.pp-stars circle { animation: pp-twinkle 3.2s ease-in-out infinite alternate; }
.pp-stars circle:nth-child(2n) { animation-delay: -1.1s; }
@keyframes pp-twinkle { from { opacity: 0.35; } to { opacity: 1; } }

.pp-app { position: relative; min-height: 100svh; z-index: 1; }

/* ── Menu ─────────────────────────────────────────────────────────────── */
.pp-menu {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: calc(72px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.pp-title {
  margin: 0; font-size: clamp(40px, 8.5vw, 68px); font-weight: 900; line-height: 1; letter-spacing: -0.5px;
  color: var(--pp-cream); text-align: center; text-shadow: 0 3px 0 rgba(43, 20, 60, 0.45);
}
.pp-title span { color: var(--pp-orange); }
.pp-sub { margin: 2px 0 0; font-size: clamp(15px, 2.8vw, 20px); font-weight: 800; color: var(--pp-cream-soft); text-align: center; }
.pp-hero { display: flex; align-items: flex-end; justify-content: center; gap: 2%; width: min(560px, 100%); height: clamp(64px, 11vw, 96px); margin-top: 4px; }
.pp-hero .pa-pumpkin { height: calc(var(--pa-h) * 100%); width: auto; animation: pp-bob 2.6s ease-in-out infinite; }
.pp-hero .pa-pumpkin:nth-child(2n) { animation-delay: -0.8s; }
.pp-hero .pa-pumpkin:nth-child(3n) { animation-delay: -1.7s; }
@keyframes pp-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.pp-page .kid-quick-start { margin: 8px auto 2px; background: var(--pp-teal); }
.pp-page .kid-quick-start:hover { background: var(--pp-teal-edge); }
.pp-quick-blurb { color: #fff; font-size: 16px; font-weight: 800; }

.pp-optrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.pp-aim-help { margin: -2px auto 4px; max-width: 30em; text-align: center; font-size: 14px; font-weight: 800; color: #fff6e5; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
.pp-optlabel { font-size: 11px; font-weight: 900; letter-spacing: 1.4px; text-transform: uppercase; color: var(--pp-cream); opacity: 0.85; margin-right: 2px; }
.pp-pill {
  min-height: 46px; padding: 0 16px;
  border: 2px solid rgba(255, 246, 229, 0.35); border-radius: 999px;
  background: rgba(253, 251, 246, 0.88); color: var(--pp-navy);
  font: 800 15px/1 Nunito, system-ui, sans-serif; cursor: pointer;
}
.pp-pill[aria-pressed="true"] { background: var(--pp-navy); border-color: var(--pp-navy); color: #fff; }
.pp-pill:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

.pp-levels-title { margin: 12px 0 2px; font-size: 22px; font-weight: 900; color: var(--pp-cream); text-shadow: 0 2px 0 rgba(43, 20, 60, 0.4); }
.pp-levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 176px), 1fr)); gap: 12px; width: min(960px, 100%); }
.pp-level {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto auto;
  column-gap: 10px; align-items: center; min-height: 92px; padding: 12px 12px 10px;
  border: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.94); color: var(--pp-ink);
  text-align: left; font: inherit; cursor: pointer; box-shadow: 0 4px 0 rgba(43, 20, 60, 0.28);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.pp-level:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 rgba(43, 20, 60, 0.28); }
.pp-level:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(43, 20, 60, 0.28); }
.pp-level:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.pp-level-emoji { grid-row: 1 / span 3; font-size: 32px; text-align: center; }
.pp-level-name { font-size: 17px; font-weight: 900; line-height: 1.15; color: var(--pp-navy); }
.pp-level-num { color: #6a5a86; font-weight: 800; margin-right: 4px; }
.pp-level-dots { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0 1px; }
.pp-level-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.08); }
.pp-level-blurb { font-size: 13px; font-weight: 700; color: #5a4a6e; line-height: 1.25; }
.pp-level-stars { font-size: 15px; letter-spacing: 1px; color: #f2b72b; }
.pp-level-stars .off { color: #d9d2e3; }
.pp-level.is-locked { background: rgba(255, 255, 255, 0.55); cursor: not-allowed; }
.pp-level.is-locked :is(.pp-level-emoji, .pp-level-name, .pp-level-dots) { opacity: 0.5; }
.pp-level.is-paywalled { cursor: pointer; }

/* ── Play ─────────────────────────────────────────────────────────────── */
.pp-play {
  position: fixed; inset: 0; overflow: hidden;
  /* the grass: the world's floor is at 790 of 900 units = 87.8% of the height */
  background: linear-gradient(180deg, transparent 0 87.8%, var(--pp-grass) 87.8%, var(--pp-grass-dark) 100%);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }

.pp-hud {
  position: absolute; top: calc(70px + env(safe-area-inset-top)); left: max(12px, calc(12px + env(safe-area-inset-left)));
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none;
}
.pp-count {
  display: flex; flex-direction: column; align-items: center; min-width: 84px; padding: 6px 12px 8px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.9); box-shadow: 0 3px 0 rgba(43, 20, 60, 0.3);
}
.pp-count b { font-size: 26px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pp-count small { font-size: 12px; font-weight: 900; letter-spacing: 0.6px; text-transform: uppercase; color: #5a4a6e; }
.pp-count.is-bump b { animation: pp-bump 260ms ease-out; }
@keyframes pp-bump { 40% { transform: scale(1.3); } }

/* the sign: top centre, between the chrome's Menu and Pause pills */
.pp-prompt {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 200px);
  pointer-events: none;
}
.pp-ask {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: clamp(18px, 3.6vw, 26px); font-weight: 900; color: var(--pp-navy);
  background: rgba(253, 251, 246, 0.95); border-radius: 16px; padding: 6px 14px; min-height: 50px;
  box-shadow: 0 3px 0 rgba(43, 20, 60, 0.3); white-space: nowrap;
}
.pp-ask .pp-ask-note { padding: 2px 9px; border-radius: 9px; }
.pp-ask .pp-ask-note small { font-size: 0.5em; font-weight: 900; margin-left: 4px; vertical-align: super; }
.pp-ask .pp-sign { height: clamp(44px, 7vw, 62px); width: auto; display: block; }
.pp-hear {
  border: 0; cursor: pointer; font-family: inherit; pointer-events: auto;
  background: var(--pp-teal); color: #fff; font-size: 14px; font-weight: 900;
  border-radius: 999px; padding: 10px 14px; min-height: 46px; box-shadow: 0 4px 0 var(--pp-teal-edge);
}
.pp-hear:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--pp-teal-edge); }

.pp-toast {
  position: absolute; top: calc(150px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -8px);
  padding: 8px 18px; border-radius: 999px; background: rgba(27, 35, 62, 0.88); color: #fff;
  font-size: 20px; font-weight: 900; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.pp-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.pp-banner {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  padding: 0 16px; color: #fff; font-size: clamp(34px, 7vw, 64px); font-weight: 900; text-align: center; line-height: 1.05;
  text-shadow: 0 4px 0 rgba(43, 20, 60, 0.55); opacity: 0; pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.pp-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ── Results ──────────────────────────────────────────────────────────── */
.pp-veil {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(30, 16, 50, 0.5); overflow-y: auto;
}
.pp-card {
  width: min(440px, 100%); padding: 22px 22px 18px; border-radius: 24px; background: #fff; text-align: center;
  box-shadow: 0 10px 0 rgba(43, 20, 60, 0.3); animation: pp-pop 280ms ease-out;
}
@keyframes pp-pop { from { transform: scale(0.9); opacity: 0; } }
.pp-card h2 { margin: 0; font-size: 30px; font-weight: 900; color: var(--pp-navy); }
.pp-stars { margin: 6px 0 2px; font-size: 40px; letter-spacing: 4px; color: #f2b72b; }
.pp-stars:empty { display: none; }
.pp-stars .off { color: #dde5ec; }
.pp-big { display: flex; flex-direction: column; align-items: center; margin: 4px 0; }
.pp-big span { font-size: 56px; font-weight: 900; line-height: 1; color: var(--pp-orange); }
.pp-big small { font-size: 15px; font-weight: 800; color: #5a4a6e; }
.pp-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 10px 0; font-size: 15px; font-weight: 700; color: #5a4a6e; }
.pp-stats b { color: var(--pp-ink); }
.pp-best { color: #d99a00; }
.pp-card button { display: block; width: 100%; min-height: 56px; margin-top: 10px; border: 0; border-radius: 16px; font: 900 20px/1 Nunito, system-ui, sans-serif; cursor: pointer; }
.pp-card button:focus-visible { outline: 4px solid #183e74; outline-offset: 3px; }
.pp-next { background: var(--pp-teal); color: #fff; }
.pp-next:hover { background: var(--pp-teal-edge); }
.pp-again { background: #fff1e3; color: #8a4a05; }
.pp-menu-btn { background: transparent; color: #5a4a6e; min-height: 48px !important; font-size: 17px !important; }

@media (max-width: 560px) {
  /* the count stays under the Menu pill; the sign gets its own full-width row
     below it and may wrap onto two lines */
  .pp-prompt { max-width: calc(100% - 24px); top: calc(128px + env(safe-area-inset-top)); flex-wrap: wrap; justify-content: center; }
  .pp-ask { white-space: normal; text-align: center; font-size: 18px; padding: 6px 10px; }
  .pp-hear { min-height: 40px; padding: 8px 12px; }
  .pp-count { flex-direction: row; gap: 6px; min-width: 0; padding: 6px 12px; }
  .pp-count b { font-size: 22px; }
  .pp-toast { top: calc(230px + env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) {
  .pp-bat, .pp-stars circle, .pp-hero .pa-pumpkin, .pp-count.is-bump b, .pp-card { animation: none; }
}
