/* ==========================================================================
   Solcaz — fondations : tokens, reset, structure
   Palette : violet sur noir profond, vert emeraude pour les actions.
   ========================================================================== */

:root {
  --bg:        #08061040;
  --bg:        #090614;
  --bg-1:      #0d0a1c;
  --panel:     #140f26;
  --panel-2:   #1a1433;
  --panel-3:   #241c44;
  --line:      rgba(160, 140, 240, .10);
  --line-2:    rgba(160, 140, 240, .20);

  --text:      #ece7fa;
  --text-2:    #b6acd8;
  /* Mesure au navigateur : #7d729c donnait 4.23:1 sur --panel et 3.99 sur
     --panel-2, sous le seuil AA de 4.5 pour du petit texte. Or c'est la
     couleur de TOUS les libelles des jeux (« Manche », « En jeu », en-tetes
     de tableau, noms de side bets), en 10-11 px. Remonte au minimum qui
     passe partout : 4.88 sur --panel, 4.61 sur --panel-2, et toujours tres
     en dessous de --text-2 (8.78) pour que la hierarchie tienne. */
  --muted:     #877da4;

  /* Violet : couleur d'identite, boutons secondaires, accents */
  --violet:      #9b87f5;
  --violet-2:    #7358e6;
  --violet-dim:  rgba(155, 135, 245, .15);

  /* Vert emeraude : action principale (connexion, encaissement) */
  --green:     #10d492;
  --green-2:   #06b077;
  --green-dim: rgba(16, 212, 146, .14);

  --gold:      #f2c14e;
  --gold-dim:  rgba(242, 193, 78, .14);
  --red:       #ff5680;
  --red-dim:   rgba(255, 86, 128, .14);
  --blue:      #55a8ff;

  --r-sm: 8px;
  --r:    13px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sidebar-w: 236px;
  --sidebar-collapsed: 68px;
  --chat-w: 314px;
  --topbar-h: 62px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 12px 34px -14px rgba(0,0,0,.85);
  --shadow-glow: 0 0 0 1px rgba(155,135,245,.30), 0 8px 30px -10px rgba(155,135,245,.45);

  --font: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui,
          -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SF Mono",
          Consolas, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

/* L'attribut `hidden` doit toujours gagner. Sans cette regle, la moindre
   classe qui pose un `display` (une barre en flex, une carte en grid) le
   neutralise en silence : c'est ainsi que les boutons de connexion
   restaient affiches une fois le wallet connecte. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}

/* Quadrillage de fond, tres discret */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(160,140,240,.030) 1px, transparent 1px),
    linear-gradient(90deg, rgba(160,140,240,.030) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

/* Halo d'ambiance violet */
body::before {
  content: "";
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 78vh;
  background:
    radial-gradient(56% 62% at 20% 0%, rgba(140,110,255,.16), transparent 70%),
    radial-gradient(48% 55% at 82% 2%, rgba(96,64,220,.13), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
svg { width: 100%; height: 100%; fill: none; stroke: currentColor;
      stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
ul { list-style: none; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(160,140,240,.14); border-radius: 99px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(160,140,240,.26);
  background-clip: content-box; }

::selection { background: rgba(155,135,245,.32); }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ==========================================================================
   Logo
   ========================================================================== */

/* Le sprite ne sert qu'a heberger les <symbol> : il ne doit rien occuper
   ni rien peindre. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ==========================================================================
   Ecran de chargement
   ========================================================================== */

.boot {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-content: center; gap: 20px; justify-items: center;
  background: var(--bg);
  transition: opacity .4s var(--ease), visibility .4s;
}
.boot.is-gone { opacity: 0; visibility: hidden; }
.boot__mark {
  width: 58px; height: 58px;
  filter: drop-shadow(0 0 26px rgba(155,135,245,.55));
  animation: bootpulse 1.6s var(--ease) infinite;
}
.boot__word {
  width: 132px; height: auto; color: var(--text-2);
  animation: bootfade .9s var(--ease) both .15s;
}
@keyframes bootpulse {
  0%, 100% { transform: scale(1); opacity: .92; }
  50%      { transform: scale(1.07); opacity: 1; }
}
@keyframes bootfade { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Structure
   ========================================================================== */

.shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) 0;
  height: 100dvh;
  transition: grid-template-columns .28s var(--ease);
}
.shell.chat-open { grid-template-columns: var(--sidebar-w) minmax(0,1fr) var(--chat-w); }
.shell.rail { grid-template-columns: var(--sidebar-collapsed) minmax(0,1fr) 0; }
.shell.rail.chat-open {
  grid-template-columns: var(--sidebar-collapsed) minmax(0,1fr) var(--chat-w); }

/* --- barre laterale --- */
.sidebar {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-1), var(--bg));
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar__head {
  height: var(--topbar-h); display: flex; align-items: center;
  gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand__mark {
  width: 30px; height: 30px; flex: none;
  filter: drop-shadow(0 3px 10px rgba(155,135,245,.45));
  transition: transform .3s var(--ease), filter .3s;
}
.brand:hover .brand__mark {
  transform: rotate(-14deg) scale(1.06);
  filter: drop-shadow(0 3px 16px rgba(155,135,245,.75));
}
.brand__word {
  width: 84px; height: 15px; flex: none; color: var(--text);
  transition: color .2s;
}
.brand:hover .brand__word { color: #fff; }
.brand--mobile { display: none; }
.sidebar__collapse { margin-left: auto; width: 26px; height: 26px; }
.shell.rail .brand__word,
.shell.rail .nav__txt,
.shell.rail .nav__label,
.shell.rail .nav__tag,
.shell.rail .online-pill span:not(.dot) { display: none; }
.shell.rail .sidebar__collapse { transform: rotate(180deg); }
.shell.rail .sidebar__head { justify-content: center; padding: 0 8px; }
.shell.rail .nav__item { justify-content: center; padding: 10px; }
.shell.rail .nav__label { display: block; height: 12px; font-size: 0; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav__label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--muted); padding: 16px 10px 8px; font-weight: 700;
}
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: background .15s, color .15s; position: relative;
}
.nav__item:hover { background: rgba(160,140,240,.055); color: var(--text); }
.nav__item.is-active { background: var(--violet-dim); color: #fff; }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -10px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 18px;
  border-radius: 0 3px 3px 0; background: var(--violet);
  box-shadow: 0 0 12px var(--violet);
}
.nav__ico { width: 18px; height: 18px; flex: none; opacity: .95; }
.nav__ico svg { stroke-width: 1.7; }
.nav__item.is-active .nav__ico { color: var(--violet); }
.nav__txt { flex: 1; }
.nav__tag {
  font-size: 9px; text-transform: uppercase; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 5px; font-weight: 800;
  background: var(--violet-dim); color: var(--violet);
}
.nav__tag--gold { background: var(--gold-dim); color: var(--gold); }
.nav__dot { width: 7px; height: 7px; border-radius: 99px; background: var(--gold);
  box-shadow: 0 0 8px var(--gold); }

/* Console operateur : detachee du reste, avec le nombre de retraits qui
   attendent une decision. C'est le seul compteur de la barre laterale, il
   doit se voir meme quand le menu est replie. */
.nav__item--admin { margin-top: 14px; border: 1px dashed var(--line-2); }
.nav__item--admin .nav__ico { color: var(--gold); }
.nav__count {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  background: var(--red); color: #fff; font-family: var(--mono);
  box-shadow: 0 0 10px -1px var(--red);
}
.shell.rail .nav__item--admin { position: relative; }
.shell.rail .nav__count {
  position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px;
  font-size: 9px; padding: 0 3px;
}

.sidebar__foot { padding: 12px; border-top: 1px solid var(--line); flex: none; }
.sidebar__legal {
  display: flex; gap: 6px; justify-content: center; margin-top: 8px;
  font-size: 11px; color: var(--muted);
}
/* 17 px de haut, sans marge autour : « 18+ » et « Jeu responsable » sont
   precisement les liens qu'un joueur doit pouvoir atteindre du premier coup,
   y compris au doigt. On leur donne de la hauteur sans changer la ligne. */
.sidebar__legal a {
  color: var(--muted); display: inline-flex; align-items: center;
  min-height: 28px; padding: 0 2px;
}
.sidebar__legal a:hover { color: var(--text-2); }
.shell.rail .sidebar__legal { display: none; }
.online-pill {
  display: flex; align-items: center; gap: 7px; font-size: 12px;
  color: var(--muted); padding: 7px 10px; border-radius: var(--r-sm);
  background: rgba(160,140,240,.04);
}
/* Flux temps reel interrompu : le compteur ne veut plus rien dire, il ne
   doit pas continuer a clignoter en vert comme si tout allait bien. */
.online-pill.is-off { color: var(--gold); background: var(--gold-dim); }
.online-pill.is-off .dot { background: var(--gold); animation: none;
  box-shadow: none; }

.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--muted);
  flex: none; position: relative; }
.dot--live { background: var(--green); }
/* L'onde de la pastille « en direct ». Elle bat sur toutes les pages, en
   permanence : c'est exactement le genre d'animation qu'il ne faut pas
   peindre. Un disque qui grandit et s'efface (transformation + opacite)
   est compose par la carte graphique et ne coute rien ; l'ancienne version
   animait un `box-shadow`, donc un repeint par image, a cote du tapis de
   blackjack et de la courbe du crash. */
.dot--live::after {
  content: ""; position: absolute; inset: 0; border-radius: 99px;
  background: rgba(16,212,146,.5);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%        { transform: scale(1); opacity: .65; }
  70%, 100% { transform: scale(2.8); opacity: 0; }
}

/* --- zone principale --- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(11,8,22,.86);
  backdrop-filter: blur(14px);
  position: relative; z-index: 20;
}
.topbar__spacer { flex: 1; }
.topbar__menu { display: none; }
.topbar__actions { display: flex; gap: 8px; }

.wallet-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 4px 4px 4px 14px;
}
.wallet-box__bal { display: flex; align-items: baseline; gap: 6px; }
.wallet-box__cur { font-size: 10px; font-weight: 800; color: var(--muted);
  letter-spacing: .06em; }
.wallet-box__amt { font-family: var(--mono); font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.wallet-box__ico {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; color: #12091f;
  background: var(--violet);
}
/* Le bouton porte un montant : chiffres a chasse fixe, pour qu'il ne
   tressaute pas a chaque manche. */
#walletCta { font-variant-numeric: tabular-nums; }
.wallet-box__amt.flash-up { animation: flashUp .6s var(--ease); }
.wallet-box__amt.flash-down { animation: flashDown .6s var(--ease); }
@keyframes flashUp { 0%,100% { color: var(--text); } 30% { color: var(--green); } }
@keyframes flashDown { 0%,100% { color: var(--text); } 30% { color: var(--red); } }

.avatar-btn { border-radius: 50%; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: block;
  background: var(--panel-3); border: 1px solid var(--line-2);
  position: relative; overflow: hidden;
}

.view {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 22px clamp(14px, 3vw, 30px) 60px;
}

/* --- chat --- */
.chat {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-1); border-left: 1px solid var(--line);
  overflow: hidden;
}
.shell:not(.chat-open) .chat { display: none; }
.chat__head {
  height: var(--topbar-h); flex: none; display: flex; align-items: center;
  padding: 0 12px 0 16px; border-bottom: 1px solid var(--line);
}
.chat__title { display: flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: 13px; flex: 1; }
.chat__count { font-size: 11px; color: var(--muted); font-weight: 600;
  background: rgba(160,140,240,.07); padding: 1px 7px; border-radius: 99px; }
.chat__list { flex: 1; overflow-y: auto; padding: 6px 12px 12px;
  display: flex; flex-direction: column; gap: 2px; }
.chat__form { flex: none; display: flex; gap: 6px; padding: 10px 12px 14px;
  border-top: 1px solid var(--line); }
.chat__input {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px;
  transition: border-color .15s;
}
.chat__input:focus { outline: none; border-color: rgba(23,227,156,.5); }

/* --- voile mobile --- */
.scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 30;
  opacity: 0; visibility: hidden; transition: .25s var(--ease);
  backdrop-filter: blur(2px);
}
.scrim.is-on { opacity: 1; visibility: visible; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .shell.chat-open { grid-template-columns: var(--sidebar-w) minmax(0,1fr) 0; }
  .shell.chat-open .chat {
    display: flex; position: fixed; top: 0; right: 0; bottom: 0;
    width: min(340px, 88vw); z-index: 40;
    box-shadow: -20px 0 60px -20px rgba(0,0,0,.8);
  }
}

@media (max-width: 860px) {
  .shell, .shell.rail, .shell.chat-open { grid-template-columns: minmax(0,1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 40;
    transform: translateX(-100%); transition: transform .28s var(--ease);
    box-shadow: 20px 0 60px -20px rgba(0,0,0,.8);
  }
  .shell.menu-open .sidebar { transform: none; }
  .shell.rail .brand__word, .shell.rail .nav__txt,
  .shell.rail .nav__label, .shell.rail .nav__tag { display: revert; }
  .shell.rail .nav__item { justify-content: flex-start; padding: 9px 11px; }
  .topbar__menu { display: grid; }
  .brand--mobile { display: flex; }
  .sidebar__collapse { display: none; }
  .view { padding: 16px 14px 80px; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar__actions .btn--ghost { display: none; }
  .wallet-box { padding-left: 9px; }
  .brand--mobile .brand__word { display: none; }
}

/* Reduit les animations si l'utilisateur le demande */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
