:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #13251c;
  color: #f4f0df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 28%, rgba(45, 120, 76, 0.55), transparent 44%),
    #101813;
}

button,
a {
  font: inherit;
}

.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.hud,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 18px;
}

.top-actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eyebrow,
h1,
p {
  margin: 0;
}

.eyebrow {
  color: #c9b36a;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.text-button,
.controls button {
  border: 1px solid rgba(244, 240, 223, 0.24);
  border-radius: 8px;
  background: #f0d06b;
  color: #15130c;
  cursor: pointer;
  padding: 10px 14px;
  text-decoration: none;
}

.text-button {
  background: rgba(244, 240, 223, 0.1);
  color: #f4f0df;
}

.craps-shell {
  display: grid;
  gap: 14px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  text-align: center;
}

.hud span {
  display: block;
  color: #d6d2bf;
  font-size: 0.88rem;
}

.hud strong {
  display: block;
  font-size: 1.35rem;
}

.table-scroll {
  overflow: auto;
  border: 12px solid #684429;
  border-radius: 28px;
  background: #1f6f47;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.35);
}

.craps-table {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 860px;
  min-height: 560px;
  padding: 20px;
}

.place-row,
.bottom-row,
.center-layout {
  display: grid;
  gap: 10px;
}

.place-row {
  grid-template-columns: repeat(6, 1fr);
}

.center-layout {
  grid-template-columns: 1fr 2.2fr 1fr;
  min-height: 250px;
}

.bottom-row {
  grid-template-columns: 1.3fr 1fr 1fr;
}

.bet-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 2px solid rgba(244, 240, 223, 0.62);
  border-radius: 8px;
  background: rgba(5, 47, 27, 0.42);
  color: #f4f0df;
  cursor: pointer;
  overflow: hidden;
  padding: 12px;
  text-align: center;
  text-transform: uppercase;
}

.bet-zone span {
  max-width: 100%;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.field-zone {
  background: rgba(155, 64, 37, 0.36);
}

.line-zone {
  background: rgba(31, 69, 122, 0.34);
}

.pass-zone {
  border-width: 4px;
}

.side-zone {
  min-height: 100%;
}

.bet-zone:disabled,
.controls button:disabled,
.text-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.85);
  opacity: 0.55;
}

.bet-zone.has-bet {
  box-shadow: inset 0 0 0 3px rgba(240, 208, 107, 0.4);
}

.bet-zone b {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 52px;
  height: 36px;
}

.felt-chip {
  position: absolute;
  left: 4px;
  bottom: calc(6px + var(--stack-y));
  width: 42px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: #f0d06b;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

.roll-stage {
  display: grid;
  align-content: center;
  gap: 16px;
  border: 2px solid rgba(244, 240, 223, 0.2);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 40%, rgba(240, 208, 107, 0.18), transparent 46%), rgba(0, 0, 0, 0.16);
  overflow: hidden;
  padding: 18px;
  text-align: center;
}

.dice-track {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 22px;
  min-height: 96px;
}

.die {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: #d5232d;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.24), inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}

.die .pip {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.16);
}

.pip-1-1,
.pip-3-2,
.pip-5-5 {
  left: 27px;
  top: 27px;
}

.pip-2-1,
.pip-3-1,
.pip-4-1,
.pip-5-1,
.pip-6-1 {
  left: 14px;
  top: 14px;
}

.pip-2-2,
.pip-3-3,
.pip-4-4,
.pip-5-4,
.pip-6-6 {
  right: 14px;
  bottom: 14px;
}

.pip-4-2,
.pip-5-2,
.pip-6-2 {
  right: 14px;
  top: 14px;
}

.pip-4-3,
.pip-5-3,
.pip-6-5 {
  left: 14px;
  bottom: 14px;
}

.pip-6-3 {
  left: 14px;
  top: 27px;
}

.pip-6-4 {
  right: 14px;
  top: 27px;
}

.rolling .die:first-child {
  animation: rollLeft 1440ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.rolling .die:last-child {
  animation: rollRight 1440ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

#statusText {
  font-size: 1.2rem;
  font-weight: 700;
}

#ruleText {
  color: #d6d2bf;
}

@keyframes rollLeft {
  0% { transform: translate(-42vw, -42px) rotate(-360deg); }
  60% { transform: translate(12px, 8px) rotate(24deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

@keyframes rollRight {
  0% { transform: translate(42vw, -18px) rotate(420deg); }
  62% { transform: translate(-10px, 10px) rotate(-20deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

.test-shell {
  display: grid;
  gap: 16px;
}

.test-results {
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  padding: 16px;
}

.test-results li {
  margin: 8px 0;
}

.pass strong {
  color: #9ff0aa;
}

.fail strong {
  color: #ff9a8a;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .hud {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .table-scroll {
    border-width: 8px;
    border-radius: 18px;
  }
}
