/*
 * Phase 8Q.4-G -- FESTIVUS BID WAR.
 *
 *   .bw-card       the weekend card at the top of the Games tab
 *   .bw-*          the #/bid-war screen: head, target picker, rounds, leaderboard, champion
 *   .bw-rules      the HOW TO PLAY and ROUND RULES cards (rules-help.js)
 *   .bwa*          GAMES -> Festivus Bid War in the Admin Console (admin-bid-war.js)
 *   (.ttl__bidwar, the Bid War line in the Take the Lead chooser, is in milestones.css with the chooser)
 *
 * Mobile first (320-412 px): every row wraps, nothing has a fixed width,
 * every control is at least the tap height, and inputs are 16 px so iOS does
 * not zoom. Only tokens defined in app.css :root are used. Linked before
 * phase8k.css, which stays LAST.
 */

/* ------------------------------- Games card ------------------------------ */

.bw-card-host {
  margin: 0 0 12px;
  min-width: 0;
}

.bw-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  min-height: var(--tap);
  overflow-wrap: anywhere;
}

.bw-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.bw-card__kicker,
.bw-head__kicker,
.bw-champion__kicker {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bw-card__title {
  font-size: 1.15rem;
  font-weight: 700;
}

.bw-card__status {
  color: var(--text-dim);
}

.bw-card__action {
  justify-self: start;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

/*
 * Phase 8R.2.1: a finished Bid War is a RESULT, not the featured game -- a
 * compact row below the hub: muted border, smaller title, the action as a
 * plain link. The CLAIM card stays prominent (an unclaimed victory is still
 * something to do).
 */
.bw-card-host--results {
  margin: 12px 0;
}

.bw-card--results {
  gap: 2px;
  padding: 10px 14px;
  border-color: var(--line);
}

.bw-card--results .bw-card__kicker {
  color: var(--text-dim);
}

.bw-card--results .bw-card__title {
  font-size: 1rem;
}

.bw-card--results .bw-card__status,
.bw-card--results .bw-card__action {
  font-size: 0.9rem;
}

.bw-card--results .bw-card__action {
  margin-top: 2px;
  padding: 0;
  background: none;
  color: var(--accent);
}

.bw-card--claim {
  border-color: var(--accent);
}

/* -------------------------------- the screen ----------------------------- */

.bw-head,
.bw-target,
.bw-rounds,
.bw-board,
.bw-champion,
.bw-rewards,
.bw-empty {
  margin: 0 0 16px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.bw-head__title {
  margin: 2px 0 4px;
}

.bw-head__status,
.bw-head__chips {
  margin: 0 0 8px;
  color: var(--text-dim);
}

.bw-head__chips {
  color: var(--metal);
  font-weight: 700;
}

.bw-section__title {
  margin: 0 0 8px;
  letter-spacing: 0.06em;
}

.bw-target__copy {
  margin: 0 0 6px;
}

.bw-target__copy--head {
  font-weight: 800;
  color: var(--accent);
}

.bw-target__copy--notfree {
  font-weight: 800;
  color: var(--warn);
}

.bw-target__mine {
  margin: 8px 0;
  font-weight: 700;
}

.bw-target__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 768px) {
  .bw-target__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bw-target__option {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 12px;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.bw-target__option.is-selected {
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

.bw-target__name {
  font-weight: 700;
}

.bw-target__price {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.bw-round {
  display: grid;
  gap: 6px;
  padding: 12px;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  min-width: 0;
}

.bw-round[data-bw-state="open"] {
  border-color: var(--accent);
}

.bw-round__title {
  margin: 0;
  font-size: 1rem;
}

.bw-round__status {
  margin: 0;
  font-weight: 700;
}

.bw-round__explain,
.bw-round__count,
.bw-board__note {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.bw-round__vs,
.bw-round__reveal {
  margin: 0;
  font-weight: 700;
  color: var(--metal);
}

.bw-bid {
  display: grid;
  gap: 6px;
  grid-template-columns: minmax(0, 1fr);
}

.bw-bid__input {
  font-size: 16px;
  min-height: var(--tap);
  width: 100%;
  box-sizing: border-box;
}

.bw-bid__go {
  min-height: var(--tap);
}

.bw-bid__error {
  margin: 0;
  color: var(--danger);
}

.bw-round__results,
.bw-board__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.bw-result,
.bw-board__row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  min-width: 0;
}

.bw-result.is-me,
.bw-board__row.is-me {
  outline: 1px solid var(--accent-dim);
}

.bw-result__name,
.bw-board__name {
  flex: 1 1 8em;
  min-width: 0;
  font-weight: 700;
}

.bw-board__rank {
  color: var(--accent);
  font-weight: 800;
}

.bw-board__meta,
.bw-result__amount {
  color: var(--text-dim);
}

.bw-champion {
  padding: 14px;
  border: 2px solid var(--metal);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.bw-champion__name {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 2px 0 8px;
}

.bw-champion__line {
  margin: 0 0 6px;
}

.bw-champion__claim {
  min-height: var(--tap);
  margin-top: 6px;
}

.bw-plan {
  margin: 0;
  padding-left: 1.4em;
  color: var(--text-dim);
}

.bw-empty__title {
  font-weight: 800;
}

.bw-empty__text {
  color: var(--text-dim);
}

/* -------------------------------- rules cards ---------------------------- */

.bw-rules__section {
  margin: 0 0 10px;
}

.bw-rules__title {
  margin: 0 0 2px;
  font-size: 0.95rem;
  color: var(--accent);
}

.bw-rules__text {
  margin: 0;
  overflow-wrap: anywhere;
}

/* --------------------------------- Admin --------------------------------- */

.bwa,
.bwa__block,
.bwa__inspect,
.bwa__editor {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bwa__event,
.bwa__controls,
.bwa__plan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin: 0 0 8px;
}

.bwa__event-title {
  font-weight: 700;
}

.bwa__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 768px) {
  .bwa__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.bwa__field {
  display: grid;
  gap: 2px;
}

.bwa .ac__input,
.bwa__plan-row .ac__input {
  font-size: 16px;
  min-height: var(--tap);
  max-width: 100%;
  box-sizing: border-box;
}

.bwa__plan {
  margin: 0;
  padding-left: 1.4em;
}

.bwa__round {
  padding: 8px;
  margin: 0 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.bwa__round-title {
  margin: 0 0 4px;
  font-weight: 700;
}

/* ---------- Phase 8R: where you stand, notifications, spectate ---------- */
/*
 * Every token below is one this file already uses (the 8L lesson: a token that
 * does not exist fails silently). Long prize names and titles wrap rather than
 * push the screen sideways at 320px.
 */
.bw-state {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  overflow-wrap: anywhere;
  min-width: 0;
}

.bw-state--spectating,
.bw-state--did_not_join,
.bw-state--not_eligible {
  border-color: var(--line);
}

.bw-state__title {
  margin: 0 0 4px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.bw-state--spectating .bw-state__title,
.bw-state--did_not_join .bw-state__title,
.bw-state--not_eligible .bw-state__title {
  color: var(--text);
}

.bw-state__line {
  margin: 0 0 4px;
}

.bw-state__action {
  margin-top: 8px;
  min-height: var(--tap);
  max-width: 100%;
  white-space: normal;
}

.bw-notif {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin: 0 0 12px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.bw-target__picked {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent);
}

.bw-target__name,
.bw-target__mine,
.bw-target__option {
  overflow-wrap: anywhere;
  min-width: 0;
}

.bw-spectate {
  margin: 12px 0 0;
}

.bw-spectate__go {
  min-height: var(--tap);
  max-width: 100%;
  white-space: normal;
}

.bw-spectate__hint {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .bw-card,
  .bw-target__option {
    transition: none;
  }
}

/*
 * Phase 8R.1: the part a Bid War notification links to (#/bid-war/round/3,
 * /target, /results, /claim) is scrolled to and focused once. The outline
 * marks it; the focus ring and the screen reader's landing on it say it in
 * more than colour. scroll-margin keeps it clear of the sticky header.
 */
.bw-linked {
  scroll-margin-top: 72px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
