:root {
  --bg: #0b0d12; --panel: #131720; --line: #232a37; --text: #e8ecf3; --muted: #8590a3;
  --green: #2fe08b; --green-d: #1aa864; --red: #ff4d5e; --amber: #ffb547; --blue: #5aa9ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { float: right; }
.err { color: var(--red); min-height: 18px; font-size: 13px; margin-top: 8px; }
.logo { font-weight: 800; letter-spacing: .12em; font-size: 20px; }
.logo span { color: var(--green); }

input { width: 100%; background: #0e1219; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; outline: none; }
input:focus { border-color: #3a4558; }
.primary { width: 100%; border: 0; border-radius: 10px; padding: 12px; cursor: pointer; font-weight: 700; color: #04130b; background: linear-gradient(180deg, #47f0a0, var(--green-d)); }
.auth-card a.primary { display: block; box-sizing: border-box; text-align: center; text-decoration: none; background: #9146ff; color: #fff; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary.cash { background: linear-gradient(180deg, #ffd27a, #f09a1a); color: #231400; }
.primary.wait { background: #252c3a; color: var(--muted); }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: #3a4558; }

/* Login */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 30%, #13301f 0, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: grid; gap: 12px; }
.auth-card .logo { font-size: 30px; text-align: center; }
.logo.brand { letter-spacing: 0; font-size: clamp(16px, 4vw, 22px); overflow-wrap: anywhere; }
.auth-card p { text-align: center; margin: 0 0 4px; }
.seg { display: flex; gap: 4px; background: #0e1219; padding: 4px; border-radius: 10px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #222a38; color: var(--text); }

/* Layout */
header { display: flex; align-items: center; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.history { display: flex; gap: 6px; overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.history span { font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: #1a202b; white-space: nowrap; }
.history .lo { color: var(--red); } .history .mid { color: var(--blue); } .history .hi { color: var(--green); } .history .mega { color: var(--amber); }
.me { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.badge { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); border: 1px solid #5a4317; padding: 2px 6px; border-radius: 5px; }
.bal { font-family: 'JetBrains Mono', monospace; font-weight: 700; background: #0e1219; border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; }

main { display: grid; grid-template-columns: 1fr 330px; grid-template-rows: auto auto; gap: 14px; padding: 14px 20px 30px; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }

.stage { position: relative; height: 430px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
#graph { width: 100%; height: 100%; display: block; }
.big { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 72px; pointer-events: none; text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.big.crashed { color: var(--red); }
.big.running { color: var(--text); }
.phase { position: absolute; left: 0; right: 0; top: calc(34% + 92px); text-align: center; color: var(--muted); font-size: 15px; pointer-events: none; }
.phase b { color: var(--red); }

.bet label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.bet label em { font-style: normal; opacity: .7; }
.bet label input { margin-top: 6px; }
.amt { display: flex; gap: 5px; margin-top: 6px; }
.amt input { margin-top: 0; }
.amt button { background: #1c2230; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; cursor: pointer; }
.big-btn { padding: 16px; font-size: 16px; margin-top: 4px; }
#betInfo { margin-top: 10px; min-height: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
td { padding: 6px; border-bottom: 1px solid #1a202b; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
td:first-child { font-family: Inter, sans-serif; }
tr.won td { color: var(--green); }
tr.lost td { color: var(--red); opacity: .8; }
tr.mine td:first-child { font-weight: 700; }
.bot { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.players { max-height: 420px; overflow-y: auto; }
.side { max-height: 420px; overflow-y: auto; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; padding: 12px 16px 30px; }
  header { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .history { order: 3; flex-basis: 100%; }
  .stage { height: 300px; }
  .big { font-size: 48px; }
  .phase { top: calc(34% + 62px); }
}

/* Navigation */
.back { color: var(--muted); text-decoration: none; font-size: 13px; border: 1px solid var(--line); padding: 5px 10px; border-radius: 8px; white-space: nowrap; }
.back:hover { color: var(--text); border-color: #3a4558; }

/* Lobby */
main.lobby { display: block; max-width: 980px; }
.lobby h1 { font-size: 26px; margin: 18px 0 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.game-card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; transition: transform .15s, border-color .15s; }
.game-card:hover { transform: translateY(-3px); border-color: #3a4558; }
.game-card h2 { margin: 12px 0 4px; font-size: 22px; }
.game-card p { margin: 0 0 12px; font-size: 13.5px; }
.gc-art { height: 120px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; }
.crash-card .gc-art { background: radial-gradient(circle at 80% 20%, #12391f, #0e1219 70%); }
.crash-card svg { width: 100%; height: 100%; }
.roulette-card .gc-art { background: radial-gradient(circle, #10301d, #0e1219 70%); }
.roulette-card svg { height: 100px; }
.gc-live { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.gc-live span:first-child { color: var(--green); }
.history.mini { mask-image: none; flex-wrap: wrap; }
.lobby-top { margin-top: 16px; }
.rn { font-family: 'JetBrains Mono', monospace; font-weight: 700; min-width: 28px; text-align: center; color: #fff !important; }
.rn.r { background: #b3202c !important; } .rn.b { background: #23272f !important; } .rn.g { background: #138a45 !important; }

/* Roulette */
.rmain { grid-template-columns: 1fr 330px; }
.rstage { height: 400px; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 0 20px;
  background: radial-gradient(circle at 35% 50%, #0f2a1a, var(--panel) 65%); }
#wheel { width: 360px; height: 360px; flex: none; }
.rinfo { min-width: 170px; text-align: center; }
.rphase { color: var(--muted); font-size: 14px; }
.rtimer { font-family: 'JetBrains Mono', monospace; font-size: 44px; font-weight: 700; margin: 4px 0; }
.rresult { display: inline-grid; place-items: center; min-width: 96px; height: 96px; border-radius: 50%; font-family: 'JetBrains Mono', monospace; font-size: 42px; font-weight: 700; color: #fff; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .3s; }
.rresult.show { opacity: 1; transform: scale(1); }
.rresult.r { background: #b3202c; box-shadow: 0 0 40px rgba(179,32,44,.6); }
.rresult.b { background: #23272f; box-shadow: 0 0 40px rgba(255,255,255,.15); border: 2px solid #3a4150; }
.rresult.g { background: #138a45; box-shadow: 0 0 40px rgba(19,138,69,.6); }
.lbl { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { width: 50px; height: 50px; border-radius: 50%; border: 4px dashed rgba(255,255,255,.55); cursor: pointer; font-weight: 800; font-size: 13px; color: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.4); transition: transform .1s; }
.chip:hover { transform: translateY(-2px); }
.chip.on { outline: 3px solid var(--amber); outline-offset: 2px; }
.rbtns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.rbtns .ghost { flex: 1; }
.rsum { margin-bottom: 8px; } .rsum b { font-family: 'JetBrains Mono', monospace; }
#myWin.win { color: var(--green); font-weight: 700; } #myWin.lose { color: var(--red); }

.rtable-wrap { grid-column: 1 / -1; overflow-x: auto; }
.rtable { display: grid; grid-template-columns: 1.2fr repeat(12, 1fr) 1.2fr; grid-template-rows: repeat(3, 52px) 44px 44px; gap: 4px; min-width: 560px; user-select: none; }
.cell { position: relative; display: grid; place-items: center; border-radius: 6px; cursor: pointer; font-weight: 700; color: #fff; background: #0f5a32; border: 1px solid rgba(255,255,255,.12); font-size: 15px; transition: filter .1s; white-space: nowrap; }
.cell:hover { filter: brightness(1.25); }
.cell.r { background: #b3202c; } .cell.b { background: #1d2129; } .cell.g { background: #138a45; }
.cell.out { background: #0f5a32; font-size: 13px; }
.cell.win { outline: 3px solid var(--amber); outline-offset: -1px; animation: winpulse .8s infinite alternate; }
@keyframes winpulse { to { filter: brightness(1.5); } }
.locked .cell { cursor: not-allowed; }
.cell .mine { position: absolute; right: 3px; top: 3px; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; display: grid; place-items: center;
  background: var(--amber); color: #231400; font-size: 10.5px; font-weight: 800; border: 2px dashed rgba(0,0,0,.35); box-shadow: 0 2px 5px rgba(0,0,0,.5); }
.cell .others { position: absolute; left: 3px; bottom: 3px; right: 3px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; pointer-events: none; }
.ochip { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 9.5px/1 Inter, sans-serif; color: #fff; background: rgba(0,0,0,.55); border-radius: 8px; padding: 2px 5px 2px 2px; }
.ochip i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c); border: 1.5px dashed rgba(255,255,255,.7); }
.ochip.more { padding: 2px 5px; color: var(--muted); }
.rtable { grid-template-rows: repeat(3, 60px) 48px 48px !important; }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

@media (max-width: 900px) {
  .rmain { grid-template-columns: 1fr; }
  .rstage { height: auto; flex-direction: column; gap: 10px; padding: 16px; }
  #wheel { width: 260px; height: 260px; }
  .rtimer { font-size: 32px; }
  .rresult { min-width: 70px; height: 70px; font-size: 30px; }
}

.bj-lobby-card .gc-art { background: radial-gradient(circle, #1a2340, #0e1219 70%); }
.bj-lobby-card svg { height: 110px; }
.bj-mini-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bj-mini-list span { font-size: 11.5px; background: #1a202b; padding: 3px 8px; border-radius: 6px; color: var(--muted); }
.bj-mini-list b { color: var(--text); font-family: 'JetBrains Mono', monospace; }

/* Chat (gemeinsam für Roulette) */
.chat-log { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 4px 2px; font-size: 13.5px; }
.chat-log .cm { line-height: 1.35; overflow-wrap: anywhere; }
.chat-log .cm b { margin-right: 6px; }
.chat-log .cm .ts { color: #4d5668; font-size: 11px; margin-right: 6px; font-family: 'JetBrains Mono', monospace; }
.chat-log .cm.self b { color: var(--amber) !important; }
.chat-log .empty { color: var(--muted); }
.chat-form { display: flex; gap: 8px; margin-top: 8px; }
.rmain { grid-template-columns: 300px minmax(0, 1fr) 330px; max-width: 1640px; align-items: start; }
.rchat { grid-column: 1; grid-row: 1 / span 3; position: sticky; top: 14px; height: calc(100vh - 100px); min-height: 420px; display: flex; flex-direction: column; }
.rchat h3 { margin: 0 0 8px; }
.rchat .chat-log { flex: 1; min-height: 0; }
.rmain .rstage { grid-column: 2; grid-row: 1; }
.rmain > .bet { grid-column: 3; grid-row: 1; }
.rmain .rtable-wrap { grid-column: 2 / 4; grid-row: 2; }
.rmain .players { grid-column: 2; grid-row: 3; }
.rmain .side { grid-column: 3; grid-row: 3; }
@media (max-width: 1150px) {
  .rmain { grid-template-columns: 1fr; }
  .rmain .rstage, .rmain > .bet, .rmain .rtable-wrap, .rmain .players, .rmain .side { grid-column: 1; grid-row: auto; }
  .rchat { grid-column: 1; grid-row: auto; position: static; height: 300px; min-height: 0; order: 10; }
}

.rcustom { display: flex; gap: 6px; margin: -4px 0 6px; }
.rcustom input { flex: 1; }

.pk-lobby-card .gc-art { background: radial-gradient(circle, #10301d, #0e1219 70%); }
.pk-lobby-card svg { height: 110px; }

.cv-lobby-card .gc-art { background: radial-gradient(circle, #1b1430, #0e1219 70%); }
.cv-lobby-card svg { width: 100%; height: 100%; }
