/* ==================================================================
   BLOCK BLAST PIX — DESIGN TOKENS
   Fonte unica de verdade pra cor, espaco, raio, sombra e estado.
   Carregado ANTES de qualquer outro CSS em todas as paginas.

   REGRA: nenhum componente inventa cor. Se precisar de um tom novo,
   ele nasce aqui como token. Nada de hex solto no CSS/JS/HTML.
   ================================================================== */

:root {
  /* ---------- superficies (do mais fundo pro mais alto) ---------- */
  --bg-page:              #061A33;
  --bg-surface:           #0A2A52;
  --bg-surface-elevated:  #0E376A;
  --bg-surface-hover:     #12417C;
  --bg-input:             #071F3E;
  --bg-input-disabled:    #0A233F;
  --bg-sunken:            #04122A;

  /* ---------- marca ---------- */
  --primary:              #28B8E6;
  --primary-hover:        #41C7F1;
  --primary-active:       #1599C7;
  --primary-soft:         rgba(40, 184, 230, .14);
  --primary-soft-strong:  rgba(40, 184, 230, .24);
  --primary-glow:         rgba(40, 184, 230, .34);

  /* ---------- bordas ---------- */
  --border-default:       rgba(255, 255, 255, .14);
  --border-strong:        rgba(255, 255, 255, .28);
  --border-subtle:        rgba(255, 255, 255, .08);
  --border-focus:         #42C8F5;

  /* ---------- texto ---------- */
  --text-primary:         #F5FAFF;  /* 13.9:1 sobre --bg-surface */
  --text-secondary:       #B7CAE0;  /*  8.6:1 */
  --text-muted:           #93A9C4;  /*  4.9:1 — piso do AA pra texto normal */
  --text-on-primary:      #04192B;  /*  7.7:1 sobre --primary */
  --text-on-accent:       #04192B;

  /* ---------- semanticas ---------- */
  --success:              #4ED79A;
  --success-soft:         rgba(78, 215, 154, .14);
  --success-border:       rgba(78, 215, 154, .38);
  --success-hover:        #6BE0AC;
  --success-strong:       #22B87A;

  --warning:              #F2C15C;
  --warning-soft:         rgba(242, 193, 92, .14);
  --warning-hover:        #F6CE79;
  --warning-border:       rgba(242, 193, 92, .38);

  /* #FF6B78 dava 4.43:1 sobre --danger-soft em cima de --bg-surface-elevated
     (reprova o AA por pouco). Clareado pra 4.9:1 sem perder a leitura de "erro". */
  --danger:               #FF7C87;
  --danger-soft:          rgba(255, 124, 135, .14);
  --danger-border:        rgba(255, 124, 135, .38);

  --info:                 #55BDF5;
  --info-soft:            rgba(85, 189, 245, .14);
  --info-border:          rgba(85, 189, 245, .38);

  --neutral:              #93A9C4;
  --neutral-soft:         rgba(147, 169, 196, .12);
  --neutral-border:       rgba(147, 169, 196, .32);

  /* ---------- overlay ---------- */
  /* --overlay = fundo de MODAL (some com o conteudo atras, de proposito).
     --scrim   = veu leve pra escurecer conteudo dentro da pagina sem
                 apaga-lo (ex: o gate "Apostar agora" sobre o tabuleiro). */
  --overlay:              rgba(1, 10, 24, .72);
  --overlay-blur:         blur(8px);
  --scrim:                rgba(6, 26, 51, .55);

  /* ---------- sombras ---------- */
  --shadow-sm:            0 2px 8px rgba(1, 10, 24, .28);
  --shadow-md:            0 8px 24px rgba(1, 10, 24, .38);
  --shadow-lg:            0 16px 44px rgba(1, 10, 24, .48);
  --shadow-sheet:         0 -16px 50px rgba(0, 0, 0, .38);
  --shadow-primary:       0 8px 22px rgba(40, 184, 230, .32);
  --shadow-success:       0 8px 22px rgba(78, 215, 154, .26);

  /* ---------- foco (anel unico pro site inteiro) ---------- */
  --ring:                 0 0 0 3px rgba(66, 200, 245, .38);
  --ring-danger:          0 0 0 3px rgba(255, 124, 135, .34);
  --ring-offset:          0 0 0 2px var(--bg-surface), 0 0 0 5px var(--border-focus);

  /* ---------- raios ---------- */
  --r-xs:  8px;
  --r-sm:  10px;
  --r-md:  13px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-sheet: 24px;
  --r-pill: 999px;

  /* ---------- espaco ---------- */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-7: 32px;  --sp-8: 40px;

  /* ---------- tipografia ---------- */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---------- area segura (iPhone / PWA) ---------- */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* altura util real — corrige a barra do Safari no iOS */
  --vh-safe: 100svh;

  /* ---------- alvo de toque minimo (WCAG 2.5.5 / HIG) ---------- */
  --tap: 44px;

  /* ---------- transicoes ---------- */
  --t-fast: .12s ease;
  --t-base: .2s ease;
  --t-sheet: .34s cubic-bezier(.2, .9, .3, 1);

  /* ---------- z-index ---------- */
  --z-header: 40;
  --z-bnav:   50;
  --z-overlay: 90;
  --z-sheet:  91;
  --z-toast:  120;

  /* ================================================================
     ALIASES LEGADOS
     O CSS antigo (theme.css, bb-theme.css, inline) usa esses nomes.
     Apontam pros tokens novos pra nada ficar orfao durante a migracao.
     ================================================================ */
  --bg:        var(--bg-page);
  --bg-deep:   var(--bg-page);
  --card:      var(--bg-surface);
  --card2:     var(--bg-surface-elevated);
  --panel:     var(--bg-surface);
  --line:      var(--border-default);
  --line2:     var(--border-strong);
  --text:      var(--text-primary);
  --muted:     var(--text-secondary);
  --soft:      var(--text-muted);
  --dim:       var(--text-secondary);
  --blue:      var(--primary);
  --blue-d:    var(--primary-active);
  --blue-2:    var(--primary-hover);
  --blue-bg:   var(--primary-soft);
  --blue-ink:  var(--text-primary);
  --green:     var(--success);
  --green-d:   var(--success-strong);
  --green-bg:  var(--success-soft);
  --amber:     var(--warning);
  --amber-bg:  var(--warning-soft);
  --amber-t:   var(--text-on-primary);
  --red:       var(--danger);
  --purple:    var(--primary);
  --purple-d:  var(--primary-active);
  --pink:      var(--primary-hover);
  --yellow:    var(--warning);
  --shadow:    var(--shadow-lg);
  --shadow-s:  var(--shadow-md);
}

/* ==================================================================
   RESET DE ESTADO — vale pro site inteiro
   ================================================================== */

/* Foco por teclado sempre visivel. Mouse/toque nao mostra o anel. */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* Desabilitado: mesma leitura em todo lugar */
[disabled], .is-disabled, [aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  filter: saturate(.5);
  pointer-events: none;
}

/* Autofill do iOS/Chrome nao pode voltar o campo pra branco */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
  caret-color: var(--text-primary);
  transition: background-color 9999s ease-out 0s;
}

/* Selecao de texto legivel */
::selection { background: var(--primary-soft-strong); color: var(--text-primary); }

/* Respeita quem pediu menos animacao */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Alto contraste do sistema: engrossa bordas em vez de depender so de cor */
@media (prefers-contrast: more) {
  :root {
    --border-default: rgba(255, 255, 255, .28);
    --border-strong:  rgba(255, 255, 255, .48);
    --text-muted:     #B7CAE0;
  }
}
