:root,
:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f0b429;
  --accent-2: #3fb950;
  --hero-gradient-start: #10151d;
}

:root[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #b07d0a;
  --accent-2: #1a7f37;
  --hero-gradient-start: #eef1f4;
}

/* Smooth theme transition */
body,
.card,
.run,
.sim,
pre,
.hero,
footer {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hero {
  text-align: center;
  padding: 5rem 1rem 3rem;
  background: linear-gradient(180deg, var(--hero-gradient-start) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero h1 { font-size: 3rem; margin-bottom: 0.5rem; }

.tagline {
  color: var(--muted);
  font-size: 1.2rem;
  max-width: 40rem;
  margin: 0 auto 1.5rem;
}

.cta {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}
.cta:hover { background: var(--accent); color: var(--bg); }

main { max-width: 60rem; margin: 0 auto; padding: 2rem 1rem; }

h2 { margin-bottom: 1.5rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }

.card-icon { font-size: 2rem; }
.card h3 { margin: 0.5rem 0; }
.card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 1rem; }

.card-scaffold { opacity: 0.85; }

/* ---------- game country groups ---------- */
.game-group { margin-top: 2.5rem; }
.game-group:first-of-type { margin-top: 0; }

.group-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.group-heading .flag { font-size: 1.3rem; }

.card-link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.card-link:hover { text-decoration: underline; }

.run {
  margin-top: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

/* ---------- interactive powerball simulator ---------- */
.sim {
  position: relative;
  overflow: hidden;
  margin-top: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

/* Three.js money-rain canvas — full-page overlay above all content
   INCLUDING the fixed language/theme controls. Pointer-transparent so the
   underlying controls and content remain clickable. */
#sim-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#sim-rain.active { opacity: 1; }

.sim-intro {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

/* ---------- 2026 facts strip ---------- */
.sim-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.fact-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.fact-per {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

.fact-label {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}

/* ---------- config + presets ---------- */
.sim-config {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.sim-config label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.sim-config input {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  width: 9.5rem;
}
.sim-config input:focus {
  outline: none;
  border-color: var(--accent);
}
.sim-config input:disabled {
  opacity: 0.6;
}

.sim-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.preset-chip {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.preset-chip:hover:not(.disabled) {
  color: var(--text);
  border-color: var(--accent);
}
.preset-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(240, 180, 41, 0.08);
}
.preset-chip.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sim-buttons {
  display: flex;
  gap: 0.5rem;
}

.sim-btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.sim-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sim-btn-start {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.sim-btn-start:hover:not(:disabled) {
  background: var(--accent-2);
  color: var(--bg);
}

.sim-btn-stop {
  border-color: #f85149;
  color: #f85149;
}
.sim-btn-stop:hover:not(:disabled) {
  background: #f85149;
  color: var(--bg);
}

/* ---------- live stat cards ---------- */
.sim-live {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.sim-live[hidden] {
  display: none;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  min-width: 0;
}

.stat-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-net .stat-value {
  transition: color 0.3s ease;
}
.stat-net .stat-value.net-negative { color: #f85149; }
.stat-net .stat-value.net-positive { color: var(--accent-2); }

/* live panel glows softly while the sim is running */
@keyframes simGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 180, 41, 0); }
  50% { box-shadow: 0 0 14px 2px rgba(240, 180, 41, 0.25); }
}
.sim-running .sim-live {
  animation: simGlow 2s ease-in-out infinite;
}

/* cash-out button pulses while waiting to be pressed */
@keyframes stopPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.sim-running .sim-btn-stop:not(:disabled) {
  animation: stopPulse 1.2s ease-in-out infinite;
}

/* ---------- summary cards ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.sim-summary {
  animation: riseIn 0.45s ease both;
}

.verdict {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg);
}
.verdict-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.verdict-sub {
  font-size: 0.85rem;
  color: var(--muted);
}
.verdict-jackpot {
  border-color: var(--accent);
  background: rgba(240, 180, 41, 0.08);
}
.verdict-jackpot .verdict-title {
  color: var(--accent);
}
.verdict-loss {
  border-color: rgba(248, 81, 73, 0.5);
}
.verdict-win {
  border-color: var(--accent-2);
}

.net-card {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
}
.net-card-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.net-card-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.net-card.net-negative { border-color: rgba(248, 81, 73, 0.5); }
.net-card.net-negative .net-card-value { color: #f85149; }
.net-card.net-positive { border-color: rgba(63, 185, 80, 0.5); }
.net-card.net-positive .net-card-value { color: var(--accent-2); }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.sstat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  min-width: 0;
}
.sstat-value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sstat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sstat-pos .sstat-value { color: var(--accent-2); }
.sstat-neg .sstat-value { color: #f85149; }

/* tier breakdown table */
.tier-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
}
.tier-heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.tier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.tier-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.tier-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.tier-table tbody tr:last-child td {
  border-bottom: none;
}
.tier-table .num {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.tier-table th:nth-child(n + 3) {
  text-align: right;
}
.tier-key {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--accent);
}
.tier-empty {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

/* verdict-warn (invalid input) */
.verdict-warn {
  border-color: var(--accent);
}

/* jackpot celebration: gold flash on the heading */
@keyframes jackpotFlash {
  0%, 100% { color: inherit; text-shadow: none; }
  25% { color: var(--accent); text-shadow: 0 0 18px rgba(240, 180, 41, 0.7); }
  50% { color: inherit; text-shadow: none; }
  75% { color: var(--accent); text-shadow: 0 0 18px rgba(240, 180, 41, 0.7); }
}
.sim.jackpot #sim-heading,
.sim.jackpot #tb-heading,
.sim.jackpot #bg-heading {
  animation: jackpotFlash 1.6s ease-in-out 2;
}

@media (prefers-reduced-motion: reduce) {
  .sim-running .sim-live,
  .sim-running .sim-btn-stop:not(:disabled),
  .sim-summary,
  .sim.jackpot #sim-heading,
  .sim.jackpot #tb-heading,
  .sim.jackpot #bg-heading {
    animation: none;
  }
}

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9rem; }

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.tech {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- controls (language + theme switches) ---------- */
.controls {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.switch-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.switch-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.switch-group .switch-btn + .switch-btn {
  border-left: 1px solid var(--border);
}

.switch-btn:hover {
  color: var(--text);
}

.switch-btn.active,
.switch-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
}

#theme-toggle {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
}

@media (max-width: 480px) {
  .controls { top: 0.5rem; right: 0.5rem; }
  .switch-btn { padding: 0.3rem 0.55rem; }
}

/* ---------- Seneté ball draws + pozos ---------- */
.sn-draw-wrap {
  margin-bottom: 1rem;
}

.sn-draw-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0.5rem 0 0.35rem;
}

.sn-ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sn-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
}

.sn-pozos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

