/* ========= Pryve · moteur crash : styles partagés (variables surchargées par chaque jeu) ========= */
:root {
  --bg: #0e0e0e;
  --panel: #1b1c1d;
  --panel-2: #141516;
  --panel-3: #101112;
  --border: #2c2d30;
  --border-light: #3e4045;
  --text: #ffffff;
  --muted: #9ea0a3;
  --red: #e50539;
  --green: #28a909;
  --green-border: #b2f2a3;
  --green-row: #123405;
  --green-row-border: #427f00;
  --orange: #d07206;
  --orange-border: #ffbd71;
  --cancel: #cb011a;
  --cancel-border: #ff7171;
  --blue: #34b4ff;
  --purple: #913ef8;
  --pink: #c017b4;
  --yellow: #e69308;
  --accent: #e50539;
  --bet-btn: #28a909; --bet-btn-border: #b2f2a3; --bet-btn-hover: #2fc40a;
  --cashout-btn: #d07206; --cashout-btn-border: #ffbd71; --cashout-btn-hover: #ea8408;
  --cancel-btn: #cb011a; --cancel-btn-border: #ff7171; --cancel-btn-hover: #e2061e;
  --stage-bg: #0d0d0f;
  --radius: 10px;
  --topbar-h: 46px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  touch-action: manipulation;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
input { font-family: inherit; }
[hidden] { display: none !important; }

.app { min-height: 100%; display: flex; flex-direction: column; }

/* ========= Top bar ========= */
.topbar {
  height: var(--topbar-h);
  background: var(--panel);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid #000;
  position: relative; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; font-size: 22px; font-style: italic; letter-spacing: -0.5px; white-space: nowrap; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.logo { min-width: 0; }
.logo span { overflow: hidden; text-overflow: ellipsis; }
.hub-link { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px; border-radius: 16px; border: 1px solid var(--border); color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.hub-link:hover { color: #fff; border-color: var(--border-light); }
.hub-link img { height: 18px; width: auto; display: block; }
@media (max-width: 640px) { .hub-link span { display: none; } .hub-link { padding: 3px 6px; } }
.avatar-btn { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; border: 2px solid var(--border-light); display: inline-flex; flex: 0 0 auto; }
.avatar-btn img { width: 100%; height: 100%; display: block; }
.avatar-btn:hover { border-color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; position: relative; }
.howto-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--yellow); color: #5f3816; border-radius: 20px;
  padding: 3px 10px 3px 4px; font-size: 12px; font-weight: 600;
}
.howto-btn .q { width: 18px; height: 18px; border-radius: 50%; background: #5f3816; color: var(--yellow); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; }
.balance { color: var(--green); font-weight: 700; font-size: 15px; white-space: nowrap; }
.balance .cur { color: var(--muted); font-weight: 600; font-size: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); }
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.06); }

/* ========= Menu ========= */
.menu {
  position: absolute; right: 0; top: 40px; width: 270px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.6); padding: 6px; z-index: 30;
}
.menu-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; width: 100%; text-align: left; border-radius: 8px 8px 0 0; }
.menu-user:hover { background: rgba(255,255,255,.05); }
.menu-user .avatar { width: 38px; height: 38px; border-radius: 50%; }
.menu-user-name { font-weight: 700; }
.menu-user-sub { font-size: 11px; color: var(--muted); }
.menu-user .chev { margin-left: auto; color: var(--muted); font-size: 20px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 8px; border-radius: 8px; font-size: 13px; text-align: left; color: #fff;
}
.menu-item:hover { background: rgba(255,255,255,.05); }
.menu-item .mi-icon { width: 20px; text-align: center; font-size: 14px; }
.menu-item .switch { margin-left: auto; }
.menu-item.danger { color: #ff7171; }
.lang-group { margin-left: auto; display: flex; gap: 4px; }
.lang-group button { padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--border); }
.lang-group button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Switch */
.switch { position: relative; display: inline-block; width: 30px; height: 16px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: #4d4f54; border-radius: 16px; transition: background .15s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(14px); }
.switch input:disabled + .slider { opacity: .5; cursor: default; }

/* ========= Layout ========= */
.layout {
  flex: none; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 6px;
  padding: 6px; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
  min-height: 0;
}
.game-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 0; }

/* ========= Side panel ========= */
.side-panel { background: var(--panel); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs, .subtabs { display: flex; background: var(--panel-2); border-radius: 20px; margin: 8px auto 4px; padding: 2px; width: max-content; }
.tab, .subtab { padding: 4px 14px; border-radius: 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tab.active, .subtab.active { background: var(--border); color: #fff; }
.tab-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bets-summary { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 6px; }
.bets-title { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.bets-count { font-size: 18px; font-weight: 700; line-height: 1.1; }
.prev-btn { display: flex; align-items: center; gap: 5px; border: 1px solid #767b85; border-radius: 16px; padding: 3px 10px; font-size: 11px; color: var(--muted); }
.prev-btn.active { background: var(--border); color: #fff; }
.bets-table-head { display: grid; grid-template-columns: minmax(0, 1fr) 62px 54px 78px; padding: 2px 10px 4px; font-size: 11px; color: var(--muted); }
.bets-table-head span:not(:first-child) { text-align: right; }
.bets-list { flex: 1; overflow-y: auto; padding: 0 6px 6px; min-height: 0; }
.bet-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 62px 54px 78px; align-items: center;
  height: 34px; padding: 0 4px; margin-bottom: 2px;
  background: var(--panel-3); border: 1px solid transparent; border-radius: 8px; font-size: 12px;
}
.bet-row.cashed { background: var(--green-row); border-color: var(--green-row-border); }
.bet-row.me { border-color: #5a4a00; background: #1d1a0a; }
.bet-row.me.cashed { background: var(--green-row); border-color: var(--green-row-border); }
.bet-row .u { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bet-row .u img { width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; }
.bet-row .u span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bet-row.me .u span { color: #fff; font-weight: 600; }
.bet-row .a, .bet-row .w { text-align: right; font-weight: 600; }
.bet-row .w { color: #fff; }
.bet-row .m { text-align: right; }
.mult-chip { display: inline-block; background: #000; border-radius: 12px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.mult-chip.blue { color: var(--blue); }
.mult-chip.purple { color: var(--purple); }
.mult-chip.pink { color: var(--pink); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 12px; }
.side-footer { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 8px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.side-footer b, .stage-footer b { color: var(--green); }
.top-row { display: grid; grid-template-columns: minmax(0,1fr) 62px 54px 78px; align-items: center; gap: 2px; padding: 6px 4px; margin-bottom: 2px; background: var(--panel-3); border-radius: 8px; font-size: 12px; }
.top-row .u { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top-row .u img { width: 24px; height: 24px; border-radius: 50%; }
.top-row .u .nm { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-row .u .dt { color: var(--muted); font-size: 10px; }
.top-row .r { text-align: right; font-weight: 600; }
.top-row .link { color: var(--muted); font-size: 11px; cursor: pointer; text-decoration: underline; text-align: right; }

/* ========= History bar ========= */
.history-wrap { position: relative; z-index: 10; }
.history-bar { display: flex; align-items: center; gap: 6px; height: 30px; }
.history-chips { display: flex; gap: 4px; overflow: hidden; flex: 1; min-width: 0; }
.history-chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { background: #000; border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; flex: 0 0 auto; cursor: pointer; line-height: 18px; }
.chip.blue { color: var(--blue); }
.chip.purple { color: var(--purple); }
.chip.pink { color: var(--pink); }
.chip:hover { outline: 1px solid var(--border-light); }
.history-toggle { display: flex; align-items: center; gap: 2px; background: var(--panel); border-radius: 14px; padding: 4px 8px; color: var(--muted); border: 1px solid var(--border); }
.history-toggle.open { background: var(--border); color: #fff; }
.history-toggle.open .chev { transform: rotate(180deg); }
.history-expanded { position: absolute; left: 0; right: 0; top: 32px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.6); max-height: 50vh; overflow: auto; }
.history-expanded-title { font-size: 11px; color: var(--muted); margin-bottom: 8px; letter-spacing: .3px; }

/* ========= Game stage ========= */
.game-stage {
  display: flex; flex-direction: column; flex: 1; min-height: 240px;
  background: var(--stage-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.stage-canvas { position: relative; flex: 1; min-height: 0; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  pointer-events: none;
}
.stage-overlay[hidden] { display: none; }
.loader .loader-anim { transform-origin: 50px 50px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-text { font-size: 20px; font-weight: 700; letter-spacing: .5px; text-align: center; padding: 0 10px; }
.waiting-bar { width: 160px; height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.waiting-bar-fill { height: 100%; width: 100%; background: var(--accent); border-radius: 3px; }
.stage-footer {
  flex: none; height: 24px;
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px;
  background: #121214; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border);
}
.stage-footer .pf { display: flex; align-items: center; gap: 5px; }
.stage-footer .brand { font-weight: 700; letter-spacing: .5px; opacity: .7; }

/* Toasts (cash out) */
.toasts { position: absolute; top: 10px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 5; }
.toast {
  display: flex; align-items: stretch; border-radius: 22px; overflow: hidden; border: 1px solid var(--green);
  background: #123405; color: #fff; font-size: 12px; animation: toastIn .25s ease-out; pointer-events: auto;
}
.toast .l { padding: 5px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.toast .l .mult { font-size: 15px; font-weight: 700; }
.toast .r { background: var(--green); padding: 5px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.toast .r .amt { font-size: 15px; font-weight: 800; }
.toast.error { background: #3a0b12; border-color: var(--red); }
.toast.error .l { padding: 8px 16px; font-weight: 600; }
.toast.info { background: #1b1c1d; border-color: var(--border-light); }
.toast.info .l { padding: 8px 16px; font-weight: 600; }
.toast.fade { animation: toastOut .3s ease-in forwards; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }

/* ========= Bet panels ========= */
.bet-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bet-panels[data-count="1"] { grid-template-columns: 1fr; }
.bet-panels[data-count="1"] .bet-panel-body { max-width: 520px; margin-left: auto; margin-right: auto; width: 100%; }
.bet-panels[data-count="1"] .auto-row { max-width: 520px; margin-left: auto; margin-right: auto; }
.bet-panel-head { position: relative; }
.panel-ctrls { position: absolute; right: 0; top: 0; display: flex; gap: 4px; }
.panel-ctrl { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #767b85; color: var(--muted); font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.panel-ctrl:hover { color: #fff; border-color: #fff; }
.panel-ctrl.panel-add { color: var(--green); border-color: var(--green); }
.panel-ctrl.panel-add:hover { background: var(--green); color: #fff; }
.bet-panel.locked .panel-remove { opacity: .35; pointer-events: none; }
.bet-panel { background: var(--panel); border-radius: var(--radius); padding: 6px 8px 8px; border: 1px solid transparent; }
.bet-panel.has-bet { border-color: #3b2a00; }
.bet-panel.active { border-color: #8a4200; }
.bet-panel-head { display: flex; justify-content: center; }
.mode-switch { display: flex; background: var(--panel-2); border-radius: 20px; padding: 2px; }
.mode-btn { padding: 3px 18px; border-radius: 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mode-btn.active { background: var(--border); color: #fff; }
.bet-panel-body { display: flex; gap: 8px; margin-top: 8px; }
.bet-controls { width: 150px; flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; }
.amount-box { display: flex; align-items: center; background: #000; border: 1px solid var(--border); border-radius: 20px; height: 34px; padding: 0 6px; }
.amt-btn { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #767b85; color: var(--muted); font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.amt-btn:hover { color: #fff; border-color: #fff; }
.amount-input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font-weight: 700; font-size: 18px; text-align: center; outline: none; }
.quick-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.quick-chips button { background: var(--panel-2); border-radius: 12px; height: 20px; font-size: 12px; font-weight: 700; color: var(--muted); }
.quick-chips button:hover { color: #fff; background: var(--border); }
.bet-action { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bet-note { font-size: 11px; color: var(--muted); text-align: center; height: 14px; line-height: 14px; margin-bottom: 2px; visibility: hidden; }
.bet-note.show { visibility: visible; }
.bet-btn {
  flex: 1; min-height: 64px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); transition: background .12s, transform .06s;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35);
}
.bet-btn:active { transform: scale(.985); }
.bet-btn .bet-btn-label { font-size: 17px; font-weight: 500; letter-spacing: .5px; line-height: 1.1; }
.bet-btn .bet-btn-amount { font-size: 22px; font-weight: 800; line-height: 1.15; }
.bet-btn.bet { background: var(--bet-btn); box-shadow: inset 0 0 0 2px var(--bet-btn-border); }
.bet-btn.bet:hover { background: var(--bet-btn-hover); }
.bet-btn.cancel { background: var(--cancel-btn); box-shadow: inset 0 0 0 2px var(--cancel-btn-border); }
.bet-btn.cancel:hover { background: var(--cancel-btn-hover); }
.bet-btn.cashout { background: var(--cashout-btn); box-shadow: inset 0 0 0 2px var(--cashout-btn-border); }
.bet-btn.cashout:hover { background: var(--cashout-btn-hover); }
.bet-btn.disabled { opacity: .55; pointer-events: none; }
.bet-btn.flash { animation: flash .5s ease-out; }
@keyframes flash { 0% { filter: brightness(1.8); } 100% { filter: none; } }

.auto-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.auto-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.auto-co-label { display: flex; align-items: center; gap: 8px; }
.auto-co-box { display: flex; align-items: center; background: #000; border: 1px solid var(--border); border-radius: 16px; height: 28px; padding: 0 10px; width: 90px; }
.auto-co-box.on { border-color: var(--border-light); }
.auto-co-input { width: 100%; min-width: 0; background: transparent; border: 0; color: #fff; font-weight: 700; font-size: 14px; text-align: right; outline: none; }
.auto-co-input:disabled { color: var(--muted); }
.auto-co-box .x { color: var(--muted); margin-left: 2px; font-weight: 700; }
.bet-panel.locked .bet-controls { opacity: .5; pointer-events: none; }

/* ========= Modal ========= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 620px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.7); border: 1px solid var(--border); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; background: var(--border); border-radius: 12px 12px 0 0; }
.modal-title { font-weight: 700; font-size: 15px; letter-spacing: .3px; }
.modal-body { padding: 16px; overflow: auto; font-size: 13px; color: #d7d8da; }
.modal-body p { margin: 0 0 10px; }
.modal-body ul { padding-left: 18px; margin: 0 0 10px; }
.modal-body li { margin-bottom: 6px; }
.modal-body h4 { margin: 14px 0 6px; color: #fff; font-size: 13px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step { background: var(--panel-2); border-radius: 10px; padding: 12px; text-align: center; }
.step .ico { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.step .ico.g { background: var(--green); }
.step .ico.r { background: var(--red); }
.step .ico.o { background: var(--orange); }
.step b { display: block; color: #fff; margin-bottom: 4px; }
.step span { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 10px; align-items: center; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; background: #000; border-radius: 6px; padding: 5px 8px; color: #fff; }
.kv .v.big { font-family: var(--font); font-size: 18px; font-weight: 800; }
.limits { display: flex; flex-direction: column; gap: 8px; }
.limits .row { display: flex; justify-content: space-between; background: var(--panel-2); padding: 10px 12px; border-radius: 8px; }
.limits .row b { color: #fff; }
.fair-mode { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; }
.fair-mode label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fair-input { display: flex; gap: 6px; }
.fair-input input { flex: 1; background: #000; border: 1px solid var(--border); color: #fff; border-radius: 8px; padding: 7px 10px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; outline: none; }
.btn { background: var(--border); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 12px; }
.btn.primary { background: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 11px; }
.hint { color: var(--muted); font-size: 11px; }
.mybets-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mybets-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.mybets-table td { padding: 6px; border-bottom: 1px solid #222; }
.mybets-table td.r, .mybets-table th.r { text-align: right; }
.mybets-table tr.won td { color: #b2f2a3; }
.mybets-table tr.lost td.win { color: var(--muted); }

/* ========= Responsive ========= */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--topbar-h)); min-height: calc(100dvh - var(--topbar-h)); }
  .side-panel { order: 2; min-height: 360px; max-height: 70vh; }
  .game-column { order: 1; }
  .game-stage { height: 42vh; min-height: 250px; max-height: 420px; flex: none; }
  .modal { max-width: 100%; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 8px; }
  .logo { font-size: 15px; gap: 4px; }
  .topbar-left { gap: 6px; }
  .topbar-right { gap: 5px; flex: 0 0 auto; }
  .balance { font-size: 13px; }
  .balance .cur { font-size: 11px; }
  .howto-btn .t { display: none; }
  .howto-btn { padding: 3px 4px; }
  .layout { padding: 4px; gap: 4px; }
  .game-column { gap: 4px; }
  .game-stage { height: 38vh; min-height: 230px; }
  .bet-panels, .bet-panels[data-count="3"], .bet-panels[data-count="4"] { grid-template-columns: 1fr; gap: 4px; }
  .bet-panel-body { gap: 10px; }
  .bet-controls { width: 46%; flex-basis: 46%; }
  .bet-btn { min-height: 66px; }
  .bet-btn .bet-btn-amount { font-size: 20px; }
  .waiting-text { font-size: 15px; }
  .loader svg { width: 70px; height: 70px; }
  .steps { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv .k { margin-top: 6px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; max-height: 92dvh; }
  .menu { width: calc(100vw - 16px); right: -8px; }
  .side-panel { min-height: 320px; }
  .bets-table-head, .bet-row, .top-row { grid-template-columns: minmax(0, 1fr) 56px 50px 78px; }
  .bets-table-head { font-size: 10px; white-space: nowrap; }
}
@media (max-width: 380px) {
  .bet-controls { width: 44%; flex-basis: 44%; }
  .amount-input { font-size: 16px; }
}
@media (hover: none) {
  .bet-btn.bet:hover { background: var(--bet-btn); }
  .bet-btn.cancel:hover { background: var(--cancel-btn); }
  .bet-btn.cashout:hover { background: var(--cashout-btn); }
}

/* ========= Flux live, lignes perdues, résumé ========= */
.feed { position: absolute; left: 36px; top: 8px; display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 4; max-width: 60%; }
.feed-item { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,.6); border: 1px solid var(--border); border-radius: 14px; padding: 2px 8px 2px 3px; font-size: 11px; color: var(--muted); animation: toastIn .2s ease-out; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-item img { width: 18px; height: 18px; border-radius: 50%; }
.feed-item .nm { color: #fff; font-weight: 600; }
.feed-item .gain { color: #b2f2a3; font-weight: 700; }
.feed-item .loss { color: #ff7171; font-weight: 700; }
.feed-item.crash { border-color: #5a1220; background: rgba(60,8,16,.75); }
.feed-item.fade { animation: toastOut .3s ease-in forwards; }
.bet-row.lost { background: #2a0b12; border-color: #5a1220; }
.bet-row.lost .w { color: #ff7171; }
.bet-row.lost .u span { opacity: .8; }
.bets-live { display: flex; gap: 10px; padding: 0 10px 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; min-height: 14px; }
.bets-live .up { color: #b2f2a3; }
.bets-live .down { color: #ff7171; }
.bets-live b { color: #fff; }

/* ========= Profil ========= */
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-head img { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--border-light); }
.profile-head .nm { font-size: 18px; font-weight: 800; color: #fff; }
.profile-head .since { font-size: 11px; color: var(--muted); }
.profile-field { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.profile-field input { flex: 1; background: #000; border: 1px solid var(--border); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 600; outline: none; }
.profile-field input:focus { border-color: var(--border-light); }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 14px; }
.avatar-grid button { border-radius: 50%; overflow: hidden; border: 3px solid transparent; aspect-ratio: 1; }
.avatar-grid button img { width: 100%; height: 100%; display: block; }
.avatar-grid button.active { border-color: var(--accent); }
.avatar-grid button:hover { border-color: var(--border-light); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 14px; }
.stat { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 16px; font-weight: 800; color: #fff; }
.stat .v.pos { color: #b2f2a3; }
.stat .v.neg { color: #ff7171; }
.profile-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.btn.danger { background: #3a0b12; color: #ff7171; border: 1px solid #5a1220; }
@media (min-width: 641px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .feed { max-width: 75%; top: auto; bottom: 34px; }
  .avatar-btn { width: 28px; height: 28px; }
  .topbar-right { gap: 6px; }
}

/* boutons /2 et x2 (Trader) */
.quick-chips.halfdouble { grid-template-columns: 1fr 1fr; }
.quick-chips.halfdouble button { height: 28px; }
