/* Texas Lotto Helper - the whole stylesheet.
   One file, no build step, no webfonts, no CDN. Mobile is the base case and the
   desktop layout is the enhancement, because this is a thing you check on your
   phone before buying a ticket.

   Colours live as custom properties so the page can flip from loss to gain by
   redefining one token. --accent is the loss orange; .in-the-black on .page
   redefines it to the green, and the hero, the badge, the callout and the chart
   all follow. There is no second template and no per-state stylesheet. */

:root {
  --paper:     #FAFAF8;
  --surface:   #FFFFFF;
  --wash:      #F4F3EE;
  --line:      #E2E1DC;
  --line-soft: #F0EFEA;

  --ink:   #16161A;
  --ink-2: #3A3A42;
  --ink-3: #5B5B66;

  /* Validated as a pair against the paper surface: distinguishable under
     deuteranopia and protanopia, not merely different hues. */
  --loss: #B03A0B;
  --gain: #047857;

  --accent: var(--loss);

  --shell:   1060px;
  --gutter:  20px;
  --measure: 62ch;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.in-the-black { --accent: var(--gain); }

/* ---------- base ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: var(--ink); }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Figures that must not jiggle between daily updates. */
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.lbl {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.note {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  max-width: var(--measure);
}

.lede {
  margin-top: 10px;
  color: var(--ink-3);
  max-width: 56ch;
}

.section-head { margin: 32px 0 12px; }

.page-title {
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

/* ---------- shell ---------- */

.page { min-height: 100vh; display: flex; flex-direction: column; }

.wrap {
  max-width: var(--shell);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.main {
  flex: 1 1 auto;
  padding: 24px 0 0;
  /* Clear the bottom tab bar, plus the home-strip inset when installed. */
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
}

.brand { display: flex; align-items: baseline; gap: 9px; }
.brand b {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.brand small { font-size: 12px; color: var(--ink-3); }

/* The header nav is the desktop affordance; on a phone the tab bar does this job. */
.nav { display: none; gap: 4px; }
.nav a {
  font-size: 13px;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 6px;
  color: var(--ink-2);
}
.nav a[aria-current] { background: var(--ink); color: var(--paper); font-weight: 550; }

/* ---------- bottom tab bar ---------- */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1 1 0;
  min-height: 56px;            /* comfortably over the 44px floor */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
  color: var(--ink-3);
  border-top: 2px solid transparent;
}
.tabbar a[aria-current] { color: var(--ink); border-top-color: var(--accent); }

/* ---------- banners ---------- */

.banner, .stale { color: var(--surface); }
.banner { background: var(--gain); }
.stale  { background: var(--ink); }

.banner .wrap, .stale .wrap {
  padding-top: 10px;
  padding-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
}
.banner strong, .stale strong {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.banner span, .stale span { font-size: 12px; opacity: 0.85; }

/* ---------- the headline ---------- */

.hero-row { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: flex-end; }
.hero-block { flex: 1 1 320px; min-width: 0; }
.hero-aside { flex: 0 0 auto; }

.hero {
  font-size: clamp(52px, 15vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 680;
  color: var(--accent);
}
.hero-sub {
  margin-top: 2px;
  font-size: clamp(22px, 6.5vw, 34px);
  line-height: 1.14;
  letter-spacing: -0.02em;
  font-weight: 450;
  color: var(--ink-2);
}
.hero-sub strong { font-weight: 650; color: var(--ink); }

.runners { margin-top: 6px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* ---------- card & list ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.card .row { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.card .row:last-child { border-bottom: 0; }

.row-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.row-head h3 { font-size: 15px; font-weight: 650; }
.row-head .when { font-size: 12px; color: var(--ink-3); }
.row-body { margin-top: 5px; font-size: 13.5px; color: var(--ink-2); }
.row-body strong { font-weight: 650; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .card .row { border-bottom: 0; }

/* ---------- table ---------- */

.data {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow-x: auto;
}
.data table { border-collapse: collapse; width: 100%; }
.data caption {
  text-align: left;
  padding: 13px 16px 0;
  font-size: 12px;
  color: var(--ink-3);
}
.data th, .data td { padding: 14px 10px; white-space: nowrap; }
.data thead th {
  padding: 13px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.data thead tr { border-bottom: 1px solid var(--line); }
.data tbody tr { border-bottom: 1px solid var(--line-soft); }
.data tbody tr:last-child { border-bottom: 0; }
.data th:first-child, .data td:first-child { padding-left: 16px; }
.data th:last-child,  .data td:last-child  { padding-right: 16px; }
.data tbody th { text-align: left; font-size: 15px; font-weight: 550; }
.data tbody tr.pick { background: #FDFCF7; }
.data tbody tr.pick th { font-weight: 650; }
.data .r { text-align: right; }
.data .ret { font-size: 17px; font-weight: 650; color: var(--accent); }
.data .soft { font-size: 13px; color: var(--ink-3); }

.badge {
  display: inline-block;
  margin-left: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--surface);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  vertical-align: 1px;
  white-space: nowrap;
}
.badge-quiet { background: var(--line-soft); color: var(--ink-3); }

/* ---------- drawn numbers ---------- */

.balls { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 10px; }
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border-radius: 50%;
  border: 1px solid #DDDCD6;
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ball-special { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.ball-note { font-size: 12px; color: var(--ink-3); margin-left: 2px; }

/* ---------- chart ---------- */

.chart-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 12px;
}
.chart-wrap svg { display: block; width: 100%; height: auto; }

.axis { stroke: var(--line); stroke-width: 1; }
.grid { stroke: var(--line-soft); stroke-width: 1; }
.tick { fill: var(--ink-3); font-size: 11px; font-family: var(--sans); }
.rule { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 4; }
.series-pre  { stroke: var(--loss); stroke-width: 2; fill: none; }
.series-post { stroke: #1D4ED8; stroke-width: 2; fill: none; }
.marker { stroke: var(--surface); stroke-width: 2; }
.caption { fill: var(--ink-2); font-size: 11px; font-family: var(--sans); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 3px; border-radius: 2px; }

/* ---------- locked panel ---------- */

.locked {
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--wash);
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-3);
}
.locked strong { display: block; color: var(--ink-2); font-weight: 650; margin-bottom: 4px; }
.locked .bar {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 14px auto 0;
  max-width: 260px;
  overflow: hidden;
}
.locked .bar i { display: block; height: 100%; background: var(--ink-3); }

/* ---------- footer ---------- */

.site-footer { margin-top: 36px; border-top: 1px solid var(--line); background: var(--wash); }
.site-footer .wrap {
  padding-top: 20px;
  padding-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  justify-content: space-between;
}
.disclaimer { font-size: 13px; line-height: 1.6; color: var(--ink-3); max-width: var(--measure); }
.asof { font-size: 12px; color: var(--ink-3); line-height: 1.7; }

/* ---------- desktop ---------- */

@media (min-width: 720px) {
  :root { --gutter: 32px; }

  .nav { display: flex; }
  .tabbar { display: none; }

  .main { padding: 40px 0 0; padding-bottom: 0; }
  .site-header .wrap { min-height: 64px; }
  .brand b { font-size: 13px; letter-spacing: 0.16em; }

  .hero-row { gap: 40px; }
  .site-footer { margin-top: 48px; }
  .site-footer .wrap { padding-top: 24px; padding-bottom: 32px; }
  .asof { text-align: right; }
  .data th, .data td { padding: 18px 12px; }
  .data .ret { font-size: 19px; }
  .card .row { padding: 15px 18px; }
}

/* chart marks, set here rather than as SVG attributes so the tokens stay in one place */
.dot-pre   { fill: var(--loss); }
.dot-post  { fill: #1D4ED8; }
.dot-today { fill: var(--ink); }
.swatch-pre  { background: var(--loss); }
.swatch-post { background: #1D4ED8; }

/* At phone width the ranked table keeps only game, cash value and return.
   The rest is detail you do not need while standing at the counter, and a
   sideways-scrolling table hides the one number the page exists to show. */
.c-short { display: none; }

@media (max-width: 719px) {
  .c-draw, .c-ticket, .c-be { display: none; }
  .c-long { display: none; }
  .c-short { display: inline; }
  .data th, .data td { padding: 14px 8px; white-space: normal; }
  .data tbody th { line-height: 1.3; }
  .badge { margin-top: 4px; }
}
