:root {
  color-scheme: dark;
  --gold: #d8b75f;
  --gold-bright: #f2d98c;
  --ink: #f7f2df;
  --muted: #a9b9af;
  --line: rgba(238, 219, 159, .25);
  --red: #c82d35;
  --black: #151918;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 25% 0%, #164b37 0, #071b14 38%, #030b08 100%);
  background-size: 34px 34px, 34px 34px, auto;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(3, 15, 11, .88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 42px; aspect-ratio: 1;
  border: 1px solid var(--gold); color: var(--gold-bright); font-weight: 800; background: #102c21;
}
.brand strong, .brand small { display: block; }
.brand small, .top-stats small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; }
.top-stats { display: flex; align-items: center; gap: clamp(14px, 3vw, 36px); }
.top-stats > div { min-width: 86px; text-align: right; }
.top-stats strong { display: block; margin-top: 3px; color: var(--gold-bright); }
.icon-button {
  width: 42px; height: 42px; border: 1px solid var(--line); color: var(--ink);
  background: #10251d; cursor: pointer; font-size: 20px;
}
.casino {
  display: grid;
  grid-template-columns: minmax(360px, .82fr) minmax(560px, 1.35fr);
  min-height: calc(100vh - 76px);
}
.wheel-zone {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: clamp(20px, 3vw, 48px); border-right: 1px solid var(--line); background: rgba(3, 18, 13, .52);
}
.wheel-stage { position: relative; width: min(100%, 610px); aspect-ratio: 1; }
.wheel-stage::before {
  content: "";
  position: absolute;
  inset: 7% 8% 3%;
  border-radius: 50%;
  box-shadow: 0 34px 26px rgba(0,0,0,.42);
}
#wheel { position: relative; width: 100%; height: 100%; display: block; }
.result-badge {
  position: static;
  display: grid; place-items: center; width: 92px; height: 58px;
  margin-top: 8px;
  border: 1px solid var(--gold); background: rgba(4, 17, 12, .94); box-shadow: 0 12px 28px rgba(0,0,0,.35);
}
.result-badge small { font-size: 9px; color: var(--muted); letter-spacing: 1.4px; }
.result-badge strong { font-size: 25px; line-height: 1; }
.spin-panel { display: grid; grid-template-columns: 1fr 140px 110px; gap: 10px; width: min(100%, 570px); margin-top: 14px; }
.spin-state, .spin-button, .secondary-button { min-height: 54px; border: 1px solid var(--line); }
.spin-state { padding: 9px 14px; background: rgba(5, 27, 19, .9); }
.spin-state small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 1.2px; }
.spin-state strong { display: block; margin-top: 4px; color: var(--gold-bright); }
.spin-button {
  border-color: var(--gold); color: #132015; font-weight: 900; letter-spacing: 1px;
  background: linear-gradient(#f2db91, #b99238); cursor: pointer;
}
.spin-button:disabled { cursor: not-allowed; filter: grayscale(.75); opacity: .46; }
.secondary-button { padding: 0 15px; color: var(--ink); background: #10281e; cursor: pointer; font-weight: 700; font-size: 12px; }
.secondary-button:hover, .icon-button:hover { border-color: var(--gold); }
.bet-zone { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 4vw, 64px); overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: 2px; }
h1, h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; }
h1 { font-size: clamp(32px, 4vw, 54px); }
.message { max-width: 310px; margin: 0; color: var(--muted); text-align: right; font-size: 13px; }
.bet-table {
  display: grid;
  grid-template-columns: 58px repeat(12, minmax(34px, 1fr)) 54px;
  grid-template-rows: repeat(3, 64px) 48px 48px;
  border: 2px solid rgba(232, 214, 157, .62); background: #0a3b2a; box-shadow: 0 24px 55px rgba(0,0,0,.3);
}
.bet-cell {
  position: relative; display: grid; place-items: center; min-width: 0;
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  color: white; background: transparent; cursor: pointer; font-weight: 800;
}
.bet-cell > span:first-child { position: relative; z-index: 1; }
.bet-cell.has-bet > span:first-child { opacity: .32; }
.bet-cell:hover { box-shadow: inset 0 0 0 2px var(--gold-bright); }
.bet-cell.red { background: linear-gradient(145deg, #d23b42, #9f1721); }
.bet-cell.black { background: linear-gradient(145deg, #202725, #0d1110); }
.bet-cell.zero { grid-row: 1 / 4; background: linear-gradient(145deg, #15965e, #087145); font-size: 24px; }
.bet-cell.column-bet { background: rgba(7, 49, 35, .96); color: var(--gold-bright); }
.bet-cell.dozen { grid-column: span 4; }
.bet-cell.outside { grid-column: span 2; }
.bet-cell:nth-child(41) { grid-column: 2 / span 4; }
.bet-cell:nth-child(44) { grid-column: 2 / span 2; }
.bet-cell .placed-chip {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: #152016;
  background: radial-gradient(circle at 32% 28%, #fff4b9, var(--gold-bright) 42%, #b58e37 100%);
  border: 3px dashed #6c5727;
  box-shadow: 0 5px 12px rgba(0,0,0,.55);
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}
.controls { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 24px; }
.chips { display: flex; gap: 10px; }
.chip {
  width: clamp(46px, 5vw, 62px); aspect-ratio: 1; border-radius: 50%; border: 4px dashed rgba(255,255,255,.48);
  outline: 2px solid #172019; color: #122017; background: #d9bd68; cursor: pointer; font-weight: 900;
  box-shadow: 0 5px 12px rgba(0,0,0,.34);
}
.chip:nth-child(2) { background: #eef1e7; }
.chip:nth-child(3) { color: white; background: #2b79b8; }
.chip:nth-child(4) { color: white; background: #bd343e; }
.chip:nth-child(5) { color: white; background: #282c2b; }
.chip.selected { transform: translateY(-7px); outline-color: var(--gold-bright); box-shadow: 0 9px 18px rgba(0,0,0,.5); }
.quick-actions { display: flex; gap: 8px; }
.history-panel {
  position: fixed; z-index: 20; top: 0; right: 0; width: min(390px, 92vw); height: 100vh;
  padding: 28px; transform: translateX(105%); transition: transform 220ms ease;
  border-left: 1px solid var(--line); background: #071b14; box-shadow: -25px 0 60px rgba(0,0,0,.45);
}
.history-panel.open { transform: translateX(0); }
.history-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.history-head small { color: var(--gold); letter-spacing: 1.4px; }
.history-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-height: calc(100vh - 180px); padding: 24px 2px; overflow: auto; }
.history-number { display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; color: white; font-weight: 800; }
.history-number.red { background: var(--red); }
.history-number.black { background: var(--black); border: 1px solid #3c4844; }
.history-number.green { background: #168c58; }
.empty-history { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 40px 0; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.red-dot { background: var(--red); } .black-dot { background: #252c2a; } .green-dot { background: #168c58; }
.overlay { position: fixed; z-index: 19; inset: 0; display: none; background: rgba(0,0,0,.58); }
.overlay.show { display: block; }
@media (max-width: 1050px) {
  .casino { grid-template-columns: minmax(0, 1fr); }
  .wheel-zone, .bet-zone { min-width: 0; width: 100%; }
  .wheel-zone { border-right: 0; border-bottom: 1px solid var(--line); }
  .wheel-stage { width: min(78vw, 560px); }
}
@media (max-width: 700px) {
  .topbar { height: 68px; padding: 0 10px; }
  .brand small { display: none; }
  .top-stats { gap: 8px; }
  .top-stats > div { min-width: 58px; }
  .icon-button { width: 38px; height: 38px; }
  .casino { min-height: calc(100vh - 68px); }
  .wheel-zone { padding: 18px 12px 24px; }
  .wheel-stage { width: min(95vw, 520px); }
  .spin-panel { grid-template-columns: 1fr 105px; }
  .spin-panel .secondary-button { grid-column: 1 / -1; min-height: 42px; }
  .bet-zone { padding: 30px 10px 45px; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; }
  .table-head { align-items: start; }
  .message { display: none; }
  .bet-table { grid-template-columns: 44px repeat(12, 42px) 50px; grid-template-rows: repeat(3, 54px) 44px 44px; min-width: 598px; }
  .bet-cell { font-size: 11px; }
  .bet-cell .placed-chip { width: 27px; height: 27px; border-width: 2px; font-size: 8px; }
  .controls { align-items: flex-start; flex-direction: column; }
  .chips { width: 100%; justify-content: space-between; gap: 5px; }
  .quick-actions { width: 100%; }
  .quick-actions button { flex: 1; }
}
@media (max-width: 430px) {
  .brand > span:last-child { display: none; }
}
