/*
 * PHASE 8Q.4-U -- RULES CARDS, NAME IN LIGHTS, THE HOME GAMES SUMMARY,
 * YOUR AUCTION TILES, AND THE PRIZES DESTINATION HIGHLIGHT.
 *
 * Linked LAST BUT ONE: after every earlier stylesheet, before phase8k.css
 * (which stays last). Only tokens app.css defines (the test reads them), no
 * fixed widths, no inline styles anywhere in the scripts these classes serve
 * (`style-src 'self'`), and no rule that re-orders the Prizes blocks (8Q.3C).
 */

/* ---------------------------------------------------------------------------
   RULES CARDS (rules-help.js) -- concise, readable, scrolls inside the sheet
   --------------------------------------------------------------------------- */

/* The sheet body already scrolls (phase6.css); this keeps a long card readable on a 320px phone. */
.rules-card {
  min-width: 0;
  overflow-wrap: break-word;
  font-size: 0.95rem;
  line-height: 1.45;
}

.rules-card__lead {
  margin: 0 0 12px;
  font-weight: 650;
  color: var(--text);
}

.rules-card__facts {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.rules-card__fact {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
}

.rules-card__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.rules-card__text {
  margin: 2px 0 0;
  color: var(--text);
}

.rules-card__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* The persistent way back: small, obvious, and a full tap target. */
.rules-button {
  min-height: var(--tap);
  padding: 0 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.rules-button::before {
  content: "ⓘ ";
}

.rules-button:focus-visible,
.hx-tile:focus-visible,
.nil-status__toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Where each surface places it. */
.ae-rules {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.ae-rules__button,
.wsi-rules,
.ux-ttl-rules,
.chaos-reveal__rules,
.pf__rules {
  margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   NAME IN LIGHTS -- the status card, the teaser, the clocks (directive 19-20)
   --------------------------------------------------------------------------- */

.nil-status {
  min-width: 0;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  overflow-wrap: anywhere;
}

.nil-status--finished {
  border-color: var(--line);
}

.nil-status__toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.nil-status__headline {
  flex: 1 1 12em;
  min-width: 0;
  font-weight: 800;
}

/* The card's headline reuses .pf-public for its words; inside the card it is not a banner. */
.nil-status__toggle .pf-public {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.nil-clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--warn);
}

.nil-clock--big {
  margin: 10px 0 0;
  font-size: 2rem;
  text-align: center;
}

.nil-status__result {
  flex: 1 1 100%;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.nil-status__more {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.nil-status__panel {
  padding: 0 12px 12px;
}

.nil-status__facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.nil-status__fact {
  display: grid;
  grid-template-columns: minmax(0, 9em) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.nil-status__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--text-dim);
}

.nil-status__text {
  margin: 0;
  min-width: 0;
  color: var(--text);
}

/* ---- Name in Lights: HOW TO COMPLETE <Challenge> (always visible, never behind DETAILS) ---- */

.nil-how {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 0 12px 12px;
}

.nil-how__title,
.nil-how__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--warn);
}

.nil-how__label {
  color: var(--text-dim);
}

.nil-how__objective,
.nil-how__winner {
  margin: 0;
  font-weight: 750;
  color: var(--text);
}

.nil-how__steps,
.nil-how__counts {
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.nil-how__steps {
  display: grid;
  gap: 2px;
  font-size: 0.9rem;
}

.nil-how__counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nil-how__count {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.nil-how__count.is-done,
.nil-how__step.is-done {
  border-color: var(--accent);
  color: var(--accent);
}

.nil-how__progress,
.nil-how__note,
.nil-how__text {
  margin: 0;
  min-width: 0;
}

.nil-how__have {
  font-weight: 800;
  color: var(--text);
}

.nil-how__note {
  font-size: 0.85rem;
  color: var(--warn);
}

.nil-how__race,
.nil-how__facts {
  display: grid;
  gap: 4px;
  margin: 0;
}

.nil-how__racer {
  display: grid;
  gap: 0;
  min-width: 0;
}

.nil-how__who {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-dim);
}

.nil-how__action {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  text-align: center;
  text-decoration: none;
}

/* A narrow phone: label over value. */
@media (max-width: 359px) {
  .nil-status__fact {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.nil-teaser__who {
  overflow-wrap: anywhere;
}

.nil-teaser__line {
  margin: 6px 0 0;
  font-size: 1.05rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   HOME -> GAMES SUMMARY (directive 22): rows on a phone, never three columns
   ---------------------------------------------------------------------------
   The 7D card was a flex ROW of three children -- the status line, the
   "1 waiting · 9 completed" counts, the button -- so between 381 and ~600 px
   the middle child was squeezed into a narrow centre column and wrapped a
   word per line. Now it is a grid: one column of rows on a phone (status,
   counts, a full-width GO TO GAMES), and from 600 px the two text rows on
   the left with the button beside them. Presentation only: the words and
   counts are home-summary.js's, unchanged.
*/
.todaycard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.todaycard__counts,
.todaycard .hx-sub {
  min-width: 0;
  margin: 0;
  overflow-wrap: break-word;
}

.todaycard__go {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  margin-top: 6px;
}

@media (min-width: 600px) {
  .todaycard {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
  }

  .todaycard__counts {
    grid-column: 1;
    grid-row: 1;
  }

  .todaycard .hx-sub {
    grid-column: 1;
    grid-row: 2;
  }

  .todaycard__go {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
    margin-top: 0;
  }
}

/* ---------------------------------------------------------------------------
   HOME -> YOUR AUCTION: every tile is one whole-tile link (directive 23)
   --------------------------------------------------------------------------- */

.hx-tiles {
  padding: 0;
  list-style: none;
}

.ux-tile-item {
  min-width: 0;
  display: flex;
}

.hx-tile {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.hx-tile .hx-stat__label,
.hx-tile .hx-stat__value {
  display: block;
}

.hx-tile:hover,
.hx-tile:active {
  border-color: var(--accent-dim);
}

/* ---------------------------------------------------------------------------
   PRIZES: the destination a tile pointed at (prizes-focus.js)
   --------------------------------------------------------------------------- */

.is-focus-target {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: no-preference) {
  .is-focus-target {
    transition: outline-color 240ms ease-out;
  }
}
