:root {
  --green: #0f7a3d;
  --green-dark: #075c2c;
  --green-mid: #2c9850;
  --green-light: #d9eed6;
  --yellow: #f7c531;
  --orange: #f28c28;
  --red: #e8442f;
  --blue: #1ba3d8;
  --pink: #d4519b;
  --cream: #fffdf7;
  --ink: #1d2b24;
  --muted: #5f7166;
  --line: #e2e8df;
  --radius: 22px;
  --shadow: 0 16px 40px rgba(0, 35, 15, .22);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: 'Trebuchet MS', 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 12% 8%, #2a9a54 0, transparent 38%),
              radial-gradient(circle at 88% 92%, #0a6330 0, transparent 42%),
              var(--green);
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

#app { min-height: 100vh; }

.screen { display: none; min-height: 100vh; animation: screen-in .28s ease-out; }
.screen.is-active { display: flex; flex-direction: column; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 22px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .16);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(0, 0, 0, .16); filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .16); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .pocket:focus-visible,
.text-btn:focus-visible, .card-back-link:focus-visible, .modal-close:focus-visible, summary:focus-visible {
  outline: 4px solid #fff; outline-offset: 3px;
}
.btn--large { padding: 16px 34px; font-size: 1.15rem; border-radius: 18px; }
.btn--ghost { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .65); }
.btn--ghost:hover { background: rgba(255, 255, 255, .2); box-shadow: inset 0 0 0 2px #fff; }
.btn--ghost-flip { background: #fffdf7; color: var(--green); box-shadow: 0 5px 0 rgba(0, 0, 0, .16), inset 0 0 0 2px rgba(15, 122, 61, .35); }
.btn--ghost-flip:hover { background: #eef7ec; box-shadow: 0 7px 0 rgba(0, 0, 0, .16), inset 0 0 0 2px var(--green); }
.btn--success { background: #3fae5b; color: #fff; }
.btn--danger { background: #e2605a; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 1.4rem; line-height: 1;
  display: grid; place-items: center;
  transition: background .15s ease, transform .15s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, .3); transform: scale(1.06); }
.icon-btn.is-muted { opacity: .55; text-decoration: line-through; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 4vw, 40px);
  color: #fff;
}
.topbar h1, .topbar-title { margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.9rem); text-align: center; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex: 1; }
.topbar-right { justify-content: flex-end; }
.topbar--game .topbar-title { flex: 0 0 auto; }

.deck-badge {
  padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  font-size: .9rem; font-weight: 800; color: #fff;
  white-space: nowrap;
}

/* HOME */
.screen--home { justify-content: center; overflow: hidden; position: relative; }
.home-decor { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .06); pointer-events: none; }
.home-decor--one { width: 480px; height: 480px; top: -180px; right: -120px; }
.home-decor--two { width: 360px; height: 360px; bottom: -150px; left: -110px; }
.home-inner {
  position: relative; z-index: 1;
  width: min(1120px, 100%); margin: 0 auto;
  padding: 40px clamp(20px, 5vw, 56px);
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(24px, 5vw, 70px);
  align-items: center;
}
.home-copy { color: #fff; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 24px; }
.brand-row { display: flex; gap: 6px; }
.tile {
  width: clamp(40px, 6.2vw, 68px); height: clamp(44px, 6.8vw, 74px);
  display: grid; place-items: center;
  border-radius: 6px;
  color: #fff; font-weight: 900;
  font-size: clamp(1.5rem, 3.4vw, 2.7rem);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .15);
  transform: rotate(-2deg);
}
.brand-row:nth-child(2) .tile { transform: rotate(2deg); }
.brand-row:nth-child(3) .tile { transform: rotate(-2deg); }
.tile:nth-child(even) { transform: rotate(3deg); }
.brand-comma {
  color: var(--blue); font-weight: 900;
  font-size: clamp(2.1rem, 4.4vw, 3.5rem); line-height: 1;
  align-self: flex-end; margin: 0 0 6px -4px;
  transform: rotate(-10deg);
}
.brand-row:nth-child(2) .tile:nth-child(5) { margin-left: clamp(14px, 2.2vw, 26px); }
.tile--blue { background: var(--blue); }
.tile--orange { background: var(--orange); }
.tile--red { background: var(--red); }
.tile--green { background: #6dbb3e; }
.tile--yellow { background: #efc324; }
.home-tagline { font-size: clamp(1.05rem, 1.8vw, 1.35rem); line-height: 1.55; max-width: 36ch; margin: 0 0 28px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.home-credit { margin: 30px 0 0; font-size: .85rem; opacity: .8; line-height: 1.5; }
.home-art { display: flex; justify-content: center; }
.home-art img {
  width: min(100%, 440px); max-height: 72vh; object-fit: contain;
  border-radius: 24px; box-shadow: var(--shadow);
  transform: rotate(2deg);
}

/* SETUP */
#screen-setup .topbar { padding: 12px clamp(12px, 3vw, 28px); }
.setup-wrap {
  width: min(1100px, 100%); margin: auto;
  padding: 2px clamp(12px, 3vw, 24px) 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start;
}
.setup-step { background: var(--cream); border-radius: 20px; padding: 20px 24px; box-shadow: var(--shadow); }
.setup-step:nth-child(3), .setup-error, .setup-actions { grid-column: 1 / -1; }
.step-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.step-num {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green); color: #fff; font-weight: 900; font-size: 1.15rem;
}
.step-heading h2 { margin: 0; font-size: 1.25rem; }
.step-heading p { margin: 0; color: var(--muted); font-size: .9rem; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; }
#deck-options {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
}
#deck-options .chip { width: 100%; }
#deck-options .chip--all { grid-column: 1 / -1; }
.chip {
  position: relative;
  border: 2px solid var(--line); background: #fff;
  border-radius: 13px; padding: 12px 16px 12px 20px;
  font-weight: 800; font-size: 1rem; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.chip::before { content: ''; width: 9px; height: 26px; border-radius: 5px; background: var(--chip-color, var(--green)); }
.chip:hover { transform: translateY(-2px); border-color: var(--chip-color, var(--green)); }
.chip.is-selected { border-color: var(--chip-color, var(--green)); background: color-mix(in srgb, var(--chip-color, var(--green)) 12%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip-color, var(--green)) 25%, transparent); }
.chip small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.text-btn { border: 0; background: none; color: var(--green); font-weight: 800; font-size: .92rem; padding: 8px 2px 0; text-decoration: underline; }
.team-controls {
  display: grid; grid-template-columns: 190px 1fr; grid-template-rows: auto auto;
  gap: 6px 18px; align-items: center;
}
.team-controls .field-label { grid-column: 1; grid-row: 1; }
.team-controls .select { grid-column: 1; grid-row: 2; }
.team-names { grid-column: 2; grid-row: 1 / 3; }
.field-label { font-weight: 800; color: var(--muted); font-size: .92rem; }
.select {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-weight: 700;
}
.team-names { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.team-field { display: grid; gap: 5px; }
.team-field label { font-size: .85rem; font-weight: 800; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.team-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--team-color); }
.team-field input {
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
  font-weight: 700; color: var(--ink); background: #fff; width: 100%;
}
.team-field input:focus, .select:focus { outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent); border-color: var(--green); }
.setup-error { color: #ffd7d3; background: var(--red); padding: 9px 15px; border-radius: 11px; font-weight: 800; font-size: .9rem; text-align: center; }
.setup-actions { display: flex; justify-content: center; }
.setup-actions .btn--large { padding: 15px 36px; font-size: 1.1rem; }

/* BOARD */
#screen-board .topbar { padding: 8px clamp(12px, 3vw, 28px); }
.board-wrap {
  width: min(1020px, 100%); margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 28px) 8px;
}
.scoreboard { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 8px; }
.team-chip {
  min-width: 130px; padding: 7px 14px; border-radius: 14px;
  background: var(--cream); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 4px solid var(--team-color);
  transition: transform .2s ease, box-shadow .2s ease;
}
.team-chip.is-active { transform: translateY(-4px) scale(1.04); box-shadow: 0 12px 30px rgba(0, 0, 0, .28); }
.team-chip__name { font-weight: 800; display: flex; align-items: center; gap: 8px; }
.team-chip__score { font-size: 1.25rem; font-weight: 900; color: var(--team-color); }
.turn-banner {
  text-align: center; color: #fff; font-size: clamp(.95rem, 1.8vw, 1.2rem); font-weight: 800;
  margin-bottom: 8px; min-height: 1.4em;
}
.board-frame {
  position: relative; width: 100%;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.8vw, 20px);
  padding: clamp(12px, 2vw, 22px);
  border-radius: 22px; overflow: hidden;
  background: radial-gradient(circle at 18% -10%, rgba(255, 255, 255, .22), transparent 45%),
              linear-gradient(145deg, #1a9bd8 0%, #0f7fbe 48%, #0a6ba3 100%);
  box-shadow: var(--shadow), inset 0 2px 0 rgba(255, 255, 255, .28), inset 0 -10px 28px rgba(0, 40, 80, .25);
}
.board-frame::before {
  content: ''; position: absolute; inset: 10px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 20px; pointer-events: none;
}
.board-spine {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(0, 40, 80, .3) 12%, rgba(0, 40, 80, .3) 88%, transparent);
  box-shadow: 2px 0 0 rgba(255, 255, 255, .12); pointer-events: none;
}
.board-panel {
  position: relative; z-index: 1;
  padding: clamp(8px, 1.4vw, 14px);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2);
}
.board-panel__title {
  color: rgba(255, 255, 255, .9); font-weight: 800; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .12em; text-align: center; margin-bottom: 7px;
}
.pocket-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr);
  gap: clamp(6px, 1vw, 11px);
}
.pocket {
  position: relative; aspect-ratio: 3 / 4;
  border: 0; border-radius: 14px; padding: 0;
  background: linear-gradient(175deg, #fffdfa 0%, #f2f0e8 100%);
  box-shadow: 0 5px 0 rgba(0, 45, 85, .35), 0 10px 18px rgba(0, 35, 70, .22), inset 0 1px 0 #fff;
  display: grid; place-items: center;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.pocket::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 42%; height: 12px; border-radius: 0 0 999px 999px;
  background: var(--peek-color, rgba(13, 120, 180, .3));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .18);
}
.pocket:hover:not(:disabled) {
  transform: translateY(-5px);
  box-shadow: 0 9px 0 rgba(0, 45, 85, .32), 0 18px 26px rgba(0, 35, 70, .3), inset 0 1px 0 #fff;
  filter: brightness(1.04);
}
.pocket:active:not(:disabled) { transform: translateY(2px); }
.pocket:disabled { cursor: default; }
.pocket__num {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: #0f86c4; color: #fff; font-size: 1.1rem; font-weight: 900;
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 3px 8px rgba(0, 60, 100, .25);
  transition: transform .16s ease, background .16s ease;
}
.pocket:hover:not(:disabled) .pocket__num { transform: scale(1.12); background: #0a6ea8; }
.pocket.is-used { background: linear-gradient(175deg, #eaf4e9, #d9e9d7); box-shadow: 0 3px 0 rgba(0, 45, 85, .22); }
.pocket.is-used .pocket__num { display: none; }
.pocket.is-used::after {
  content: '✓'; position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: #3fae5b; color: #fff; font-size: .85rem; font-weight: 900;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 50, 20, .3);
  z-index: 2;
}
.pocket__card {
  position: absolute; top: 5%; left: 50%;
  width: 78%; height: 88%;
  transform: translateX(-50%) rotate(-1.5deg);
  object-fit: cover; object-position: top center;
  border-radius: 7px;
  box-shadow: 0 4px 10px rgba(0, 40, 70, .32);
  pointer-events: none; z-index: 1;
  animation: card-insert .35s ease-out;
}
@keyframes card-insert {
  from { opacity: 0; transform: translate(-50%, -14px) rotate(-4deg) scale(.94); }
  to { opacity: 1; transform: translate(-50%, 0) rotate(-1.5deg) scale(1); }
}
.board-hint { color: rgba(255, 255, 255, .9); text-align: center; margin: 8px 0 0; font-size: .85rem; }

/* CARD */
.card-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 0 16px 16px; }
.card-instruction, .card-note { color: #fff; text-align: center; margin: 0; font-size: clamp(.9rem, 1.6vw, 1.05rem); }
.card-note { min-height: 1.4em; font-weight: 800; }
.card-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.topic-badge, .point-badge { padding: 8px 16px; border-radius: 999px; font-weight: 900; font-size: .9rem; }
.topic-badge { background: rgba(255, 255, 255, .2); color: #fff; }
.point-badge { background: var(--yellow); color: var(--ink); }
.flip-card { position: relative; width: min(340px, calc((100vh - 270px) * 0.633), 100%); aspect-ratio: 380 / 600; perspective: 1400px; }
.flip-card::before {
  content: ''; position: absolute; inset: -12%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 130, .6), rgba(255, 226, 130, 0) 68%);
  opacity: 0; transform: scale(.7); pointer-events: none;
}
.flip-card.is-flipping::before { animation: flip-glow .9s ease-out; }
@keyframes flip-glow {
  0% { opacity: 0; transform: scale(.7); }
  40% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.3); }
}
.flip-card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.flip-card-inner.is-flipped { animation: card-flip .95s ease-in-out both; }
.flip-card-inner.is-unflipping { animation: card-flip-back .95s ease-in-out both; }
@keyframes card-flip {
  0% { transform: rotateY(0deg) scale(1) translateY(0); }
  50% { transform: rotateY(90deg) scale(1.09) translateY(-10px); }
  100% { transform: rotateY(180deg) scale(1) translateY(0); }
}
@keyframes card-flip-back {
  0% { transform: rotateY(180deg) scale(1) translateY(0); }
  50% { transform: rotateY(90deg) scale(1.09) translateY(-10px); }
  100% { transform: rotateY(0deg) scale(1) translateY(0); }
}
.card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 24px; overflow: hidden; background: var(--cream);
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 1px rgba(0, 50, 25, .12), var(--shadow);
}
.card-face-image { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(1.045); }
.card-face--front { transition: transform .2s ease; }
.flip-card:not(.is-flipping):hover .card-face--front { transform: translateY(-3px) rotateX(2deg); }
.card-face--back { transform: rotateY(180deg); pointer-events: none; }
.flip-card-inner.is-flipped .card-face--front { pointer-events: none; }
.flip-card-inner.is-flipped .card-face--back { pointer-events: auto; }
.flip-card-inner.is-unflipping .card-face--front { pointer-events: none; }
.flip-card-inner.is-unflipping .card-face--back { pointer-events: none; }
.card-actions { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; min-height: 52px; }
.card-actions .btn { min-width: 180px; }
.grade-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.grade-actions[hidden], .card-actions .btn[hidden] { display: none; }
.card-actions[hidden] { display: none; }
.card-back-link {
  border: 0; background: none; color: rgba(255, 255, 255, .9);
  font-weight: 800; font-size: .95rem; padding: 2px 10px;
  text-decoration: underline; text-underline-offset: 3px;
}
.card-back-link:hover { color: #fff; }

/* RESULTS */
.results-wrap {
  width: min(760px, 100%); margin: auto;
  padding: 36px clamp(16px, 4vw, 40px) 48px;
  background: var(--cream); border-radius: 28px; box-shadow: var(--shadow);
  text-align: center;
}
.trophy { font-size: 4rem; color: var(--yellow); text-shadow: 0 4px 0 #d99f10; line-height: 1; }
.results-title { margin: 8px 0 4px; font-size: clamp(1.8rem, 4vw, 2.6rem); color: var(--green); }
.results-subtitle { margin: 0 0 24px; color: var(--muted); font-size: 1.1rem; font-weight: 700; }
.results-list { display: grid; gap: 12px; }
.result-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-radius: 16px; background: #fff;
  border: 2px solid var(--line); text-align: left;
}
.result-row.is-winner { border-color: var(--yellow); background: #fffbec; box-shadow: 0 0 0 4px rgba(247, 197, 49, .25); }
.result-rank { font-size: 1.5rem; font-weight: 900; width: 42px; text-align: center; }
.result-name { flex: 1; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.result-score { font-size: 1.6rem; font-weight: 900; color: var(--green); }
.history { margin: 26px 0 0; text-align: left; }
.history summary { cursor: pointer; font-weight: 800; color: var(--green); padding: 8px 0; }
.history-list { max-height: 220px; overflow-y: auto; display: grid; gap: 6px; margin-top: 8px; }
.history-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: #f4f7f1; font-size: .9rem; }
.history-item strong { color: var(--green); }
.results-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.results-actions .btn--ghost { background: var(--green); box-shadow: 0 5px 0 rgba(0,0,0,.16); }

/* MODAL, CONFETTI, TOAST */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 25, 10, .72); }
.modal-card {
  position: relative; width: min(720px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--cream); border-radius: 24px; padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow); animation: pop-in .25s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.modal-card h2 { margin: 0 0 18px; color: var(--green); font-size: 1.9rem; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eef2ea; font-size: 1.1rem; }
.rules-content section { margin-bottom: 18px; }
.rules-content h3 { margin: 0 0 6px; font-size: 1.1rem; color: var(--green); }
.rules-content p, .rules-content li { line-height: 1.55; color: #34463a; }
.rules-content ol { padding-left: 22px; margin: 6px 0 0; }

.confetti-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.confetti-piece { position: absolute; top: -30px; width: 10px; height: 18px; border-radius: 3px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  z-index: 70; padding: 12px 24px; border-radius: 999px;
  background: rgba(10, 40, 22, .95); color: #fff; font-weight: 800;
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .home-inner { grid-template-columns: 1fr; text-align: center; gap: 24px; padding-top: 24px; }
  .brand, .home-actions { align-items: center; justify-content: center; }
  .home-tagline { max-width: none; }
  .home-art img { max-height: 34vh; width: auto; }
  .setup-wrap { grid-template-columns: 1fr; gap: 8px; padding-bottom: 10px; }
  .setup-step { padding: 10px 13px; }
  .step-heading { gap: 8px; margin-bottom: 7px; }
  .step-num { width: 27px; height: 27px; font-size: .95rem; }
  .step-heading h2 { font-size: 1rem; }
  .step-heading p { font-size: .78rem; }
  .chip-grid { gap: 6px; }
  .chip { padding: 7px 10px 7px 14px; font-size: .85rem; }
  .chip::before { width: 6px; height: 18px; }
  .chip small { font-size: .7rem; }
  .setup-actions .btn--large { padding: 10px 24px; font-size: .95rem; }
  .select, .team-field input { padding: 8px 10px; }
  .field-label { font-size: .82rem; }
  .team-field label { font-size: .75rem; }
  .board-frame { padding: 16px; gap: 14px; }
  .board-panel { padding: 12px; }
  .flip-card { width: min(300px, calc((100vh - 270px) * 0.633), 100%); }
}

@media (max-width: 620px) {
  .board-frame { grid-template-columns: 1fr; }
  .board-spine { display: none; }
}

@media (max-width: 560px) {
  .topbar { padding: 12px; }
  .topbar-title { font-size: 1.1rem; }
  .deck-badge { display: none; }
  .brand-row { gap: 4px; }
  .tile { width: 34px; height: 40px; font-size: 1.35rem; }
  .brand-comma { font-size: 1.8rem; margin-bottom: 4px; }
  .brand-row:nth-child(2) .tile:nth-child(5) { margin-left: 12px; }
  .home-actions .btn { width: 100%; max-width: 300px; }
  .home-art img { max-height: 28vh; }
  .pocket__num { width: 30px; height: 30px; font-size: .8rem; }
  .team-chip { min-width: 120px; padding: 8px 12px; }
  .team-controls { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .team-controls .field-label { grid-column: 1; grid-row: 1; }
  .team-controls .select { grid-column: 1; grid-row: 2; }
  .team-names { grid-column: 1; grid-row: 3; }
  .flip-card { width: min(260px, calc((100vh - 270px) * 0.633), 100%); }
  .card-actions .btn { min-width: 0; width: 100%; max-width: 300px; }
  .results-actions .btn { width: 100%; max-width: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .flip-card-inner.is-flipped { animation: card-flip .95s ease-in-out both !important; }
  .flip-card-inner.is-unflipping { animation: card-flip-back .95s ease-in-out both !important; }
}
