:root {
  --bg: #0e1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --red: #f85149;
  --blue: #2f81f7;
  --green: #3fb950;
  --gold: #d29922;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
header h1 { margin: 0; font-size: 20px; }
.conn { display: flex; gap: 8px; align-items: center; }
.conn input { padding: 6px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); }
.conn input#wsUrl { width: 240px; }
.conn input#token { width: 200px; }
.conn button { padding: 6px 14px; background: var(--blue); color: white; border: 0; border-radius: 4px; cursor: pointer; }
.conn button:hover { opacity: 0.9; }

.badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.badge.offline { background: #3a1d1d; color: var(--red); }
.badge.online  { background: #1d3a1d; color: var(--green); }

main {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.panel h2 { margin: 0 0 10px 0; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.label { color: var(--muted); margin-right: 4px; }

#roundPanel { grid-column: span 2; }
#logPanel   { grid-column: span 3; max-height: 240px; overflow: auto; }

.cards { display: flex; gap: 24px; margin-top: 10px; }
.hand { flex: 1; }
.hand-label { font-weight: bold; font-size: 12px; margin-bottom: 6px; }
.hand-label.red { color: var(--red); }
.hand-label.blue { color: var(--blue); }
.community { margin-top: 14px; }

.card-row { display: flex; gap: 6px; min-height: 60px; }
.card {
  width: 40px; height: 56px;
  background: white; color: black;
  border-radius: 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-weight: bold; font-size: 14px;
  border: 1px solid #444;
}
.card.red-suit { color: #c33; }
.card.placeholder { background: #1f242c; border: 1px dashed var(--border); }

.winner {
  margin-top: 12px;
  padding: 8px;
  border-radius: 4px;
  font-weight: bold;
  text-align: center;
  display: none;
}
.winner.show { display: block; }
.winner.red  { background: #3a1d1d; color: var(--red); }
.winner.blue { background: #1d2c3a; color: var(--blue); }
.winner.tie  { background: #3a341d; color: var(--gold); }
.winner.won  { box-shadow: 0 0 0 2px #2ecc71 inset; }
.winner.lost { box-shadow: 0 0 0 2px #555 inset; }
.payout { margin-top: 6px; font-size: 14px; font-weight: 600; }
.payout.won  { color: #2ecc71; }
.payout.lost { color: #aaa; }
.payout.tie  { color: var(--gold); }
.rank { font-weight: 400; font-size: 12px; color: var(--muted, #aaa); margin-left: 6px; }

.bet-form { display: flex; gap: 8px; }
.bet-form select, .bet-form input {
  padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; color: var(--text); flex: 1;
}
.bet-form button {
  padding: 6px 14px; background: var(--green); color: black; border: 0; border-radius: 4px; cursor: pointer; font-weight: bold;
}
.bet-form button:disabled { background: #555; color: #888; cursor: not-allowed; }
.my-bets { margin-top: 12px; font-size: 12px; }
.my-bet  { padding: 4px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }

.trend-bar { display: flex; height: 32px; border-radius: 4px; overflow: hidden; }
.trend-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; transition: width 0.3s; }
.trend-seg.red  { background: var(--red); color: white; }
.trend-seg.blue { background: var(--blue); color: white; }
.trend-seg.tie  { background: var(--gold); color: black; }

#bigWins { list-style: none; padding: 0; margin: 0; max-height: 180px; overflow: auto; }
#bigWins li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
#bigWins .gold { color: var(--gold); font-weight: bold; }

.log pre { margin: 0; font-size: 11px; color: var(--muted); white-space: pre-wrap; word-break: break-all; }
