:root {
  color-scheme: light;
  --ink: #211d18;
  --muted: #756b5e;
  --paper: #fffaf2;
  --panel: #ffffff;
  --line: #e2d7c6;
  --accent: #12778a;
  --accent-dark: #07596c;
  --river: #1f9db6;
  --river-deep: #0f6178;
  --bank: #79a761;
  --gold: #d49431;
  --danger: #b64435;
  --sky: #4078bc;
  --shadow: 0 16px 40px rgba(50, 38, 24, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  position: relative;
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(244, 188, 88, 0.3), transparent 28%),
    radial-gradient(circle at 82% 6%, rgba(72, 146, 95, 0.2), transparent 26%),
    linear-gradient(135deg, rgba(31, 157, 182, 0.15), transparent 42%),
    linear-gradient(225deg, rgba(212, 148, 49, 0.12), transparent 38%),
    var(--paper);
}

body.app-locked {
  overflow: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(116deg, transparent 0 10%, rgba(121, 167, 97, 0.24) 10% 13%, transparent 13% 100%),
    linear-gradient(116deg, transparent 0 35%, rgba(31, 157, 182, 0.2) 35% 44%, rgba(15, 97, 120, 0.16) 44% 48%, transparent 48% 100%),
    repeating-linear-gradient(116deg, transparent 0 36px, rgba(255, 255, 255, 0.18) 36px 39px, transparent 39px 76px);
  opacity: 0.8;
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.app-locked .app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 2px 16px;
}

.hero-actions {
  display: grid;
  gap: 8px;
  flex: 0 0 auto;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 12vw, 4.25rem);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
}

h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.intro {
  max-width: 46rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.river-scene {
  width: min(520px, 100%);
  margin-top: 14px;
  padding: 8px;
  border: 1px solid rgba(7, 89, 108, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(121, 167, 97, 0.34), transparent 18% 82%, rgba(121, 167, 97, 0.34)),
    #eaf7f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.river-current {
  position: relative;
  min-height: 76px;
  overflow: hidden;
  border-radius: 8px;
  background:
    repeating-linear-gradient(168deg, transparent 0 22px, rgba(255, 255, 255, 0.2) 22px 25px, transparent 25px 46px),
    linear-gradient(135deg, var(--river), var(--river-deep));
}

.river-current::before,
.river-current::after {
  position: absolute;
  right: -24px;
  left: -24px;
  height: 28px;
  content: "";
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(-5deg);
}

.river-current::before {
  top: 12px;
}

.river-current::after {
  bottom: 10px;
}

.floating-card,
.river-chip {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(12, 67, 76, 0.22);
}

.floating-card {
  width: 42px;
  height: 54px;
  color: var(--ink);
  background: #fffdf8;
  border: 2px solid rgba(33, 29, 24, 0.1);
  font-size: 1.35rem;
}

.card-a {
  top: 13px;
  left: 24px;
  color: var(--danger);
  transform: rotate(-12deg);
}

.card-k {
  top: 9px;
  left: 92px;
  transform: rotate(8deg);
}

.card-q {
  top: 16px;
  left: 160px;
  color: var(--accent-dark);
  transform: rotate(-5deg);
}

.river-chip {
  height: 30px;
  padding: 0 12px;
  color: #063f4d;
  background: rgba(255, 250, 242, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.river-chip:nth-of-type(4) {
  top: 12px;
  right: 142px;
}

.river-chip:nth-of-type(5) {
  top: 34px;
  right: 72px;
}

.river-chip:nth-of-type(6) {
  top: 13px;
  right: 16px;
}

.panel,
.round-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  min-width: 0;
}

.setup-panel {
  border-top: 5px solid var(--bank);
}

.home-panel {
  border-top: 5px solid var(--river-deep);
}

.entry-panel {
  border-top: 5px solid var(--river);
}

.standings-panel {
  border-top: 5px solid var(--gold);
}

.setup-panel,
.game-shell {
  display: grid;
  gap: 14px;
}

.home-panel,
.setup-panel {
  min-height: 0;
  overflow: hidden;
}

.app-locked .home-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.app-locked .setup-panel {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.game-shell {
  min-height: 0;
}

.game-active .game-shell {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.event-banner {
  position: fixed;
  right: 14px;
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 14px));
  left: 14px;
  z-index: 4;
  max-width: 952px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow);
  font-weight: 850;
  pointer-events: none;
  animation: banner-in 360ms ease both;
}

.event-banner.miss {
  background: var(--danger);
}

.event-banner.win {
  background: var(--sky);
}

.section-heading,
.players-header,
.entry-footer,
.round-card,
.round-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 14px;
}

.compact {
  margin-bottom: 10px;
}

.pill {
  flex: 0 0 auto;
  border: 1px solid rgba(31, 122, 107, 0.24);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent-dark);
  background: #e7f8fb;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-grid,
.game-grid {
  display: grid;
  gap: 10px;
}

.category-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.game-picker {
  margin-top: 16px;
  min-height: 0;
  overflow: auto;
}

.category-card,
.game-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #fffdf8;
  box-shadow: 0 8px 22px rgba(50, 38, 24, 0.07);
  cursor: pointer;
}

.category-card.active {
  border-color: rgba(31, 157, 182, 0.6);
  background:
    linear-gradient(135deg, rgba(31, 157, 182, 0.13), transparent),
    #fffdf8;
  box-shadow: 0 0 0 3px rgba(31, 157, 182, 0.12);
}

.category-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--river), var(--river-deep));
  font-size: 1rem;
  font-weight: 950;
}

.category-card strong,
.game-card strong {
  font-size: 1.05rem;
}

.category-card small,
.game-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.35;
}

.game-card {
  grid-template-columns: 1fr;
  border-left: 5px solid var(--gold);
}

.game-card:not(.disabled)::after {
  content: "Start setup";
  justify-self: start;
  margin-top: 4px;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: var(--river-deep);
  font-size: 0.78rem;
  font-weight: 900;
}

.game-card.disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffdf8;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(31, 122, 107, 0.24);
  outline-offset: 2px;
}

.score-rules {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  padding: 12px;
  border: 1px dashed rgba(7, 89, 108, 0.35);
  border-radius: 8px;
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(31, 157, 182, 0.1), transparent 52%),
    #fffaf3;
  font-size: 0.9rem;
}

.player-list,
.round-entry,
.team-totals {
  display: grid;
  gap: 10px;
}

.player-list {
  min-height: 0;
  overflow: auto;
}

.round-entry {
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding-right: 2px;
}

.players-header {
  margin: 4px 0 10px;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 44px;
  gap: 8px;
  align-items: center;
}

.team-select {
  display: none;
}

.teams .player-row {
  grid-template-columns: minmax(0, 1fr) 104px 104px 44px;
}

.teams .team-select {
  display: block;
}

.dealer-select {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fffdf8;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dealer-select input {
  width: 22px;
  min-height: 22px;
  margin: 2px 0 0;
  accent-color: var(--river-deep);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--river-deep));
  box-shadow: 0 10px 20px rgba(15, 97, 120, 0.18);
}

.primary-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.secondary-button,
.ghost-button,
.icon-button {
  color: var(--ink);
  background: #f4eadc;
}

.secondary-button {
  min-height: 40px;
  padding: 8px 12px;
}

.ghost-button {
  min-width: 58px;
  min-height: 40px;
}

.ghost-button.active {
  color: #fff;
  background: var(--river-deep);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  padding: 0 10px;
  height: 44px;
  flex: 0 0 auto;
  font-size: 0.78rem;
  line-height: 1;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.round-card {
  z-index: 3;
  padding: 14px;
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(31, 157, 182, 0.13), transparent 58%),
    rgba(255, 255, 255, 0.96);
}

.round-card h2 {
  font-size: 1.55rem;
}

.dealer-line {
  margin: 7px 0 0;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 900;
}

.game-tabs,
.setup-tabs {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(7, 89, 108, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.86);
  box-shadow: 0 8px 22px rgba(50, 38, 24, 0.08);
}

.game-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.setup-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.game-tab,
.setup-tab {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.game-tab.active,
.setup-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--river-deep));
  box-shadow: 0 8px 18px rgba(15, 97, 120, 0.16);
}

.game-panel,
.setup-panel-page {
  display: none;
  min-height: 0;
  overflow: hidden;
}

.game-panel.active,
.setup-panel-page.active {
  display: grid;
}

.setup-panel-page.active {
  align-content: start;
  overflow: auto;
}

.entry-panel.game-panel.active {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.standings-panel.game-panel.active,
.stats-panel.game-panel.active {
  align-content: start;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 74px 74px 54px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  min-width: 0;
}

.entry-row.board-armed {
  border-color: rgba(199, 132, 42, 0.65);
  background:
    linear-gradient(90deg, rgba(212, 148, 49, 0.14), transparent),
    #fff7e8;
  box-shadow: 0 0 0 3px rgba(199, 132, 42, 0.13);
}

.entry-row.active-dealer {
  border-color: rgba(31, 157, 182, 0.55);
  background:
    linear-gradient(90deg, rgba(31, 157, 182, 0.1), transparent),
    #fffdf8;
}

.entry-name {
  min-width: 0;
  font-weight: 850;
}

.mini-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  min-width: 0;
}

.board-toggle {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  min-width: 0;
}

.board-toggle input {
  width: 28px;
  min-height: 28px;
  accent-color: var(--gold);
}

.entry-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 12px;
  align-items: stretch;
  flex: 0 0 auto;
}

.entry-footer .hint {
  align-self: start;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.25;
}

.entry-footer .primary-button {
  width: 100%;
  justify-self: stretch;
  margin-top: 0;
}

.mexican-rules {
  display: grid;
  gap: 12px;
}

.mexican-rules-hint {
  padding: 12px;
  border: 1px dashed rgba(7, 89, 108, 0.28);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.84);
}

.mexican-stack {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.mexican-status-card,
.mexican-roll-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.mexican-status-card {
  background:
    linear-gradient(90deg, rgba(31, 157, 182, 0.12), transparent 68%),
    #fffdf8;
}

.mexican-status-card.win,
.mexican-roll-card.revealed {
  border-color: rgba(31, 122, 107, 0.34);
}

.mexican-roll-card.shaking {
  border-color: rgba(64, 120, 188, 0.42);
  box-shadow: 0 0 0 3px rgba(64, 120, 188, 0.12);
  animation: cup-shake 140ms linear infinite;
}

.mexican-status-card strong,
.mexican-roll-card strong {
  font-size: 1rem;
}

.mexican-status-card span,
.mexican-roll-card span {
  color: var(--muted);
  line-height: 1.3;
}

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

.mexican-actions-grid .primary-button,
.mexican-actions-grid .secondary-button {
  width: 100%;
  margin-top: 0;
}

.dice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.die-face {
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px solid rgba(7, 89, 108, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(64, 120, 188, 0.12), rgba(255, 255, 255, 0.96)),
    #fff;
  color: var(--ink);
  font-size: 2.55rem;
  line-height: 1;
}

.mexican-roll-card.shaking .die-face {
  animation: die-bounce 110ms ease-in-out infinite alternate;
}

.mexican-roll-card.shaking .die-face:nth-child(2) {
  animation-delay: 40ms;
}

@keyframes cup-shake {
  0% { transform: translate3d(-2px, 0, 0) rotate(-1.5deg); }
  50% { transform: translate3d(2px, -1px, 0) rotate(1.5deg); }
  100% { transform: translate3d(-1px, 1px, 0) rotate(-1deg); }
}

@keyframes die-bounce {
  0% { transform: translateY(-2px) rotate(-3deg) scale(1.02); }
  100% { transform: translateY(2px) rotate(3deg) scale(0.98); }
}

.team-totals {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

.standings-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.standing-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf3;
}

.standing-row strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--river-deep);
}

.standing-row div {
  min-width: 0;
  font-weight: 900;
}

.standing-row span {
  display: block;
  margin-top: 2px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.standing-row b {
  color: var(--accent-dark);
  font-size: 1.45rem;
}

.standing-row.out {
  opacity: 0.58;
}

.team-total {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf3;
}

.team-total strong {
  display: block;
  font-size: 1.55rem;
}

.team-total em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.25;
}

.bid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf3;
}

.stat-card strong {
  font-size: 0.94rem;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.stat-card .stat-team,
.entry-team,
.score-team {
  display: block;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.entry-team {
  margin-top: 2px;
}

.dealer-badge {
  display: inline-grid;
  place-items: center;
  margin-top: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  background: var(--river-deep);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.compact-badge {
  display: inline-grid;
  margin: 4px 0 0;
  padding: 3px 7px;
  font-size: 0.68rem;
}

.standing-row .compact-badge {
  display: inline-grid;
  width: auto;
  color: #fff;
  background: var(--river-deep);
}

.scoreboard-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.scoreboard {
  width: 100%;
  border-collapse: collapse;
  min-width: 440px;
  font-size: 0.88rem;
}

.scoreboard th,
.scoreboard td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: right;
  white-space: nowrap;
}

.scoreboard th:first-child,
.scoreboard td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 74px;
  text-align: left;
  background: #fffdf8;
}

.scoreboard thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4eadc;
  font-size: 0.78rem;
}

.scoreboard tfoot td,
.scoreboard tfoot th {
  border-bottom: 0;
  color: var(--accent-dark);
  background: #ecf7f4;
  font-weight: 900;
}

.score-delta {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
  overflow: hidden;
}

.celebration-card {
  position: relative;
  z-index: 2;
  width: min(300px, calc(100vw - 96px));
  border-radius: 8px;
  padding: 22px 18px;
  color: #fff;
  text-align: center;
  background: var(--accent);
  box-shadow: 0 24px 70px rgba(33, 29, 24, 0.28);
  animation: pop-in 560ms cubic-bezier(0.18, 0.9, 0.22, 1.18) both;
}

.celebration-card.miss {
  background: var(--danger);
}

.celebration-card.win {
  background: var(--sky);
}

.celebration-kicker {
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.celebration-title {
  font-size: 1.75rem;
  font-weight: 950;
  line-height: 1.05;
}

.celebration-detail {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 750;
}

.confetti-piece,
.splash-piece {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall var(--fall-time, 1500ms) ease-in forwards;
}

.splash-piece {
  top: 42%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  animation: splash-out 760ms ease-out forwards;
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.86);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes banner-in {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 0), 110vh, 0) rotate(var(--spin, 360deg));
  }
}

@keyframes splash-out {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.4);
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(1.2);
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 680px) {
  html,
  body {
    min-height: 100dvh;
  }

  body {
    font-size: 18px;
  }

  .app {
    padding-inline: 10px;
  }

  .app-locked .app {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }

  .hero {
    display: grid;
    grid-template-columns: 1fr;
    padding-top: 10px;
  }

  .app-locked .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 0;
  }

  .app-locked .hero .eyebrow,
  .app-locked .hero .intro,
  .app-locked .river-scene {
    display: none;
  }

  .app-locked .hero h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1;
  }

  .hero-actions {
    display: flex;
    gap: 7px;
    justify-self: end;
    order: -1;
  }

  .app-locked .hero-actions {
    order: 0;
    justify-self: auto;
  }

  h1 {
    font-size: clamp(2.7rem, 14vw, 4.4rem);
  }

  h2 {
    font-size: 1.55rem;
  }

  h3 {
    font-size: 1.18rem;
  }

  .intro {
    font-size: 1.12rem;
  }

  .eyebrow {
    font-size: 0.86rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .category-card,
  .game-card {
    padding: 12px;
  }

  .category-card {
    grid-template-columns: 54px 1fr;
    align-items: center;
  }

  .category-card small {
    grid-column: 2;
  }

  .category-icon {
    grid-row: 1 / span 2;
    width: 46px;
    height: 46px;
  }

  .app-locked .home-panel .section-heading h2 {
    font-size: 1.45rem;
  }

  .app-locked .home-panel {
    gap: 8px;
  }

  .app-locked .category-grid {
    gap: 8px;
  }

  .app-locked .category-card {
    min-height: 82px;
  }

  .app-locked .category-card strong,
  .app-locked .game-card strong {
    font-size: 1rem;
  }

  .app-locked .category-card small,
  .app-locked .game-card span {
    font-size: 0.82rem;
  }

  .panel {
    padding: 15px;
  }

  .app-locked .panel {
    padding: 10px;
  }

  .app-locked .section-heading {
    margin-bottom: 8px;
  }

  .app-locked .section-heading h2 {
    font-size: 1.18rem;
  }

  .compact-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .compact-fields .field:first-child {
    grid-column: 1 / -1;
  }

  .compact-fields .field {
    font-size: 0.82rem;
  }

  .compact-fields input,
  .compact-fields select {
    min-height: 46px;
    padding: 9px 10px;
    font-size: 1rem;
  }

  .setup-tabs {
    gap: 4px;
    padding: 4px;
  }

  .setup-tab {
    min-height: 44px;
  }

  .setup-panel-page .score-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 8px 0 0;
    padding: 8px;
    gap: 3px 8px;
    font-size: 0.74rem;
  }

  .setup-panel-page .score-rules div:last-child {
    grid-column: 1 / -1;
  }

  .field {
    font-size: 0.98rem;
  }

  input,
  select {
    min-height: 56px;
    padding: 13px 14px;
    font-size: 1.08rem;
  }

  .primary-button {
    min-height: 58px;
    font-size: 1.08rem;
  }

  .secondary-button,
  .ghost-button {
    min-height: 48px;
    font-size: 1rem;
  }

  .icon-button {
    min-height: 48px;
    height: 48px;
    font-size: 0.92rem;
  }

  .pill {
    font-size: 0.92rem;
  }

  .hint,
  .score-rules {
    font-size: 1rem;
  }

  .player-row {
    grid-template-columns: minmax(0, 1fr) 96px 48px;
  }

  .teams .player-row {
    grid-template-columns: minmax(116px, 1fr) 72px 38px 34px;
    gap: 5px;
  }

  .teams .player-name {
    grid-column: auto;
  }

  .teams .dealer-select span {
    display: none;
  }

  .teams .dealer-select input {
    margin: 0;
  }

  .teams .team-select {
    padding-inline: 7px;
    font-size: 0.92rem;
  }

  .teams .dealer-select {
    min-height: 48px;
  }

  .teams .remove-player {
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .dealer-select {
    min-height: 56px;
    font-size: 0.78rem;
  }

  .dealer-select input {
    width: 28px;
    min-height: 28px;
  }

  .round-card h2 {
    font-size: 1.75rem;
  }

  .game-active .round-card {
    padding: 10px;
  }

  .game-active .round-card h2 {
    font-size: 1.18rem;
  }

  .game-active .round-card .eyebrow {
    font-size: 0.72rem;
  }

  .game-active .dealer-line {
    margin-top: 4px;
    font-size: 0.82rem;
  }

  .game-tabs {
    gap: 4px;
    padding: 4px;
  }

  .game-tab {
    min-height: 46px;
    font-size: 0.88rem;
  }

  .game-active .entry-panel h2,
  .game-active .standings-panel h2,
  .game-active .stats-panel h2 {
    font-size: 1.05rem;
  }

  .entry-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px;
    gap: 6px;
  }

  .entry-name {
    grid-column: 1 / -1;
    font-size: 1.18rem;
  }

  .game-active .entry-name {
    font-size: 1rem;
  }

  .mini-field,
  .board-toggle {
    font-size: 0.9rem;
  }

  .entry-row input {
    padding-inline: 8px;
  }

  .board-toggle {
    min-height: 66px;
    align-content: end;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
    background: #fffdf8;
  }

  .board-toggle input {
    width: 36px;
    min-height: 36px;
  }

  .bid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: auto;
  }

  .stat-card {
    padding: 11px;
  }

  .stat-card strong {
    font-size: 1.02rem;
  }

  .stat-card span {
    font-size: 0.92rem;
  }

  .entry-footer {
    display: grid;
    gap: 8px;
    margin-top: 8px;
  }

  .entry-footer .primary-button {
    width: 100%;
  }

  .mexican-actions-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .die-face {
    min-height: 74px;
    font-size: 2.15rem;
  }

  .celebration-card {
    align-self: start;
    margin-top: 26vh;
  }

  .scoreboard {
    font-size: 1rem;
    min-width: 360px;
  }

  .scoreboard th,
  .scoreboard td {
    padding: 11px 10px;
  }

  .score-delta {
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .confetti-piece,
  .splash-piece {
    display: none;
  }
}
