/* Think & Remember, batch 5c-1: Story Order, Spot the Difference, Mini Sudoku, Maze Run, Tangram and Same Shape, Turned.
   Loaded after games.css by those six pages. Every control is a real button of at least 44px (the main ones use --tap); nothing needs
   movement to be understood: Calm mode and reduced motion only switch off the sliding of Hoot and the pop-in of the boards. */

.puzzle-status { min-height: 1.6em; margin: 0 auto var(--space-3); text-align: center; font-size: var(--fs-m); font-weight: 800; }

/* ---------- Story Order ---------- */
.seq-slots, .seq-tray { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--space-2); width: 100%; max-width: 640px; margin: 0 auto var(--space-4); padding: 0; list-style: none; }
.seq-place { position: relative; display: grid; aspect-ratio: 1; border: 4px dashed #8a97a8; border-radius: var(--radius-m); background: #f4f7fb; }
.seq-place.is-filled { border-style: solid; border-color: var(--blue-deep); background: #fff; }
.seq-place.is-locked { border-color: var(--good); background: #e8f7ec; }
.seq-place > * { grid-area: 1 / 1; }
.seq-place__number { position: absolute; top: 2px; left: 6px; z-index: 2; font-size: var(--fs-s); font-weight: 900; color: var(--ink); }
.seq-slot { width: 100%; min-height: var(--tap); border: 0; border-radius: var(--radius-s); background: transparent; cursor: pointer; }
.seq-slot.is-active { box-shadow: inset 0 0 0 5px var(--sun-deep); background: rgba(255, 210, 63, 0.35); }
.seq-slot:focus-visible, .seq-card:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.seq-card { position: relative; z-index: 1; display: grid; place-items: center; width: 100%; aspect-ratio: 1; min-height: var(--tap); padding: 4px; border: 3px solid #cfd6df; border-radius: var(--radius-m); background: #fff; cursor: pointer; touch-action: manipulation; }
.seq-place .seq-card { border-radius: calc(var(--radius-m) - 4px); border-color: transparent; }
.seq-card.is-selected { box-shadow: 0 0 0 5px var(--blue-deep); }
.seq-card.is-locked { cursor: default; }
.seq-art { width: 100%; height: 100%; }
.seq-tray > li { display: block; }

/* ---------- Spot the Difference ---------- */
.spot-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); width: 100%; max-width: 560px; margin: 0 auto var(--space-4); }
@media (min-width: 900px) { .spot-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 1000px; } }
.spot-panel { margin: 0; }
.spot-panel figcaption { margin-bottom: var(--space-1); font-weight: 800; text-align: center; }
.spot-frame { position: relative; border: 4px solid var(--ink); border-radius: var(--radius-m); overflow: hidden; background: #fff; }
.spot-svg { display: block; width: 100%; height: auto; }
.spot-grid { position: absolute; inset: 0; }
.spot-cell { position: absolute; padding: 0; border: 3px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; touch-action: manipulation; }
.spot-cell:hover { border-color: rgba(43, 45, 66, 0.35); }
.spot-cell:focus-visible { outline: 4px solid var(--focus); outline-offset: -4px; background: rgba(27, 100, 181, 0.15); }
.spot-cell.is-found { border: 4px solid var(--good); background: rgba(60, 207, 110, 0.28); }

/* ---------- Mini Sudoku ---------- */
.sdk-grid { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); width: min(100%, 420px); margin: 0 auto var(--space-4); border: 4px solid var(--ink); border-radius: var(--radius-s); background: var(--ink); gap: 1px; overflow: hidden; }
.sdk-cell { position: relative; display: grid; place-items: center; aspect-ratio: 1; min-height: 44px; padding: 2px; border: 0; background: #fff; color: var(--ink); font-size: var(--fs-l); font-weight: 900; cursor: pointer; touch-action: manipulation; }
.sdk-cell--right { margin-right: 3px; }
.sdk-cell--below { margin-bottom: 3px; }
.sdk-cell.is-given { background: #e7ecf3; }
.sdk-cell.is-filled { cursor: default; }
.sdk-cell.is-chosen { box-shadow: inset 0 0 0 5px var(--sun-deep); background: #fff7d6; }
.sdk-cell.is-clash { box-shadow: inset 0 0 0 4px #d97706; background: #ffeccc; }
.sdk-cell:focus-visible, .sdk-piece:focus-visible { outline: 4px solid var(--focus); outline-offset: -4px; z-index: 1; }
.sdk-cell .shape { width: 80%; height: 80%; }
.sdk-palette { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: var(--space-2); width: min(100%, 420px); margin: 0 auto var(--space-4); }
.sdk-piece { display: grid; place-items: center; aspect-ratio: 1; min-height: 48px; padding: 4px; border: 3px solid #cfd6df; border-radius: var(--radius-m); background: #fff; color: var(--ink); font-size: var(--fs-l); font-weight: 900; cursor: pointer; touch-action: manipulation; }
.sdk-piece.is-chosen { border-color: var(--sun-deep); background: var(--sun); box-shadow: inset 0 -4px 0 var(--sun-deep); }
.sdk-piece .shape { width: 80%; height: 80%; }
.sdk-pad { margin: 0 auto var(--space-4); }
.sdk-pad[hidden] { display: none; }

/* ---------- Maze Run ---------- */
.maze-board { position: relative; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); width: min(100%, 420px); aspect-ratio: 1; margin: 0 auto var(--space-4); border: 4px solid var(--ink); border-radius: var(--radius-s); background: #fff; }
.maze-cell { position: relative; display: grid; place-items: center; box-sizing: border-box; border: 2px solid #e3e8ef; font-size: clamp(1.2rem, 6vw, 2rem); line-height: 1; cursor: pointer; }
.maze-cell--up { border-top: 5px solid var(--ink); }
.maze-cell--right { border-right: 5px solid var(--ink); }
.maze-cell--down { border-bottom: 5px solid var(--ink); }
.maze-cell--left { border-left: 5px solid var(--ink); }
.maze-cell--goal { background: #fff4cc; }
.maze-cell--door { background: #ffd9c2; }
.maze-cell--key { background: #e3f3ff; }
.maze-cell.is-taken { font-size: 0; }
.maze-cell--door.is-open { background: #e8f7ec; opacity: 0.8; }
.maze-hoot { position: absolute; display: grid; place-items: center; font-size: clamp(1.4rem, 7vw, 2.4rem); line-height: 1; pointer-events: none; transition: left 220ms var(--ease-out), top 220ms var(--ease-out); }
html.calm .maze-hoot { transition: none; }
@media (prefers-reduced-motion: reduce) { .maze-hoot { transition: none; } }
.maze-hoot.is-bumped { filter: drop-shadow(0 0 6px var(--try)); }
.maze-pad { display: grid; grid-template-columns: repeat(3, var(--tap)); grid-template-areas: ". up ." "left down right"; gap: var(--space-2); justify-content: center; margin: 0 auto var(--space-4); }
.maze-pad .btn { min-width: var(--tap); min-height: var(--tap); padding: 0; justify-content: center; }
.maze-pad__up { grid-area: up; }
.maze-pad__left { grid-area: left; }
.maze-pad__down { grid-area: down; }
.maze-pad__right { grid-area: right; }

/* ---------- Tangram ---------- */
.tg-board { position: relative; width: min(100%, 520px); margin: 0 auto var(--space-4); border: 4px solid var(--line); border-radius: var(--radius-m); background: #fff; }
.tg-svg { display: block; width: 100%; height: auto; }
.tg-slot { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; touch-action: manipulation; }
.tg-slot:focus-visible { background: rgba(255, 210, 63, 0.7); }
.tg-slot[aria-disabled="true"] { cursor: default; }
.tg-tray { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: var(--space-2); width: min(100%, 560px); margin: 0 auto var(--space-4); padding: 0; list-style: none; }
.tg-tray > li[hidden] { display: none; }
.tg-piece { display: grid; place-items: center; width: 100%; aspect-ratio: 1; min-height: var(--tap); padding: 4px; border: 3px solid #cfd6df; border-radius: var(--radius-m); background: #fff; cursor: pointer; touch-action: manipulation; }
.tg-piece.is-chosen { border-color: var(--sun-deep); background: #fff7d6; box-shadow: inset 0 -4px 0 var(--sun-deep); }
.tg-piece:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.tg-art { width: 100%; height: 100%; }
.tg-controls { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin: 0 auto var(--space-4); }
.tg-controls[hidden] { display: none; }
.tg-controls .btn[aria-disabled="true"] { opacity: 0.5; }

/* ---------- Same Shape, Turned ---------- */
.rot-first { width: clamp(112px, 34vw, 160px); margin: 0 auto var(--space-4); padding: var(--space-2); border: 4px solid var(--ink); border-radius: var(--radius-m); background: #fff; }
.rot-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); width: min(100%, 420px); margin: 0 auto var(--space-4); padding: 0; list-style: none; }
.rot-option { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; min-height: var(--tap); padding: var(--space-2); border: 4px solid #cfd6df; border-radius: var(--radius-m); background: #fff; cursor: pointer; touch-action: manipulation; }
.rot-option:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.rot-option.is-dimmed { opacity: 0.4; }
.rot-option[aria-disabled="true"] { cursor: default; }
.rot-option__number { position: absolute; top: 4px; left: 8px; font-weight: 900; color: var(--ink); }
.rot-art { width: 100%; height: 100%; }
