/* Charte Centro Jeux : bleu nuit, vert, or, rouge, blanc. */
:root {
  --bg: #040a1f;
  --panel: #0a1433;
  --panel-2: #102049;
  --line: #1f3170;
  --text: #f5f8ff;
  --muted: #b0bcdf;
  --blue: #2f5bea;
  --blue-l: #4c8dff;
  --green: #2fd06a;
  --green-d: #1e8b3a;
  --gold: #ffc61a;
  --gold-l: #ffe58a;
  --red: #ff3b4e;
  --red-d: #d10f1f;
  --radius: 16px;
  color-scheme: dark;
  font-size: 16px;
}
@media (min-width: 1800px) { :root { font-size: 20px; } }   /* écrans TV */
@media (min-width: 2600px) { :root { font-size: 27px; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) radial-gradient(1400px 700px at 15% -15%, #13286b 0%, var(--bg) 60%) no-repeat;
  color: var(--text);
  font: 500 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .78rem; }
[hidden] { display: none !important; }

/* ---------- barre du haut ---------- */
.topbar {
  display: flex; align-items: center; gap: .9rem;
  padding: .55rem max(16px, env(safe-area-inset-left));
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--blue) 0 25%, #fff 25% 50%, var(--green) 50% 75%, var(--gold) 75%) 1;
  background: rgba(4, 10, 31, .85);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
/* Centro Jeux (03/11/2026) : logo CENTRO PLAY (fond bleu déjà dans l'image), plus de plaque blanche */
.brand { display: block; line-height: 0; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.brand img { height: 46px; width: auto; border-radius: 8px; }
.game-name { font-weight: 900; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-size: 1.05rem; }
.conn { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); }
.conn .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--gold); }
.conn[data-state="online"] .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn[data-state="reconnecting"] .dot { background: var(--red); animation: blink 1s infinite; }
.online { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.online strong { color: var(--text); font-variant-numeric: tabular-nums; }
.wallet { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.who-btn { background: none; border: 0; padding: 0; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.who-btn:hover #playerName { color: var(--text); text-decoration: underline; }
.secure-badge { background: var(--gold); color: #2a1c00; border-radius: 99px; padding: .05rem .45rem; font-weight: 800; font-size: .7rem; }
.acct { display: flex; flex-direction: column; gap: .6rem; }
.acct form { display: flex; flex-direction: column; }
.acct-ok { margin: 0; color: var(--green); font-weight: 800; }
.acct-box { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; }
.acct-box summary { cursor: pointer; font-weight: 700; color: var(--blue-l); }
.acct-box[open] summary { margin-bottom: .7rem; }
.acct-msg { min-height: 1.3em; margin: 0; font-weight: 700; }
.acct-msg.ok { color: var(--green); }
.acct-msg.err { color: #ff8f9c; }
.warn { margin: 0 0 .7rem; padding: .5rem .7rem; border-radius: 10px; background: rgba(255, 198, 26, .12); color: var(--gold-l); font-size: .85rem; }
.link-btn.danger { color: #ff8f9c; border-color: rgba(255, 59, 78, .4); align-self: flex-start; }
.wallet .bal { white-space: nowrap; }
.wallet strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; color: var(--gold); display: inline-block; }
.tools { display: flex; gap: 6px; }
.icon-btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; width: 2.5rem; height: 2.5rem; font-size: 1.1rem; display: grid; place-items: center; }

/* ---------- mise en page ---------- */
.layout {
  flex: 1; display: grid; gap: 16px; padding: 14px 16px;
  grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 440px);
  align-items: start;
}
.game { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

.history-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hb-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); flex: none; }
.history { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 85%, transparent); padding: 2px; }
.history::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: .22rem .65rem; font-weight: 800; font-variant-numeric: tabular-nums; font-size: .85rem; }
.chip[data-tier="low"] { color: #ff8f9c; }
.chip[data-tier="mid"] { color: var(--blue-l); }
.chip[data-tier="high"] { color: var(--green); }
.chip[data-tier="top"] { color: #1d1400; background: var(--gold); border-color: var(--gold); }
.chip.new { animation: chipIn .5s ease-out; }

.stage-wrap { position: relative; }
.stage {
  height: clamp(320px, 58vh, 980px);
  background: radial-gradient(120% 90% at 30% 110%, #0d2a6e 0%, #060d2a 55%, #030716 100%);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative;
  box-shadow: inset 0 0 80px rgba(47, 91, 234, .18);
}
.round-stats {
  position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; z-index: 1;
}
.round-stats span { background: rgba(4, 10, 31, .7); border: 1px solid var(--line); border-radius: 99px; padding: .15rem .6rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- composant d'animation ---------- */
.cv { position: absolute; inset: 0; will-change: transform; }
.cv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cv-flash { position: absolute; inset: 0; background: radial-gradient(circle at 60% 40%, #fff 0%, var(--red) 70%); opacity: 0; pointer-events: none; mix-blend-mode: screen; }
.cv-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center; padding: 0 16px;
}
.cv-status { font-weight: 800; letter-spacing: .16em; text-transform: uppercase; font-size: clamp(.85rem, 2vw, 1.35rem); color: var(--muted); min-height: 1.4em; }
.cv-mult {
  font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1;
  font-size: clamp(3rem, 10vw, 9rem); color: #fff;
  text-shadow: 0 0 28px var(--glow, rgba(76, 141, 255, .45)), 0 3px 0 rgba(0,0,0,.55);
  transition: color .3s;
}
.cv-sub { margin-top: .5rem; color: var(--muted); font-size: clamp(.85rem, 1.7vw, 1.15rem); min-height: 1.4em; }
.cv-bar { margin-top: 1rem; width: min(380px, 70%); height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.cv-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green), var(--gold)); transform-origin: left; }

.cv[data-tier="blue"] .cv-mult { --glow: rgba(76, 141, 255, .55); }
.cv[data-tier="green"] .cv-mult { color: #d9ffe6; --glow: rgba(47, 208, 106, .65); }
.cv[data-tier="gold"] .cv-mult { color: var(--gold-l); --glow: rgba(255, 198, 26, .7); }
.cv[data-tier="star"] .cv-mult { color: #fff; --glow: rgba(255, 229, 138, .95); }
.cv[data-phase="running"] .cv-status { color: var(--green); }
/* Écran d'attente : le grand avion occupe le haut, le compte à rebours le bas. */
.cv[data-phase="betting"] .cv-overlay { justify-content: flex-end; padding-bottom: clamp(16px, 6%, 48px); }
.cv[data-phase="betting"] .cv-mult { font-size: clamp(2rem, 6vw, 5rem); }
.cv[data-phase="betting"][data-count] .cv-mult { font-size: clamp(2.6rem, 8vw, 6.5rem); }
.cv-brand { display: none; margin-top: .8rem; background: #fff; border-radius: 12px; padding: 4px 10px; line-height: 0; box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.cv-brand img { height: clamp(28px, 5vh, 52px); width: auto; }
.cv[data-phase="betting"] .cv-brand { display: block; }
.cv[data-count] .cv-mult { color: var(--gold); --glow: rgba(255, 198, 26, .7); }
.cv[data-count] .cv-status { color: var(--gold); }
.cv[data-phase="crashed"] .cv-status { color: var(--red); font-size: clamp(1.2rem, 3.4vw, 2.4rem); }
.cv[data-phase="crashed"] .cv-mult { color: var(--red); --glow: rgba(255, 59, 78, .6); }
.cv .cv-mult.cv-pop { animation: pop .38s cubic-bezier(.2,.9,.3,1.4); }
.cv[data-fx="off"] .cv-mult { text-shadow: none; animation: none !important; }

.gain-float {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, 0); z-index: 3; pointer-events: none;
  font-weight: 900; font-size: clamp(1.8rem, 5vw, 3.6rem); color: var(--green);
  text-shadow: 0 0 22px rgba(47, 208, 106, .8), 0 2px 0 rgba(0,0,0,.6);
  animation: gainUp 1.7s ease-out forwards;
}
.gain-float[data-fx="off"] { animation: gainFade 1.7s linear forwards; }
.coin {
  position: fixed; z-index: 50; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #fff6c8 0 18%, var(--gold) 45%, #b47b00 100%);
  box-shadow: 0 0 10px rgba(255, 198, 26, .8);
}

/* ---------- emplacements de mise ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.slot { display: flex; flex-direction: column; gap: .6rem; position: relative; }
.slot[data-auto="true"] { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.slot-head { display: flex; align-items: center; justify-content: space-between; }
.slot-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.seg { display: inline-flex; background: #060d2a; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 99px; padding: .3rem .85rem; font-weight: 700; font-size: .85rem; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.amount-row { display: grid; grid-template-columns: 2.6rem 1fr 2.6rem; gap: 6px; }
.amount-row input { text-align: center; font-size: 1.25rem; font-weight: 800; }
.step { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 1.3rem; font-weight: 800; }
.slot input[type="text"], .field input, .field select, .chat-form input {
  background: #060d2a; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem;
  color: var(--text); font-variant-numeric: tabular-nums; width: 100%; min-width: 0;
}
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.quick button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: .4rem 0; font-weight: 700; font-size: .85rem; }
.toggle { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--muted); }
.toggle input[type="checkbox"], .check input { width: 1.15rem; height: 1.15rem; accent-color: var(--green); flex: none; }
.toggle .auto-x { width: 5.2rem !important; flex: none; text-align: center; padding: .35rem .4rem !important; }
.autobet { display: flex; flex-direction: column; gap: .5rem; padding: .6rem; border: 1px dashed var(--line); border-radius: 12px; }
.ab-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ab-grid label { display: flex; flex-direction: column; gap: .2rem; font-size: .72rem; color: var(--muted); }
.ab-grid input { padding: .4rem .5rem !important; text-align: center; }
.ab-toggle { background: var(--panel-2); border: 1px solid var(--green); color: var(--green); border-radius: 10px; padding: .5rem; font-weight: 800; }
.ab-toggle[data-on="true"] { background: var(--green); color: #032010; }
.ab-status { margin: 0; font-size: .8rem; color: var(--green); min-height: 1em; }
.slots-tools { display: flex; gap: 10px; flex-wrap: wrap; }

.action {
  width: 100%; border: 0; border-radius: 14px; padding: 1rem .8rem;
  font-weight: 900; font-size: 1.2rem; font-variant-numeric: tabular-nums; letter-spacing: .01em;
  background: var(--panel-2); color: var(--text); transition: filter .15s, transform .06s, box-shadow .2s;
}
.action:hover:not(:disabled) { filter: brightness(1.08); }
.action:active:not(:disabled) { transform: scale(.98); }
.action:disabled { cursor: default; opacity: .85; }
.action[data-kind="bet"] { background: linear-gradient(180deg, #38de78, var(--green-d)); color: #fff; box-shadow: 0 4px 0 #0f5a23, 0 0 18px rgba(47, 208, 106, .35); text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.action[data-kind="cashout"] { background: linear-gradient(180deg, #ffd84d, #f0a800); color: #2a1c00; box-shadow: 0 4px 0 #9a6b00, 0 0 26px rgba(255, 198, 26, .55); animation: pulse 1s ease-in-out infinite; }
.action[data-kind="placed"] { background: #13306f; color: var(--blue-l); }
.action[data-kind="won"] { background: #0c3a1f; color: var(--green); }
.action[data-kind="lost"] { background: #3a0d16; color: #ff8f9c; }
.hint { min-height: 1.2em; margin: 0; color: var(--muted); font-size: .8rem; }

/* ---------- panneau latéral ---------- */
.side { position: sticky; top: 84px; display: flex; flex-direction: column; padding: 0; max-height: calc(100dvh - 100px); min-height: 420px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: .8rem .4rem; font-weight: 800; font-size: .88rem; color: var(--muted); border-bottom: 3px solid transparent; position: relative; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.tabs .count { background: var(--panel-2); border-radius: 99px; padding: 0 .45rem; font-size: .75rem; margin-left: .2rem; }
.dot-new { display: inline-block; width: .5rem; height: .5rem; background: var(--red); border-radius: 50%; vertical-align: middle; }
.tab-panel { display: none; padding: 12px 14px; overflow: auto; flex: 1; min-height: 0; }
.tab-panel.active { display: block; }
.players, .top { list-style: none; margin: 0; padding: 0; }
.players li { display: grid; grid-template-columns: 1fr auto auto; gap: .7rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: .9rem; }
.players li.me .who { color: var(--gold); font-weight: 700; }
.players li .st { min-width: 7em; text-align: right; color: var(--muted); }
.players li[data-status="cashed"] { background: linear-gradient(90deg, rgba(47, 208, 106, .12), transparent); }
.players li[data-status="cashed"] .st { color: var(--green); font-weight: 700; }
.players li[data-status="lost"] .st { color: #ff8f9c; }
.top li { display: grid; grid-template-columns: 1.8rem 1fr auto auto; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: .9rem; }
.top .rank { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--panel-2); font-weight: 900; font-size: .8rem; }
.top li:nth-child(1) .rank { background: var(--gold); color: #2a1c00; }
.top li:nth-child(2) .rank { background: #dfe6f5; color: #0a1433; }
.top li:nth-child(3) .rank { background: #d68b4a; color: #2a1200; }
.top .mult { color: var(--blue-l); font-weight: 700; }
.top .gain { color: var(--green); font-weight: 800; }
.top li.me .who { color: var(--gold); }
.chat.active { display: flex; flex-direction: column; gap: 8px; }
.chat-log { flex: 1; min-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.msg { margin: 0; font-size: .88rem; overflow-wrap: anywhere; }
.msg .t { color: var(--muted); font-size: .72rem; margin-right: .4rem; }
.msg strong { color: var(--blue-l); margin-right: .35rem; }
.msg.me strong { color: var(--gold); }
.chat-form { display: flex; gap: 6px; }
.chat-form .action { width: auto; padding: .55rem .9rem; font-size: .9rem; border-radius: 10px; box-shadow: none; }

/* ---------- divers ---------- */
.fair-note { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .4rem 16px 1rem; color: var(--muted); font-size: .8rem; }
.fair-note p { margin: 0; flex: 1; min-width: 260px; }
.fair-note code { color: var(--text); }
.fair-note .credit { flex-basis: 100%; min-width: 0; font-size: .72rem; opacity: .8; }
.link-btn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .8rem; color: var(--blue-l); font-size: .85rem; }
.small-btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 .8rem; flex: none; }

.offline {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: rgba(4, 10, 31, .85); border-radius: var(--radius); text-align: center; z-index: 4;
}
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--gold); animation: spin 1s linear infinite; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); width: min(520px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog h2 { margin-top: 0; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.field input[type="range"] { padding: 0; accent-color: var(--gold); }
.check { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.verify input { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }
.vresult p { margin: .3rem 0; font-weight: 700; }
.vresult .ok { color: var(--green); }
.vresult .err { color: var(--red); }
.row { display: flex; gap: 10px; margin-top: .8rem; }
.row.tight { margin: 0; gap: 6px; }

.toasts { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 40; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 5px solid var(--blue-l); border-radius: 10px; padding: .7rem 1rem; box-shadow: 0 8px 30px rgba(0,0,0,.5); transition: opacity .4s, transform .4s; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- téléphone ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 10px 16px; }
  .side { position: static; max-height: none; min-height: 0; }
  .tab-panel { max-height: 50vh; }
  .stage { height: 46dvh; min-height: 260px; }
}
@media (max-width: 640px) {
  .topbar { gap: .5rem; padding: .4rem 16px; }
  .brand img { height: 36px; }
  .game-name, #connText, .online { display: none; }
  .tools { gap: 4px; }
  .icon-btn { width: 2rem; height: 2rem; font-size: .95rem; border-radius: 8px; }
  .wallet strong { font-size: 1.1rem; }
  .secure-badge .lbl { display: none; }
  .slots { grid-template-columns: 1fr; }
  .action { font-size: 1.1rem; padding: .9rem .6rem; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes pop { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { box-shadow: 0 4px 0 #9a6b00, 0 0 38px rgba(255, 198, 26, .85); } }
@keyframes chipIn { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes gainUp {
  0% { transform: translate(-50%, 20px) scale(.6); opacity: 0; }
  15% { transform: translate(-50%, 0) scale(1.15); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(-50%, -90px) scale(1); opacity: 0; }
}
@keyframes gainFade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cv-mult, .spinner, .conn .dot, .action, .chip { animation: none !important; }
  .toast { transition: none; }
}
