/* ==========================================================================
   Lotto — "a very bad bet"
   Light ticket-stub theme. Minimal, slightly retro, responsive.
   ========================================================================== */

:root {
  --paper: #f4efe3;
  --paper-deep: #ece4d0;
  --card: #fffdf6;
  --ink: #1c1913;
  --ink-soft: #6b6152;
  --ink-faint: #9a8f7c;
  --line: #ddd2ba;
  --line-strong: #c8b995;

  --red: #c0392b;
  --red-soft: #f7e6e3;
  --green: #27ae60;
  --orange: #f39c12;
  --purple: #8e44ad;
  --pb-red: #e74c3c;
  --ticket: #2c3e50;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 19, 0.08), 0 4px 14px rgba(28, 25, 19, 0.06);
  --shadow-strong: 0 2px 6px rgba(28, 25, 19, 0.12), 0 10px 28px rgba(28, 25, 19, 0.1);

  --font-display: "Zilla Slab", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono",
    Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-mono);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255, 253, 246, 0.9), rgba(244, 239, 227, 0) 60%),
    var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ */
/* Layout shell                                                        */
/* ------------------------------------------------------------------ */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px 64px;
}

.site-header {
  border-bottom: 1px dashed var(--line-strong);
  padding: 28px 0 20px;
  margin-bottom: 4px;
}

.site-header .wrap { padding-bottom: 0; }

.logo {
  font-family: var(--font-display);
  font-size: clamp(30px, 6vw, 48px);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tagline {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 60ch;
}

/* ------------------------------------------------------------------ */
/* Tabs                                                                */
/* ------------------------------------------------------------------ */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  appearance: none;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 10px 18px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  position: relative;
  top: 1px;
  transition: background 0.12s ease, color 0.12s ease;
}

.tab:hover { background: var(--card); color: var(--ink); }

.tab.active {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}

.panel { display: none; }
.panel.active { display: block; animation: fade 0.18s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ */
/* Cards                                                               */
/* ------------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

/* ------------------------------------------------------------------ */
/* Controls                                                            */
/* ------------------------------------------------------------------ */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.btn {
  appearance: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.06s ease, background 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 2px 0 rgba(28, 25, 19, 0.2);
  min-width: 44px;
}

.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(28, 25, 19, 0.2); }
.btn:hover { background: #2f2a22; }

.btn.small { padding: 6px 11px; font-size: 15px; }

.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: 0 2px 0 var(--line-strong);
}

.btn.primary { background: var(--red); border-color: var(--red); box-shadow: 0 2px 0 #8f2b21; }
.btn.primary:hover { background: #a83227; }

.btn.blue { background: #2980b9; border-color: #2980b9; box-shadow: 0 2px 0 #1d5c86; }
.btn.blue:hover { background: #226f9e; }

.btn.wide { flex: 1 1 auto; }

.speed-value {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--ink);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--ink);
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/* Balls                                                               */
/* ------------------------------------------------------------------ */
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.15);
  flex: none;
}

.ball.lg { width: 46px; height: 46px; font-size: 17px; }
.ball.sm { width: 32px; height: 32px; font-size: 13px; }

.ball.b-white   { background: #ffffff; color: #111; border: 1px solid #d9d4c8; }
.ball.b-bonus   { background: var(--orange); color: #1c1913; }
.ball.b-pb      { background: var(--pb-red); color: #fff; }
.ball.b-ticket  { background: var(--ticket); color: #fff; }
.ball.b-ticket-pb { background: var(--purple); color: #fff; }
.ball.b-match   { background: var(--green); color: #fff; animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.ball-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Drawn-numbers line: caption + ball stay glued together, and the line
   only ever wraps at whole-group boundaries (never splitting a label from
   its ball). */
.draw-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.draw-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.draw-group.main {
  flex-wrap: wrap;
}

.ball-caption {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-transform: uppercase;
  white-space: nowrap;
}

.draw-area .ball-row + .ball-row { margin-top: 8px; }

.sub-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 12px 0 6px;
}

/* ------------------------------------------------------------------ */
/* Stats                                                               */
/* ------------------------------------------------------------------ */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.stat .k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 3px;
}

.stat .v {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat .v.pos { color: var(--green); }
.stat .v.neg { color: var(--red); }
.stat .v.accent { color: var(--pb-red); }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
}

/* ------------------------------------------------------------------ */
/* Jackpot                                                             */
/* ------------------------------------------------------------------ */
.jackpot-figure {
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.jackpot-bar {
  height: 12px;
  border-radius: 6px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 10px 0 6px;
}

.jackpot-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--pb-red));
  width: 0%;
  transition: width 0.12s linear;
}

.jackpot-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  min-height: 1.4em;
}

/* ------------------------------------------------------------------ */
/* Reality check                                                       */
/* ------------------------------------------------------------------ */
.reality {
  background: var(--red-soft);
  border: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-strong);
}

.reality .card-title { color: var(--red); }

.reality-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 20px;
}

@media (min-width: 640px) {
  .reality-grid { grid-template-columns: 1fr 1fr; }
}

.reality-item .k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.reality-item .v {
  font-size: 20px;
  font-weight: 700;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* ------------------------------------------------------------------ */
/* Table                                                               */
/* ------------------------------------------------------------------ */
.table-scroll { overflow-x: auto; }

table.odds {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

table.odds th, table.odds td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.odds thead th {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 2px solid var(--line-strong);
}

table.odds .sep td {
  border-top: 2px solid var(--line-strong);
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

table.odds td.num { text-align: right; }

/* ------------------------------------------------------------------ */
/* Event / summary                                                     */
/* ------------------------------------------------------------------ */
.event-line {
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 1.4em;
  margin: 2px 0;
}

.summary {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--red);
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 4px 0 0;
}

/* ------------------------------------------------------------------ */
/* Generate tab                                                        */
/* ------------------------------------------------------------------ */
.gen-controls {
  display: grid;
  gap: 14px;
}

.gen-row { display: grid; gap: 4px; }

.gen-row .lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.gen-row .val { color: var(--ink); font-weight: 700; }

.gen-output {
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--paper-deep);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  min-height: 60px;
}

.gen-output .pb { color: var(--purple); font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.site-footer {
  border-top: 1px dashed var(--line-strong);
  padding: 22px 0 0;
  margin-top: 26px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

@media (min-width: 900px) {
  .sim-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  .sim-grid .card { margin-bottom: 16px; }
}

@media (max-width: 480px) {
  .ball.lg { width: 40px; height: 40px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
