:root {
  --bg: #020202;
  --panel: rgba(9, 12, 12, .78);
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .22);
  --text: #f8fbfa;
  --muted: #98a4a0;
  --felt: #061d16;
  --felt-bright: #0b3d2c;
  --gold: #ffd36a;
  --red: #ff4f6d;
  --green: #62ff9c;
  --blue: #76d9ff;
  --shadow: 0 28px 90px rgba(0, 0, 0, .52);
  --deal-speed: 520ms;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(98, 255, 156, .16), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(118, 217, 255, .13), transparent 26%),
    linear-gradient(180deg, #050505, #000);
  overflow-x: hidden;
}
body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}

button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 11px 18px;
  color: #04110b;
  background: linear-gradient(135deg, var(--green), #d7ffe5);
  font-weight: 900;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, opacity .22s ease;
}
button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(98, 255, 156, .24); }
button:disabled { opacity: .36; cursor: not-allowed; }
button.ghost, .icon-button {
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  color: var(--text);
}
button.danger { background: linear-gradient(135deg, var(--red), #ff9caf); color: #1a0307; }

.table-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  place-items: center;
}
.table {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 56px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    radial-gradient(ellipse at center, rgba(13, 97, 65, .82), rgba(6, 29, 22, .96) 48%, rgba(0,0,0,.96) 100%),
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,0));
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr auto 1fr auto;
  gap: 18px;
  padding: 24px;
}
.felt-glow {
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(98,255,156,.12), 0 0 120px rgba(98,255,156,.08);
}
.hud, .controls, .center-rail, .play-zone {
  position: relative;
  z-index: 1;
}
.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .13em;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(44px, 8vw, 110px); line-height: .86; text-shadow: 0 22px 80px rgba(98,255,156,.18); }
h2 { font-size: 28px; }
.bank, .status-panel, .play-zone, .settings-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(18px);
}
.bank { padding: 14px 18px; min-width: 190px; }
.bank span, .bet-line span, .zone-head span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.bank strong, .bet-line strong { display: block; font-size: 26px; color: var(--green); }

.play-zone { padding: 18px; min-height: 190px; }
.zone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.zone-head strong {
  color: var(--gold);
  font-size: 26px;
}
.hand {
  min-height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.center-rail {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}
.shoe {
  height: 104px;
  position: relative;
}
.deck-card {
  position: absolute;
  width: 72px;
  height: 104px;
  left: 28px;
  top: 0;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.22);
  background:
    linear-gradient(135deg, rgba(255,255,255,.14), transparent),
    repeating-linear-gradient(45deg, #101616 0 8px, #162121 8px 16px);
  box-shadow: 0 14px 24px rgba(0,0,0,.28);
}
.deck-card:nth-child(2) { transform: translate(7px, -4px); }
.deck-card:nth-child(3) { transform: translate(14px, -8px); }
.status-panel { padding: 18px; }
.status-panel p { margin: 0 0 14px; color: #dfe7e3; font-size: 18px; font-weight: 850; }
.bet-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chip-tray {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chip {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-size: 13px;
  font-weight: 950;
  border: 6px dashed rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 5px rgba(0,0,0,.2), 0 14px 24px rgba(0,0,0,.28);
  transition: transform .2s ease;
}
.chip:hover { transform: translateY(-4px) rotate(-8deg); }
.chip[data-value="25"] { background: #246dff; }
.chip[data-value="100"] { background: #181818; }
.chip[data-value="500"] { background: #7d35ff; }
.chip[data-value="1000"] { background: #c99c28; color: #120d02; }

.card {
  width: 88px;
  height: 128px;
  border-radius: 8px;
  background: #f6f3e9;
  color: #141414;
  border: 1px solid rgba(0,0,0,.14);
  box-shadow: 0 20px 34px rgba(0,0,0,.32);
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 9px;
  font-weight: 950;
  transform-origin: center;
  animation: dealIn var(--deal-speed) cubic-bezier(.2,.9,.2,1) both;
}
.card.red { color: #cf1736; }
.card.hidden {
  background:
    linear-gradient(135deg, rgba(255,255,255,.18), transparent),
    repeating-linear-gradient(45deg, #07110e 0 7px, #123529 7px 14px);
  color: transparent;
}
.card .top, .card .bottom { display: flex; flex-direction: column; line-height: .9; }
.card .bottom { transform: rotate(180deg); }
.card .suit { font-size: 20px; }
.card .pip { display: grid; place-items: center; font-size: 38px; }

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 12px;
}

.settings-dialog {
  width: min(560px, calc(100% - 32px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}
.settings-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.settings-card {
  padding: 22px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.modal-head, .modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
label { color: var(--muted); font-weight: 850; display: grid; gap: 7px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,.5);
  color: var(--text);
  padding: 12px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(98,255,156,.65); box-shadow: 0 0 0 3px rgba(98,255,156,.08); }

.win-flash { animation: winPulse .8s ease both; }
.lose-shake { animation: shake .42s ease both; }

@keyframes dealIn {
  from { opacity: 0; transform: translate(-260px, -110px) rotate(-18deg) scale(.72); }
  70% { opacity: 1; transform: translate(8px, 2px) rotate(2deg) scale(1.03); }
  to { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes winPulse {
  0% { box-shadow: var(--shadow); }
  45% { box-shadow: 0 0 0 6px rgba(98,255,156,.16), 0 0 90px rgba(98,255,156,.36); }
  100% { box-shadow: var(--shadow); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@media (max-width: 900px) {
  .table-shell { padding: 12px; }
  .table { min-height: calc(100vh - 24px); padding: 16px; }
  .hud, .center-rail, .controls { grid-template-columns: 1fr; }
  .chip-tray { justify-content: flex-start; }
  .hand { justify-content: flex-start; }
  .card { width: 76px; height: 112px; }
}
