@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;700&display=swap');

:root {
  color-scheme: light dark;
  --bg: #EAE3D2;
  --ink: #14181D;
  --paper: #F4EEDD;
  --paper-line: #D9CDA8;
  --muted: #6B6456;
  --accent-win: #B3382A;
  --accent-gold: #93702F;
  --ball-fg: #F4EEDD;
  --ball-bg: #14181D;
  --focus: #1D6E5C;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1013;
    --ink: #F0EAD9;
    --paper: #EFE6CD;
    --paper-line: #C9BC94;
    --muted: #7A7263;
    --accent-win: #D9503F;
    --accent-gold: #B08A3E;
    --ball-fg: #EFE6CD;
    --ball-bg: #191C20;
    --focus: #4FBFA1;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1013;
  --ink: #F0EAD9;
  --paper: #EFE6CD;
  --paper-line: #C9BC94;
  --muted: #7A7263;
  --accent-win: #D9503F;
  --accent-gold: #B08A3E;
  --ball-fg: #EFE6CD;
  --ball-bg: #191C20;
  --focus: #4FBFA1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", -apple-system, sans-serif;
  font-feature-settings: "tnum" 1, "lnum" 1;
  line-height: 1.5;
  padding-block: 0;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }

p { margin: 0 0 0.75rem; }

.muted { color: var(--muted); }

/* ---- Chrome ---- */

header.site {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--paper-line);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.wordmark {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.wordmark .dot { color: var(--accent-win); }

header.site nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  font-size: 0.92rem;
}

header.site nav a { text-decoration: none; }
header.site nav a:hover { color: var(--accent-gold); }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.flash {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-left: 4px solid var(--accent-gold);
  padding: 0.7rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* ---- Buttons & forms ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 4px;
  padding: 0.65rem 1.15rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

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

.btn.danger { background: var(--accent-win); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

form.inline { display: inline; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1rem 0 0.3rem;
}

input[type="text"], input[type="number"], input[type="date"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

input:focus, button:focus, a:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

fieldset { border: none; padding: 0; margin: 1rem 0 0; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

.error-banner {
  background: color-mix(in srgb, var(--accent-win) 12%, var(--paper));
  border: 1px solid var(--accent-win);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ---- Lottery balls: the one recurring motif ---- */

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--ball-bg);
  color: var(--ball-fg);
  font-weight: 700;
  font-size: 0.95rem;
  flex: none;
}

.ball.pb {
  background: var(--accent-win);
  color: #fff;
}

.ball.small {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.75rem;
}

.ball.match {
  box-shadow: 0 0 0 3px var(--accent-gold);
}

.ball-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Ticket stubs ---- */

.stub {
  display: flex;
  background: var(--paper);
  border-radius: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.stub__main {
  flex: 1;
  padding: 1rem 1.1rem;
  min-width: 0;
}

.stub__main a { text-decoration: none; }

.stub__meta {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.stub__tear {
  position: relative;
  width: 0;
  border-left: 2px dashed var(--paper-line);
  margin-block: 0.6rem;
}

.stub__tear::before, .stub__tear::after {
  content: "";
  position: absolute;
  left: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
}
.stub__tear::before { top: -7px; }
.stub__tear::after { bottom: -7px; }

.stub__side {
  width: 6.5rem;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  text-align: center;
}

.stamp {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-win);
  border: 2px solid var(--accent-win);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  transform: rotate(-6deg);
}

.status-text {
  font-size: 0.78rem;
  color: var(--muted);
}

.stub--hidden { opacity: 0.6; }

/* ---- Draw results ledger ---- */

.ledger {
  border-top: 1px solid var(--paper-line);
  margin-top: 1.5rem;
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--paper-line);
  flex-wrap: wrap;
}

.ledger-row__date {
  width: 5.2rem;
  flex: none;
  font-size: 0.82rem;
  color: var(--muted);
}

.ledger-row__balls { flex: 1; min-width: 220px; }

.ledger-row__result {
  width: 8rem;
  flex: none;
  text-align: right;
  font-size: 0.85rem;
}

.dp-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  margin-left: 0.4rem;
}

/* ---- Home / login ---- */

.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}

.hero .stub {
  display: inline-flex;
  text-align: left;
  margin: 1.75rem 0;
}

.hero h1 { font-size: 2.1rem; max-width: 20ch; margin-inline: auto 0.6rem; }

.hero p.lede {
  max-width: 34ch;
  margin-inline: auto;
  color: var(--muted);
}

@media (max-width: 480px) {
  .hero .stub { display: flex; width: 100%; }
  .ledger-row__result { width: 100%; text-align: left; order: 3; }
}
