:root {
  --navy: #1a3552;
  --navy-dark: #0f2238;
  --cream: #f7f4ec;
  --gold: #c9962f;
  --ink: #20242b;

  /* --- design-system adapter (added by the design-system refresh) --- */
  --ds-primary: var(--navy);
  --ds-primary-dark: var(--navy-dark);
  --ds-surface: #ffffff;
  --ds-bg: var(--cream);
  --ds-ink: var(--ink);
  --ds-accent: var(--gold);
  --ds-radius: 10px;
  --ds-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --ds-shadow-hover: 0 4px 10px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.08);

  /* WCAG AA-compliant muted ink (>=4.5:1 on cream/white) */
  --ds-muted: #5a5f66;
  /* comfortable minimum touch target */
  --ds-tap: 44px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

header {
  background: var(--navy);
  color: var(--cream);
  padding: 1.2rem 1rem;
  text-align: center;
}

header h1 { margin: 0 0 .25rem; font-size: 1.6rem; line-height: 1.2; }
header p { margin: 0; font-size: .95rem; color: color-mix(in srgb, var(--cream) 88%, transparent); }

nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
  background: var(--ds-primary-dark, var(--navy-dark));
  padding: .5rem .75rem;
  border-radius: 0 0 var(--ds-radius, 10px) var(--ds-radius, 10px);
}

nav a {
  color: var(--ds-surface, var(--cream));
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  padding: .6rem 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  min-height: var(--ds-tap, 44px);
  opacity: .92;
  transition: background .15s ease, opacity .15s ease, transform .08s ease;
}
nav a:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--ds-surface, #fff) 12%, transparent);
}
nav a.active {
  opacity: 1;
  background: var(--ds-accent);
  color: var(--ds-primary-dark, var(--navy-dark));
}
nav a:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
}

main { max-width: 880px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

h2 {
  color: var(--navy-dark); border-bottom: 2px solid var(--gold);
  padding-bottom: .3rem; font-size: 1.4rem; line-height: 1.25;
  margin-top: 2rem;
}
main > h2:first-of-type, main > p:first-of-type { margin-top: .5rem; }

/* Shared muted helper text (AA-compliant, replaces inline color:#777) */
.help { font-size: .88rem; color: var(--ds-muted, #5a5f66); line-height: 1.55; }

/* Intro / lead paragraph for scannable hub pages */
.lead { font-size: 1.05rem; color: var(--ds-ink); max-width: 60ch; }

.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 600px) { .teams { grid-template-columns: 1fr; } }

.team {
  background: var(--ds-surface, #fff);
  border: 1px solid transparent;
  border-radius: var(--ds-radius, 10px);
  box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
  padding: 1.1rem;
  transition: box-shadow .15s ease, transform .08s ease;
}
.team:hover {
  box-shadow: var(--ds-shadow-hover, 0 4px 10px rgba(0,0,0,.10));
  transform: translateY(-2px);
}
.team h3 { margin-top: 0; color: var(--ds-primary, var(--navy)); }
.team.active-dealer { border-color: var(--gold); border-width: 2px; box-shadow: 0 0 0 2px rgba(0,0,0,.03); }
.team.active-dealer h3 { color: var(--gold); }

.team input[type="text"] {
  font-size: 1.1rem; font-weight: bold; border: none;
  border-bottom: 1.5px solid color-mix(in srgb, var(--ds-ink) 18%, transparent);
  background: transparent; width: 100%; margin-bottom: .75rem; font-family: inherit; color: var(--ink);
  padding: .3rem 0; transition: border-color .15s ease;
}
.team input[type="text"]:focus { outline: none; border-bottom-color: var(--ds-primary); }

.round-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.round-row label { flex: 1; font-size: .92rem; }
.round-row input[type="number"] {
  width: 5.5rem; text-align: right; padding: .6rem .7rem; min-height: var(--ds-tap, 44px);
  font-size: 1.05rem;
  border: 1.5px solid color-mix(in srgb, var(--ds-ink) 18%, transparent);
  border-radius: calc(var(--ds-radius, 10px) * .5);
  background: var(--ds-surface, #fff); color: var(--ds-ink); font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}

/* Number-of-players / teams selector and its label */
.round-controls label { font-size: .95rem; font-weight: 600; color: var(--ds-ink); }
select {
  font-family: inherit; font-size: 1rem; color: var(--ds-ink);
  padding: .55rem 2.2rem .55rem .8rem; min-height: var(--ds-tap, 44px);
  border: 1.5px solid color-mix(in srgb, var(--ds-ink) 22%, transparent);
  border-radius: calc(var(--ds-radius, 10px) * .5);
  background-color: var(--ds-surface, #fff); cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a3552' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:hover { border-color: color-mix(in srgb, var(--ds-ink) 38%, transparent); }
select:focus-visible {
  outline: none; border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-primary) 18%, transparent);
}
.round-row input[type="number"]:hover { border-color: color-mix(in srgb, var(--ds-ink) 32%, transparent); }
.round-row input[type="number"]:focus {
  outline: none; border-color: var(--ds-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-primary) 18%, transparent);
}

.score-total {
  margin-top: 1rem; padding-top: .75rem; border-top: 2px solid var(--gold);
  font-size: 1.3rem; font-weight: bold; text-align: right; color: var(--navy-dark);
}

.round-controls { display: flex; justify-content: center; gap: 1rem; margin: 1.5rem 0; flex-wrap: wrap; }

button {
  font-family: inherit; font-size: 1rem; font-weight: 600; padding: .7rem 1.3rem;
  min-height: var(--ds-tap, 44px);
  border-radius: var(--ds-radius, 10px); border: 1px solid transparent;
  background: var(--ds-primary, var(--navy)); color: var(--ds-surface, var(--cream));
  cursor: pointer; box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
  transition: transform .08s ease, box-shadow .15s ease, opacity .15s ease;
}
button:hover {
  box-shadow: var(--ds-shadow-hover, 0 4px 10px rgba(0,0,0,.1));
  transform: translateY(-1px);
}
button:active { transform: translateY(0); opacity: .92; }
button.secondary {
  background: transparent; color: var(--ds-primary, var(--navy));
  border-color: var(--ds-primary, var(--navy)); box-shadow: none;
}
button.secondary:hover { background: color-mix(in srgb, var(--ds-primary) 8%, transparent); box-shadow: none; }
button:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }

table.history {
  width: 100%; border-collapse: collapse; margin-top: 1rem;
  background: var(--ds-surface, #fff); border-radius: var(--ds-radius, 10px);
  overflow: hidden; box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
}
table.history th, table.history td {
  border: 1px solid color-mix(in srgb, var(--ds-ink) 12%, transparent);
  padding: .55rem; text-align: center;
}
table.history th { background: var(--navy); color: var(--cream); font-size: .95rem; }
table.history tbody tr:nth-child(even) { background: color-mix(in srgb, var(--ds-bg) 55%, #fff); }

.grand-totals { display: flex; justify-content: center; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }
.grand-totals span {
  display: inline-block; font-size: 1.25rem; font-weight: bold;
  background: var(--ds-surface, #fff); color: var(--ds-primary-dark, var(--navy-dark));
  border: 1px solid color-mix(in srgb, var(--ds-ink) 12%, transparent);
  border-top: 3px solid var(--ds-accent);
  border-radius: var(--ds-radius, 10px); padding: .6rem 1.1rem;
  box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
}

.variant-card {
  background: var(--ds-surface, #fff); border: 1px solid transparent;
  border-left: 4px solid var(--ds-accent); border-radius: var(--ds-radius, 10px);
  box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
  padding: .8rem 1rem; margin-bottom: 1rem;
}

.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 600px) { .game-grid { grid-template-columns: 1fr; } }
.game-card {
  background: var(--ds-surface, #fff); border: 1px solid transparent;
  border-radius: var(--ds-radius, 10px); box-shadow: var(--ds-shadow, 0 1px 3px rgba(0,0,0,.08));
  padding: 1.2rem; text-decoration: none; color: var(--ink);
  transition: box-shadow .15s ease, transform .08s ease;
}
.game-card { position: relative; border-left: 4px solid var(--ds-accent); }
.game-card h3 {
  margin-top: 0; margin-right: 1.5rem; color: var(--ds-primary, var(--navy));
}
.game-card p { margin-bottom: 0; }
.game-card::after {
  content: "\2192"; position: absolute; top: 1.2rem; right: 1.2rem;
  color: var(--ds-accent); font-weight: bold; font-size: 1.2rem;
  transition: transform .15s ease;
}
.game-card:hover {
  box-shadow: var(--ds-shadow-hover, 0 4px 10px rgba(0,0,0,.10));
  transform: translateY(-2px);
}
.game-card:hover::after { transform: translateX(3px); }
.game-card.coming-soon { opacity: .55; pointer-events: none; }

footer {
  text-align: center; font-size: .85rem; color: var(--ds-muted, #5a5f66);
  padding: 1.75rem 1rem; margin-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--ds-ink) 10%, transparent);
}

@media print {
  header, nav, .round-controls, footer, .no-print { display: none !important; }
  body { background: #fff; }
}
