/* PR-4 Pattern Memory (js/ex/patterns/view.js). Every rule under .ex-patterns; tokens from
   css/base.css with fallbacks. Cells are 10 drawing units; on screen at most 72 CSS px. */
.ex-patterns .pm-phase {
  margin: 0 0 var(--s2, 0.5rem); min-height: 1.5em;
  font-size: var(--fs-lg, 1.125rem); font-weight: 600; color: var(--ink, #1A1D21);
}
.ex-patterns .pm-stage { display: flex; flex-direction: column; align-items: center; padding: 1.8rem 0.75rem 0.9rem; }
.ex-patterns .pm-wrap { width: 100%; margin: 0 auto; outline: none; border-radius: var(--r-plate, 2px); }
.ex-patterns .pm-wrap:focus-visible { box-shadow: 0 0 0 3px var(--focus, #0B6A86); }
.ex-patterns .pm-svg { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.ex-patterns .pm-verdict { margin-top: 0.6rem; }

.ex-patterns .pm-sq { fill: var(--surface, #FFFFFF); stroke: var(--rule-strong, #7B838A); stroke-width: 0.35; }
.ex-patterns .pm-cell { cursor: pointer; }
.ex-patterns .pm-dot, .ex-patterns .pm-cross { display: none; }
/* The exposure: filled squares, solid ink (high contrast in light and dark). */
.ex-patterns .pm-cell.is-filled .pm-sq { fill: var(--ink, #1A1D21); stroke: var(--ink, #1A1D21); }
/* A mark: a tint and a dot (colour never alone). */
.ex-patterns .pm-cell.is-marked .pm-sq { fill: var(--signal-wash, #E0EEF2); stroke: var(--signal, #0B6A86); stroke-width: 0.5; }
.ex-patterns .pm-cell.is-marked .pm-dot { display: inline; fill: var(--signal, #0B6A86); }
/* Reveal: found (dot kept), missed (dashed outline), extra (a cross). */
.ex-patterns .pm-cell.is-hit .pm-sq { fill: var(--stim-face-3, #A4ABB2); stroke: var(--ink, #1A1D21); }
.ex-patterns .pm-cell.is-hit .pm-dot { display: inline; fill: var(--ink, #1A1D21); }
.ex-patterns .pm-cell.is-miss .pm-sq { fill: var(--stim-face-2, #C9CED3); stroke: var(--ink, #1A1D21); stroke-width: 0.8; stroke-dasharray: 1.4 1; }
.ex-patterns .pm-cell.is-extra .pm-sq { fill: var(--surface, #FFFFFF); stroke: var(--wrong, #B3261E); stroke-width: 0.6; }
.ex-patterns .pm-cell.is-extra .pm-dot { display: none; }
.ex-patterns .pm-cell.is-extra .pm-cross { display: inline; fill: none; stroke: var(--wrong, #B3261E); stroke-width: 0.8; stroke-linecap: round; }
.ex-patterns .pm-cursor { fill: none; stroke: none; pointer-events: none; }
.ex-patterns .pm-cursor.is-on { stroke: var(--signal, #0B6A86); stroke-width: 0.9; }

.ex-patterns .pm-actions {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3, 0.75rem);
  margin-top: var(--s2, 0.5rem);
}
.ex-patterns .pm-actions[hidden] { display: none; }
.ex-patterns .pm-count { font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace); font-size: var(--fs-sm, 0.875rem); color: var(--ink-2, #454B52); }

/* The marking time: one slow linear sweep (no ticks, no colour change). */
.ex-patterns .pr-timer {
  height: 4px; margin-top: 0.5rem; overflow: hidden;
  background: var(--surface-3, #DDE1DE); border-radius: 2px;
}
.ex-patterns .pr-timer-fill {
  width: 100%; height: 100%; transform-origin: left center; transform: scaleX(1);
  background: var(--ink-3, #5D646C);
}
.ex-patterns .pr-timer.is-running .pr-timer-fill { animation-name: pm-countdown; animation-timing-function: linear; animation-fill-mode: forwards; }
.ex-patterns .pr-timer.is-stopped .pr-timer-fill,
html[data-hx-state="paused"] .ex-patterns .pr-timer-fill,
[data-paused] .ex-patterns .pr-timer-fill { animation-play-state: paused; }
@keyframes pm-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Phones held sideways (css/play.css: --pl-avail): the grid on the left at full height, so the
   whole pattern is on the screen while it shows; the question, the bar and Confirm on the right. */
@media (max-height: 500px) and (min-aspect-ratio: 1/1) {
  .pl-trial.ex-patterns .ex-patterns-stem {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto 1fr;
    align-items: start; column-gap: var(--s4);
  }
  .pl-trial.ex-patterns .pm-stage { grid-column: 1; grid-row: 1 / -1; padding: 1.6rem 0.5rem 0.5rem; }
  .pl-trial.ex-patterns .ex-patterns-stem > :not(.pm-stage) { grid-column: 2; }
  .pl-trial.ex-patterns .pm-wrap { width: auto; }
  .pl-trial.ex-patterns .pm-svg { width: auto; height: calc(var(--pl-avail) - 2.2rem - 2px) !important; max-width: calc(var(--pl-w) * 0.6); } /* !important: PX.core.svg sets height:auto inline */
}
