/* Opsi Puzzle: empat tile logo berserakan, disusun pengunjung ke bingkai 2×2 hingga logo SOFS utuh. */

:root {
  --pz-shadow: oklch(50% 0.09 222 / 0.34);
  --pz-shadow-lift: oklch(45% 0.1 222 / 0.3);
}
:root[data-theme="dark"] {
  --pz-shadow: oklch(6% 0.03 240 / 0.6);
  --pz-shadow-lift: oklch(6% 0.03 240 / 0.55);
}

body.puzzle { background: var(--color-paper); color: var(--color-ink); }

.pz-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 27rem) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); width: 100%; max-width: 1380px; margin: 0 auto; padding-block: clamp(24px, 4vw, 56px); }
.pz-copy { display: flex; flex-direction: column; gap: 24px; min-width: 0; align-self: center; }
.pz-copy .brand-word { height: 22px; }
.pz-copy h1 { font-size: clamp(2.3rem, 3.2vw + 0.9rem, 3.75rem); line-height: 1.03; font-weight: 800; letter-spacing: -0.03em; color: var(--color-heading); text-wrap: balance; }

.pz-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 16px; border-radius: var(--radius-inner); background: var(--color-paper-3); }
.pz-count { font-weight: 700; color: var(--color-heading); flex: 1 1 auto; }
.pz-timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--color-muted); font-size: 0.9375rem; }
.pz-reset { min-height: var(--sofs-control-h); padding: 0 18px; border-radius: var(--sofs-radius-md); border: 2px solid var(--sofs-border); background: var(--sofs-surface-raised); font-weight: 600; font-size: var(--text-sm); cursor: pointer; color: var(--sofs-ink); }
.pz-reset:hover { border-color: var(--sofs-ink); }
.pz-help { font-size: var(--text-sm); color: var(--color-muted); max-width: 46ch; }

/* Panggung: posisi diatur JS lewat --S (tile), --F (bingkai), --g (celah), --fx/--fy (pojok bingkai) */
.pz-stage { position: relative; min-height: 540px; min-width: 0; }
.pz-frame { position: absolute; left: var(--fx, 0); top: var(--fy, 0); width: var(--F, 300px); height: var(--F, 300px); display: grid; grid-template-columns: 1fr 1fr; gap: var(--g, 20px); }
.pz-slot { position: relative; border-radius: 14%; border: 1.5px dashed var(--sofs-border); display: grid; place-items: center; transition: border-color 0.25s, background-color 0.25s, transform 0.35s var(--ease-out); }
.pz-slot svg { width: 58%; height: auto; color: var(--sofs-border); opacity: 0.5; }
.pz-slot.is-near { border-color: var(--color-accent); border-style: solid; background: var(--color-accent-soft); transform: scale(1.03); }
.pz-slot.is-filled { border-color: transparent; }

/* Wordmark dan slogan di bawah bingkai: samar saat belum tersusun, penuh saat logo lengkap (logo stacked) */
.pz-word { position: absolute; left: var(--fx, 0); top: calc(var(--fy, 0px) + var(--F, 300px) + var(--S, 120px) * 0.22); width: var(--F, 300px); height: auto; color: var(--sofs-border); opacity: 0.45; transition: color 0.6s, opacity 0.6s; }
.pz-slogan { position: absolute; left: calc(var(--fx, 0px) - 40px); width: calc(var(--F, 300px) + 80px); top: calc(var(--fy, 0px) + var(--F, 300px) + var(--S, 120px) * 0.22 + var(--F, 300px) * 0.27 + 18px); text-align: center; font-size: clamp(0.875rem, 0.5vw + 0.7rem, 1rem); font-weight: 600; line-height: 1.45; color: var(--color-muted); text-wrap: balance; transition: color 0.6s; }
.puzzle.is-done .pz-word { color: var(--color-heading); opacity: 1; }
.puzzle.is-done .pz-slogan { color: var(--color-heading); }

.pz-tile { position: absolute; left: 0; top: 0; width: var(--S, 120px); height: var(--S, 120px); padding: 0; border: 0; background: none; cursor: grab; touch-action: none; border-radius: 14%; filter: drop-shadow(10px 16px 12px var(--pz-shadow)); will-change: transform; -webkit-tap-highlight-color: transparent; z-index: 2; }
.pz-tile svg { width: 100%; height: 100%; display: block; pointer-events: none; transition: transform 0.25s var(--ease-out); }
.pz-tile:hover svg { transform: scale(1.035); }
.pz-tile.is-moving { transition: transform 0.5s var(--ease-out), filter 0.3s; }
.pz-tile.is-lifted { cursor: grabbing; z-index: 6; filter: drop-shadow(22px 34px 22px var(--pz-shadow-lift)); }
.pz-tile.is-lifted svg { transform: scale(1.08); }
.pz-tile.is-placed { cursor: default; filter: drop-shadow(3px 5px 5px var(--pz-shadow)); z-index: 1; }
.pz-tile.is-placed:hover svg { transform: none; }
.pz-tile.is-wrong svg { animation: pz-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.pz-tile.is-hint svg { animation: pz-nudge 0.9s var(--ease-out); }
.pz-tile.is-held { z-index: 6; filter: drop-shadow(22px 34px 22px var(--pz-shadow-lift)); }
.pz-tile.is-held svg { transform: scale(1.08); }
.puzzle.is-done .pz-tile svg { animation: pz-hop 0.7s var(--ease-out) both; animation-delay: calc(var(--i) * 90ms); }
.puzzle.is-done .strip i { animation: pz-strip 0.9s var(--ease-out) both; }
.puzzle.is-done .strip i:nth-child(2) { animation-delay: 0.08s; }
.puzzle.is-done .strip i:nth-child(3) { animation-delay: 0.16s; }
.puzzle.is-done .strip i:nth-child(4) { animation-delay: 0.24s; }
.pz-confetti { position: absolute; width: 10px; height: 10px; border-radius: 2px; pointer-events: none; z-index: 8; }

@keyframes pz-shake {
  10%, 90% { transform: translateX(-3px) rotate(-2deg); }
  20%, 80% { transform: translateX(6px) rotate(3deg); }
  30%, 50%, 70% { transform: translateX(-9px) rotate(-4deg); }
  40%, 60% { transform: translateX(9px) rotate(4deg); }
}
@keyframes pz-hop {
  0% { transform: none; }
  35% { transform: translateY(-18%) rotate(-4deg); }
  70% { transform: translateY(2%); }
  100% { transform: none; }
}
@keyframes pz-strip { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* Ajakan saat diam: satu tile terangkat dan bergoyang sebentar */
@keyframes pz-nudge {
  0% { transform: none; }
  20% { transform: translateY(-7%) rotate(-6deg) scale(1.05); }
  40% { transform: translateY(-7%) rotate(5deg) scale(1.05); }
  60% { transform: translateY(-3%) rotate(-3deg); }
  100% { transform: none; }
}

/* HP: game naik tepat setelah judul; jadwal turun ke bawah. Tile disebar di kiri-kanan bingkai (diatur JS). */
@media (max-width: 900px) {
  .pz-wrap { display: flex; flex-direction: column; gap: 20px; padding-top: 76px; }
  .pz-copy { display: contents; }
  .pz-copy > .brand { order: 1; }
  .pz-copy > h1 { order: 2; }
  .pz-copy > .lead { order: 3; }
  .pz-copy > .pz-help { order: 4; }
  .pz-stage { order: 5; min-height: 0; height: var(--stage-h, 420px); }
  .pz-copy > .pz-status { order: 6; }
  .pz-copy > .sched { order: 7; }
}

@media (prefers-reduced-motion: reduce) {
  .pz-tile.is-moving { transition: none; }
  .puzzle.is-done .pz-tile svg, .puzzle.is-done .strip i, .pz-tile.is-wrong svg, .pz-tile.is-hint svg { animation: none; }
}
