  @import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

  :root {
    --bg: #0d0f14;
    --bg2: #13161d;
    --bg3: #1a1e28;
    --bg4: #212636;
    --border: rgba(255,255,255,0.07);
    --border2: rgba(255,255,255,0.12);
    --text: #f0f2f8;
    --text2: #8892a4;
    --text3: #505870;
    --accent: #4f8ef7;
    --accent2: #6c63ff;
    --gold: #f5c842;
    --green: #3ecf8e;
    --red: #f56565;
    --orange: #f6ad55;
    --purple: #9b8afb;
    --g1: #ff6b6b; --g1b: rgba(255,107,107,0.12);
    --g2: #ffa94d; --g2b: rgba(255,169,77,0.12);
    --g3: #51cf66; --g3b: rgba(81,207,102,0.12);
    --g4: #4dabf7; --g4b: rgba(77,171,247,0.12);
    --g5: #cc5de8; --g5b: rgba(204,93,232,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
  }

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

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

  /* BACKGROUND DECORATION */
  body::before {
    content: '';
    position: fixed;
    top: -200px; left: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(79,142,247,0.08) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
  }
  body::after {
    content: '';
    position: fixed;
    bottom: -200px; right: -200px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(108,99,255,0.07) 0%, transparent 70%);
    pointer-events: none; z-index: 0;
  }

  /* LAYOUT */
  .layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

  /* SIDEBAR */
  .sidebar {
    width: 220px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
  }
  .logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
  }
  .logo-title {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
  }
  .logo-sub {
    font-size: 11px;
    color: var(--text3);
    margin-top: 3px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .nav { padding: 12px 0; flex: 1; }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
    border-left: 3px solid transparent;
    user-select: none;
    text-decoration: none;
  }
  .nav-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
  .nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(79,142,247,0.08); font-weight: 500; }
  .nav-icon { font-size: 16px; width: 20px; text-align: center; }
  .sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
  }
  .concurso-badge {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12px;
  }
  .concurso-badge .num { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--gold); }
  .concurso-badge .lbl { color: var(--text3); font-size: 11px; margin-top: 2px; }

  /* MAIN */
  .main { margin-left: 220px; flex: 1; padding: 28px; }

  /* TOP BAR */
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .page-title {
    font-family: 'Syne', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
  }
  .topbar-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

  /* BUTTONS */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid var(--border2);
    background: var(--bg3);
    color: var(--text);
    white-space: nowrap;
  }
  .btn:hover { background: var(--bg4); border-color: var(--border2); }
  .btn:active { transform: scale(0.97); }
  .btn:disabled { opacity: .4; cursor: not-allowed; }
  .btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn-accent:hover { background: #3a7de8; border-color: #3a7de8; }
  .btn-gold { background: var(--gold); border-color: var(--gold); color: #1a1200; font-weight: 600; }
  .btn-gold:hover { background: #e8b828; }
  .btn-green { background: var(--green); border-color: var(--green); color: #001a0a; font-weight: 600; }
  .btn-green:hover { background: #2db87b; }
  .btn-red { background: rgba(245,101,101,0.15); border-color: rgba(245,101,101,0.3); color: var(--red); }
  .btn-red:hover { background: rgba(245,101,101,0.25); }
  .btn-sm { padding: 5px 10px; font-size: 12px; }

  select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--bg3);
    color: var(--text);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
  }

  /* CARDS */
  .card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
  }
  .card-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .card-title::before {
    content: '';
    width: 3px; height: 14px;
    border-radius: 2px;
    background: var(--accent);
  }

  /* METRIC CARDS */
  .metrics-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
  .mcard {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color .2s;
  }
  .mcard:hover { border-color: var(--border2); }
  .mcard-lbl { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
  .mcard-val { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
  .mcard-sub { font-size: 11px; color: var(--text2); margin-top: 5px; }
  .mcard-accent { border-left: 3px solid var(--accent); }
  .mcard-gold { border-left: 3px solid var(--gold); }
  .mcard-green { border-left: 3px solid var(--green); }
  .mcard-red { border-left: 3px solid var(--red); }

  /* NOTICE */
  .notice {
    background: rgba(79,142,247,0.07);
    border: 1px solid rgba(79,142,247,0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 18px;
    line-height: 1.6;
  }

  /* LOADING */
  .loading-overlay {
    position: fixed; inset: 0; z-index: 999;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
  }
  .loading-overlay.hidden { display: none; }
  .spinner-big {
    width: 48px; height: 48px;
    border: 3px solid var(--bg4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-text { font-family: 'Syne', sans-serif; font-size: 14px; color: var(--text2); }
  .spinner-sm {
    display: inline-block; width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
  }

  /* PAGE PANELS */
  .page { display: block; animation: fadeIn .2s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

  /* TABLE */
  .tbl-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
  table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 400px; }
  th {
    padding: 10px 8px; text-align: center; font-weight: 500;
    color: var(--text3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--bg3); border-bottom: 1px solid var(--border); white-space: nowrap;
  }
  td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: rgba(255,255,255,0.02); }

  /* BALLS */
  .ball {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    font-size: 11px; font-weight: 600; flex-shrink: 0;
  }
  .ball-lg { width: 34px; height: 34px; font-size: 13px; }
  .ball-sm { width: 20px; height: 20px; font-size: 10px; }
  .g1 { background: var(--g1b); color: var(--g1); border: 1px solid rgba(255,107,107,0.3); }
  .g2 { background: var(--g2b); color: var(--g2); border: 1px solid rgba(255,169,77,0.3); }
  .g3 { background: var(--g3b); color: var(--g3); border: 1px solid rgba(81,207,102,0.3); }
  .g4 { background: var(--g4b); color: var(--g4); border: 1px solid rgba(77,171,247,0.3); }
  .g5 { background: var(--g5b); color: var(--g5); border: 1px solid rgba(204,93,232,0.3); }
  .ball-hit { background: rgba(62,207,142,0.2); color: var(--green); border: 1px solid rgba(62,207,142,0.4); }
  .ball-miss { background: var(--bg3); color: var(--text3); border: 1px solid var(--border); }
  .ball-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); display: inline-block; }

  /* FREQ GRID */
  .freq-grid { display: grid; grid-template-columns: repeat(25, minmax(0,1fr)); gap: 3px; }
  .fcell {
    aspect-ratio: 1; border-radius: 8px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    cursor: default; transition: transform .15s;
    border: 1px solid transparent;
    position: relative;
  }
  .fcell:hover { transform: scale(1.1); z-index: 2; }
  .fcell .fn { font-size: 10px; }
  .fcell .fp { font-size: 9px; margin-top: 2px; opacity: .8; }
  .fhot { background: rgba(245,101,101,0.15); color: var(--red); border-color: rgba(245,101,101,0.3); }
  .fcold { background: rgba(77,171,247,0.12); color: var(--g4); border-color: rgba(77,171,247,0.25); }
  .fmid { background: var(--bg3); color: var(--text2); border-color: var(--border); }
  .fwarm { background: rgba(255,169,77,0.12); color: var(--orange); border-color: rgba(255,169,77,0.25); }

  /* GROUP CARDS */
  .groups-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
  .gcard {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    text-align: center; transition: border-color .2s;
  }
  .gcard:hover { border-color: var(--border2); }
  .gcard-lbl { font-size: 11px; margin-bottom: 6px; font-weight: 500; }
  .gcard-val { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; }
  .gcard-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }
  .gbar-wrap { height: 4px; background: var(--bg4); border-radius: 2px; margin-top: 10px; overflow: hidden; }
  .gbar { height: 4px; border-radius: 2px; transition: width .5s ease; }

  /* SELECTOR */
  .num-grid { display: grid; grid-template-columns: repeat(25, minmax(0,1fr)); gap: 4px; }
  .nball {
    aspect-ratio: 1; border-radius: 50%; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border2);
    background: var(--bg3); color: var(--text2);
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; user-select: none;
  }
  .nball:hover { border-color: var(--accent); color: var(--accent); }
  .nball.on { background: var(--accent); border-color: var(--accent); color: #fff; }
  .nball.conf-on { background: var(--red); border-color: var(--red); color: #fff; }

  /* GAME CARDS */
  .game-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    margin-bottom: 10px; transition: border-color .2s;
  }
  .game-card:hover { border-color: var(--border2); }
  .game-card-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 12px;
    flex-wrap: wrap; gap: 8px;
  }
  .game-card-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 600; color: var(--text); }
  .game-card-meta { font-size: 11px; color: var(--text3); }
  .game-balls { display: flex; gap: 5px; flex-wrap: wrap; }

  /* SEQ DOTS */
  .seq-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .seq-lbl { font-size: 12px; font-weight: 500; min-width: 80px; }
  .seq-dots { display: flex; gap: 3px; }
  .sdot { width: 16px; height: 16px; border-radius: 4px; transition: opacity .2s; }

  /* BADGES */
  .badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
    white-space: nowrap;
  }
  .badge-15 { background: rgba(245,200,66,0.2); color: var(--gold); border: 1px solid rgba(245,200,66,0.3); }
  .badge-14 { background: rgba(62,207,142,0.15); color: var(--green); border: 1px solid rgba(62,207,142,0.3); }
  .badge-13 { background: rgba(79,142,247,0.15); color: var(--accent); border: 1px solid rgba(79,142,247,0.3); }
  .badge-12 { background: rgba(204,93,232,0.12); color: var(--purple); border: 1px solid rgba(204,93,232,0.25); }
  .badge-11 { background: rgba(255,169,77,0.12); color: var(--orange); border: 1px solid rgba(255,169,77,0.25); }
  .badge-no { background: var(--bg3); color: var(--text3); border: 1px solid var(--border); }

  /* AI CARD */
  .ai-card {
    background: linear-gradient(135deg, rgba(79,142,247,0.08), rgba(108,99,255,0.08));
    border: 1px solid rgba(108,99,255,0.25);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
  }
  .ai-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .ai-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); display: flex; align-items: center; justify-content: center; font-size: 18px; }
  .ai-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--text); }
  .ai-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .ai-prompt { width: 100%; background: var(--bg); border: 1px solid var(--border2); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px; resize: vertical; min-height: 70px; margin-bottom: 10px; }
  .ai-prompt:focus { outline: none; border-color: var(--accent); }
  .ai-response { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; font-size: 13px; color: var(--text2); line-height: 1.7; min-height: 60px; }
  .ai-response .thinking { color: var(--text3); font-style: italic; }

  /* HISTOGRAM */
  .hist-entry {
    display: flex; align-items: center;
    gap: 10px; padding: 10px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .hist-entry:last-child { border-bottom: none; }
  .hist-ts { font-size: 11px; color: var(--text3); min-width: 80px; }

  /* EXPORT */
  .exp-pre {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: var(--text2);
    white-space: pre;
    overflow: auto;
    max-height: 350px;
    line-height: 1.7;
  }

  /* GRID LAYOUT HELPERS */
  .grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

  /* CONF RESULT ROW */
  .conf-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .conf-row:last-child { border-bottom: none; }

  /* CHART WRAP */
  .chart-wrap { position: relative; }

  /* SCROLLBAR */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg2); }
  ::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--border2); }

  /* MENU MOBILE (hambúrguer + gaveta lateral) */
  .mobile-menu-btn {
    display: none;
    align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--bg3);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-menu-btn:active { transform: scale(0.95); }
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 150;
  }
  .sidebar-overlay.show { display: block; }

  /* RESPONSIVE */
  @media (max-width: 900px) {
    .sidebar { width: 180px; }
    .main { margin-left: 180px; padding: 16px; }
    .groups-row { grid-template-columns: repeat(3, 1fr); }
    .freq-grid { grid-template-columns: repeat(13, 1fr); }
    .num-grid { grid-template-columns: repeat(13, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
  }
  @media (max-width: 640px) {
    .mobile-menu-btn { display: inline-flex; }
    .sidebar {
      width: 240px;
      transform: translateX(-100%);
      transition: transform .25s ease;
      z-index: 200;
      box-shadow: 0 0 32px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 12px; padding-top: 64px; }
    .groups-row { grid-template-columns: repeat(2, 1fr); }
    .freq-grid { grid-template-columns: repeat(7, 1fr); }
    .num-grid { grid-template-columns: repeat(7, 1fr); }
    .topbar { padding-right: 90px; } /* espaço pro banner de conta fixo */
  }

  /* PROGRESS BAR ANIM */
  @keyframes barGrow { from { width: 0; } to { width: var(--w); } }
  .anim-bar { animation: barGrow .6s ease forwards; }

  /* TREND ARROW */
  .trend-up { color: var(--green); }
  .trend-down { color: var(--red); }

  /* TOOLTIP */
  [data-tip] { position: relative; cursor: help; }
  [data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: var(--bg4); color: var(--text); font-size: 11px;
    padding: 5px 9px; border-radius: 6px; white-space: nowrap;
    border: 1px solid var(--border2); z-index: 100; pointer-events: none;
  }

  /* SECTION DIVIDER */
  .section-gap { margin-bottom: 24px; }

  /* STRATEGY BUTTONS */
  .strategy-btn { border: 1px solid var(--border2); transition: all .15s; }
  .strategy-btn.active { border-color: var(--accent); background: rgba(79,142,247,0.12); color: var(--accent); }

  /* FIXED BALL HIGHLIGHT (estratégia 10 fixas) */
  .nball.fixo-mark { box-shadow: 0 0 0 2px var(--accent); }
