:root {
  --bg: #0c111c;
  --panel: #151d2e;
  --panel-2: #1b2539;
  --border: #28344d;
  --text: #e8edf6;
  --muted: #8fa0bd;
  --green: #2dd4a7;
  --green-bg: rgba(45, 212, 167, 0.12);
  --red: #f2565f;
  --red-bg: rgba(242, 86, 95, 0.12);
  --accent: #4f8cff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #16213a 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 17, 28, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.logo span { color: var(--green); }

.balance-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 18px;
}
.balance-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.balance-value { font-weight: 800; font-size: 18px; color: var(--green); font-variant-numeric: tabular-nums; }

.layout {
  display: grid;
  grid-template-columns: minmax(420px, 560px) minmax(340px, 440px);
  gap: 24px;
  justify-content: center;
  padding: 28px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ---- game panel ---- */
.game-header { display: flex; gap: 12px; margin-bottom: 14px; }
.stat {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

.canvas-wrap { position: relative; border-radius: 12px; overflow: hidden; }
canvas {
  display: block;
  width: 100%;
  background: #0a0f1a;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(10, 15, 26, 0.86);
  backdrop-filter: blur(4px);
  padding: 24px;
}
.overlay.hidden { display: none; }
.overlay h2 { font-size: 30px; font-weight: 800; }
.overlay p { color: var(--muted); line-height: 1.5; }
.disclaimer { font-size: 11px; opacity: 0.7; }

.btn-primary {
  background: linear-gradient(135deg, var(--green), #1fae87);
  color: #04281d;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  padding: 13px 34px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 22px rgba(45, 212, 167, 0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(45, 212, 167, 0.5); }

/* ---- markets ---- */
.panel-title { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.45; }

.market-card { margin-bottom: 14px; opacity: 0; }
.market-card:hover { border-color: #36466b; }

.mk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mk-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.mk-q { font-weight: 700; font-size: 14.5px; line-height: 1.35; }

.odds-track {
  height: 8px;
  border-radius: 999px;
  background: var(--red-bg);
  overflow: hidden;
  margin-bottom: 6px;
}
.odds-fill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #6ee7c8);
}

.odds-labels { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.yes-text { color: var(--green); }
.no-text { color: var(--red); }

.bet-row { display: flex; gap: 8px; }
.stake {
  width: 76px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 10px;
}
.stake:focus { outline: none; border-color: var(--accent); }

.btn-yes, .btn-no {
  flex: 1;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 0;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-yes { background: var(--green-bg); color: var(--green); border-color: rgba(45, 212, 167, 0.35); }
.btn-no { background: var(--red-bg); color: var(--red); border-color: rgba(242, 86, 95, 0.35); }
.btn-yes:hover:not(:disabled), .btn-no:hover:not(:disabled) { filter: brightness(1.35); transform: translateY(-1px); }
.btn-yes:disabled, .btn-no:disabled, .stake:disabled { opacity: 0.4; cursor: not-allowed; }

.pos { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; }
.pos b.yes { color: var(--green); }
.pos b.no { color: var(--red); }

/* ---- history ---- */
.history-card h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; }
#history { list-style: none; max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
#history li {
  font-size: 12.5px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border-left: 3px solid var(--border);
}
#history li.win { border-left-color: var(--green); }
#history li.loss { border-left-color: var(--red); }

@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
}
