/*
 * FESTIVUS 21 (Phase 8S): the lobby, the challenge builder, the felt table,
 * the cards, the Games card and the admin panel.
 *
 * PHONE FIRST. 375-430 px is the priority, 320 px must still work, and
 * nothing here has a fixed pixel width: cards are sized from the viewport
 * (clamp) and a growing hand OVERLAPS more tightly (the f21-fan--* classes
 * scripts/festivus21-cards.js picks from the card count) instead of
 * widening the page.
 *
 * NO INLINE STYLES. `style-src 'self'` blocks them, so every size, overlap,
 * delay and animation is a class here.
 *
 * MOTION IS DECORATION. Cards slide from the shoe, the hole card turns over,
 * a bust shakes, a Blackjack glows and a win bursts -- and under
 * prefers-reduced-motion every one of those is switched off at the bottom of
 * this file. The table is then identical, only still: every state is in
 * words and symbols as well.
 *
 * Tokens: app.css, game.css and phase6.css ones only, plus the --f21-* ones
 * defined right here.
 */

.f21,
.f21-gcard,
.f21-admin,
.f21-sheet {
  --f21-felt: #0f5132;
  --f21-felt-deep: #08311e;
  --f21-felt-line: rgba(255, 255, 255, 0.14);
  --f21-rim: #6b4423;
  --f21-rim-light: #8a5a30;
  --f21-paper: #fbf8ef;
  --f21-paper-edge: #cfc6b0;
  --f21-red: #c41e3a;
  --f21-ink: #1b1b1f;
  --f21-gilt: #e9b949;
  --f21-back: #8e1b24;
  --f21-back-deep: #5e0f16;
  --f21-pole: #d5dde0;
  --f21-skin: #f4d3b0;
  --f21-hair: #6b4423;
  --f21-card-w: clamp(52px, 16vw, 84px);
  --f21-overlap: -0.3;
  --f21-from-x: 38vw;
  --f21-from-y: -10px;
  --f21-beat: 170ms;
}

/* ========================================================================== *
 * Shared pieces
 * ========================================================================== */

.f21 {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.f21-head {
  display: grid;
  gap: var(--sp-2);
  justify-items: start;
}

.f21-head__kicker {
  margin: 0;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 700;
}

.f21-head__title {
  margin: 0;
  font-size: var(--fs-display);
  letter-spacing: 0.04em;
}

.f21-head__balances {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--fs-small);
}

.f21-section {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  min-width: 0;
}

.f21-section--continue {
  border-color: var(--gold);
  background: var(--bg-elev-2);
}

.f21-section__title {
  margin: 0;
  font-size: var(--fs-title);
  letter-spacing: 0.06em;
}

.f21-section__text,
.f21-section__meta,
.f21-section__status {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
}

.f21-section__status {
  color: var(--accent);
  font-weight: 700;
}

.f21-footnote {
  margin: 0;
  color: var(--text-faint);
  font-size: var(--fs-small);
}

.f21-warning {
  margin: 0;
  padding: var(--sp-3);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
}

.f21-warning::before {
  content: "⚠ ";
}

.f21-back {
  color: var(--text-dim);
  text-decoration: none;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.f21-bigbtn {
  min-height: var(--tap);
  width: 100%;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.f21-empty {
  display: grid;
  gap: var(--sp-3);
  justify-items: start;
  padding: var(--sp-4);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.f21-empty__title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.f21-empty__text {
  margin: 0;
  color: var(--text-dim);
}

/* ========================================================================== *
 * Lobby
 * ========================================================================== */

.f21-continue {
  display: grid;
  gap: var(--sp-1);
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--f21-felt);
  color: var(--snow);
  text-decoration: none;
  border: 2px solid var(--gold);
}

.f21-continue__go {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: var(--fs-lead);
}

.f21-continue__what,
.f21-continue__when {
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.f21-stakes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 88px), 1fr));
  gap: var(--sp-2);
}

.f21-stake {
  display: grid;
  gap: var(--sp-1);
  justify-items: center;
  min-height: 64px;
  padding: var(--sp-2);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 35%, var(--f21-felt), var(--f21-felt-deep));
  color: var(--snow);
  font: inherit;
  cursor: pointer;
}

.f21-stake:disabled {
  border-color: var(--line);
  opacity: 0.6;
  cursor: not-allowed;
}

.f21-stake__amount {
  font-size: var(--fs-title);
  font-weight: 800;
}

.f21-stake__hint {
  font-size: var(--fs-small);
  color: var(--metal);
}

.f21-group {
  display: grid;
  gap: var(--sp-2);
}

.f21-group__title {
  margin: 0;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.f21-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--line-soft);
}

.f21-row__text {
  flex: 1 1 12rem;
  min-width: 0;
}

.f21-row__what,
.f21-row__when {
  margin: 0;
  overflow-wrap: anywhere;
}

.f21-row__when {
  color: var(--text-dim);
  font-size: var(--fs-small);
}

.f21-row__go {
  min-height: var(--tap);
}

.f21-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.f21-recent__row {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
}

.f21-recent__row::before {
  content: "♠ ";
  color: var(--gold);
}

.f21-howto__summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.f21-rules__list {
  display: grid;
  gap: var(--sp-3);
}

.f21-rules__section {
  display: grid;
  gap: var(--sp-1);
}

.f21-rules__title {
  margin: 0;
  font-size: var(--fs-body);
  letter-spacing: 0.04em;
  color: var(--gold);
}

.f21-rules__text {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--text);
}

/* ========================================================================== *
 * Challenge builder
 * ========================================================================== */

.f21-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: var(--sp-2);
}

.f21-choice {
  display: grid;
  gap: var(--sp-1);
  align-content: center;
  min-height: var(--tap);
  padding: var(--sp-2) var(--sp-3);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.f21-choice.is-selected {
  border-color: var(--gold);
  background: var(--f21-felt-deep);
}

.f21-choice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.f21-choice__label {
  font-weight: 800;
}

.f21-choice__sub {
  font-size: var(--fs-small);
  color: var(--text-dim);
}

.f21-choice__picked {
  font-size: var(--fs-small);
  color: var(--gold);
  font-weight: 800;
}

/* ========================================================================== *
 * Confirmation sheets
 * ========================================================================== */

.f21-wager {
  margin: 0 0 var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--f21-felt);
  color: var(--snow);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
}

.f21-sheet__text {
  margin: var(--sp-2) 0;
  font-size: var(--fs-body);
}

.f21-outcomes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--sp-2);
}

.f21-outcomes__row {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  font-size: var(--fs-body);
  overflow-wrap: anywhere;
}

.f21-payout {
  margin: 0;
  display: grid;
  gap: var(--sp-1);
}

.f21-payout__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) 1fr;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
}

.f21-payout__label {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.f21-payout__row--win .f21-payout__label::before,
.f21-payout__row--blackjack .f21-payout__label::before {
  content: "★ ";
  color: var(--gold);
}

.f21-payout__row--push .f21-payout__label::before {
  content: "= ";
}

.f21-payout__row--loss .f21-payout__label::before {
  content: "✕ ";
}

.f21-payout__value {
  margin: 0;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.f21-payout__returns {
  font-weight: 800;
}

.f21-payout__explain {
  font-size: var(--fs-small);
  color: var(--text-dim);
  overflow-wrap: anywhere;
}

/* ========================================================================== *
 * THE TABLE
 * ========================================================================== */

.f21-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}

.f21-table {
  position: relative;
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 6px solid var(--f21-rim);
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 50% 50%, var(--f21-felt), var(--f21-felt-deep));
  box-shadow: inset 0 0 0 2px var(--f21-rim-light), inset 0 0 40px rgba(0, 0, 0, 0.45);
  color: var(--snow);
  overflow: hidden;
  min-width: 0;
}

.f21-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: var(--sp-1) var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 999px;
  border: 1px solid var(--f21-felt-line);
  background: rgba(0, 0, 0, 0.25);
  text-align: center;
}

.f21-banner__symbol {
  font-weight: 800;
}

.f21-banner__title {
  font-size: var(--fs-title);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.f21-banner__detail {
  flex-basis: 100%;
  font-size: var(--fs-small);
  color: var(--metal);
}

.f21-tone--win .f21-banner__title,
.f21-tone--win .f21-banner__symbol,
.f21-tone--win .f21-result__symbol {
  color: var(--gold);
}

.f21-tone--loss .f21-banner__symbol,
.f21-tone--loss .f21-result__symbol {
  color: var(--danger);
}

.f21-tone--turn .f21-banner__symbol {
  color: var(--accent);
}

.f21-zone {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 1px dashed var(--f21-felt-line);
  border-radius: var(--radius);
  min-width: 0;
}

.f21-zone--dealer {
  --f21-from-x: 30vw;
  --f21-from-y: 0px;
}

.f21-zone--me {
  --f21-from-x: 30vw;
  --f21-from-y: -38vh;
  border-style: solid;
  border-color: rgba(233, 185, 73, 0.45);
}

.f21-zone--opponent {
  --f21-from-x: 30vw;
  --f21-from-y: -20vh;
}

.f21-zone__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.f21-zone__name {
  font-size: var(--fs-eyebrow);
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--metal);
  overflow-wrap: anywhere;
}

.f21-total {
  min-width: 2.4rem;
  padding: 2px var(--sp-2);
  border-radius: 999px;
  background: var(--f21-paper);
  color: var(--f21-ink);
  font-weight: 900;
  text-align: center;
}

.f21-chip {
  padding: 2px var(--sp-2);
  border-radius: 999px;
  border: 1px solid var(--f21-felt-line);
  font-size: var(--fs-small);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.f21-chip--bust {
  background: var(--danger);
  color: var(--f21-ink);
}

.f21-chip--blackjack {
  background: var(--gold);
  color: var(--f21-ink);
}

.f21-zone__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
}

.f21-zone__row > .f21-hand {
  flex: 1 1 auto;
}

/* ---- hands: overlap more as they grow, never wider than the table ------ */

.f21-hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: calc(var(--f21-card-w) * 1.4);
  min-width: 0;
  padding: var(--sp-1) 0;
}

.f21-hand__slot {
  flex: 0 0 auto;
  position: relative;
}

.f21-hand__slot + .f21-hand__slot {
  margin-left: calc(var(--f21-card-w) * var(--f21-overlap));
}

.f21-fan--loose {
  --f21-overlap: -0.3;
}

.f21-fan--mid {
  --f21-overlap: -0.5;
}

.f21-fan--tight {
  --f21-overlap: -0.62;
}

.f21-fan--max {
  --f21-overlap: -0.72;
}

.f21-hand--empty,
.f21-hand--hidden {
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.f21-hand__backs {
  display: flex;
}

.f21-hand__backs > .f21-card + .f21-card {
  margin-left: calc(var(--f21-card-w) * -0.55);
}

.f21-hand__note {
  flex-basis: 100%;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--metal);
  letter-spacing: 0.04em;
}

.f21-slot {
  width: var(--f21-card-w);
  aspect-ratio: 5 / 7;
  border: 2px dashed var(--f21-felt-line);
  border-radius: 8px;
}

/* ---- the shoe ------------------------------------------------------------ */

.f21-shoe {
  flex: 0 0 auto;
  position: relative;
  display: grid;
  justify-items: center;
  width: calc(var(--f21-card-w) * 0.62);
}

.f21-shoe__card {
  grid-area: 1 / 1;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.f21-shoe__card svg {
  display: block;
  width: 100%;
  height: 100%;
}

.f21-shoe__card--1 {
  transform: translate(2px, -2px);
}

.f21-shoe__card--2 {
  transform: translate(4px, -4px);
}

.f21-shoe__card--3 {
  transform: translate(6px, -6px);
}

.f21-shoe__label {
  margin-top: var(--sp-1);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--metal);
  white-space: nowrap;
}

/* ---- controls --------------------------------------------------------- */

.f21-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

.f21-btn {
  min-height: 64px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.45);
  transition: transform var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);
}

.f21-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.f21-btn:focus-visible {
  outline: 3px solid var(--snow);
  outline-offset: 3px;
}

.f21-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.f21-btn--hit {
  background: var(--accent);
  color: var(--f21-ink);
}

.f21-btn--hit::before {
  content: "+ ";
}

.f21-btn--stand {
  background: var(--gold);
  color: var(--f21-ink);
}

.f21-btn--stand::before {
  content: "✋ ";
}

.f21-btn--deal {
  grid-column: 1 / -1;
  background: var(--gold);
  color: var(--f21-ink);
}

.f21-controls__hint,
.f21-controls__deadline {
  grid-column: 1 / -1;
  margin: 0;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--metal);
}

.f21-controls__cancel {
  grid-column: 1 / -1;
  min-height: var(--tap);
}

/* ---- review, result, stakes, fair deal ------------------------------- */

.f21-review,
.f21-result,
.f21-stakeinfo,
.f21-fair {
  position: relative;
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  min-width: 0;
}

.f21-review {
  border-color: var(--gold);
}

.f21-review__terms {
  margin: 0;
  font-size: var(--fs-lead);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.f21-review__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: var(--sp-2);
}

.f21-result {
  overflow: hidden;
  text-align: center;
  border-width: 2px;
}

.f21-result.f21-tone--win {
  border-color: var(--gold);
}

.f21-result.f21-tone--loss {
  border-color: var(--danger);
}

.f21-result__headline {
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  font-size: var(--fs-display);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.f21-result__line {
  margin: 0;
  overflow-wrap: anywhere;
}

.f21-result__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}

.f21-result__actions .btn {
  min-height: var(--tap);
}

.f21-kv {
  margin: 0;
  display: grid;
  gap: var(--sp-1);
}

.f21-kv__row {
  display: grid;
  /* Both columns may shrink: a fixed 7rem label at EVERY nesting level pushed the Admin overview past a phone. */
  grid-template-columns: minmax(0, min(7rem, 40%)) minmax(0, 1fr);
  gap: var(--sp-2);
  min-width: 0;
}

/* A nested list (the Admin overview's settings summary) stacks label over value, so depth never costs width. */
.f21-kv--nested .f21-kv__row {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.f21-kv__row > dt {
  color: var(--text-dim);
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.f21-kv__row > dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.f21-fair__summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.f21-fair__text,
.f21-fair__commit {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--text-dim);
}

.f21-fair__code {
  font-family: var(--mono);
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* One hand per line ("Gene (challenger): KH 9D"), broken at spaces rather than mid-card. */
.f21-fair__hand {
  display: block;
  word-break: normal;
}

/* ========================================================================== *
 * THE CARDS
 * ========================================================================== */

.f21-card {
  position: relative;
  width: var(--f21-card-w);
  aspect-ratio: 5 / 7;
  perspective: 700px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.f21-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.f21-card__side {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.f21-card__side svg {
  display: block;
  width: 100%;
  height: 100%;
}

.is-flipping .f21-card__side--back {
  transform: rotateY(180deg);
}

/* SVG fills: by class (presentation, never an inline style) */
.f21-face__paper {
  fill: var(--f21-paper);
  stroke: var(--f21-paper-edge);
  stroke-width: 1.5;
}

.f21-face--red .f21-suit,
.f21-face--red .f21-index__rank {
  fill: var(--f21-red);
}

.f21-face--black .f21-suit,
.f21-face--black .f21-index__rank {
  fill: var(--f21-ink);
}

.f21-court__frame {
  fill: #f6edd4;
  stroke: var(--f21-ink);
  stroke-width: 1;
}

.f21-court__divider {
  stroke: var(--f21-ink);
  stroke-width: 0.8;
}

.f21-court__face {
  fill: var(--f21-skin);
  stroke: var(--f21-ink);
  stroke-width: 0.8;
}

.f21-court__crown,
.f21-court__band {
  fill: var(--f21-gilt);
  stroke: var(--f21-ink);
  stroke-width: 0.8;
}

.f21-court__hair {
  fill: var(--f21-hair);
}

.f21-court__feather {
  fill: var(--f21-ink);
}

.f21-face--red .f21-court__robe,
.f21-face--red .f21-court__jewel,
.f21-face--red .f21-court__feather {
  fill: var(--f21-red);
}

.f21-face--black .f21-court__robe,
.f21-face--black .f21-court__jewel {
  fill: #2c3e66;
}

.f21-court--J .f21-court__crown {
  fill: #2f9e6b;
}

.f21-back__base {
  fill: var(--f21-back);
  stroke: var(--f21-paper);
  stroke-width: 3;
}

.f21-back__border {
  fill: none;
  stroke: var(--f21-gilt);
  stroke-width: 1.5;
}

.f21-back__lattice {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.f21-back__medallion {
  fill: var(--f21-back-deep);
  stroke: var(--f21-gilt);
  stroke-width: 1.5;
}

.f21-back__pole {
  fill: var(--f21-pole);
}

.f21-back__mark {
  fill: var(--f21-gilt);
}

/* ========================================================================== *
 * Motion (all of it switched off under reduced motion, below)
 * ========================================================================== */

.f21-card.is-dealt {
  animation: f21-deal 420ms var(--ease) both;
}

.is-flipping .f21-card__inner {
  animation: f21-flip 560ms var(--ease) both;
}

.f21-deal-0 { animation-delay: 0ms; }
.f21-deal-1, .f21-deal-1 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 1); }
.f21-deal-2, .f21-deal-2 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 2); }
.f21-deal-3, .f21-deal-3 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 3); }
.f21-deal-4, .f21-deal-4 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 4); }
.f21-deal-5, .f21-deal-5 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 5); }
.f21-deal-6, .f21-deal-6 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 6); }
.f21-deal-7, .f21-deal-7 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 7); }
.f21-deal-8, .f21-deal-8 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 8); }
.f21-deal-9, .f21-deal-9 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 9); }
.f21-deal-10, .f21-deal-10 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 10); }
.f21-deal-11, .f21-deal-11 .f21-card__inner { animation-delay: calc(var(--f21-beat) * 11); }

@keyframes f21-deal {
  from {
    opacity: 0;
    transform: translate(var(--f21-from-x), var(--f21-from-y)) rotate(-14deg) scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes f21-flip {
  from {
    transform: rotateY(180deg);
  }
  to {
    transform: rotateY(0deg);
  }
}

.is-bust-shake .f21-hand {
  animation: f21-shake 480ms var(--ease) both;
}

@keyframes f21-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

.is-blackjack .f21-hand {
  filter: drop-shadow(0 0 10px rgba(233, 185, 73, 0.75));
}

.is-blackjack-new .f21-hand {
  animation: f21-glow 900ms var(--ease) 2;
}

@keyframes f21-glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(233, 185, 73, 0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(233, 185, 73, 1)); }
}

.f21-banner.is-celebrating,
.f21-result.is-celebrating .f21-result__headline {
  animation: f21-pop 520ms var(--ease) both;
}

@keyframes f21-pop {
  0% { transform: scale(0.85); opacity: 0.4; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

.f21-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.f21-burst__bit {
  position: absolute;
  left: 50%;
  top: 30%;
  width: 0.5rem;
  height: 0.75rem;
  border-radius: 2px;
  background: var(--gold);
  opacity: 0;
  animation: f21-burst 1100ms var(--ease) forwards;
}

.f21-burst__bit--1, .f21-burst__bit--5, .f21-burst__bit--9 { background: var(--holly); }
.f21-burst__bit--2, .f21-burst__bit--6 { background: var(--pine); }
.f21-burst__bit--3, .f21-burst__bit--7 { background: var(--metal); }

.f21-burst__bit--0 { --f21-bx: -120px; --f21-by: -40px; }
.f21-burst__bit--1 { --f21-bx: -90px; --f21-by: 50px; }
.f21-burst__bit--2 { --f21-bx: -60px; --f21-by: -70px; }
.f21-burst__bit--3 { --f21-bx: -30px; --f21-by: 70px; }
.f21-burst__bit--4 { --f21-bx: 0px; --f21-by: -80px; }
.f21-burst__bit--5 { --f21-bx: 30px; --f21-by: 60px; }
.f21-burst__bit--6 { --f21-bx: 60px; --f21-by: -60px; }
.f21-burst__bit--7 { --f21-bx: 90px; --f21-by: 40px; }
.f21-burst__bit--8 { --f21-bx: 120px; --f21-by: -30px; }
.f21-burst__bit--9 { --f21-bx: 10px; --f21-by: 80px; }

@keyframes f21-burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate(var(--f21-bx), var(--f21-by)) rotate(220deg); }
}

/* ========================================================================== *
 * The Games card
 * ========================================================================== */

.f21-gcard {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  border: 3px solid var(--f21-rim);
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 30% 40%, var(--f21-felt), var(--f21-felt-deep));
  color: var(--snow);
  --f21-card-w: clamp(40px, 11vw, 56px);
}

.f21-gcard__art {
  display: flex;
}

.f21-gcard__art > .f21-card + .f21-card {
  margin-left: calc(var(--f21-card-w) * -0.45);
  transform: rotate(8deg);
}

.f21-gcard__body {
  display: grid;
  gap: var(--sp-1);
  min-width: 0;
}

.f21-gcard__title {
  color: var(--snow);
  font-size: var(--fs-title);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-decoration: none;
}

.f21-gcard__line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-2);
  font-size: var(--fs-small);
}

.f21-gcard__label {
  color: var(--metal);
  letter-spacing: 0.06em;
}

.f21-gcard__value {
  font-weight: 800;
}

.f21-gcard__actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: var(--sp-2);
}

.f21-gcard__action {
  min-height: var(--tap);
  justify-content: center;
  text-align: center;
  font-weight: 800;
}

/* ========================================================================== *
 * Admin panel
 * ========================================================================== */

.f21-admin {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.f21-admin__block {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  min-width: 0;
}

.f21-admin__title {
  margin: 0;
  font-size: var(--fs-title);
}

.f21-admin__access {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.f21-admin__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}

.f21-admin__row > span {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.f21-admin__row .btn,
.f21-admin__controls .btn,
.f21-admin__controls select {
  min-height: var(--tap);
}

.f21-admin__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
}

.f21-admin__controls select {
  font-size: 16px;
  max-width: 100%;
}

.f21-admin__hidden {
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border-left: 4px solid var(--warn);
  background: var(--bg-elev-2);
  font-weight: 700;
}

.f21-admin__problems {
  margin: 0;
  color: var(--danger);
}

.f21-admin .f21-kv--nested {
  padding-left: var(--sp-2);
  border-left: 2px solid var(--line-soft);
}

/* ========================================================================== *
 * Wider screens: more felt, bigger cards, side-by-side info
 * ========================================================================== */

@media (min-width: 768px) {
  .f21-table {
    padding: var(--sp-5);
  }

  .f21-controls {
    max-width: 30rem;
    width: 100%;
    justify-self: center;
  }
}

@media (max-width: 359px) {
  .f21-table {
    padding: var(--sp-2);
    border-width: 4px;
    border-radius: 20px;
  }

  .f21-btn {
    font-size: 1.1rem;
    letter-spacing: 0.08em;
  }
}

/* ========================================================================== *
 * 8W: House count, YOUR CHALLENGES, the two challenge formats, Direct Duel
 * ========================================================================== */

.f21-count {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-3);
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
}

.f21-count__label {
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.f21-count__value {
  font-size: var(--fs-lead);
  font-weight: 800;
  color: var(--gold);
}

.f21-incoming {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 0%, var(--f21-felt), var(--f21-felt-deep));
  color: var(--snow);
}

.f21-incoming__title {
  margin: 0;
  font-size: var(--fs-lead);
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.f21-incoming__terms {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.f21-incoming .f21-row__when {
  color: var(--metal);
}

.f21-incoming__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.f21-incoming__actions .btn {
  justify-content: center;
  text-align: center;
}

.f21-group--completed > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
}

.f21-formats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--sp-3);
}

.f21-format {
  display: grid;
  gap: var(--sp-2);
  align-content: start;
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
  min-width: 0;
}

.f21-format__title {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.f21-format__text {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--text-dim);
}

.f21-format__go {
  min-height: var(--tap);
  justify-content: center;
  text-align: center;
}

.f21-direct-note {
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--f21-felt-line);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--snow);
}

.f21-result__score {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.f21-sheet__format,
.f21-review__format {
  margin: 0;
  font-size: var(--fs-small);
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ========================================================================== *
 * REDUCED MOTION: the same table, standing still
 * ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .f21 *,
  .f21-gcard * {
    animation: none !important;
    transition: none !important;
  }

  .f21-burst {
    display: none;
  }
}
