/* ==========================================================================
   SHIOL+ v9 DESIGN SYSTEM - PREMIUM HUMAN-CENTRIC ANALYTICAL SAAS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg-base: #0b0f19;
  --bg-surface: #121929;
  --bg-surface-elevated: #1a243a;
  --bg-surface-hover: #222f4b;
  
  --ink: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  
  --positive: #10b981;
  --negative: #f43f5e;
  
  --powerball: #ef4444;
  --powerball-bg: rgba(239, 68, 68, 0.12);
  --mega: #f59e0b;
  --mega-bg: rgba(245, 158, 11, 0.12);
  --cash5: #10b981;
  --cash5-bg: rgba(16, 185, 129, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --content: 1180px;
  --shadow-soft: 0 12px 36px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
  background-color: var(--bg-base);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Skip Link */
.skip-link {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 2000;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  background: var(--accent);
  border-radius: var(--radius-md);
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Header Navbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  width: min(var(--content), calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.brand-text {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand-plus {
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #3b82f6;
  margin-left: -2px;
  margin-right: 2px;
}

.brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-left: 2px;
}

.data-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-surface);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 8px var(--positive);
}

.desktop-nav {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 24px;
}

.desktop-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  height: 100%;
  transition: color 0.2s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--ink);
}

.desktop-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Informative Disclaimer Banner */
.trust-banner {
  margin-top: 16px;
  margin-bottom: 24px;
  padding: 10px 16px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(18, 25, 41, 0.4) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  color: #fbbf24;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.trust-banner strong {
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.trust-banner a {
  color: #fef08a;
  text-decoration: underline;
  font-weight: 600;
  white-space: nowrap;
}

/* Containers */
.home-main,
.report-shell,
.legal-shell {
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
}

.home-main {
  padding: 28px 0 64px;
}

.home-hero {
  max-width: 780px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-hero h1,
.report-intro h1,
.legal-shell h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.home-lead,
.report-lead,
.legal-lead {
  margin: 10px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

/* Game Switcher Segmented Bar */
.game-switcher {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  gap: 4px;
  margin-bottom: 24px;
}

.game-switcher a {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.game-switcher a:hover {
  color: var(--ink);
  background: var(--bg-surface-elevated);
}

.game-switcher a.active {
  color: #ffffff;
  background: var(--bg-surface-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-switcher a[data-game="powerball"].active { border-bottom: 2px solid var(--powerball); }
.game-switcher a[data-game="mega_millions"].active { border-bottom: 2px solid var(--mega); }
.game-switcher a[data-game="cash5"].active { border-bottom: 2px solid var(--cash5); }

/* Home Reports Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.game-report {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.game-report:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.game-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.game-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.game-report.powerball .game-marker { background: var(--powerball); }
.game-report.mega .game-marker { background: var(--mega); }
.game-report.cash5 .game-marker { background: var(--cash5); }

.game-report h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.game-days-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg-surface-elevated);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
}

.game-jackpot-block {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.jackpot-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--mega);
  font-family: var(--font-main);
  letter-spacing: -0.03em;
  display: block;
}

.game-report-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.metric-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.metric-val small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.game-report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.report-arrow {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.game-report:hover .report-arrow {
  transform: translateX(4px);
}

/* Method Strip */
.method-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 40px;
}

.method-strip div strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.method-strip div span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* Hero Cards Band (Overview Stage) */
.summary-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 800px) {
  .summary-band { grid-template-columns: 1fr; }
  .method-strip { grid-template-columns: 1fr; }
}

.summary-item {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.jackpot-summary {
  background: linear-gradient(145deg, var(--bg-surface) 0%, rgba(245, 158, 11, 0.05) 100%);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.summary-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.summary-primary {
  font-size: 28px;
  font-weight: 800;
  color: var(--mega);
  letter-spacing: -0.03em;
  font-family: var(--font-main);
}

.summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
}

.summary-secondary {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Tactile Spherical Lottery Balls */
.draw-balls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap; /* CRITICAL: Never break balls into 2 lines! */
  gap: 6px;
  margin-top: 4px;
}

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font-mono);
  user-select: none;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  color: #0f172a;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,0.35), 0 3px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.ball::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 7px;
  width: 10px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

/* Compact Balls for Data Tables (26px) */
.ball-sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.25);
}

.ball-sm::after {
  top: 2px;
  left: 5px;
  width: 8px;
  height: 4px;
}

.ball.extra,
.ball.pb {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,0.5), 0 3px 10px rgba(220, 38, 38, 0.4);
}

/* Fireball (NC Pick 3 / Pick 4): dato informativo del sorteo, NO parte de la
   combinación ganadora del straight. Deliberadamente no se pinta como bola
   para que no se lea como un número más de la jugada. */
.fireball-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 3px 8px;
  border: 1px dashed rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  user-select: none;
  vertical-align: middle;
}

body.game-mega .ball.extra,
body.game-mega .ball.pb {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #1e1b4b;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,0.5), 0 3px 10px rgba(217, 119, 6, 0.4);
}

body.game-cash5 .ball.extra,
body.game-cash5 .ball.pb {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  color: #ffffff;
  box-shadow: inset 0 -2px 5px rgba(0,0,0,0.5), 0 3px 10px rgba(5, 150, 105, 0.4);
}

.skeleton {
  color: transparent !important;
  background: var(--bg-surface-elevated) !important;
  box-shadow: none !important;
}

/* Performance Summary Strip */
.performance-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-top: 16px;
}

.performance-strip strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.performance-strip small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Main Section Stages */
.report-section {
  padding: 32px 0 0;
}

.report-stage {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow-card);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* Clean Data Tables */
.history-table,
.next-analysis-table,
.ranking-table-wrap {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 16px;
}

/* Draw History Precision Columns: Date/Balls (280px), Won (100px), Combinations (130px), Best Strategy (180px), Best Match (1fr), Action (100px) */
.history-header,
.history-row {
  display: grid;
  grid-template-columns: 280px 100px 130px 180px 1fr 100px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.history-header {
  background: var(--bg-surface-hover);
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line-strong);
}

.history-row {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.history-row:hover,
.next-analysis-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.history-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-date {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

/* Next Draw Analysis Precision Columns: Pos (80px), Balls (240px), Strategy (180px), Score (1fr) */
.next-analysis-context {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .next-analysis-context {
    grid-template-columns: 1fr;
  }
}

.next-analysis-context > div {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-analysis-context span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.next-analysis-context strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
  display: block;
}
.next-analysis-header,
.next-analysis-row {
  display: grid;
  grid-template-columns: 80px 240px 180px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.next-analysis-header {
  background: var(--bg-surface-hover);
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line-strong);
}

.next-analysis-row {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

/* Historical Strategy Ranking Podium Cards Grid (Top 3 Cards + Clean Table) */
.podium-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 20px;
}

@media (max-width: 850px) {
  .podium-cards-grid { grid-template-columns: 1fr; }
}

.podium-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
}

.podium-card.rank-top-1 {
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(145deg, var(--bg-surface-elevated) 0%, rgba(245, 158, 11, 0.06) 100%);
}

.rank-badge-lg {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  font-family: var(--font-mono);
}

.rank-badge-lg.gold { background: rgba(245, 158, 11, 0.2); color: var(--mega); border: 1px solid var(--mega); }
.rank-badge-lg.silver { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid #cbd5e1; }
.rank-badge-lg.bronze { background: rgba(180, 83, 9, 0.2); color: #d97706; border: 1px solid #d97706; }

.podium-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.podium-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.podium-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.podium-stat-label { color: var(--muted); }
.podium-stat-val { font-weight: 700; font-family: var(--font-mono); }

/* Leaderboard Ranking Table */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.ranking-table th {
  background: var(--bg-surface-hover);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line-strong);
}

.ranking-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}

.ranking-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.rank-badge.rank-1,
.rank-badge.gold { background: rgba(245, 158, 11, 0.2); color: var(--mega); border: 1px solid var(--mega); }
.rank-badge.rank-2,
.rank-badge.silver { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid #cbd5e1; }
.rank-badge.rank-3,
.rank-badge.bronze { background: rgba(180, 83, 9, 0.2); color: #d97706; border: 1px solid #d97706; }
.rank-badge.rank-other { background: var(--bg-surface-elevated); color: var(--muted); border: 1px solid var(--line); }

/* Top-3 row highlights in unified rankings table */
.rank-top-row td { position: relative; }
.rank-top-1 td { background: rgba(245, 158, 11, 0.06); }
.rank-top-2 td { background: rgba(148, 163, 184, 0.05); }
.rank-top-3 td { background: rgba(180, 83, 9, 0.05); }
.rank-top-row:hover td { filter: brightness(1.15); }
.rank-top-1 td:first-child { border-left: 2px solid var(--mega); }
.rank-top-2 td:first-child { border-left: 2px solid #cbd5e1; }
.rank-top-3 td:first-child { border-left: 2px solid #d97706; }
/* Baseline strategy markers in ranking */
.baseline-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 3px;
}
.podium-card.is-baseline {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(145deg, var(--bg-surface-elevated) 0%, rgba(59, 130, 246, 0.05) 100%);
}
.baseline-row {
  background: rgba(59, 130, 246, 0.05);
  outline: 1px solid rgba(59, 130, 246, 0.2);
  outline-offset: -1px;
}

.match-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-surface-hover);
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  border: 1px solid var(--line);
}

/* Score Meter Bar */
.score-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  min-width: 48px;
}

.meter-bar {
  height: 6px;
  width: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
}

.pos { color: var(--positive); font-weight: 700; }
.neg { color: var(--negative); font-weight: 700; }

/* Control Row & Filters */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface-elevated);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.filter-control {
  background: var(--bg-surface-hover);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}

/* Pagination & Footers */
.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-button {
  background: var(--bg-surface-elevated);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pagination-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-button:not(:disabled):hover {
  background: var(--bg-surface-hover);
  border-color: var(--line-strong);
}

/* Action Buttons & Links */
.text-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.text-action:hover {
  text-decoration: underline;
}

/* State Boxes */
.ui-state {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.ui-state-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
}

.ui-state-loading .ui-state-marker {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* CRITICAL FIX: Modal Overlays MUST be hidden by default! */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex !important;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: min(800px, calc(100% - 32px));
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-soft);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-surface-elevated);
  color: var(--muted);
  border: 1px solid var(--line);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--bg-surface-hover);
}

.modal-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 20px;
}

/* Modal Analysis Tabs */
.analysis-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.analysis-tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.analysis-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Analysis Modal Panel Styling */
.analysis-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .analysis-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.analysis-summary-grid > div {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-summary-grid span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.analysis-summary-grid strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono);
  display: block;
}

.coverage-note {
  padding: 14px 18px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  color: var(--ink);
  margin-top: 16px;
}

.coverage-note.is-partial {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}

.coverage-note strong {
  display: block;
  font-size: 13.5px;
  color: var(--positive);
  margin-bottom: 2px;
}

.coverage-note.is-partial strong {
  color: var(--mega);
}

.coverage-note p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* Modal Data Tables (Strategies, Combinations, Distribution) */
.detail-table {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.detail-table-header {
  display: grid;
  grid-template-columns: 60px 180px 110px 100px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface-hover);
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line-strong);
}

.detail-table-row {
  display: grid;
  grid-template-columns: 60px 180px 110px 100px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.detail-table-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.analysis-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface-elevated);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.analysis-combinations-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analysis-combination-row {
  display: grid;
  grid-template-columns: 60px 180px 240px 1fr;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.analysis-combination-row.is-winning {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(145deg, var(--bg-surface-elevated) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.combination-position {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 13px;
}

.distribution-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
}

.distribution-row strong {
  color: var(--ink);
  font-weight: 700;
}

.distribution-row span {
  font-family: var(--font-mono);
  color: var(--muted);
}

/* Recent Wins Card Grid */
.wins-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.win-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.win-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.win-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.win-card-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.win-card-strategy {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.win-card-amount {
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--positive);
  margin-left: auto;
}

.weight-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weight-bar {
  height: 6px;
  width: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.weight-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
}

.weight-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--positive);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Minimalist Centered Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-base);
  padding: 40px 20px 48px;
  margin-top: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-copy {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Legal Page Styles */
.legal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}

.legal-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.legal-card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--ink);
}

.legal-card p {
  margin: 0 0 10px;
  color: var(--muted);
}

.legal-card-emphasis {
  border-color: rgba(245, 158, 11, 0.3);
  background: linear-gradient(145deg, var(--bg-surface) 0%, rgba(245, 158, 11, 0.05) 100%);
}

/* PWA Install Button */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: 0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.5);
}

/* Mobile Responsive Overhaul */
@media (max-width: 900px) {
  .topbar {
    height: auto;
    padding: 10px 0;
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 12px;
    width: min(var(--content), calc(100% - 24px));
  }

  .desktop-nav {
    width: 100%;
    order: 3;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 4px;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .desktop-nav::-webkit-scrollbar {
    display: none;
  }

  .data-status {
    margin-left: auto;
    font-size: 11px;
    padding: 4px 10px;
  }
}

@media (max-width: 768px) {
  .home-main,
  .report-shell,
  .legal-shell {
    width: calc(100% - 24px);
  }

  .game-switcher {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .game-switcher a {
    padding: 8px 14px;
    font-size: 12.5px;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .performance-strip {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .podium-cards-grid {
    grid-template-columns: 1fr;
  }

  .history-table,
  .next-analysis-table,
  .ranking-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .history-header,
  .history-row {
    min-width: 720px;
  }

  .next-analysis-header,
  .next-analysis-row {
    min-width: 620px;
  }

  .modal-card {
    padding: 20px 16px;
    width: calc(100% - 16px);
    margin: 8px auto;
    border-radius: var(--radius-md);
  }

  .analysis-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .analysis-filters label {
    flex-direction: column;
    align-items: flex-start;
  }

  .analysis-combination-row {
    grid-template-columns: 40px 140px 1fr;
  }

  .ranking-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ranking-table {
    min-width: 600px;
  }

  .list-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .pagination {
    align-self: flex-end;
  }

  .detail-table-header,
  .detail-table-row {
    grid-template-columns: 50px 150px 90px 80px 1fr;
    font-size: 12px;
  }

  .win-card-head {
    flex-wrap: wrap;
  }

  .win-card-amount {
    margin-left: 0;
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .brand-text {
    font-size: 19px;
  }

  .brand-tag {
    display: none;
  }

  .draw-balls {
    gap: 3px;
    flex-wrap: wrap;
  }

  .ball {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .ball-sm {
    width: 23px;
    height: 23px;
    font-size: 10px;
  }

  .ball-sm::after {
    top: 1px;
    left: 4px;
    width: 6px;
    height: 3px;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 20px 40px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-control {
    width: 100%;
  }

  .distribution-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .distribution-row > *:last-child {
    grid-column: 1 / -1;
  }

  .report-stage {
    padding: 16px;
  }

  .report-stage .section-heading {
    margin-bottom: 12px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .method-strip {
    gap: 16px;
  }
}
