/* La Grille: three franchises across, three criteria down, nine album slots to fill with stickers.
   The album page, the stickers, the slots and the criterion labels are shared (assets/styles.css). */

.gr-help {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-soft);
}

.gr-grid {
  display: grid;
  /* minmax(0, …): a long name or label never widens its column past the page. */
  grid-template-columns: minmax(0, 0.85fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.gr-grid .crit.is-row,
.gr-cell {
  min-height: 90px;
}

.gr-cell {
  font: inherit;
}

/* The inside of a box never grows past its column, even for a long name (it shrinks instead). */
.gr-cell.stk,
.gr-cell .stk-foil {
  grid-template-columns: minmax(0, 1fr);
}

button.gr-cell {
  cursor: pointer;
}

.gr-cell.is-choice span {
  font-size: 13px;
  color: var(--ink);
}

.gr-cell.is-choice {
  border: 2px solid var(--ink);
  background: #fff6d6;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  animation: gr-pulse 1s ease-in-out infinite alternate;
}

button.gr-cell:focus-visible {
  border-color: var(--ink);
}

@media (hover: hover) {
  button.gr-cell:hover {
    border-color: var(--ink);
  }
}

@keyframes gr-pulse {
  to { background: #f6d97a; }
}

.gr-cell.is-dim {
  opacity: 0.45;
}

/* After the game, a box left empty shows one answer it had, as a sticker not stuck. */
.gr-cell.is-revealed {
  opacity: 0.75;
  box-shadow: none;
  border-style: dashed;
}

.gr-cell.is-revealed .stk-foil {
  background: var(--card);
}

.gr-cell.is-revealed .stk-band {
  background: var(--ink-soft);
}

.gr-feedback {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--red-strong);
}

.gr-feedback .ghost {
  margin-left: 6px;
  vertical-align: middle;
}

.gr-card .tried {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
}

.gr-card .tried li {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border: 2px solid currentColor;
  color: var(--red-strong);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* After the game: every box opens the list of its possible answers. */
button.gr-cell.stk {
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.gr-cell.is-shown {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.gr-answers {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.gr-answers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gr-answers h3 {
  margin: 0;
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gr-answers-count {
  margin: 6px 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.gr-answers ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gr-answers li {
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--rule);
}

.gr-answers li.is-mine {
  background: linear-gradient(135deg, #f7e6a8 0%, #fff8dc 45%, #e3c96a 100%);
  border-color: var(--ink);
}

.gr-answers li em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink-soft);
}

@media (max-width: 560px) {
  /* Phone: the row labels take less room, the boxes more, and everything in them is set larger. */
  .gr-grid {
    grid-template-columns: minmax(0, 0.95fr) repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .gr-grid .crit.is-row,
  .gr-cell {
    min-height: 100px;
  }

  /* The criteria keep a margin inside their label (DESIGN.md, « Espacement »): a long name is set
     smaller instead of touching the edges (fitNames, grid/app.js). */
  .gr-grid .crit {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 6px;
    gap: 4px;
  }

  .gr-grid .crit b {
    width: 100%;
    font-size: 13px;
    overflow-wrap: normal;
    hyphens: manual;
  }

  .gr-grid .crit small {
    font-size: 10px; /* at least 10 px (audit of 22 October 2026) */
  }

  .gr-cell.stk {
    padding: 3px;
  }

  .gr-cell .stk-foil {
    padding: 6px 2px;
  }

  /* A word never breaks: a long name is set smaller instead (fitNames, grid/app.js). */
  .gr-cell .stk-name {
    max-width: 100%;
    font-size: 15px;
    overflow-wrap: normal;
  }

  .gr-cell .stk-sub {
    font-size: 10px; /* at least 10 px (audit of 22 October 2026) */
    letter-spacing: 0.06em;
  }

  /* "19 réponses possibles" must fit a box a quarter of a phone wide. */
  .gr-cell .stk-band {
    padding: 3px 2px;
    font-size: 10px; /* at least 10 px (audit of 22 October 2026) */
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }

  .gr-cell.stk-slot b {
    font-size: 26px;
  }

  .gr-cell .stk-slot span,
  .gr-cell.stk-slot span {
    font-size: 10px; /* at least 10 px (audit of 22 October 2026) */
    letter-spacing: 0.08em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gr-cell.is-choice {
    animation: none;
  }
}

/* The narrowest phones (320 px): a little less margin inside the criteria and the boxes, and no letter
   spacing, so « TIMBERWOLVES » and « ANTETOKOUNMPO » still fit. */
@media (max-width: 360px) {
  .gr-grid .crit {
    padding-inline: 2px;
  }

  .gr-grid .crit b,
  .gr-cell .stk-name {
    letter-spacing: 0;
  }

  .gr-cell.stk {
    padding: 3px 1px;
  }

  .gr-cell .stk-foil {
    padding-inline: 1px;
  }

  /* « POR ENCONTRAR » is wider than a box here, even without letter spacing: the dashed box and its
     number say it is empty (its label is read out all the same, aria-label). */
  .gr-cell.stk-slot span {
    display: none;
  }
}

/* Maquettes du 13 octobre 2026: the criteria on the dark hardwood, the boxes flat. */
.gr-grid .crit {
  background: var(--cover);
  border-color: var(--cover);
  box-shadow: none;
}

.gr-grid .crit b {
  color: var(--paper);
}

.gr-grid .crit small {
  color: var(--sand);
}

/* ————————————————————————————————————————————————
   Les cases, plus nettes (DESIGN.md, « Le plateau ») : une case vide teintée de bleu nuit, pointillés
   marqués, pour qu'elle se détache du papier ; une case remplie claire à filet or (comme au Onze), ses
   points dans une pastille arrondie ; en fin de partie, une case restée vide en pointillés, le nombre
   de réponses possibles souligné comme un lien (on la touche pour les voir) ; les critères gardent
   un filet or du côté de la grille.
   ———————————————————————————————————————————————— */
.gr-cell.stk-slot {
  background: rgba(58, 29, 18, 0.06);
  border: 2px dashed rgba(58, 29, 18, 0.35);
  color: var(--ink-soft);
}

.gr-cell.stk-slot b {
  color: rgba(58, 29, 18, 0.45);
}

.gr-cell.stk:not(.is-revealed) {
  border: 2px solid var(--gold);
  background: var(--card);
  box-shadow: 0 3px 0 rgba(39, 19, 11, 0.2);
}

.gr-cell .stk-band {
  border-radius: 10px;
  padding: 1px 8px;
}

.gr-cell.is-revealed {
  opacity: 1;
  background: rgba(58, 29, 18, 0.04);
  border: 2px dashed rgba(58, 29, 18, 0.35);
}

.gr-cell.is-revealed .stk-foil {
  background: none;
}

.gr-cell.is-revealed .stk-name {
  color: var(--ink-soft);
}

.gr-cell.is-revealed .stk-band {
  background: none;
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.gr-grid .crit:not(.is-row) {
  border-bottom: 3px solid var(--gold);
}

.gr-grid .crit.is-row {
  border-right: 3px solid var(--gold);
}

/* A box the player can go into (several fit): gold, so it stands out from the empty ones. */
.gr-cell.stk-slot.is-choice {
  border: 2px solid var(--gold);
  background: var(--gold-soft);
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(39, 19, 11, 0.25);
  animation: gr-choice 1s ease-in-out infinite alternate;
}

.gr-cell.stk-slot.is-choice b {
  color: var(--ink);
}

@keyframes gr-choice {
  to { background: #f6d97a; }
}

@media (prefers-reduced-motion: reduce) {
  .gr-cell.stk-slot.is-choice {
    animation: none;
  }
}

/* Phone, set larger (13 octobre 2026): the row labels a little narrower and the gaps tighter, so the
   boxes get the width; every text one or two sizes up (a long name still shrinks, fitNames). */
@media (max-width: 560px) {
  .gr-grid {
    grid-template-columns: minmax(0, 0.85fr) repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .gr-help {
    font-size: 14px;
  }

  .gr-grid .crit b {
    font-size: 15px;
  }

  .gr-grid .crit small {
    font-size: 10px;
  }

  .gr-cell .stk-name {
    font-size: 16px;
  }

  .gr-cell .stk-sub {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .gr-cell .stk-band {
    font-size: 11px;
  }

  .gr-cell.stk-slot b {
    font-size: 30px;
  }

  .gr-cell .stk-slot span,
  .gr-cell.stk-slot span {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
}

/* The points of a box: large enough to read at a glance, computer and phone. */
.gr-cell.stk:not(.is-revealed) .stk-band {
  padding: 2px 10px;
  font-size: 14px;
  font-weight: 800;
}

@media (max-width: 560px) {
  .gr-cell.stk:not(.is-revealed) .stk-band {
    padding: 2px 8px;
    font-size: 13px;
  }
}

/* After the game, your own answer in the list of possible answers: pale gold, framed in gold (no gold foil). */
.gr-answers li.is-mine {
  background: var(--gold-soft);
  border-color: var(--gold);
}
