/* The on-screen play cards of the Power-ups section (issue #350): the runners in public/js/ui/power-ups/ (rhythm-tap, echo-melody,
   number-pattern, mental-maths, riddle, reaction-lights, block-builder, breathing-orb). Linked from index.html. The activity page,
   the countdown and the shared Power-ups rules are in styles/views/power-ups.css.

   They have to hold at 360 px, and at 320 px with the root font size at 200 %: every flex and grid child that holds text gets
   `min-width: 0` and wraps (`overflow-wrap`), sizes are in rem, and the wide parts (the keyboard) scroll inside their own box.
   Anything that moves is inside `prefers-reduced-motion: no-preference`; under `reduce` nothing animates or transitions.
   Colours come from the theme's variables; the four block colours are fixed mid-tones that read on both the light and dark theme,
   and each colour also has its own mark in the cell, so nothing depends on colour alone. */

.pu-rhythm, .pu-echo, .pu-pattern, .pu-maths, .pu-riddle, .pu-react, .pu-blocks, .pu-breathing {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.7rem; min-width: 0; overflow-wrap: anywhere;
}
.pu-rhythm h3, .pu-echo h3, .pu-pattern h3, .pu-maths h3, .pu-riddle h3, .pu-react h3, .pu-blocks h3, .pu-breathing h3 { margin: 0; }
.pu-rhythm p, .pu-echo p, .pu-pattern p, .pu-maths p, .pu-riddle p, .pu-react p, .pu-blocks p, .pu-breathing p { margin: 0; }
.pu-feedback { min-height: 1.5em; font-weight: 600; overflow-wrap: anywhere; }

/* A typed answer: the label and the box, then the buttons. */
.pu-form { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.pu-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.pu-label { font-weight: 700; }
.pu-input {
  font: inherit; width: 100%; min-width: 0; max-width: 100%; min-height: 44px; padding: 0.45rem 0.7rem;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.pu-input:focus { border-color: var(--accent); }
.pu-input:disabled { opacity: 0.6; }
.pu-pattern .pu-actions .btn, .pu-maths .pu-actions .btn, .pu-riddle .pu-actions .btn, .pu-echo .pu-actions .btn,
.pu-rhythm .pu-actions .btn, .pu-react .pu-actions .btn, .pu-blocks .pu-actions .btn, .pu-breathing .pu-actions .btn { min-height: 44px; }
.pu-pattern .btn[aria-disabled="true"], .pu-riddle .btn[aria-disabled="true"], .pu-echo .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; }

/* Rhythm tap: four dots for the beat in the bar, and a big pad. */
.pu-beats { display: flex; gap: 0.6rem; justify-content: center; }
.pu-beat-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--accent); background: transparent; }
.pu-beat-dot--on { background: var(--accent); }
.pu-rhythm-bar { text-align: center; font-weight: 600; }
.pu-tap-pad {
  min-height: 6.5rem; width: 100%; font-size: 1.6rem; font-weight: 800; border: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--text); touch-action: manipulation; user-select: none;
}
.pu-tap-pad:active { background: var(--accent); color: var(--accent-text); }
@media (prefers-reduced-motion: no-preference) {
  .pu-pulse-a { animation: pu-pulse-a 0.35s ease-out; }
  .pu-pulse-b { animation: pu-pulse-b 0.35s ease-out; }
}
@keyframes pu-pulse-a { from { box-shadow: 0 0 0 0.6rem color-mix(in srgb, var(--accent) 35%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }
@keyframes pu-pulse-b { from { box-shadow: 0 0 0 0.6rem color-mix(in srgb, var(--accent) 35%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }

/* Number pattern and mental maths: the big line of numbers, and the combo. */
.pu-pattern-terms, .pu-maths-sum { font-size: clamp(1.3rem, 6vw, 1.9rem); font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pu-pattern-hint-text { min-height: 1.5em; font-style: italic; }
.pu-combo { font-weight: 800; color: var(--accent); font-size: 1.15rem; }

/* Riddle of the day. */
.pu-riddle-text { font-size: 1.15rem; font-weight: 600; }
.pu-riddle-reveal { display: flex; flex-direction: column; gap: 0.4rem; min-height: 1.5em; }
.pu-riddle-reveal .pu-riddle-hint { padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--warn-soft); }
.pu-riddle-reveal .pu-riddle-answer { padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--good-soft); }

/* Reaction lights: a big tile that is plain while it waits and filled when it is lit. */
.pu-react-tile {
  font: inherit; min-height: 7rem; width: 100%; border-radius: var(--radius); border: 3px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 1.5rem; font-weight: 800; touch-action: manipulation; user-select: none;
}
.pu-react-tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.pu-react-tile--lit { background: var(--glow); border-color: var(--text); color: #1c2033; }

/* Block builder: the target and your grid, 6 by 6, each cell a square that shrinks with the screen. */
.pu-blocks-boards { display: grid; gap: 0.9rem; grid-template-columns: minmax(0, 1fr); min-width: 0; }
@media (min-width: 560px) { .pu-blocks-boards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pu-board { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.pu-board h4 { margin: 0; }
.pu-blocks-target, .pu-blocks-grid {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; width: 100%; max-width: 20rem; padding: 3px;
  border-radius: 10px; background: var(--border);
}
.pu-cell {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
}
.pu-cell--static { cursor: default; }
.pu-cell:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; position: relative; z-index: 1; }
.pu-cell--red { background: #e03131; color: #fff; }
.pu-cell--blue { background: #1c7ed6; color: #fff; }
.pu-cell--green { background: #2f9e44; color: #fff; }
.pu-cell--yellow { background: #fcc419; color: #1c2033; }
.pu-mark { line-height: 1; }
.pu-palette { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pu-swatch { min-height: 44px; min-width: 0; }
.pu-swatch[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); font-weight: 800; }
.pu-swatch--red .pu-mark { color: #e03131; }
.pu-swatch--blue .pu-mark { color: #1c7ed6; }
.pu-swatch--green .pu-mark { color: #2f9e44; }
.pu-swatch--yellow .pu-mark { color: #e0a800; }

/* Breathing orb: the script sets the scale from 0.55 to 1 and back (and never does under reduced motion). */
.pu-orb {
  align-self: center; width: min(14rem, 70%); aspect-ratio: 1; border-radius: 50%; background: var(--accent-soft);
  border: 4px solid var(--accent); transform: scale(0.55); transform-origin: center;
}
@media (prefers-reduced-motion: no-preference) { .pu-orb { transition: transform 0.2s linear; } }
.pu-orb--static { transform: none; width: min(10rem, 60%); }
.pu-orb-text { text-align: center; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pu-orb-breath { text-align: center; font-size: 0.9rem; }

.pu-breathing .pu-actions, .pu-rhythm .pu-actions, .pu-react .pu-actions, .pu-echo .pu-actions { justify-content: center; }

/* Nothing in the play cards moves under reduced motion: no pulse, no growing circle, no transitions. */
@media (prefers-reduced-motion: reduce) {
  .pu-pulse-a, .pu-pulse-b, .pu-orb, .pu-tap-pad, .pu-react-tile, .pu-cell { animation: none; transition: none; }
  .pu-orb { transform: none !important; }
}
