/* =========================================================
   WORDLE LEAGUE — the board
   One component, both games. Column count comes from --cols,
   set per game in JS, so NFL (9) and RL (6) share every rule.
   ========================================================= */

.game {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
  padding-block: var(--s-5) var(--s-6);
}

/* ---------- status strip ---------- */
.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding-block: var(--s-2);
  border-block: 1px solid var(--line);
}
.statusbar__label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.statusbar__label b { color: var(--fg); font-weight: 700; }

/* guess pips */
.pips { display: flex; gap: 5px; flex: 1 1 140px; max-width: 220px; }
.pip {
  flex: 1;
  height: 4px;
  background: var(--miss);
  transition: background 0.25s var(--ease);
}
.pip[data-state="used"] { background: var(--fg-faint); }
.pip[data-state="hit"]  { background: var(--hit); }

/* ---------- guess entry ---------- */
.entry { display: flex; flex-direction: column; gap: var(--s-2); max-width: 620px; }
.entry__row { display: flex; gap: var(--s-2); }
.entry__row .combobox { flex: 1 1 auto; min-width: 0; }

.combobox { position: relative; }
.combobox__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 17rem;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 4px;
  margin: 0;
  list-style: none;
}
.combobox__list[hidden] { display: none; }
.combobox__opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  width: 100%;
  padding: 0.6rem 0.65rem;
  background: none;
  border: 0;
  border-radius: 1px;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.combobox__opt:hover,
.combobox__opt[aria-selected="true"] { background: var(--bg-hover); }
.combobox__opt[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--game); }
.combobox__opt .meta {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-muted);
  white-space: nowrap;
}

/* ---------- board: wide (tablet and up) ---------- */
.board { display: flex; flex-direction: column; gap: var(--s-3); }

.board__head,
.board__row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr));
  gap: 4px;
}

.board__head { padding-bottom: var(--s-1); }
.board__head div {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guess { display: flex; flex-direction: column; gap: 5px; }

.guess__name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  color: var(--fg);
}
.guess__no {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
}
.guess__bar {
  width: 3px;
  align-self: stretch;
  min-height: 14px;
  background: var(--team, var(--line-strong));
}

/* ---------- tiles ---------- */
.tile {
  position: relative;
  min-height: 60px;
  padding: 0.4rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--miss);
  color: var(--miss-ink);
  box-shadow: inset 0 0 0 1px var(--miss-edge);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
.tile[data-state="hit"] {
  background: var(--hit); color: var(--hit-ink);
  box-shadow: inset 0 0 0 1px var(--hit-edge), 0 0 22px -10px var(--hit-edge);
}
.tile[data-state="near"] {
  background: var(--near); color: var(--near-ink);
  box-shadow: inset 0 0 0 1px var(--near-edge);
}

.tile__label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.75;
  font-weight: 700;
}
.tile__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  word-break: break-word;
  hyphens: auto;
}
.tile__mark {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.95;
}

/* reveal: staggered flip, left to right, like a stat graphic dropping in */
.board__row[data-reveal] .tile {
  animation: tile-in 0.44s var(--ease) both;
  animation-delay: calc(var(--i) * 70ms);
}
@keyframes tile-in {
  0%   { transform: rotateX(-88deg); opacity: 0; }
  58%  { transform: rotateX(7deg);   opacity: 1; }
  100% { transform: rotateX(0);      opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .board__row[data-reveal] .tile { animation: none; }
}

/* ---------- board: phone ---------- */
@media (max-width: 700px) {
  .board__head { display: none; }
  .board__row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .tile { min-height: 54px; }
  .tile__label { display: block; }
  .tile__value { font-size: 1rem; }
}
@media (min-width: 701px) {
  /* labels live in the header row on wide screens */
  .tile__label { display: none; }
}

/* ---------- legend ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-muted);
}
.legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend i {
  width: 10px; height: 10px; border-radius: 1px;
  display: inline-block; font-style: normal;
}

/* ---------- result ---------- */
.result {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--bg-raised);
  border-left: 3px solid var(--game);
}
.result[hidden] { display: none; }
.result__head {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--step-2);
  line-height: 0.9;
  text-transform: uppercase;
  margin: 0;
}
.result__head[data-outcome="win"]  { color: var(--hit-edge); }
.result__head[data-outcome="loss"] { color: var(--accent-hot); }
.result__body { margin: 0; color: var(--fg-muted); }
.result__body b { color: var(--fg); font-weight: 600; }
.result__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- setup panel ---------- */
.setup {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
  padding: var(--s-4);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.setup[hidden] { display: none; }

/* skeleton while players load */
.skeleton {
  display: grid;
  grid-template-columns: repeat(var(--cols, 9), minmax(0, 1fr));
  gap: 4px;
}
.skeleton div {
  min-height: 60px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--miss) 25%, var(--bg-hover) 50%, var(--miss) 75%);
  background-size: 200% 100%;
  animation: sheen 1.4s linear infinite;
}
@keyframes sheen { to { background-position: -200% 0; } }
@media (max-width: 700px) { .skeleton { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
