/* The Power-ups view (public/js/ui/views/power-ups.js) and its runners (public/js/ui/power-ups/*.js). Linked from index.html; its
   rules live here and nowhere else (never in styles.css). The cards of the curriculum and play slots keep their own rules in
   styles/power-ups/curriculum.css and play.css.

   It has 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`, buttons wrap their labels (the shared `.btn` rule), and the big time is sized in rem with a vw ceiling. */

/* The hub: one big tile per moment. */
.pu-tiles, .pu-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; grid-template-columns: minmax(0, 1fr); }
.pu-tile { display: flex; flex-direction: column; gap: 0.5rem; min-height: 44px; text-decoration: none; color: inherit; overflow-wrap: anywhere; }
.pu-tile h2 { font-size: 1.4rem; }
.pu-tile:hover, .pu-tile:focus-visible { border-color: var(--accent); }
.pu-tile--start { border-left: 6px solid var(--tier-foundations); }
.pu-tile--break { border-left: 6px solid var(--tier-application); }
.pu-tile--finish { border-left: 6px solid var(--tier-challenge); }
@media (min-width: 720px) { .pu-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* The deal: a card is one big link. The title link is stretched over the whole card, so the card is the target. */
.pu-card { position: relative; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; overflow-wrap: anywhere; }
.pu-card h3 { margin: 0; }
.pu-card-link { color: inherit; text-decoration: none; }
.pu-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.pu-card:hover, .pu-card:focus-within { border-color: var(--accent); }
.pu-card-link:focus-visible { outline: none; }
.pu-card:has(.pu-card-link:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
@media (min-width: 720px) { .pu-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pu-tags { align-items: center; }
.pu-first { overflow-wrap: anywhere; }
.pu-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.pu-actions .btn { min-height: 44px; }
/* The live regions stay rendered when empty (a `display: none` region is not in the accessibility tree, so the first text written
   into it would not be announced); a little reserved room is the price. */
.pu-status { margin: 0; min-height: 1.5em; }

/* An activity: the steps, and the countdown for a break. */
.pu-steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; }
.pu-steps li { min-width: 0; overflow-wrap: anywhere; }
.pu-timer { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; text-align: center; }
.pu-time {
  margin: 0; font-size: clamp(2rem, 12vw, 3.5rem); font-weight: 800; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.pu-bar { width: 100%; height: 0.6rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pu-bar > span { display: block; height: 100%; background: var(--accent); }
.pu-live { margin: 0; min-height: 1.5em; font-weight: 600; overflow-wrap: anywhere; }
.pu-timer .pu-actions { justify-content: center; }
.pu-timer-note { font-size: 0.9rem; }
@media (prefers-reduced-motion: no-preference) { .pu-bar > span { transition: width 1s linear; } }
@media (prefers-reduced-motion: reduce) { .pu-bar > span, .pu-card, .pu-tile { transition: none; animation: none; } }

/* Runners. */
.pu-dice, .pu-boss { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; min-width: 0; }
.pu-dice-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; width: 100%; }
.pu-dice-move { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.2rem 0.8rem; padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--surface-2); }
.pu-dice-name, .pu-dice-count { min-width: 0; overflow-wrap: anywhere; }
.pu-boss-label { font-weight: 700; }
.pu-boss-input {
  font: inherit; width: 100%; min-height: 44px; max-width: 100%; padding: 0.45rem 0.7rem;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.pu-boss-input:focus { border-color: var(--accent); }
.pu-boss-note { font-size: 0.9rem; }

/* The links into the section: on the home page, at the end of a lesson and at the end of Learn. */
.power-card { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; text-decoration: none; color: inherit; }
.power-card > div { flex: 1 1 220px; min-width: 0; }
.power-card p { color: var(--muted); font-size: 0.92rem; }
.pu-links { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.pu-links .btn, .pu-link { min-height: 44px; margin-top: 0; }
.next-row:has(> .pu-link) { flex-wrap: wrap; justify-content: space-between; gap: 0.6rem; }
