/* Page Shuffle. The board keeps a fixed square size from the first paint (aspect-ratio), so nothing shifts while the
   game loads, and nothing outside the game card is ever placed inside it. Shared styles: puzzles/assets/puzzles.css. */

.ps-game { max-width: 560px; margin-left: auto; margin-right: auto; }
.ps-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ps-buttons { display: flex; gap: 10px; }

.ps-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.ps-stats div { padding: 8px 10px; border: 1px solid var(--border, #2A2F36); border-radius: 10px; background: #111827; text-align: center; }
.ps-stats dt { color: var(--text-muted, #9AA4AE); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ps-stats dd { margin: 2px 0 0; color: var(--heading, #F8FAFC); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.ps-board { --size: 3; display: grid; grid-template-columns: repeat(var(--size), 1fr); grid-template-rows: repeat(var(--size), 1fr); gap: 8px;
    width: min(100%, 440px); aspect-ratio: 1; margin: 0 auto; padding: 8px; box-sizing: border-box; border-radius: 14px; background: #0B0F14;
    border: 1px solid var(--border, #2A2F36); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ps-board:focus-visible { outline: 3px solid #f87171; outline-offset: 3px; }
.pz .ps-tile { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; margin: 0; padding: 0 !important;
    border: 1px solid #d1d5db !important; border-radius: 6px !important; background: #f9fafb !important; color: #111827 !important; cursor: default;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45); font: inherit; overflow: hidden; }
.pz .ps-tile::after { content: ""; position: absolute; top: 0; right: 0; width: 22%; height: 22%; background: linear-gradient(225deg, #0B0F14 50%, #e5e7eb 50%); }
.ps-number { position: relative; z-index: 1; font-size: clamp(1.3rem, 7vw, 2.2rem); font-weight: 800; font-variant-numeric: tabular-nums; }
[data-size="4"] .ps-number { font-size: clamp(1.1rem, 5.5vw, 1.8rem); }
.ps-lines { position: absolute; left: 16%; right: 16%; bottom: 14%; height: 18%; background: repeating-linear-gradient(#d1d5db 0 2px, transparent 2px 7px); opacity: 0.8; }
.pz .ps-tile.is-movable { cursor: pointer; border-color: #f87171 !important; }
/* tool-dark.css darkens every button on a tool page on hover (!important); a page keeps its paper colour, so its number stays readable. */
.pz .ps-tile:hover { background: #f9fafb !important; }
.pz .ps-tile.is-movable:hover { background: #fff !important; }

.pz .ps-tile:focus-visible { outline: 3px solid #f87171; outline-offset: 2px; }
.ps-board.is-solved .ps-tile { border-color: #4ade80 !important; }
.ps-tile.is-stuck { animation: ps-stuck 0.25s; }
@keyframes ps-stuck { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.ps-help { margin: 12px 0 0; font-size: 0.9rem; text-align: center; }
.ps-status { min-height: 1.4em; margin: 8px 0 0; color: #bbf7d0; font-weight: 600; text-align: center; }

@media (max-width: 480px) {
    .ps-controls { flex-direction: column; align-items: stretch; }
    .ps-sizes { align-self: center; }
    .ps-buttons .pz-btn { flex: 1; }
    .ps-board { gap: 6px; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .ps-tile.is-stuck { animation: none; }
}

@media print {
    .ps-game { break-inside: avoid; }
}

/* Page numbers are ink on paper; tool-dark.css colours every span of a tool page light with !important. */
.pz .ps-tile .ps-number { color: #111827 !important; }
.pz .ps-tile.is-home .ps-number { color: #B71C1C !important; }
