/* Weekly Puzzle board + side column. Shared by rewards.html (the real tab,
   logic in rewards-puzzle.js) and manage-puzzle.html (the admin preview), so
   the preview is the player view, not a lookalike.
   Since 2026-09-28 it wears the Rewards "stage" look (Path hero, Wheelspin):
   an always-dark card with a glow, Geist type, a big white title, chips,
   glass tiles and a full-width action bar. The stage is dark in BOTH themes,
   so colours in here are literal, not theme tokens. */
.pz-wrap {
  --pz-ink: #F2F2F0; --pz-muted: #A1A1AA; --pz-green: var(--pp-green-400);
  --pz-glass: rgba(255, 255, 255, .05); --pz-line: rgba(255, 255, 255, .1);
  position: relative; overflow: hidden; width: 100%; box-sizing: border-box;
  border-radius: 28px; border: 1px solid rgba(255, 255, 255, .08);
  background:
    radial-gradient(42% 70% at 24% 50%, rgba(var(--pp-green-400-rgb), .16), transparent 70%),
    radial-gradient(40% 60% at 100% 0%, rgba(59, 130, 246, .10), transparent 65%),
    linear-gradient(180deg, #101118, #0B0C14);
  color: var(--pz-ink); font-family: 'Geist', 'Inter', system-ui, sans-serif;
  padding: 30px 36px;
  /* The board grows up to 580px (capped by the screen height, so the whole
     stage still fits under the tab row); the side column takes the rest. */
  display: grid; grid-template-columns: minmax(0, clamp(340px, 100vh - 290px, 580px)) minmax(300px, 1fr);
  gap: 44px; align-items: center;
}
.pz-wrap *, .pz-wrap *::before, .pz-wrap *::after { box-sizing: border-box; }
.pz-board-col { min-width: 0; }
/* No surround — the board sits straight on the stage. */
.pz-frame {
  --pz-well: rgba(255, 255, 255, .06);
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 18px;
}
.pz-board {
  --pz-n: 3; --pz-gap: 4px;
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 18px; overflow: hidden;
  background: var(--pz-well); box-shadow: inset 0 1px 4px rgba(0,0,0,.35), 0 24px 60px -24px rgba(0,0,0,.8);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  outline: none;
}
.pz-tile {
  position: absolute; left: 0; top: 0;
  width: calc(100% / var(--pz-n)); height: calc(100% / var(--pz-n));
  padding: calc(var(--pz-gap) / 2); cursor: pointer;
  transition: transform .14s cubic-bezier(.2,.8,.2,1), padding .45s ease;
  will-change: transform;
}
.pz-face {
  position: relative; width: 100%; height: 100%; border-radius: 7px;
  background-color: var(--pz-well); background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -2px 0 rgba(0,0,0,.28), 0 2px 5px rgba(0,0,0,.35);
  transition: border-radius .45s ease, box-shadow .45s ease;
}
.pz-tile--last { opacity: 0; pointer-events: none; transition: opacity .5s ease .2s; }
.pz-board.pz-no-anim .pz-tile { transition: none; }
.pz-board.pz-locked .pz-tile { cursor: default; }
/* Solved: the gaps close, the missing corner piece fades in, one glow. */
.pz-board.pz-solved { --pz-gap: 0px; background: transparent; box-shadow: 0 24px 60px -24px rgba(0,0,0,.8); animation: pzSolvedGlow 1.4s ease-out 1; }
.pz-board.pz-solved .pz-face { border-radius: 0; box-shadow: none; }
.pz-board.pz-solved .pz-tile--last { opacity: 1; }
@keyframes pzSolvedGlow {
  0% { box-shadow: 0 0 0 0 rgba(var(--pp-green-400-rgb), 0); }
  35% { box-shadow: 0 0 0 6px rgba(var(--pp-green-400-rgb), .55); }
  100% { box-shadow: 0 0 0 0 rgba(var(--pp-green-400-rgb), 0); }
}
.pz-peek {
  position: absolute; inset: 0; border-radius: 18px; pointer-events: none;
  background-size: cover; background-position: center; opacity: 0; transition: opacity .15s ease;
}
.pz-frame.pz-peeking .pz-peek { opacity: 1; }
/* Solved: after the gaps close, swap the tiles for the one whole image, so no
   hairline seams (sub-pixel tile edges) are left across the picture. */
.pz-board.pz-solved ~ .pz-peek { opacity: 1; transition: opacity .35s ease .45s; }
.pz-empty {
  position: absolute; inset: 0; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--pz-well); color: var(--pz-muted); font-size: 13.5px; font-weight: 600; text-align: center; padding: 20px;
}
.pz-empty[hidden] { display: none; }

/* ── Side column ─────────────────────────────────────────────────────────── */
.pz-side { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.pz-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
/* Chips: the Path hero's eyebrow pills (.sb-path-pill construction). */
.pz-eyebrow, .pz-reward {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 99px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.pz-eyebrow { background: rgba(255, 255, 255, .1); color: #E4E4E7; }
.pz-eyebrow svg { width: 13px; height: 13px; flex: 0 0 auto; }
.pz-reward { padding-left: 8px; background: rgba(var(--pp-green-400-rgb), .14); color: var(--pz-green); }
/* The XP mark as a mask (order.css .ot-xp-mark): the real xp.png shape in one
   flat colour, the chip's green, instead of the orange badge. */
.pz-xp-mark { display: inline-block; flex-shrink: 0; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url(images/xp.png) center / contain no-repeat; mask: url(images/xp.png) center / contain no-repeat; }
.pz-reward-sub { font-weight: 500; color: rgba(var(--pp-green-400-rgb), .7); }
.pz-title {
  margin: 0; font-family: inherit; font-size: 38px; font-weight: 700;
  letter-spacing: -.03em; line-height: 1.08; color: #FFFFFF; overflow-wrap: anywhere;
}
.pz-status { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; font-size: 14px; font-weight: 500; color: var(--pz-muted); line-height: 1.45; min-height: 20px; }
.pz-status:empty { display: none; }
.pz-status.done { color: var(--pz-green); font-weight: 600; }
.pz-status.done svg { flex: 0 0 auto; margin-top: 2px; }
.pz-status.err { color: #FCA5A5; }
.pz-link { background: none; border: none; padding: 0; font: inherit; font-weight: 700; color: inherit; text-decoration: underline; cursor: pointer; }

/* Tiles: Moves + Time (the Wheelspin token tiles, neutral glass) and the
   full-width Preview tile under them. */
.pz-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.pz-stats { display: contents; }
.pz-stat {
  position: relative; overflow: hidden; height: 96px; padding: 12px 14px; border-radius: 18px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  background: radial-gradient(120% 140% at 100% 100%, rgba(var(--pp-green-400-rgb), .14), transparent 55%), var(--pz-glass);
  border: 1px solid var(--pz-line);
}
.pz-stat-lbl { font-size: 13px; font-weight: 600; color: var(--pz-muted); }
.pz-stat-val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: #FFFFFF; font-variant-numeric: tabular-nums; }
.pz-preview {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 10px 16px 10px 10px; border-radius: 18px;
  background: var(--pz-glass); border: 1px solid var(--pz-line); color: var(--pz-ink);
  font-family: inherit; text-align: left; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: border-color .15s, background .15s;
}
.pz-preview:hover, .pz-preview:active { border-color: rgba(var(--pp-green-400-rgb), .55); background: rgba(255, 255, 255, .08); }
.pz-preview:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.pz-preview:disabled { cursor: default; opacity: .5; filter: grayscale(1); border-color: var(--pz-line); background: var(--pz-glass); }
.pz-preview-img { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 12px; background: rgba(255, 255, 255, .06) center / cover no-repeat; }
.pz-preview-txt { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.pz-preview-lbl { font-size: 14px; font-weight: 700; color: #FFFFFF; }
.pz-preview-sub { font-size: 12.5px; font-weight: 500; color: var(--pz-muted); }
.pz-preview-eye { flex: 0 0 auto; color: var(--pz-muted); }

/* Action bar: the countdown once solved. The player tab has no reset (there
   is nothing to recover from on a sliding puzzle); the admin preview keeps
   "Start over" here to deal a fresh scramble. Empty bar = no gap. */
.pz-actions { display: flex; gap: 10px; margin-top: 14px; }
.pz-actions:not(:has(> :not([hidden]):not([style*="none"]))) { display: none; }
.pz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border-radius: 10px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .18);
  color: var(--pz-ink); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: border-color .15s, background .15s; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.pz-btn:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .32); }
.pz-btn:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
.pz-btn--big { flex: 1; height: 54px; border-radius: 16px; font-size: 14px; }
.pz-btn--sm { padding: 5px 10px; font-size: 11.5px; border-radius: 9px; }
/* "New puzzle in 2d 4h" — a quiet full-width bar where Reset was, so the
   finished picture on the board stays fully visible. */
.pz-next {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px; border-radius: 16px; background: var(--pz-glass); border: 1px solid var(--pz-line);
  color: #D4D4D8; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pz-next[hidden] { display: none; }
.pz-next svg { flex: 0 0 auto; opacity: .75; width: 15px; height: 15px; }
/* Foot: the Wheelspin's .ws2-foot. */
.pz-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--pz-muted); }
.pz-foot:not(:has(> :not([style*="none"]))) { display: none; }
.pz-solvers { font-size: 12.5px; font-weight: 600; color: var(--pz-muted); }
.pz-admin { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pz-muted); }
.pz-side--empty .pz-reward, .pz-side--empty .pz-tiles, .pz-side--empty .pz-actions { display: none; }

/* "Tap a tile to slide it" — same pill as the 3D viewer's .dv-note
   (decor-viewer.css), centred on the board and a size up. */
.pz-note {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3;
  max-width: calc(100% - 40px); height: 42px; line-height: 42px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 15px; font-weight: 700; color: #fff;
  background: rgba(0, 0, 0, .6); padding: 0 20px; border-radius: 999px; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity .35s ease, transform .35s ease;
}
.pz-note.is-gone { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
.pz-frame.pz-peeking .pz-note { opacity: 0; }

/* "Solved by 42 this week" — on the right of the tab row (rewards.html),
   the same pill as Wheelspin's fragments count. */
.pz-count-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 99px;
  background: var(--rw2-surface-2, var(--card-bg)); color: var(--text-muted);
  font-family: 'Geist', 'Inter', system-ui, sans-serif; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.pz-count-pill b { color: var(--text); font-weight: 700; }
.pz-count-pill svg { color: var(--text); }

/* "Unsolved this week" — a small NEW pill on the tab (was an orange dot). */
.pnl-tab.pz-has-dot::after, .rw-mtab.pz-has-dot::after {
  content: "New"; display: inline-flex; align-items: center;
  height: 16px; padding: 0 6px; border-radius: 999px; box-sizing: border-box;
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  color: var(--green-cta); background: rgba(var(--pp-green-600-rgb), .14);
  box-shadow: inset 0 0 0 1px rgba(var(--pp-green-600-rgb), .28);
}
html.dark .pnl-tab.pz-has-dot::after, html.dark .rw-mtab.pz-has-dot::after {
  color: var(--pp-green-300); background: rgba(var(--pp-green-400-rgb), .14);
  box-shadow: inset 0 0 0 1px rgba(var(--pp-green-400-rgb), .3);
}
/* On the selected tab the pill takes the tab's ink so it still reads. */
.pnl-tab.active.pz-has-dot::after,
html.dark .pnl-tab.active.pz-has-dot::after {
  color: inherit; background: color-mix(in srgb, currentColor 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent);
}
.rw-mtab { position: relative; }
/* Phone bar: app-badge style at the icon's top-right corner. */
.rw-mtab.pz-has-dot::after {
  position: absolute; top: 3px; left: calc(50% + 5px); height: 15px; padding: 0 5px; font-size: 8.5px;
}

/* Tablet */
@media (max-width: 1099.98px) {
  .pz-wrap { padding: 26px; gap: 28px; grid-template-columns: minmax(0, clamp(320px, 100vh - 290px, 500px)) minmax(280px, 1fr); }
  .pz-title { font-size: 32px; }
}
@media (max-width: 899.98px) {
  .pz-wrap { grid-template-columns: 1fr; gap: 22px; justify-items: center; }
  .pz-board-col, .pz-side { width: 100%; max-width: 540px; }
}
/* Phone: board first, then the panel under it (the Wheelspin's order). */
@media (max-width: 767.98px) {
  .pz-wrap {
    padding: 14px 14px 16px; border-radius: 24px; gap: 18px;
    background:
      radial-gradient(70% 45% at 50% 28%, rgba(var(--pp-green-400-rgb), .16), transparent 70%),
      linear-gradient(180deg, #101118, #0B0C14);
  }
  .pz-board { --pz-gap: 3px; border-radius: 16px; }
  .pz-frame, .pz-peek, .pz-empty { border-radius: 16px; }
  .pz-note { font-size: 13.5px; height: 38px; line-height: 38px; padding: 0 16px; }
  .pz-note-more { display: none; }
  .pz-side { padding: 0 2px; }
  .pz-head { margin-bottom: 10px; gap: 6px; }
  /* Both chips on one line at 360px+. */
  .pz-eyebrow, .pz-reward { height: 26px; padding: 0 9px; gap: 5px; font-size: 12px; }
  .pz-reward { padding-left: 7px; }
  .pz-xp-mark { width: 16px; height: 16px; }
  .pz-title { font-size: 24px; }
  .pz-status { font-size: 13.5px; margin-top: 6px; }
  .pz-tiles { gap: 8px; margin-top: 16px; }
  .pz-actions { margin-top: 12px; }
  .pz-stat { height: 80px; padding: 10px 12px; border-radius: 16px; }
  .pz-stat-val { font-size: 24px; }
  .pz-preview { border-radius: 16px; padding: 8px 14px 8px 8px; }
  .pz-preview-img { width: 56px; height: 56px; flex-basis: 56px; border-radius: 10px; }
  .pz-btn--big, .pz-next { height: 50px; border-radius: 14px; }
}
@media (max-width: 640px) {
  .pz-count-pill { height: 32px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pz-tile, .pz-face, .pz-tile--last, .pz-note { transition: none; }
  .pz-board.pz-solved { animation: none; }
}
