/* ==================== RESET & BASE ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #080b14;
  --bg2: #0d1120;
  --card: #111827;
  --card2: #1a2236;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --gold: #f59e0b;
  --gold2: #fbbf24;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #475569;
  --glow: rgba(108,99,255,0.3);
  --radius: 16px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ==================== BACKGROUND ==================== */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(108,99,255,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(167,139,250,0.08) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(245,158,11,0.04) 0%, transparent 50%);
}

/* ==================== HEADER ==================== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text); }
.logo-accent { color: var(--accent2); }
.back-link {
  font-size: 0.8rem; font-weight: 600; color: var(--text3);
  text-decoration: none; transition: color 0.2s;
}
.back-link:hover { color: var(--text2); }
.logo-sep { color: var(--text3); font-size: 0.8rem; }
.game-badge {
  font-size: 0.65rem; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 6px;
}
.quina-badge { background: rgba(108,99,255,0.2); border: 1px solid rgba(108,99,255,0.4); color: #a78bfa; }
.badge-live {
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.35);
  color: var(--accent2);
  font-size: 0.75rem; font-weight: 600;
  padding: 4px 12px; border-radius: 20px;
  letter-spacing: 0.3px;
}

/* ==================== HERO ==================== */
.hero {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding: 80px 2rem 60px;
  text-align: center;
}
.hero-content { max-width: 720px; margin: 0 auto; }
.hero-tag {
  display: inline-block;
  background: rgba(108,99,255,0.12);
  border: 1px solid rgba(108,99,255,0.3);
  color: var(--accent2); font-size: 0.8rem; font-weight: 600;
  padding: 5px 16px; border-radius: 20px;
  letter-spacing: 0.8px; text-transform: uppercase;
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900; line-height: 1.15;
  letter-spacing: -1.5px; margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent2), var(--gold2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.05rem; color: var(--text2); line-height: 1.7;
  margin-bottom: 36px; max-width: 600px; margin-left: auto; margin-right: auto;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-size: 1rem; font-weight: 700;
  padding: 14px 32px; border-radius: 12px;
  border: none; cursor: pointer;
  box-shadow: 0 0 32px rgba(108,99,255,0.35);
  transition: all 0.25s ease;
  letter-spacing: 0.2px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 48px rgba(108,99,255,0.55);
}
.btn-primary:active { transform: translateY(0); }
.btn-icon { font-size: 1.1rem; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border2);
  color: var(--text2); font-size: 0.85rem; font-weight: 600;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-generate {
  padding: 16px 40px; font-size: 1.05rem;
  box-shadow: 0 0 40px rgba(108,99,255,0.4);
}

/* ==================== STATS STRIP ==================== */
.stats-strip {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-top: 56px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-item {
  flex: 1; text-align: center;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value {
  font-size: 1.8rem; font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 0.78rem; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-divider { width: 1px; background: var(--border); height: 40px; flex-shrink: 0; }

/* ==================== LOADING ==================== */
.loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(8,11,20,0.92); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  background: var(--card2);
  border: 1px solid var(--border2);
  border-radius: 20px; padding: 48px;
  text-align: center; min-width: 380px;
  box-shadow: 0 0 80px rgba(108,99,255,0.2);
}
.loading-spinner {
  width: 52px; height: 52px; margin: 0 auto 24px;
  border: 3px solid rgba(108,99,255,0.2);
  border-top-color: var(--accent2);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.loading-bar-track {
  background: rgba(255,255,255,0.07);
  border-radius: 8px; height: 6px; overflow: hidden; margin-bottom: 12px;
}
.loading-bar-fill {
  height: 100%; border-radius: 8px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.3s ease;
}
.loading-sub { font-size: 0.82rem; color: var(--text3); }

/* ==================== DASHBOARD ==================== */
.dashboard { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 0 2rem 80px; }
.section { margin-bottom: 56px; }
.section-header { margin-bottom: 28px; }
.section-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.section-desc { color: var(--text2); font-size: 0.9rem; }

/* ==================== CARDS ==================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border2); }
.card-title { font-size: 0.92rem; font-weight: 700; color: var(--text2); margin-bottom: 20px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

/* ==================== HEATMAP ==================== */
.heatmap-card { margin-bottom: 24px; }
.heatmap-legend { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--text3); }
.legend-bar {
  width: 100px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #1e3a5f, #1d4ed8, #7c3aed, #dc2626, #f59e0b);
}
.heatmap-grid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px;
}
.hm-cell {
  aspect-ratio: 1; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  cursor: default; transition: transform 0.15s;
  position: relative; overflow: hidden;
}
.hm-cell:hover { transform: scale(1.15); z-index: 2; }
.hm-cell .hm-tooltip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--border2);
  border-radius: 8px; padding: 6px 10px;
  font-size: 0.7rem; white-space: nowrap; z-index: 10; color: var(--text);
}
.hm-cell:hover .hm-tooltip { display: block; }

/* ==================== BAR CHARTS ==================== */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card { }
.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; font-weight: 600; color: var(--text2);
  width: 28px; text-align: right; flex-shrink: 0;
}
.bar-track { flex: 1; background: rgba(255,255,255,0.05); border-radius: 4px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s cubic-bezier(.23,1,.32,1); }
.bar-count { font-size: 0.72rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; width: 38px; flex-shrink: 0; }

/* ==================== MINI CARDS ==================== */
.mini-card { }
.donut-container { display: flex; flex-direction: column; gap: 12px; }
.donut-row { display: flex; align-items: center; justify-content: space-between; }
.donut-bar-track { flex: 1; height: 12px; background: rgba(255,255,255,0.05); border-radius: 6px; margin: 0 12px; overflow: hidden; }
.donut-bar-fill { height: 100%; border-radius: 6px; }
.donut-pct { font-size: 0.82rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

.decade-chart { display: flex; flex-direction: column; gap: 8px; }
.decade-row { display: grid; grid-template-columns: 80px 1fr 44px; align-items: center; gap: 10px; }
.decade-label { font-size: 0.78rem; color: var(--text2); }
.decade-track { background: rgba(255,255,255,0.05); border-radius: 4px; height: 14px; overflow: hidden; }
.decade-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.decade-pct { font-size: 0.75rem; color: var(--text3); font-family: 'JetBrains Mono', monospace; text-align: right; }

.soma-info { display: flex; flex-direction: column; gap: 14px; }
.soma-row { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.soma-key { font-size: 0.82rem; color: var(--text2); }
.soma-val { font-size: 1.1rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--accent2); }

/* ==================== STRATEGY GRID ==================== */
.strategy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
  margin-bottom: 28px;
}
.strategy-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px; cursor: pointer;
  transition: all 0.2s; text-align: center;
}
.strategy-card:hover { border-color: rgba(108,99,255,0.4); background: var(--card2); }
.strategy-card.active { border-color: var(--accent); background: rgba(108,99,255,0.1); box-shadow: 0 0 24px rgba(108,99,255,0.2); }
.strategy-icon { font-size: 2rem; margin-bottom: 10px; }
.strategy-name { font-size: 0.92rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.strategy-desc { font-size: 0.75rem; color: var(--text3); line-height: 1.5; }

/* ==================== GENERATOR CONTROLS ==================== */
.generator-controls {
  display: flex; align-items: center; gap: 24px; justify-content: center;
  margin-bottom: 32px; flex-wrap: wrap;
}
.control-group { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.control-label { font-size: 0.8rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.qty-control { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border2);
  color: var(--text); font-size: 1.2rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: rgba(108,99,255,0.25); border-color: var(--accent); }
.qty-value { font-size: 1.6rem; font-weight: 900; width: 48px; text-align: center; font-family: 'JetBrains Mono', monospace; }

/* ==================== GAMES OUTPUT ==================== */
.games-output { }
.games-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.games-title { font-size: 1.1rem; font-weight: 800; }
.games-actions { display: flex; gap: 10px; }
.games-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  animation: slideUp 0.4s ease both;
  transition: border-color 0.2s;
}
.game-card:hover { border-color: rgba(108,99,255,0.3); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.game-num { font-size: 0.78rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.game-score {
  font-size: 0.75rem; font-weight: 700;
  background: rgba(108,99,255,0.15); border: 1px solid rgba(108,99,255,0.3);
  color: var(--accent2); padding: 3px 10px; border-radius: 20px;
}
.game-balls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.ball {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.ball:hover { transform: scale(1.1); }
.ball-hot { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,0.35); }
.ball-warm { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; box-shadow: 0 4px 12px rgba(217,119,6,0.3); }
.ball-cold { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.ball-neutral { background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; box-shadow: 0 4px 12px rgba(108,99,255,0.3); }

.game-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-tag {
  font-size: 0.72rem; font-weight: 600; color: var(--text3);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 6px;
}

/* ==================== RESULTS LIST ==================== */
.results-list { display: flex; flex-direction: column; gap: 12px; }
.result-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.result-concurso { font-size: 0.82rem; font-weight: 700; color: var(--text3); min-width: 80px; }
.result-date { font-size: 0.8rem; color: var(--text3); min-width: 90px; }
.result-balls { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.result-ball {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--card2), var(--card));
  border: 2px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  color: var(--text2);
}
.result-acumulou {
  font-size: 0.72rem; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; flex-shrink: 0;
}
.acumulou-sim { background: rgba(245,158,11,0.15); color: var(--gold2); border: 1px solid rgba(245,158,11,0.3); }
.acumulou-nao { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.25); }

/* ==================== FOOTER ==================== */
.footer {
  position: relative; z-index: 1;
  text-align: center; padding: 32px 2rem;
  border-top: 1px solid var(--border);
  color: var(--text3); font-size: 0.82rem; line-height: 1.8;
}
.footer a { color: var(--accent2); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-disclaimer { color: var(--text3); font-size: 0.75rem; margin-top: 6px; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .charts-row { grid-template-columns: 1fr; }
  .stats-strip { flex-direction: column; }
  .stat-divider { width: 80%; height: 1px; }
  .heatmap-grid { grid-template-columns: repeat(8, 1fr); }
  .games-list { grid-template-columns: 1fr; }
  .strategy-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .heatmap-grid { grid-template-columns: repeat(5, 1fr); }
  .strategy-grid { grid-template-columns: 1fr; }
}
