:root {
  --green: #0e3b2c;
  --green-ink: #0a2b20;
  --green-soft: #1a4c3a;
  --cream: #f7efdc;
  --paper: #fffaf0;
  --rule: #e6d9b8;
  --ink: #2a211a;
  --muted: #75685a;
  --cranberry: #9e1b3b;
  --cranberry-dark: #761229;
  --gold: #d9a62e;
  --gold-pale: #f3d98a;

  --display: "Bowlby One", "Arial Black", Impact, sans-serif;
  --text: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--green);
  color: var(--cream);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
main.wide { max-width: 980px; }

.masthead { text-align: center; margin: 0 0 20px; }
.masthead p { margin: 0; color: var(--gold-pale); font-size: 1.05rem; }
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 10vw, 3rem);
  line-height: .95;
  color: var(--cream);
  text-shadow: 0 3px 0 var(--cranberry);
}
h2 {
  margin: 28px 4px 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--gold-pale);
}

/* Buttons */
button { font: inherit; cursor: pointer; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 20px;
  border: 0; border-radius: 10px;
  background: var(--cranberry); color: #fff;
  font-weight: 700; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 4px 0 var(--cranberry-dark);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--cranberry-dark); }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--rule); }
.btn.quiet:active { transform: none; background: var(--cream); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .95rem; }
.btn[disabled] { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.link {
  background: none; border: 0; color: var(--gold-pale);
  text-decoration: underline; text-underline-offset: 3px;
  font-size: .92rem; padding: 10px 4px; min-height: 44px;
}
a.link { display: inline-flex; align-items: center; }

/* Ticket: notched corners like a torn-off raffle ticket */
.ticket {
  --notch: 12px;
  background: var(--paper);
  color: var(--ink);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left,
    radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right,
    radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom left,
    radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom right;
  -webkit-mask-size: 51% 51%;
  -webkit-mask-repeat: no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left,
    radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right,
    radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom left,
    radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom right;
  mask-size: 51% 51%;
  mask-repeat: no-repeat;
}
.panel { padding: 24px 20px; }
.panel p { margin: 0 0 16px; }

/* Forms */
label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"] {
  width: 100%; min-height: 50px;
  font: inherit; font-size: 1.1rem; /* >=16px avoids iOS zoom */
  padding: 10px 14px;
  border: 2px solid var(--rule); border-radius: 10px;
  background: #fff; color: var(--ink);
}
input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--gold-pale); }
input[aria-invalid="true"] { border-color: var(--cranberry); }
.error { color: var(--cranberry); font-size: .92rem; font-weight: 700; min-height: 1.4em; margin: 6px 0 12px; line-height: 1.3; }
.on-green .error, .error.on-green { color: var(--gold-pale); }

/* Dialogs */
dialog {
  width: min(92vw, 420px);
  border: 0; border-radius: 14px; padding: 0;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
dialog::backdrop { background: rgba(6, 26, 19, .78); }
.dlg { padding: 22px 20px 20px; }
.dlg h3 { margin: 0 0 14px; font-size: 1.3rem; line-height: 1.25; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.actions .spacer { flex: 1; }

/* Game pages share one header: back link, then the game's name */
.back { margin: -8px 0 2px; }
.masthead.game { margin-bottom: 16px; }
.masthead.game h1 { font-size: clamp(1.7rem, 8.4vw, 2.4rem); text-wrap: balance; }

/* Standalone numbers (scores, ranks, points) are set bingo-hall style */
.num { font-family: var(--display); font-weight: 400; font-variant-numeric: tabular-nums; }

/* Dabber stamp: the ink mark a used ticket gets */
.stamp {
  --size: 64px; --r: -9deg;
  display: inline-grid; place-content: center; justify-items: center;
  width: var(--size); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(158,27,59,.13) 0 60%, rgba(158,27,59,.5) 67%, rgba(158,27,59,.13) 70%, transparent 72%);
  color: var(--cranberry-dark);
  font-family: var(--display); font-size: calc(var(--size) * .36); line-height: 1;
  transform: rotate(var(--r));
}
.stamp small { font-family: var(--text); font-weight: 700; font-size: max(.68rem, calc(var(--size) * .1)); margin-top: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .stamp.land { animation: stamp-land .36s cubic-bezier(.2, 1.6, .4, 1); }
  @keyframes stamp-land {
    from { transform: rotate(var(--r)) scale(1.7); opacity: 0; }
    to   { transform: rotate(var(--r)) scale(1); opacity: 1; }
  }
}

.error.on-green:empty { display: none; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
