/* Plop Pop page — keeps the site header, gives the game the rest of the screen */
html:has(body.game-page), body.game-page { overscroll-behavior: none; }
/* While a level is being played: the page can't scroll or pull-to-refresh, and the stage swallows touch gestures */
html.pp-playing, html.pp-playing body { overflow: hidden; overscroll-behavior: none; }
html.pp-playing .pp-stage, html.pp-playing .pp-frame { touch-action: none; -webkit-user-select: none; user-select: none; }
body.game-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
.game-page .site-header { padding-bottom: 6px; }
.pp-main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 1; }
.pp-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: min(560px, calc(100% - 16px)); padding: 2px 0 8px;
}
.pp-back {
  display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 4px 12px 4px 8px;
  border-radius: 999px; background: var(--chip); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 0.9rem; color: var(--ink);
}
.pp-back svg { width: 18px; height: 18px; }
.pp-title {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--brand), var(--cartoons)); -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.pp-tools { display: flex; gap: 8px; }
.pp-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--chip); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s var(--spring);
}
.pp-btn:active { transform: scale(0.9); }
.pp-btn svg { width: 20px; height: 20px; grid-area: 1 / 1; }
.pp-btn[data-state="on"] .i-off, .pp-btn[data-state="off"] .i-on { display: none; }
.pp-btn[data-state="playing"] .i-play, .pp-btn[data-state="paused"] .i-pause { display: none; }
.pp-back:focus-visible, .pp-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.pp-stage {
  flex: 1 1 auto; min-height: 0; width: min(560px, 100%); margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 0 8px max(10px, env(safe-area-inset-bottom));
}
#pp-canvas {
  display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  border-radius: 22px; border: 1.5px solid var(--line); box-shadow: var(--shadow);
  background: var(--bg-soft); cursor: crosshair;
}
@media (max-width: 620px) {
  .pp-bar { padding-bottom: 6px; }
  .pp-title { font-size: 1.2rem; }
  .pp-stage { padding: 0 6px max(6px, env(safe-area-inset-bottom)); }
  #pp-canvas { border-radius: 18px; }
}

/* ---------- frame + HTML menus over the canvas (scaled with the canvas via --u) ---------- */
.pp-frame { position: relative; flex: none; --u: 1; }
.pp-frame #pp-canvas { width: 100%; height: 100%; }
.pp-ui {
  position: absolute; inset: 0; z-index: 2; border-radius: 22px; overflow: hidden;
  font-size: calc(var(--u) * 16px); font-family: var(--sans); color: var(--ink);
}
.pp-ui[hidden] { display: none; }
@media (max-width: 620px) { .pp-ui { border-radius: 18px; } }
.pp-scr { position: absolute; inset: 0; display: flex; flex-direction: column; animation: pp-fade 0.25s var(--ease); }
@keyframes pp-fade { from { opacity: 0; } }

/* Title */
.pp-title-scr { justify-content: flex-start; }
.pp-topline { display: flex; justify-content: flex-end; padding: 1em 1em 0; }
.pp-acct.ng-chip { font-size: max(0.82em, 12px); min-height: 2.5em; max-width: 12em; }
.pp-menu { position: absolute; left: 0; right: 0; top: 47%; display: flex; flex-direction: column; align-items: center; gap: 0.85em; padding: 0 1.5em; }
.pp-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35em; padding: 0 1.1em 0 0.8em;
  border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: 700 1.75em var(--display); letter-spacing: 0.01em;
  background: linear-gradient(90deg, var(--brand), var(--gaming) 60%, var(--cartoons)); background-size: 100% 100%;
  box-shadow: 0 0.22em 0 var(--brand-deep), 0 0.6em 1.2em rgba(107, 77, 255, 0.35);
  animation: pp-breathe 2.2s ease-in-out infinite; -webkit-tap-highlight-color: transparent;
  font-size: 1.75em; height: 2.3em; min-width: 6.4em;
}
[data-theme="dark"] .pp-play { box-shadow: 0 0.22em 0 #4a3bb8, 0 0.6em 1.2em rgba(0, 0, 0, 0.4); }
.pp-play:active { transform: translateY(0.15em); animation: none; }
.pp-play-i svg { width: 1em; height: 1em; display: block; }
@keyframes pp-breathe { 50% { transform: scale(1.045); } }
.pp-prog { margin: 0; font-weight: 800; color: var(--muted); font-size: 1em; text-align: center; }
.pp-row { display: flex; gap: 0.6em; justify-content: center; flex-wrap: wrap; }
.pp-pill {
  display: inline-flex; align-items: center; gap: 0.45em; height: 2.9em; padding: 0 1.15em 0 0.6em; border-radius: 999px; cursor: pointer;
  background: var(--card); color: var(--ink); border: 0.1em solid var(--line); box-shadow: 0 0.2em 0 var(--line), var(--shadow-sm);
  font: 800 1em var(--sans); -webkit-tap-highlight-color: transparent; transition: transform 0.2s var(--spring);
}
.pp-pill:active { transform: translateY(0.15em); }
.pp-pill-i { width: 1.9em; height: 1.9em; border-radius: 0.7em; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--hardware), var(--games)); font: 700 1.15em/1 var(--display); }
.pp-pill:nth-child(2) .pp-pill-i { background: linear-gradient(135deg, #ffc24d, var(--cartoons-2)); }
.pp-pill-i svg { width: 1.15em; height: 1.15em; display: block; }
.pp-pill.locked { color: var(--muted); }
.pp-pill.locked .pp-pill-i { background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 0.1em var(--line); }
.pp-pill-sm { height: 2.5em; font-size: 0.9em; }
.pp-guest { margin: 0.3em 0 0; max-width: 24em; text-align: center; color: var(--muted); font-weight: 700; font-size: 0.86em; line-height: 1.45; }
.pp-linkbtn { border: 0; padding: 0; background: none; color: var(--brand); font: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; }
.pp-pill:focus-visible, .pp-play:focus-visible, .pp-round:focus-visible, .pp-endless:focus-visible, .pp-linkbtn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Result cards */
.pp-card-scr { align-items: center; justify-content: center; padding: 1.2em; background: color-mix(in srgb, var(--bg) 45%, transparent); }
.pp-card {
  width: min(23em, 100%); display: flex; flex-direction: column; align-items: stretch; gap: 0.7em; padding: 1.6em 1.4em 1.3em; text-align: center;
  background: var(--card); border: 0.1em solid var(--line); border-radius: 1.8em; box-shadow: 0 1.4em 3em rgba(0, 0, 0, 0.22);
  animation: pp-pop 0.5s var(--spring);
}
.pp-card .ng-primary { font-size: 1.15em; min-height: 2.9em; margin-top: 0.2em; }
.pp-card .pp-row .pp-pill { flex: 1; justify-content: center; }
@keyframes pp-pop { from { transform: scale(0.7) translateY(1em); opacity: 0; } }
.pp-kicker { margin: 0; color: var(--muted); font-weight: 800; font-size: 0.9em; letter-spacing: 0.02em; }
.pp-big {
  margin: 0; font: 700 2.6em/1.05 var(--display); letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--brand), var(--cartoons)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pp-big-over { background-image: linear-gradient(90deg, var(--cartoons), var(--cartoons-2)); }
.pp-stars { display: flex; justify-content: center; align-items: flex-end; gap: 0.3em; margin: 0.1em 0 0.2em; }
.pp-star { width: 3.2em; height: 3.2em; color: var(--line); animation: pp-star 0.55s var(--spring) both; animation-delay: var(--d); }
.pp-star:nth-child(2) { width: 4em; height: 4em; }
.pp-star svg { width: 100%; height: 100%; display: block; }
.pp-star.on { color: #ffcc33; filter: drop-shadow(0 0.18em 0 #e09a00) drop-shadow(0 0.4em 0.6em rgba(255, 170, 0, 0.35)); }
@keyframes pp-star { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.pp-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; }
.pp-stats div, .pp-score { display: flex; flex-direction: column; padding: 0.6em; border-radius: 1em; background: var(--bg-soft); }
.pp-stats small, .pp-score small { color: var(--muted); font-weight: 800; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.06em; }
.pp-stats b { font: 700 1.45em var(--display); }
.pp-score b { font: 700 2.4em var(--display); color: var(--ink); }
.pp-bonus { margin: 0; color: var(--games); font-weight: 800; font-size: 0.88em; }
.pp-save { margin: 0; color: var(--muted); font-weight: 700; font-size: 0.85em; min-height: 1.2em; }
.pp-save:empty { display: none; }
.pp-rank { display: flex; flex-wrap: wrap; gap: 0.4em; justify-content: center; align-items: center; color: var(--muted); font-weight: 700; font-size: 0.9em; min-height: 2em; }
.pp-rank-chip { padding: 0.3em 0.8em; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); }
.pp-rank-chip b { font-family: var(--display); font-size: 1.15em; }
.pp-newbest { padding: 0.3em 0.8em; border-radius: 999px; background: linear-gradient(90deg, #ffc24d, var(--cartoons-2)); color: #fff; font-weight: 800; animation: pp-pop 0.6s var(--spring); }
.pp-card-sm { width: min(19em, 100%); }
.pp-pause { background: transparent; }
@media (prefers-reduced-motion: reduce) { .pp-play, .pp-card, .pp-star, .pp-scr { animation: none; } }

/* ---------- Plop Pop extras ---------- */
#pp-canvas { cursor: none; }
.pp-howto { margin: 0; max-width: 20em; text-align: center; color: var(--muted); font-weight: 800; font-size: 0.95em; line-height: 1.45; }
.pp-howto b { color: var(--ink); }
.pp-best { margin: 0; font-weight: 800; color: var(--muted); font-size: 1em; text-align: center; }
.pp-best b { font-family: var(--display); color: var(--ink); font-size: 1.15em; }
.pp-menu { top: 52%; }
.pp-biggest { display: flex; align-items: center; justify-content: center; gap: 0.5em; margin: 0; color: var(--muted); font-weight: 800; font-size: 0.92em; }
.pp-biggest i { width: 1.3em; height: 1.3em; border-radius: 50%; display: inline-block; box-shadow: inset 0 -0.15em 0 rgba(0,0,0,0.18); }
.pp-biggest b { color: var(--ink); }
/* the rank line fills in after the score is saved: reserve room so the buttons below never jump under a finger */
.pp-over .pp-rank { min-height: 3.3em; align-content: center; }
/* title menu sits on a soft frosted card so it reads over the blob pile */
.pp-title-scr .pp-menu {
  left: 1.2em; right: 1.2em; top: 40%; padding: 1.3em 1.2em 1.1em; border-radius: 1.6em;
  background: color-mix(in srgb, var(--card) 78%, transparent); border: 0.1em solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 1em 2.4em rgba(0, 0, 0, 0.12);
}
.pp-title-scr .pp-guest { margin-top: 0; }
