:root {
  --bg: #0a110e; --felt: #0f2a20; --panel: #121f19; --panel2: #172a21; --border: #25443a;
  --gold: #e8c35a; --gold-d: #b8932f; --text: #e9efe9; --muted: #8fa399;
  --red: #e0556a; --green: #4fd18b; --blue: #6aa9ff; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -10%, #17382b 0%, transparent 70%);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: .3em 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.gold { color: var(--gold); } .win { color: var(--green); } .lose { color: var(--red); }
.noscript { padding: 2rem; text-align: center; }

button, input { font: inherit; color: inherit; }
button {
  cursor: pointer; border: 1px solid var(--border); background: var(--panel2); padding: .55em 1em;
  border-radius: 10px; transition: transform .06s, background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: #1d3629; border-color: var(--gold-d); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.primary { background: linear-gradient(#f0cf6a, #cfa43a); color: #1a1405; border-color: #f6dc8d; font-weight: 700; }
.primary:hover:not(:disabled) { background: linear-gradient(#f7d977, #d9ad40); border-color: #fff0b5; }
.danger { border-color: #6b2a35; color: #ff9aa9; }
input {
  background: #0c1713; border: 1px solid var(--border); border-radius: 10px; padding: .6em .8em; width: 100%;
}
input[type=number] { -moz-appearance: textfield; }

/* --- en-tête --- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .6rem 1rem; background: rgba(10, 17, 14, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; letter-spacing: .06em; color: var(--gold); font-size: 1.15rem; margin-right: auto; }
.chip { display: flex; align-items: center; gap: .5rem; padding: .3rem .8rem; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border); }
.money { color: var(--gold); font-weight: 800; font-variant-numeric: tabular-nums; }
.xpwrap { min-width: 120px; }
.bar { height: 8px; background: #0c1713; border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2f8f63, var(--green)); transition: width .4s; }
.bar.gold > i { background: linear-gradient(90deg, var(--gold-d), var(--gold)); }

nav.tabs { display: flex; gap: .4rem; padding: .7rem 1rem 0; overflow-x: auto; max-width: 1000px; margin: 0 auto; }
nav.tabs button { white-space: nowrap; border-radius: 10px 10px 0 0; border-bottom: none; background: transparent; }
nav.tabs button.on { background: var(--panel); border-color: var(--gold-d); color: var(--gold); }
main { max-width: 1000px; margin: 0 auto; padding: 0 1rem 3rem; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-top: 0; }
.tabs + main .panel:first-child, #view > .panel:first-child { border-top-left-radius: 0; }
.stack > * + * { margin-top: 1rem; }
.narrow { max-width: 440px; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card-box { background: var(--panel2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem; }
.card-box.locked { opacity: .85; border-style: dashed; }
.card-box .icon { font-size: 2.2rem; }
.card-box .grow { flex: 1; }

/* --- connexion --- */
.auth { max-width: 400px; margin: 8vh auto 0; padding: 0 1rem; }
.auth .panel { padding: 1.5rem; }
.auth h1 { text-align: center; color: var(--gold); letter-spacing: .08em; }
.auth form > * + * { margin-top: .8rem; }
.seg { display: flex; gap: .3rem; margin-bottom: 1rem; }
.seg button { flex: 1; } .seg button.on { border-color: var(--gold-d); color: var(--gold); }
.err { color: var(--red); min-height: 1.4em; font-size: .92rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }

/* --- jeux --- */
.game-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: 1rem; flex-wrap: wrap; }
.game-head .grow { flex: 1; min-width: 200px; }
.bet { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.bet input { width: 9em; text-align: right; font-weight: 700; }
.bet button { padding: .4em .7em; }
.choices { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.choice { display: flex; flex-direction: column; align-items: center; min-width: 6.5em; }
.choice small { color: var(--muted); }
.choice.on { border-color: var(--gold); background: #2a2a12; color: var(--gold); }
.stage { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  margin: 1rem 0 0; padding: 1rem; background: var(--felt); border: 1px solid var(--border); border-radius: var(--radius); }
.big { font-size: 3.4rem; line-height: 1; }
.spin { animation: spin .5s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotateY(360deg); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pop { animation: pop .25s ease-out; }
.dice { font-size: 4.2rem; letter-spacing: .15em; }
.reels { display: flex; gap: .6rem; }
.reel { width: 76px; height: 86px; display: grid; place-items: center; font-size: 2.6rem; background: #0b1511;
  border: 2px solid var(--gold-d); border-radius: 12px; box-shadow: inset 0 0 12px #000; }
.ball { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800;
  border: 4px solid var(--gold); }
.ball.rouge { background: #b3243a; } .ball.noir { background: #181818; } .ball.vert { background: #1f8a50; }
.banner { padding: .5rem 1rem; border-radius: 10px; font-weight: 800; font-size: 1.15rem; border: 1px solid; }
.banner.win { color: var(--green); border-color: #2c6e4d; background: #12281e; }
.banner.lose { color: var(--red); border-color: #6b2a35; background: #2a141a; }
.banner.push { color: var(--gold); border-color: var(--gold-d); background: #2a2612; }
.hand { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; min-height: 92px; }
.card { width: 58px; height: 84px; border-radius: 8px; background: #f7f7f2; color: #151515; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 2px 6px #0008; animation: pop .25s ease-out; }
.card.red { color: #c8102e; } .card .r { font-size: 1.3rem; line-height: 1; } .card .s { font-size: 1.5rem; line-height: 1; }
.card.back { background: repeating-linear-gradient(45deg, #1b3f8f, #1b3f8f 6px, #234ca8 6px, #234ca8 12px); border: 3px solid #f7f7f2; }
.bj { width: 100%; text-align: center; }
.bj h3 { color: var(--muted); font-weight: 600; font-size: .95rem; margin-top: .5rem; }

/* --- ferme / boutique / classement --- */
.pips { display: flex; gap: 3px; flex-wrap: wrap; }
.pips i { width: 10px; height: 10px; border-radius: 3px; background: #0c1713; border: 1px solid var(--border); }
.pips i.on { background: var(--gold); border-color: var(--gold); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .6rem; text-align: right; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
tr.me { background: #2a2612; }
.lb-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.lb-tabs button.on { border-color: var(--gold); color: var(--gold); }
.scroll-x { overflow-x: auto; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 20; max-width: min(92vw, 360px); }
.toast { background: var(--panel2); border: 1px solid var(--gold-d); padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 6px 20px #000a; animation: pop .2s; }
.toast.err { border-color: #8a3040; color: #ffb4bf; }

@media (max-width: 560px) {
  .topbar { padding: .5rem .7rem; } .xpwrap { display: none; }
  .big { font-size: 2.8rem; } .reel { width: 64px; height: 74px; font-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- multijoueur : présence, fil d'activité, duel, jackpot --- */
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 6px var(--green); margin-right: .4rem; vertical-align: middle; }
.tag { display: inline-block; align-self: flex-start; font-size: .72rem; padding: .1rem .55rem; border-radius: 999px;
  border: 1px solid var(--gold-d); color: var(--gold); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.feed-list li { padding: .4rem .65rem; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; font-size: .92rem; overflow-wrap: anywhere; }
.pot { font-size: 2.6rem; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
