/* PaintGlyph: the paint studio. Raised cream walls, sunken slate floor,
   a pearl ball that leaves a trail of paint. */

.pgCard{ overflow: visible; }
.pgTop{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pgStats{ display: flex; gap: 14px; font-size: 12px; color: var(--w-dim); }
.pgStats b{ display: block; font-family: var(--w-font); font-weight: 400; font-size: 21px; line-height: 1; color: var(--w-accent-text); font-variant-numeric: tabular-nums; }
.pgHead{ display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 8px 0 0; }
.pgHeadMid{ text-align: center; }
.pgTier{ display: inline-block; font: 400 10.5px/1 var(--w-font); letter-spacing: .14em; text-transform: uppercase; padding: 5px 10px 4px; border-radius: 999px; color: var(--w-dim); background: var(--w-bg-0); border: 1px solid var(--w-line-soft); }
.pgTier.t-h{ color: #ff9a2e; border-color: rgba(255,154,46,.55); }
.pgTier.t-x{ color: #ff5aa5; border-color: rgba(255,90,165,.6); }
.pgTier.t-d{ color: var(--w-accent-text); border-color: var(--w-line); }
.pgTitle{ font-family: var(--w-font); font-size: clamp(24px, 6.4vw, 32px); line-height: 1.05; margin-top: 4px; color: var(--w-ink); }
.pgFill{ --p: 0; position: relative; height: 10px; border-radius: 999px; margin: 10px 4px 2px; background: var(--w-bg-0); box-shadow: inset 0 0 0 1px var(--w-line-soft); overflow: hidden; }
.pgFill::before{ content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); border-radius: inherit; background: linear-gradient(90deg, var(--paint, #8be03c), var(--paintHi, #c4f58e)); transition: width .3s ease; }
.pgFillRow{ display: flex; justify-content: flex-end; font-size: 11.5px; color: var(--w-dim); margin: 0 6px; }
.pgMsg{ height: 0; overflow: hidden; opacity: 0; text-align: center; font-size: 14px; font-weight: 700; color: var(--w-warn-text); transition: opacity .25s, height .25s; }
.pgMsg.show{ height: 22px; opacity: 1; }

/* ---------- the studio ---------- */
.pgStage{ position: relative; margin: 6px -6px 4px; padding: 14px 6px; border-radius: 20px; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(110% 80% at 50% 10%, var(--w-glow-soft), transparent 60%), linear-gradient(180deg, var(--w-bg-0), var(--w-bg-1)); box-shadow: inset 0 1px 0 var(--w-edge-hi), inset 0 0 0 1px var(--w-line-soft); }
.pgBoard{
  --cs: 40px; --pad: calc(var(--cs) * .32);
  position: relative; display: grid; grid-template-columns: repeat(var(--w), var(--cs)); grid-auto-rows: var(--cs);
  padding: var(--pad); border-radius: calc(var(--cs) * .4);
}
.pgW{ position: relative; }
.pgW.on{
  background: linear-gradient(180deg, #fbf4e3, #efe3c8);
  box-shadow: inset 0 calc(var(--cs) * -.16) 0 #d6c6a3, inset 0 1px 0 #fff;
}
.pgF{
  position: relative; background: #485566;
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.28), inset 0 0 0 1.5px rgba(255,255,255,.03);
}
.pgF.eT{ box-shadow: inset 0 calc(var(--cs) * .14) 0 rgba(0,0,0,.28), inset 0 0 0 .5px rgba(0,0,0,.28); }
.pgF.eL{ box-shadow: inset calc(var(--cs) * .1) 0 0 rgba(0,0,0,.18), inset 0 0 0 .5px rgba(0,0,0,.28); }
.pgF.eT.eL{ box-shadow: inset 0 calc(var(--cs) * .14) 0 rgba(0,0,0,.28), inset calc(var(--cs) * .1) 0 0 rgba(0,0,0,.18), inset 0 0 0 .5px rgba(0,0,0,.28); }
.pgF::before{
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(160deg, var(--paintHi), var(--paint) 55%); opacity: 0; transform: scale(.4); border-radius: 30%;
  transition: opacity .18s ease, transform .22s cubic-bezier(.3,1.5,.5,1), border-radius .22s ease;
}
.pgF.p::before{ opacity: 1; transform: none; border-radius: 0; }
.pgF.splash::before{ animation: pgSplash .32s cubic-bezier(.3,1.5,.5,1); }
@keyframes pgSplash{ 0%{ transform: scale(.35); border-radius: 50%; filter: brightness(1.5) } 70%{ transform: scale(1.02); border-radius: 8% } 100%{ transform: none; border-radius: 0; filter: none } }
.pgF.p.eT::after{ content: ""; position: absolute; inset: 0 0 auto 0; height: calc(var(--cs) * .14); background: rgba(0,0,0,.22); pointer-events: none; }
.pgBoard.won .pgF::before{ animation: pgGlow .7s ease both; animation-delay: var(--d, 0ms); }
@keyframes pgGlow{ 0%,100%{ filter: none } 40%{ filter: brightness(1.45) saturate(1.2) } }

/* the ball */
.pgBall{ position: absolute; left: var(--pad); top: var(--pad); width: var(--cs); height: var(--cs); pointer-events: none; z-index: 6; will-change: transform; }
.pgBall i{
  position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff 0 12%, #eef1f6 30%, #b8c1ce 72%, #8e98a8);
  box-shadow: 0 calc(var(--cs) * .1) calc(var(--cs) * .12) rgba(0,0,0,.38), inset calc(var(--cs) * -.05) calc(var(--cs) * -.06) calc(var(--cs) * .1) rgba(0,0,0,.14);
  transition: transform .12s ease;
}
.pgBall.rollX i{ transform: scale(1.08, .93); }
.pgBall.rollY i{ transform: scale(.93, 1.08); }
.pgBall.squashX i{ animation: pgSqX .28s cubic-bezier(.3,1.6,.5,1); }
.pgBall.squashY i{ animation: pgSqY .28s cubic-bezier(.3,1.6,.5,1); }
@keyframes pgSqX{ 0%{ transform: scale(.78, 1.16) } 100%{ transform: none } }
@keyframes pgSqY{ 0%{ transform: scale(1.16, .78) } 100%{ transform: none } }

/* hint */
.pgF.hintPath::after{ content: ""; position: absolute; inset: 18%; border-radius: 50%; background: rgba(255,214,58,.55); box-shadow: 0 0 12px rgba(255,214,58,.8); animation: pgPulse 1s ease-in-out infinite; pointer-events: none; }
@keyframes pgPulse{ 0%,100%{ transform: scale(.8); opacity: .7 } 50%{ transform: scale(1); opacity: 1 } }
.pgArrows{ position: absolute; left: var(--pad); top: var(--pad); pointer-events: none; z-index: 7; }
.pgArrow{ position: absolute; left: calc(var(--x) * var(--cs)); top: calc(var(--y) * var(--cs)); width: var(--cs); height: var(--cs); display: grid; place-items: center; font: 900 calc(var(--cs) * .62)/1 system-ui, sans-serif; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 10px rgba(0,0,0,.4); animation: pgPulse 1s ease-in-out infinite; animation-delay: calc(var(--k) * 120ms); }
.pgArrow::after{ content: attr(data-n); position: absolute; right: 4%; top: 4%; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font: 800 10px/1 system-ui; color: #3a2300; background: #ffd23a; text-shadow: none; }

/* ---------- bar ---------- */
.pgBar{ display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin: 10px 4px 4px; }
.pgSwipe{ align-self: center; font-size: 12.5px; color: var(--w-dim); text-align: center; }
.pgKey{ -webkit-appearance: none; appearance: none; cursor: pointer; border: 0; padding: 0; background: none; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; color: var(--w-ink); font: 400 11px/1 var(--w-font); letter-spacing: .06em; text-transform: uppercase; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.pgKey .pgRound{ position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: linear-gradient(180deg, var(--w-bg-3), var(--w-bg-1)); border: 1px solid var(--w-line); box-shadow: inset 0 1px 0 var(--w-edge-hi), 0 6px 0 var(--w-bg-0), 0 10px 18px var(--w-drop); transition: transform .12s, box-shadow .12s; }
.pgKey:active .pgRound{ transform: translateY(4px); box-shadow: inset 0 1px 0 var(--w-edge-hi), 0 2px 0 var(--w-bg-0); }
.pgKey[disabled]{ opacity: .4; cursor: default; }
.pgKey.small .pgRound{ width: 40px; height: 40px; font-size: 17px; box-shadow: inset 0 1px 0 var(--w-edge-hi), 0 4px 0 var(--w-bg-0), 0 8px 14px var(--w-drop); }
.pgKey.gold .pgRound{ background: linear-gradient(180deg, #ffd860, #ffae1a); color: #3a2300; border-color: #c98200; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 6px 0 #a86a00, 0 10px 18px var(--w-drop); }
.pgKey.gold.spent .pgRound{ filter: grayscale(.85) brightness(.8); }
.pgKey.hintUndo .pgRound{ box-shadow: 0 0 0 3px #ffd23a, 0 0 22px rgba(255,210,58,.7); animation: pgPulse2 1s ease-in-out infinite; }
@keyframes pgPulse2{ 0%,100%{ transform: scale(1) } 50%{ transform: scale(1.1) } }
.pgBadge{ position: absolute; right: -4px; top: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; font: 800 11px/1 system-ui, sans-serif; color: #fff; background: #c81e3a; border: 2px solid var(--w-bg-1); }
.pgMiniRow{ display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--w-dim); }
:root body.gv-world .pgCard .pgKey{ background: none !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; min-width: 0; color: var(--w-ink); }

/* ---------- done ---------- */
.pgDone{ position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; border-radius: inherit; background: radial-gradient(80% 60% at 50% 40%, color-mix(in srgb, var(--w-bg-1) 72%, transparent), color-mix(in srgb, var(--w-bg-0) 92%, transparent)); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s ease; }
.pgDone[hidden]{ display: none; }
.pgDone.show{ opacity: 1; }
.pgDonePanel{ text-align: center; padding: 20px 18px; max-width: 320px; transform: translateY(12px) scale(.96); transition: transform .45s cubic-bezier(.2,1.4,.4,1); }
.pgDone.show .pgDonePanel{ transform: none; }
.pgDoneKick{ font: 400 11px/1 var(--w-font); letter-spacing: .2em; text-transform: uppercase; color: var(--w-accent-text); }
.pgDoneTitle{ font-family: var(--w-font); font-size: 27px; line-height: 1.1; margin: 8px 0 10px; color: var(--w-ink); }
.pgStars{ display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.pgStar{ font-size: 46px; line-height: 1; color: var(--w-bg-3); text-shadow: 0 2px 0 rgba(0,0,0,.25); transform: scale(0); animation: pgStarIn .5s cubic-bezier(.3,1.8,.5,1) forwards; animation-delay: var(--d); }
.pgStar:nth-child(2){ font-size: 58px; margin-top: -10px; }
.pgStar.on{ color: #ffcc1f; text-shadow: 0 0 18px rgba(255,204,31,.6), 0 3px 0 #b07800; }
@keyframes pgStarIn{ to{ transform: scale(1) } }
.pgDoneStats{ font-size: 14px; color: var(--w-dim); margin-bottom: 16px; }
.pgDoneBtns{ display: grid; gap: 8px; }
.pgBig{ -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; padding: 14px 18px; border-radius: 16px; font: 400 18px/1 var(--w-font); letter-spacing: .03em; color: #fff; background: linear-gradient(180deg, #4d8dff, #2563eb); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 0 #1a46b0, 0 12px 22px rgba(0,0,0,.3); }
.pgBig:active{ transform: translateY(4px); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 0 #1a46b0; }
.pgBig[disabled]{ opacity: .5; }
.pgBigRow{ display: flex; gap: 8px; }
.pgGhost{ -webkit-appearance: none; appearance: none; flex: 1; cursor: pointer; padding: 11px 12px; border-radius: 14px; font: 400 14px/1 var(--w-font); color: var(--w-ink); background: var(--w-bg-2); border: 1px solid var(--w-line); }
:root body.gv-world .pgCard .pgBig{ border: 0 !important; color: #fff !important; background: linear-gradient(180deg, #4d8dff, #2563eb) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 0 #1a46b0, 0 12px 22px rgba(0,0,0,.3) !important; }
:root body.gv-world .pgCard .pgGhost{ color: var(--w-ink) !important; background: var(--w-bg-2) !important; border: 1px solid var(--w-line) !important; }

/* level select */
.pgLevelsDlg .dlg{ max-width: 520px; }
.pgLevelSum{ font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.pgLevelGrid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; max-height: 62vh; overflow: auto; padding: 4px 2px 8px; }
.pgLv{ -webkit-appearance: none; appearance: none; cursor: pointer; border-radius: 12px; padding: 8px 0 6px; display: grid; gap: 3px; justify-items: center; background: var(--card); border: 1px solid var(--line); color: var(--text); box-shadow: inset 0 -3px 0 var(--pc), 0 3px 0 rgba(0,0,0,.15); }
.pgLv b{ font-size: 16px; } .pgLv i{ font-style: normal; font-size: 10px; letter-spacing: 1px; color: #e6a700; min-height: 10px; }
.pgLv.t-h{ border-color: rgba(255,154,46,.6); } .pgLv.t-x{ border-color: rgba(255,90,165,.7); }
.pgLv.cur{ outline: 2px solid #4d8dff; outline-offset: 1px; } .pgLv.locked{ opacity: .45; cursor: default; }

.pgHelpBox{ margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--card) 70%, var(--bg)); border: 1px solid var(--line); }
.pgHelpKicker{ font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pgHelpList{ margin: 0; padding-left: 18px; } .pgHelpList li{ margin: 4px 0; }
.pgHelpActions, .pgShareActions{ display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 420px){ .pgStage{ margin-left: -10px; margin-right: -10px; padding: 10px 4px; } .pgKey .pgRound{ width: 48px; height: 48px; } }
@media (prefers-reduced-motion: reduce){ .pgF::before, .pgF.splash::before, .pgBall i, .pgArrow, .pgF.hintPath::after, .pgStar{ animation: none; transition: none; } .pgStar{ transform: none; } }
