/* Parkii: the reward mini-games (js/games.js).
 * The app's sticker style: 2px ink outlines, a hard ink shadow directly underneath, chunky pills that press down
 * into their shadow, and rounded type. Every class starts with .pg-
 */

.pg-root {
  --pg-ink: var(--ink, #2B2326);
  --pg-surface: var(--surface, #FFFDF6);
  --pg-accent: var(--accent, #6250C0);
  --pg-accent-ink: var(--accent-ink, #fff);
  --pg-outline: var(--outline, #2B2326);
  --pg-muted: var(--muted, #766A63);
  --pg-warn: var(--clay, #C9573A);
  --pg-display: var(--font-display, "Fredoka"), ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --pg-body: var(--font-body, "Nunito"), ui-rounded, system-ui, sans-serif;
  --pg-lift: 3px;
  /* Text drawn straight onto the scene. The office and the room are always light and the court is always dark,
     whatever the site's theme, so these don't follow --ink. */
  --pg-scene-ink: #2B2326;
  --pg-scene-muted: #766A63;
  --pg-scene-hi: var(--pg-accent);

  position: absolute;
  inset: 0;
  overflow: hidden;
  container: pg / size;
  font-family: var(--pg-body);
  color: var(--pg-ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* The basketball court is an evening scene, so its text is light */
.pg-dark {
  --pg-scene-ink: #fff;
  --pg-scene-muted: rgba(255, 255, 255, 0.78);
  --pg-scene-hi: #FFE066;
}

.pg-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-touch-callout: none;
  cursor: default;
}
.pg-ready .pg-canvas { cursor: grab; }
.pg-dragging .pg-canvas { cursor: grabbing; }

/* ------------------------------------------------------------------ HUD */

.pg-hud {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.pg-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  padding: 8px 10px 0 20px;
}

.pg-scorebox { min-width: 0; }

.pg-score {
  font-family: var(--pg-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--pg-scene-ink);
  transform-origin: 20% 60%;
}

.pg-sub {
  margin-top: 3px;
  font-family: var(--pg-display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--pg-scene-muted);
}
.pg-sub.pg-hot { color: var(--pg-scene-hi); }

.pg-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.pg-clock {
  padding: 6px 14px;
  font-family: var(--pg-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--pg-ink);
  background: var(--pg-surface);
  border: 2px solid var(--pg-outline);
  border-radius: 999px;
  box-shadow: 0 var(--pg-lift) 0 var(--pg-outline);
}
.pg-clock.pg-warn { color: var(--pg-warn); }

.pg-wind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--pg-display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  color: var(--pg-scene-muted);
}
.pg-wind[hidden] { display: none; }
.pg-wind svg { flex: none; }
/* The arrow comes first, as in the app's Label, and points the way the wind blows */
.pg-wind.pg-left svg { transform: scaleX(-1); }

.pg-close {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--pg-scene-muted);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.15s, color 0.15s;
}
.pg-close[hidden] { display: none; }
@media (hover: hover) {
  .pg-close:hover { color: var(--pg-scene-ink); background: rgba(0, 0, 0, 0.07); }
  .pg-dark .pg-close:hover { background: rgba(255, 255, 255, 0.14); }
}

/* The how-to sits on the floor in a see-through panel (the app's floorGlass), until the first throw */
.pg-hint {
  align-self: center;
  max-width: calc(100% - 32px);
  margin: 0 16px 18px;
  padding: 7px 14px;
  font-family: var(--pg-body);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  color: #fff;
  background: rgba(20, 14, 16, 0.36);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
/* The hacky sack room's floor is light, so its glass is darker */
.pg-kind-hacky .pg-hint { background: rgba(43, 35, 38, 0.62); }
.pg-hint.pg-gone {
  opacity: 0;
  transform: translateY(8px);
}

/* ------------------------------------------------------------------ results */

.pg-results {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(43, 35, 38, 0.12);
}
.pg-results[hidden] { display: none; }

.pg-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(320px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 24px;
  text-align: center;
  color: var(--pg-ink);
  background: var(--pg-surface);
  border: 2px solid var(--pg-outline);
  border-radius: 28px;
  box-shadow: 0 var(--pg-lift) 0 var(--pg-outline);
  animation: pg-pop 0.4s cubic-bezier(0.2, 1.35, 0.4, 1) both;
}

@keyframes pg-pop {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.pg-title {
  margin: 0;
  font-family: var(--pg-display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.1;
  color: var(--pg-ink);
}

.pg-portrait {
  display: block;
  flex: none;
  width: 140px;
  height: 120px;
}

.pg-final {
  font-family: var(--pg-display);
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--pg-accent);
}

.pg-best {
  font-family: var(--pg-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--pg-muted);
}
.pg-best.pg-new { color: var(--pg-accent); }

.pg-streak {
  font-family: var(--pg-body);
  font-size: 13px;
  color: var(--pg-muted);
}
.pg-streak[hidden] { display: none; }

.pg-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding-bottom: var(--pg-lift);
}

/* A chunky capsule that presses down into its shadow */
.pg-btn {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  font-family: var(--pg-display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.2;
  color: var(--pg-ink);
  background: var(--pg-surface);
  border: 2px solid var(--pg-outline);
  border-radius: 999px;
  box-shadow: 0 var(--pg-lift) 0 var(--pg-outline);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.pg-btn[hidden] { display: none; }
.pg-btn-primary {
  color: var(--pg-accent-ink);
  background: var(--pg-accent);
}
@media (hover: hover) {
  .pg-btn:hover { filter: brightness(1.06); }
}
.pg-btn:active {
  transform: translateY(var(--pg-lift));
  box-shadow: 0 0 0 var(--pg-outline);
}
.pg-btn:focus-visible,
.pg-close:focus-visible {
  outline: 3px solid var(--pg-accent);
  outline-offset: 3px;
}
.pg-dark .pg-close:focus-visible { outline-color: #FFE066; }

.pg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ small containers */

@container pg (max-width: 380px) {
  .pg-top { padding: 6px 6px 0 14px; gap: 4px; }
  .pg-score { font-size: 34px; }
  .pg-sub { font-size: 12px; }
  .pg-clock { font-size: 16px; padding: 5px 12px; }
  .pg-card { padding: 20px 18px; }
}

@container pg (max-height: 600px) {
  .pg-card { gap: 6px; padding-top: 18px; padding-bottom: 18px; }
  .pg-title { font-size: 26px; }
  .pg-portrait { width: 110px; height: 92px; }
  .pg-final { font-size: 54px; }
}

@container pg (max-height: 440px) {
  .pg-portrait { display: none; }
  .pg-hint { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-card { animation: none; }
  .pg-hint, .pg-btn, .pg-close { transition: none; }
}
