:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6472;
  --soft: #eef2f7;
  --line: #d9e1ec;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --gold: #c97f18;
  --danger: #b42318;
  --success: #16703c;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f8fafc;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  background: rgba(17, 24, 39, 0.96);
  color: white;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--gold);
  color: #111827;
  font-weight: 800;
}

.brand-title {
  display: grid;
  line-height: 1.05;
}

.brand-title strong {
  font-size: 1rem;
  font-weight: 800;
}

.brand-title span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.68);
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.nav-link {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: transparent;
  color: white;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.loading-view,
.empty-state,
.status-card {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

#recall-status:empty {
  display: none;
}

.hero {
  display: grid;
  gap: 1rem;
  align-items: center;
  justify-items: center;
  min-height: 13rem;
  padding: clamp(1.25rem, 5vw, 3rem);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(110deg, rgba(17, 24, 39, 0.92), rgba(17, 24, 39, 0.55)),
    radial-gradient(circle at 75% 25%, rgba(201, 127, 24, 0.6), transparent 28rem),
    #1f2937;
  color: white;
  text-align: center;
}

.hero h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.75rem);
  line-height: 0.98;
}

.hero p {
  max-width: 44rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.05rem;
}

.leaderboard-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.leaderboard-header h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.leaderboard-header .version {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.board {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.board-header {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #f1f5f9;
}

.board-header h3 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.board-header p {
  margin: 0;
  color: var(--muted);
}

.board-header .yesterday-winner {
  min-height: 2.75rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.row-button,
.table-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.row-button:hover,
.table-button:hover,
.table-button.active {
  background: #ecfdf5;
}

.rank {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--soft);
  font-weight: 800;
}

.row-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wins {
  min-width: 3rem;
  text-align: right;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-strong);
}

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

.form-card,
.rules-card,
.account-card {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.recall-page {
  max-width: none;
  padding: 1rem;
}

.recall-card {
  width: 100%;
  min-width: 0;
  padding: 0;
}

.form-card h1,
.rules-card h1,
.account-card h1,
.recall-card h1 {
  margin: 0 0 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: center;
}

.form-grid label {
  color: var(--muted);
  font-weight: 700;
}

.form-grid input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.65rem 0.75rem;
}

.checkbox-row {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.primary,
.secondary,
.danger {
  border: 0;
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-weight: 800;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

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

.message {
  margin-top: 1rem;
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
}

.message.error {
  background: #fef3f2;
  color: var(--danger);
}

.message.success {
  background: #ecfdf3;
  color: var(--success);
}

.authorization {
  color: var(--muted);
  line-height: 1.45;
}

.account-layout {
  display: grid;
  gap: 1rem;
}

.account-win-tallies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-block: 1px solid var(--line);
  padding: 0.9rem 0;
}

.account-win-tally {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0 1rem;
}

.account-win-tally + .account-win-tally {
  border-left: 1px solid var(--line);
}

.account-win-tally dt {
  color: var(--muted);
  font-weight: 700;
}

.account-win-tally dd {
  margin: 0;
  color: var(--accent-strong);
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.assignment-list {
  display: grid;
  gap: 0.5rem;
}

.table-button {
  border: 1px solid var(--line);
  border-radius: 6px;
}

.recall-grid {
  display: grid;
  gap: 0.75rem;
}

/* Ported from AZ1's GameRecall, with static class names for this non-React page. */
.az-recall-scroll {
  overflow: auto;
  width: 100%;
  max-width: 100%;
}

.az-recall-grid {
  --az-recall-columns: 7rem 7rem 7rem minmax(30rem, 1fr) 18rem 5.25rem 4.75rem 4.75rem 5.25rem;
  width: 100%;
  min-width: 90.5rem;
}

.az-recall-header,
.az-recall-row {
  display: grid;
  grid-template-columns: var(--az-recall-columns);
  align-items: center;
}

.az-recall-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8f9fa;
  color: #1f2937;
  font-weight: 700;
  border-bottom: 1px solid #e5e7eb;
}

.az-recall-header > div,
.az-cell {
  box-sizing: border-box;
  min-width: 0;
  padding: .85rem .9rem;
  border-bottom: 1px solid #f0f0f0;
  overflow: hidden;
  text-align: left;
}

.az-recall-row:nth-child(odd) { background: #f7f7f9; }
.az-recall-row:nth-child(even) { background: #fff; }
.az-recall-row { min-height: 12.25rem; contain: layout paint; }
.az-recall-row.az-recall-row-live {
  background: #fff8df;
  box-shadow: inset 4px 0 0 #c97f18;
}
.az-deck-index,
.az-number-cell { text-align: center; }
.az-deck-index {
  display: grid;
  gap: .45rem;
  overflow-wrap: anywhere;
  font-size: .78rem;
}
.az-live-state {
  color: #8a4b08;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.az-draw-cell,
.az-card-cell { display: flex; align-items: center; }
.az-draw-cell { justify-content: center; }
.az-card-cell { justify-content: flex-start; }
.az-recall-row-new { animation: az-recall-row-enter 45ms ease-out; }

@keyframes az-recall-row-enter {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.az-draw-col { width: 30rem; min-width: 30rem; padding: 0; }
.az-draw-row {
  display: flex;
  flex-direction: column;
  gap: .02rem;
  align-items: center;
  justify-content: flex-start;
  /* The 101-ball domain occupies seven 16-ball rows. */
  height: 10.97rem;
}
.az-draw-line {
  display: grid;
  grid-template-columns: repeat(16, 1.55rem);
  grid-auto-rows: 1.55rem;
  gap: 0 .08rem;
  opacity: 1;
}
.az-draw-item { position: relative; display: block; width: 1.55rem; height: 1.55rem; opacity: 0; }
.az-recall-static .az-draw-item { opacity: 1; }
.az-recall-animated .az-draw-item {
  animation: az-draw-ball-reveal 50ms ease-out forwards;
  animation-delay: var(--draw-delay, 0ms);
  will-change: opacity, transform;
}
@keyframes az-draw-ball-reveal {
  from { opacity: 0; transform: translateY(-.3rem) scale(.7); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.az-draw-ball { position: absolute; top: .05rem; left: .05rem; width: 1.45rem; height: 1.45rem; }
.az-draw-symbol { position: absolute; top: .17rem; left: .17rem; width: 1.22rem; height: 1.22rem; z-index: 1; }
.az-ball-text { position: absolute; top: .05rem; left: .05rem; z-index: 1; display: block; width: 1.45rem; height: 1.45rem; color: #1f2937; font-size: .7rem; line-height: 1.45rem; text-align: center; }

.az-bingo-card-cont { width: 250px; min-height: 175px; margin-left: .4rem; }
.az-bingo-spot-row { position: relative; width: 250px; height: 105px; padding: 0; margin: 0; }
.az-bingo-card-img { position: relative; width: 250px; }
.az-card-spot-row { position: absolute; top: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); width: 250px; height: 105px; padding-top: 10px; overflow: hidden; }
.az-card-spot { position: relative; display: grid; place-items: center; min-width: 0; }
.az-spot-star { position: absolute; top: 40px; width: 35px; height: 35px; z-index: 1; opacity: 0; }
.az-recall-static .az-spot-star.is-hit { opacity: .7; }
.az-spot-star.is-miss { opacity: 0; }
.az-recall-animated .az-spot-star.is-hit {
  animation: az-card-daub 50ms ease-out forwards;
  animation-delay: var(--hit-delay, 0ms);
  will-change: opacity, transform;
  transform-origin: center;
}
@keyframes az-card-daub {
  0% { opacity: 0; transform: scale(1.65) rotate(-8deg); }
  70% { opacity: .85; transform: scale(.92) rotate(0); }
  100% { opacity: .7; transform: scale(1) rotate(0); }
}
.az-spot-symbol { position: relative; width: 35px; height: 35px; z-index: 0; }
.az-spot-text { position: relative; padding-top: 11px; padding-left: 2px; z-index: 0; font-size: 1.2rem; font-weight: 700; }
.az-prize-row { display: flex; align-items: center; width: 250px; min-height: 75px; margin: .55rem 0 0; }
.az-interim-prize,
.az-end-prize { opacity: 0; height: 75px; }
.az-interim-prize { width: 75px; }
.az-end-prize { width: 33%; }
.az-recall-static .az-interim-prize.is-visible,
.az-recall-static .az-end-prize.is-visible { opacity: 1; }
.az-recall-animated .az-interim-prize.is-visible,
.az-recall-animated .az-end-prize.is-visible {
  animation: az-prize-reveal 60ms ease-out forwards;
  animation-delay: var(--prize-delay, 0ms);
}
@keyframes az-prize-reveal {
  from { opacity: 0; transform: translateY(.4rem) scale(.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rules-card {
  line-height: 1.55;
}

.rules-card h2 {
  margin-top: 1.25rem;
}

@media (max-width: 780px) {
  .top-nav {
    grid-template-columns: 1fr;
  }

  .nav-actions {
    justify-content: flex-start;
  }

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

  .form-grid,
  .recall-row {
    grid-template-columns: 1fr;
  }
}
