/* Craps: the table and dice, seats, the betting layout and proposition bets,
   the console and panels. Loaded after style.css on the /craps/ pages. The
   controls shared with the other tables (settings bar, chips, panels, switches)
   are repeated here so each game can change independently. */

/* ---------- intro ---------- */

.intro {
  padding: 18px 0 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 4px 28px;
}

.intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.2;
  color: var(--ivory);
}

.intro-lead {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- game bar ---------- */

.game-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 24px;
  margin-bottom: 12px;
}

.bank {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.bank-label {
  font-size: 13px;
  color: var(--muted);
}

.bank-value {
  font-family: "Bodoni Moda", serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--brass-hi);
  font-variant-numeric: tabular-nums lining-nums;
}

.text-btn {
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-btn:hover:not(:disabled) {
  color: var(--brass-hi);
}

.text-btn[data-armed="1"] {
  color: var(--warn);
}

.text-btn:disabled {
  opacity: 0.4;
}

.settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
}

.set {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-label {
  font-size: 12px;
  color: var(--muted);
}

.seg,
.stepper {
  display: inline-flex;
  border: 1px solid rgba(212, 175, 106, 0.4);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
}

.seg button,
.stepper button {
  min-width: 34px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  background: none;
  font-size: 13px;
}

.seg button + button {
  border-left: 1px solid rgba(212, 175, 106, 0.25);
}

.seg button[aria-pressed="true"] {
  background: var(--brass);
  color: var(--room-deep);
  font-weight: 700;
}

.stepper output {
  min-width: 28px;
  display: grid;
  place-items: center;
  font-weight: 700;
  border-left: 1px solid rgba(212, 175, 106, 0.25);
  border-right: 1px solid rgba(212, 175, 106, 0.25);
}

.stepper button:disabled,
.seg button:disabled {
  opacity: 0.45;
}

.select {
  height: 30px;
  padding: 0 26px 0 10px;
  border: 1px solid rgba(212, 175, 106, 0.4);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23D4AF6A'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none;
  -webkit-appearance: none;
  font-size: 13px;
}

.select option {
  background: var(--room-deep);
}

.select:disabled {
  opacity: 0.45;
}

/* ---------- table ---------- */

.table-wrap {
  position: relative;
  width: 100%;
  max-width: max(940px, calc((100vh - 430px) * 2.15 + 32px));
  margin: 0 auto;
}

.table-rim {
  position: relative;
  width: 100%;
  padding: 16px;
  border-radius: 34px 34px 50% 50% / 34px 34px 78% 78%;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 40%),
    linear-gradient(180deg, #3a2219, #1c0e09 60%, #0d0604);
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -2px 0 rgba(0, 0, 0, 0.6);
}

.table-rim::before {
  /* thin brass edge between rail and felt */
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 30px 30px 50% 50% / 30px 30px 78% 78%;
  border: 1px solid rgba(212, 175, 106, 0.45);
  pointer-events: none;
}


.felt-msg {
  position: absolute;
  top: calc(4% + var(--ch) + 46px);
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  max-width: min(78%, 560px);
  margin: 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(6, 26, 23, 0.72);
  border: 1px solid rgba(212, 175, 106, 0.35);
  color: var(--ivory);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.felt-msg:empty {
  display: none;
}

.felt-msg[data-tone="good"] {
  color: var(--good);
  border-color: rgba(127, 211, 168, 0.5);
}

.felt-msg[data-tone="bad"] {
  color: var(--bad);
  border-color: rgba(255, 138, 143, 0.5);
}

.felt-msg[data-tone="warn"] {
  color: var(--warn);
  border-color: rgba(255, 210, 122, 0.55);
}

.felt-msg.pop {
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  from { opacity: 0.4; transform: translate(-50%, -50%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}


.chips {
  display: flex;
  gap: 8px;
}

.chip {
  --chip: #2463b4;
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--chip) 0 54%, transparent 55%),
    repeating-conic-gradient(var(--chip) 0 30deg, #f4ebd6 30deg 45deg);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 6px 10px rgba(0, 0, 0, 0.4), inset 0 0 0 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.12s;
}

.chip span {
  position: absolute;
  inset: 22%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.6);
  font-family: "Bodoni Moda", serif;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.chip:hover:not(:disabled) {
  transform: translateY(-3px);
}

.chip:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.chip:disabled {
  opacity: 0.35;
  filter: saturate(0.4);
}

.c25 { --chip: #2e8b57; --chip-side: #1b5636; }

.c100 { --chip: #2a2a2e; --chip-side: #0c0c0e; }

.c500 { --chip: #6b3fa0; --chip-side: #3f235f; }

.c1000 { --chip: #d98f20; --chip-side: #8a5a12; }

.c1000 span,
.c100 span {
  color: #fff;
}

/* ---------- study panels ---------- */

.study {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid rgba(212, 175, 106, 0.38);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 8, 10, 0.88), rgba(14, 5, 7, 0.92));
  overflow: hidden;
}

.panel > summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  list-style: none;
  cursor: pointer;
}

.panel > summary::-webkit-details-marker {
  display: none;
}

.panel > summary::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--brass);
  border-bottom: 2px solid var(--brass);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.panel[open] > summary::before {
  transform: rotate(45deg);
}

.p-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--brass-hi);
}

.p-toggle {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid rgba(212, 175, 106, 0.3);
  border-radius: 999px;
  padding: 1px 10px;
}

.panel .when-open,
.panel[open] .when-closed {
  display: none;
}

.panel[open] .when-open {
  display: inline;
}

.panel-body {
  padding: 0 18px 18px;
}

.p-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.p-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-ui {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.15s;
  flex-shrink: 0;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ivory);
  transition: transform 0.15s;
}

.switch input:checked + .switch-ui {
  background: var(--brass);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(14px);
  background: var(--room-deep);
}

.switch input:focus-visible + .switch-ui {
  outline: 2px solid var(--brass-hi);
  outline-offset: 2px;
}


.score {
  display: flex;
  gap: 18px;
  margin: 0;
}

.score div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score dt {
  font-size: 12px;
  color: var(--muted);
}

.score dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* table rules panel */

.p-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.panel[open] .p-summary {
  visibility: hidden;
}

.rules-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 10px 28px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(15, 81, 72, 0.22);
  border: 1px solid rgba(212, 175, 106, 0.2);
}

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  border-bottom: 1px dashed rgba(212, 175, 106, 0.15);
}

.rule-label {
  font-size: 13px;
  color: var(--ivory);
}

.rule-row .seg button {
  min-width: 58px;
  height: 32px;
}

.rule-row .select {
  min-width: 110px;
  height: 32px;
}

.rules-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

.rules-actions .btn {
  min-height: 40px;
  font-size: 13px;
}

.btn[data-armed="1"] {
  border-color: var(--warn);
  color: var(--warn);
}

.rules-form[title]:not([title=""]) {
  opacity: 0.6;
}


/* seats along the rail */

.seats {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.seat {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.seat-bets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  min-height: 20px;
}

.sb {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.sb-p { background: var(--pc); }
.sb-b { background: var(--bc); }
.sb-s { background: rgba(0, 0, 0, 0.45); color: var(--brass-hi); border: 1px solid rgba(212, 175, 106, 0.5); }

.plate {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 9px 2px 2px;
  border: 1px solid rgba(212, 175, 106, 0.3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  font-size: 11.5px;
  color: var(--ivory);
}

.plate:disabled {
  cursor: default;
}

.avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #555;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.pname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat[data-kind="you"] .plate {
  border-color: var(--brass-hi);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: var(--room-deep);
  font-weight: 700;
}

.seat[data-kind="you"] .avatar {
  background: var(--room-deep);
  box-shadow: inset 0 0 0 2px var(--brass-hi);
}

.seat[data-kind="vacant"] .plate {
  border-style: dashed;
  background: rgba(0, 0, 0, 0.15);
  color: var(--ink);
}

.seat[data-kind="vacant"] .avatar {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(236, 214, 160, 0.4);
}

.can-sit .seat[data-kind="vacant"] .plate:hover {
  border-color: var(--brass-hi);
  color: var(--ivory);
}

.seat-no {
  position: absolute;
  bottom: -14px;
  font-family: "Bodoni Moda", serif;
  font-size: 10px;
  color: var(--ink-soft);
}

.seat-res {
  position: absolute;
  top: -16px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 12.5px;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.seat-res[data-tone="good"] { color: var(--good); }
.seat-res[data-tone="bad"] { color: var(--bad); }

.seat.squeezing .plate {
  animation: squeeze-glow 0.9s ease-in-out infinite alternate;
}

@keyframes squeeze-glow {
  to { box-shadow: 0 0 0 2px var(--warn), 0 0 14px var(--warn); }
}

/* ---------- dock: chips and betting board ---------- */

.dock {
  position: relative;
  z-index: 6;
  margin-top: 14px;
  padding: 12px 16px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31, 14, 10, 0.94), rgba(14, 6, 5, 0.96));
  border: 1px solid rgba(212, 175, 106, 0.4);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  display: grid;
  gap: 12px;
}

.dock-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 175, 106, 0.18);
}

.dock .bank-value {
  font-size: 26px;
}

.bet-sum {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.bet-sum strong {
  font-family: "Bodoni Moda", serif;
  font-size: 22px;
  color: var(--ivory);
  font-variant-numeric: tabular-nums lining-nums;
}

.dock .chips {
  justify-content: center;
  flex-wrap: wrap;
}

.c1 { --chip: #e9e2d0; --chip-side: #8f8672; }
.c5 { --chip: #c73a3a; --chip-side: #7a1f1f; }
.c10 { --chip: #2463b4; --chip-side: #173f73; }
.c25 { --chip: #2e8b57; --chip-side: #1b5636; }
.c50 { --chip: #d98f20; --chip-side: #8a5a12; }
.c100 { --chip: #2a2a2e; --chip-side: #0c0c0e; }
.c500 { --chip: #6b3fa0; --chip-side: #3f235f; }
.c1000 { --chip: #c9a24a; --chip-side: #7c6024; }

.c100 span,
.c500 span,
.c1000 span {
  color: #fff;
}

.chip[aria-checked="true"] {
  transform: translateY(-6px);
  box-shadow: 0 0 0 3px var(--brass-hi), 0 0 16px rgba(241, 217, 154, 0.7), 0 8px 12px rgba(0, 0, 0, 0.5);
}

.spot {
  --tone: rgba(212, 175, 106, 0.55);
  --tone-bg: rgba(212, 175, 106, 0.06);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 52px;
  padding: 6px 8px;
  border: 1.5px solid var(--tone);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--tone-bg), rgba(0, 0, 0, 0.28));
  color: var(--ivory);
  text-align: center;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.spot:hover:not(:disabled) {
  box-shadow: 0 0 0 1px var(--tone), 0 0 14px -2px var(--tone);
}

.spot:active:not(:disabled) {
  transform: scale(0.98);
}

.spot:disabled {
  cursor: default;
}

.spot-p { grid-area: p; --tone: var(--pc); --tone-bg: rgba(63, 127, 208, 0.22); min-height: 78px; }
.spot-b { grid-area: b; --tone: var(--bc); --tone-bg: rgba(208, 71, 90, 0.22); min-height: 78px; }
.spot-t { grid-area: t; --tone: var(--tc); --tone-bg: rgba(47, 163, 107, 0.2); }
.spot-pp { grid-area: pp; --tone: var(--pc); --tone-bg: rgba(63, 127, 208, 0.1); }
.spot-bp { grid-area: bp; --tone: var(--bc); --tone-bg: rgba(208, 71, 90, 0.1); }
.spot.tone-p { --tone: rgba(63, 127, 208, 0.75); --tone-bg: rgba(63, 127, 208, 0.1); }
.spot.tone-b { --tone: rgba(208, 71, 90, 0.75); --tone-bg: rgba(208, 71, 90, 0.1); }

.spot-name {
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.25;
}

.spot-p .spot-name,
.spot-b .spot-name {
  font-family: "Bodoni Moda", var(--font-display);
  font-size: 20px;
  letter-spacing: 0.08em;
}

.spot-p .spot-name { color: var(--pc-hi); }
.spot-b .spot-name { color: var(--bc-hi); }
.spot-t .spot-name { color: #8fe3b6; font-size: 17px; }

.spot-name b {
  color: var(--brass-hi);
}

.spot-pay {
  font-family: "Bodoni Moda", serif;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.spot-amt:empty {
  display: none;
}

.spot-amt {
  position: absolute;
  top: -8px;
  right: -6px;
  z-index: 1;
  min-width: 34px;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: var(--room-deep);
  font-weight: 800;
  font-size: 11.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
}

.spot.has-bet {
  box-shadow: inset 0 0 0 1px var(--tone), 0 0 18px -6px var(--tone);
}

.spot[data-res="win"] {
  box-shadow: 0 0 0 2px var(--good), 0 0 18px rgba(127, 211, 168, 0.6);
}

.spot[data-res="lose"] {
  opacity: 0.55;
}

.spot[data-res="push"] {
  box-shadow: 0 0 0 2px var(--warn);
}

.props-wrap {
  border: 1px solid rgba(212, 175, 106, 0.25);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.props-wrap > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--brass-hi);
}

.props-wrap > summary::-webkit-details-marker {
  display: none;
}

.props-wrap > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--brass);
  border-bottom: 2px solid var(--brass);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}

.props-wrap[open] > summary::before {
  transform: rotate(45deg);
}

.side-count {
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--room-deep);
  font-size: 11px;
}

.side-count:empty {
  display: none;
}

.board-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* Sticks to the bottom of the screen while the table is in view, so the visitor
   can rebet and deal without scrolling down to the board. */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border: 1px solid rgba(212, 175, 106, 0.45);
  border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, rgba(36, 16, 12, 0.96), rgba(16, 6, 5, 0.98));
  box-shadow: 0 -10px 24px -10px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ab-info {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.ab-info b {
  margin-right: 8px;
  font-family: "Bodoni Moda", serif;
  font-size: 19px;
  color: var(--brass-hi);
  font-variant-numeric: tabular-nums lining-nums;
}

.dock-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.dock-actions .btn-deal {
  min-width: 150px;
}

.btn-rebuy {
  margin-right: auto;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 4px 18px;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 13px;
}

.results li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.r-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.r-stake {
  color: var(--muted);
  font-size: 12px;
}

.results li[data-tone="good"] b { color: var(--good); }
.results li[data-tone="bad"] b { color: var(--bad); }

.results .r-total {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid rgba(212, 175, 106, 0.2);
}

/* ---------- panels ---------- */

.pay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
  background: rgba(10, 4, 5, 0.55);
}

.pay-table th,
.pay-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(212, 175, 106, 0.16);
  text-align: left;
  vertical-align: top;
}

.pay-table thead th {
  background: rgba(212, 175, 106, 0.12);
  color: var(--brass-hi);
  white-space: nowrap;
}

.pay-table tbody th {
  color: var(--brass-hi);
  white-space: nowrap;
  font-weight: 700;
}

.pay-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 106, 0.28);
}

.score {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.score dd {
  font-family: "Bodoni Moda", serif;
  font-size: 20px;
  color: var(--brass-hi);
}

.score dd[data-tone="good"] { color: var(--good); }
.score dd[data-tone="bad"] { color: var(--bad); }

/* ---------- craps table ---------- */

.crp {
  --die: clamp(28px, 3.3vw, 40px);
  --line: rgba(244, 235, 214, 0.78);
  --gold: #f6d77d;
  --red: #ef5f5f;
}

.c1 span {
  color: #3b2a19;
  text-shadow: none;
  border-color: rgba(59, 42, 25, 0.45);
}

.table-wrap {
  max-width: none;
}

.crp-rim,
.table-rim.crp-rim {
  border-radius: 30px;
  padding: 14px;
}

.table-rim.crp-rim::before {
  border-radius: 26px;
  inset: 10px;
}

.crp-felt {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 0;
  padding: 14px 16px 18px;
  border-radius: 20px;
  background-color: var(--felt);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"),
    radial-gradient(80% 90% at 50% 30%, var(--felt-hi), var(--felt) 55%, var(--felt-deep));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 18px 40px -10px rgba(0, 0, 0, 0.55), inset 0 -30px 60px -20px rgba(0, 0, 0, 0.6);
}

/* The top of the table: the puck and the shooter, the dealer's call, the rolls. */
.crp-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) min(36%, 340px);
  grid-template-areas: "puck msg hist";
  align-items: center;
  gap: 12px;
}

/* The back wall lined with rubber pyramids that the dice must hit. */
.puck-info {
  grid-area: puck;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.puck {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-family: "Bodoni Moda", serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  background: radial-gradient(circle at 35% 30%, #3a3a3e, #0d0d0f 70%);
  color: #fff;
  box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(0, 0, 0, 0.55);
}

.puck[data-on="1"] {
  background: radial-gradient(circle at 35% 30%, #fff, #e6e1d4 70%);
  color: #111;
  box-shadow: 0 0 0 2px #111, 0 0 0 4px #fff, 0 4px 12px rgba(0, 0, 0, 0.55);
}

.pi-text {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.pi-text b {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--brass-hi);
  white-space: nowrap;
}

#pi-shooter {
  font-size: 12px;
  color: var(--ivory);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* roll history (top right) */
.history {
  grid-area: hist;
  min-width: 0;
  padding: 8px 10px 6px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 106, 0.4);
  background: rgba(6, 22, 20, 0.72);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.hs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}

.hs-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--brass-hi);
}

.hs-count {
  font-size: 11px;
  color: var(--muted);
}

.hs-rolls {
  display: flex;
  gap: 4px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.hs-rolls li {
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-items: center;
  gap: 1px 2px;
  flex-shrink: 0;
  width: 34px;
  padding: 3px 2px 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 2px solid transparent;
}

.hs-rolls li:first-child {
  background: rgba(241, 217, 154, 0.16);
}

.hd {
  width: 14px;
  height: 14px;
}

.hd svg,
.pd svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hs-rolls b {
  grid-column: 1 / -1;
  font-family: "Bodoni Moda", serif;
  font-size: 13px;
  line-height: 1.1;
  color: var(--ivory);
}

.hs-rolls li[data-kind="sevenOut"] { border-color: var(--red); }
.hs-rolls li[data-kind="sevenOut"] b { color: var(--red); }
.hs-rolls li[data-kind="made"] { border-color: var(--good); }
.hs-rolls li[data-kind="made"] b { color: var(--good); }
.hs-rolls li[data-kind="natural"] b { color: var(--gold); }
.hs-rolls li[data-kind="point"] { border-color: var(--brass-hi); }
.hs-rolls li[data-kind="craps"] b { color: #b9c2c0; }

.hs-freq {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 3px;
  height: 46px;
  margin-top: 6px;
}

.fq {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 1px;
  min-width: 0;
}

.fq i {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  opacity: 0.8;
}

.fq.f7 i {
  background: linear-gradient(180deg, #ff9a9a, var(--red));
}

.fq b {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
}

.crp-felt .felt-msg {
  grid-area: msg;
  position: static;
  justify-self: center;
  transform: none;
  max-width: 100%;
  white-space: normal;
  border-radius: 14px;
}

.crp-felt .felt-msg.pop {
  animation: crp-pop 0.25s ease-out;
}

@keyframes crp-pop {
  from { opacity: 0.4; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* seats along the rail */
/* The players, in a row above the layout (seat 1 on the right). */
.crp-felt .seats {
  position: static;
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-around;
  gap: 6px;
  padding: 16px 4px 22px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
  pointer-events: auto;
}

.crp-felt .seat {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 150px;
}

.crp-rack {
  margin-top: 0;
  background: linear-gradient(180deg, rgba(31, 14, 10, 0.86), rgba(14, 6, 5, 0.9));
}

.sb-pass { background: #2f7d5c; }
.sb-dont { background: #3a3a40; }
.sb-other { background: rgba(0, 0, 0, 0.45); color: var(--brass-hi); border: 1px solid rgba(212, 175, 106, 0.5); }

.shooter-tag {
  display: none;
  position: absolute;
  bottom: -30px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.seat.shooter .shooter-tag {
  display: block;
}

.seat.shooter .seat-no {
  visibility: hidden;
}

.seat.shooter .plate {
  box-shadow: 0 0 0 2px var(--red), 0 0 14px rgba(239, 95, 95, 0.55);
}

.seat.throwing .plate {
  animation: throw-glow 0.4s ease-in-out infinite alternate;
}

@keyframes throw-glow {
  to { box-shadow: 0 0 0 3px var(--warn), 0 0 18px var(--warn); }
}

/* ---------- betting layout ---------- */

.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  align-items: start;
  gap: 12px;
}

.board-note {
  grid-column: 1 / -1;
}

.layout {
  display: grid;
  grid-template-columns: 112px repeat(6, minmax(0, 1fr));
  grid-template-areas:
    "dc   nums  nums  nums  nums  nums  nums"
    "big  come  come  come  come  come  come"
    "big  field field field field field field"
    "big  dp    dp    dp    dp    dpo   dpo"
    "pass pass  pass  pass  pass  po    po";
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background-color: var(--felt);
  background-image: radial-gradient(90% 80% at 50% 20%, var(--felt-hi), var(--felt) 60%, var(--felt-deep));
  border: 1px solid rgba(212, 175, 106, 0.4);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35);
}

.layout .spot,
.layout .num {
  --tone: var(--line);
  --tone-bg: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
}

.layout .num .spot {
  border: 0;
  border-radius: 0;
}

.layout .spot.closed,
.layout .spot:disabled.closed {
  opacity: 0.42;
}

.lo {
  min-height: 46px;
}

.lo-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--ivory);
}

.lo-big-name {
  font-family: "Bodoni Moda", var(--font-display);
  font-size: 22px;
  letter-spacing: 0.12em;
}

.lo-sub {
  font-size: 10.5px;
  color: var(--ink);
}

.lo-dc { grid-area: dc; position: relative; }
.lo-come { grid-area: come; min-height: 62px; }
.lo-come .lo-name { color: var(--red); font-size: 26px; }
.lo-field { grid-area: field; min-height: 58px; }
.lo-dp { grid-area: dp; }
.lo-dpo { grid-area: dpo; }
.lo-pass { grid-area: pass; min-height: 56px; }
.lo-po { grid-area: po; }

.lo-pass .lo-name {
  color: #fff;
}

.lo-po .lo-name,
.lo-dpo .lo-name {
  color: var(--gold);
  font-size: 13px;
}

.field-nums {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Bodoni Moda", serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.field-nums i {
  font-style: normal;
}

.field-nums b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  font-size: 15px;
}

.field-nums .x3 {
  box-shadow: 0 0 0 3px var(--felt), 0 0 0 4.5px var(--gold);
}

.lo-field .lo-name {
  color: var(--gold);
  letter-spacing: 0.18em;
}

.lo-nums {
  grid-area: nums;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.num {
  position: relative;
  display: grid;
  grid-template-rows: 26px minmax(66px, 1fr) 28px;
  overflow: hidden;
}

.num-dc,
.num-come {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 4px;
  border: 0;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.15;
}

.num-dc {
  border-bottom: 1px solid rgba(244, 235, 214, 0.45);
}

.num-come {
  border-top: 1px solid rgba(244, 235, 214, 0.45);
}

.num-dc:empty::before,
.num-dc .stk:empty::before {
  content: "DC";
  opacity: 0.45;
  letter-spacing: 0.1em;
}

.num-come .stk:empty::before {
  content: "COME";
  opacity: 0.45;
  letter-spacing: 0.1em;
}

.stk {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 4px;
  min-width: 0;
}

.stk b {
  color: var(--ivory);
  font-weight: 700;
}

.stk em {
  font-style: normal;
  color: var(--gold);
  font-weight: 700;
}

.num-dc.has-bet,
.num-come.has-bet {
  background: rgba(241, 217, 154, 0.14);
}

.num-dc[data-res="win"],
.num-come[data-res="win"] {
  box-shadow: inset 0 0 0 2px var(--good);
}

.num-dc[data-res="lose"],
.num-come[data-res="lose"] {
  box-shadow: inset 0 0 0 2px var(--bad);
}

.num-place {
  min-height: 66px;
  padding: 4px;
}

.num-label {
  font-family: "Bodoni Moda", serif;
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  color: var(--gold);
}

.num[data-num="6"] .num-label,
.num[data-num="9"] .num-label {
  font-size: 18px;
  letter-spacing: 0.1em;
}

.puck-slot {
  position: absolute;
  top: 3px;
  right: 3px;
  line-height: 0;
}

.lo-puck {
  width: 28px;
  height: 28px;
  font-size: 9px;
}

.num-place .spot-amt {
  top: 3px;
  left: 3px;
  right: auto;
  min-width: 0;
}

.layout[data-point] .num[data-num] {
  transition: box-shadow 0.2s;
}

.layout .num:has(.lo-puck) {
  box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(255, 255, 255, 0.35);
}

.lo-big {
  grid-area: big;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
}

.big {
  min-height: 52px;
}

.big-n {
  font-family: "Bodoni Moda", serif;
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  color: var(--red);
  text-shadow: 0 0 1px #fff;
}

/* proposition bets */
.props-wrap {
  align-self: stretch;
}

.props {
  padding: 0 12px 12px;
}

.pg-title {
  margin: 6px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brass-hi);
}

.pg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pg-one {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.prop {
  min-height: 52px;
  padding: 4px;
}

.prop.wide {
  grid-column: 1 / -1;
}

.pg-one .prop[data-spot="horn"],
.pg-one .prop[data-spot="ce"] {
  grid-column: span 2;
}

.pd {
  display: flex;
  gap: 3px;
}

.pd i {
  width: 18px;
  height: 18px;
}

.prop-name {
  font-weight: 700;
  font-size: 13px;
}

.prop.seven .prop-name {
  color: var(--red);
  letter-spacing: 0.06em;
}

.prop .spot-pay {
  font-size: 11px;
}

/* ---------- console ---------- */

.ab-bets {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip.ab-chip {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-size: 12px;
}

.chip.ab-chip:disabled {
  opacity: 0.5;
}

.ab-q {
  position: relative;
  min-width: 92px;
  min-height: 44px;
  padding: 4px 14px;
  border: 1.5px solid var(--line, rgba(244, 235, 214, 0.7));
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(15, 81, 72, 0.6), rgba(0, 0, 0, 0.3));
  color: var(--ivory);
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.1s, box-shadow 0.15s;
}

.ab-q:hover:not(:disabled) {
  box-shadow: 0 0 0 1px var(--brass-hi), 0 0 14px -2px var(--brass-hi);
}

.ab-q:active:not(:disabled) {
  transform: scale(0.98);
}

.ab-q:disabled {
  opacity: 0.45;
  cursor: default;
}

.ab-q[data-tone="come"] .ab-q-name {
  color: #ff9a9a;
}

.ab-q[data-spot="field"] .ab-q-name {
  color: var(--gold, #f6d77d);
}

.ab-q .spot-amt:empty {
  display: none;
}

.ab-q .spot-amt {
  position: absolute;
  top: -8px;
  right: -6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: var(--room-deep);
  font-weight: 800;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.ab-q[data-res="win"] {
  box-shadow: 0 0 0 2px var(--good);
}

.ab-q[data-res="lose"] {
  opacity: 0.6;
}

/* ---------- responsive ---------- */

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

  .crp-head {
    grid-template-columns: minmax(0, 1fr) min(44%, 340px);
    grid-template-areas:
      "puck hist"
      "msg hist";
  }
}

@media (max-width: 760px) {
  .crp {
    --die: 30px;
  }

  .intro {
    grid-template-columns: 1fr;
  }

  .game-bar {
    justify-content: flex-start;
  }

  .settings {
    gap: 8px 12px;
  }

  .table-rim.crp-rim {
    margin: 0 -8px;
    padding: 8px;
    border-radius: 22px;
  }

  .table-rim.crp-rim::before {
    inset: 6px;
    border-radius: 18px;
  }

  .crp-felt {
    gap: 10px;
    padding: 10px 8px 14px;
    border-radius: 16px;
  }

  .crp-head {
    grid-template-columns: minmax(0, 1fr) 52%;
    grid-template-areas:
      "puck hist"
      "msg msg";
    gap: 8px;
  }

  .puck-info {
    gap: 7px;
  }

  .puck {
    width: 38px;
    height: 38px;
    font-size: 11px;
  }

  .pi-text b {
    font-size: 15px;
  }

  #pi-shooter {
    font-size: 10.5px;
    white-space: normal;
  }

  .history {
    padding: 6px 7px 5px;
  }

  .hs-head {
    margin-bottom: 4px;
  }

  .hs-count {
    font-size: 10px;
  }

  .hs-rolls li {
    width: 30px;
  }

  .hd {
    width: 12px;
    height: 12px;
  }

  .hs-freq {
    height: 26px;
  }

  .lo-puck {
    width: 24px;
    height: 24px;
    font-size: 8px;
  }

  .fq b {
    font-size: 8px;
  }

  .crp-felt .felt-msg {
    font-size: 12.5px;
    padding: 6px 12px;
  }

  .crp-felt .seats {
    gap: 3px;
    padding: 16px 2px 20px;
  }

  .crp-felt .plate {
    flex-direction: column;
    gap: 1px;
    padding: 2px 4px 3px;
    border-radius: 12px;
    font-size: 10px;
  }

  .crp-felt .pname {
    max-width: 52px;
  }

  .crp-felt .sb {
    font-size: 9px;
    padding: 0 4px;
  }

  .seat-res {
    font-size: 11px;
  }

  .shooter-tag {
    bottom: -24px;
    font-size: 9px;
  }

  .dock {
    padding: 10px 10px 12px;
    margin-left: -4px;
    margin-right: -4px;
  }

  .dock-head {
    flex-wrap: wrap;
  }

  .dock .chips {
    gap: 6px;
  }

  .chip {
    width: 46px;
    height: 46px;
  }

  .chip span {
    font-size: 12.5px;
  }

  .layout {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "nums nums nums nums nums nums"
      "dc   dc   dc   big  big  big"
      "come come come come come come"
      "field field field field field field"
      "dp   dp   dp   dp   dpo  dpo"
      "pass pass pass pass po   po";
    gap: 5px;
    padding: 7px;
  }

  .lo-nums {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .num {
    grid-template-rows: 24px minmax(58px, 1fr) 26px;
  }

  .num-label {
    font-size: 22px;
  }

  .lo-big {
    grid-template-rows: none;
    grid-template-columns: 1fr 1fr;
  }

  .big {
    min-height: 48px;
  }

  .big-n {
    font-size: 24px;
  }

  .big .spot-pay {
    font-size: 9px;
  }

  .lo-name {
    font-size: 13px;
  }

  .lo-big-name {
    font-size: 17px;
  }

  .lo-come .lo-name {
    font-size: 20px;
  }

  .field-nums {
    gap: 6px;
    font-size: 15px;
  }

  .field-nums b {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .pg-one {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pg-one .prop[data-spot="horn"],
  .pg-one .prop[data-spot="ce"] {
    grid-column: span 1;
  }

  .action-bar {
    margin: 10px -4px 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .ab-info {
    width: 100%;
    justify-content: center;
    font-size: 11px;
  }

  .ab-info b {
    font-size: 16px;
  }

  .ab-bets {
    width: 100%;
    gap: 6px;
  }

  .ab-q {
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 6px;
    font-size: 13px;
  }

  .dock-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1.6fr;
    gap: 6px;
    margin-left: 0;
  }

  .dock-actions .btn {
    min-height: 44px;
    padding: 0 6px;
    font-size: 13px;
  }

  .dock-actions .btn-deal {
    min-width: 0;
    font-size: 15px;
  }

  .btn-rebuy {
    grid-column: 1 / -1;
  }

  .panel > summary {
    padding: 12px 14px;
  }

  .p-title {
    font-size: 17px;
  }

  .panel-body {
    padding: 0 12px 14px;
  }

  .pay-table {
    font-size: 12px;
  }

  .pay-table td:nth-child(2) {
    min-width: 200px;
  }
}

@media (hover: none) {
  .act-keys-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seat.throwing .plate {
    animation: none;
  }
}

/* ---------- the throw (popup) ---------- */

.crp-throw {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(60% 60% at 50% 50%, rgba(10, 30, 26, 0.72), rgba(5, 1, 2, 0.9));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.crp-throw[hidden] {
  display: none;
}

body.th-open {
  overflow: hidden;
}

.th-panel {
  width: min(94vw, 560px);
  padding: 16px 16px 14px;
  border-radius: 18px;
  border: 2px solid var(--brass);
  background: linear-gradient(180deg, #24120b, #120806);
  box-shadow: 0 0 0 6px #24120b, 0 0 0 7px rgba(212, 175, 106, 0.55), 0 30px 60px rgba(0, 0, 0, 0.7);
  text-align: center;
  animation: th-rise 0.3s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes th-rise {
  from { transform: translateY(16px) scale(0.98); opacity: 0; }
}

.th-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--brass-hi);
}

.th-stage {
  position: relative;
  aspect-ratio: 448 / 280;
  overflow: hidden;
  border-radius: 12px;
  background-color: var(--felt);
  background-image:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 5px, transparent 5px 10px),
    radial-gradient(90% 80% at 50% 70%, var(--felt-hi), var(--felt) 60%, var(--felt-deep));
  background-size: 100% 12%, 100% 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 106, 0.4), inset 0 -20px 40px -10px rgba(0, 0, 0, 0.5);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.th-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

.th-stage[data-mode="fly"] .th-gif {
  opacity: 1;
}

.th-aim,
.th-result {
  position: absolute;
  inset: 0;
  display: none;
}

.th-stage[data-mode="aim"] .th-aim,
.th-stage[data-mode="ready"] .th-aim {
  display: block;
}

.th-stage[data-mode="aim"] {
  cursor: grab;
}

.th-stage.grabbing {
  cursor: grabbing;
}

.th-hand {
  position: absolute;
  left: 50%;
  bottom: 18%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  transition: transform 0.18s ease;
}

.th-stage.grabbing .th-hand {
  transition: none;
}

.th-die {
  display: block;
  width: clamp(40px, 11vw, 56px);
  height: clamp(40px, 11vw, 56px);
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.5));
}

.th-die svg {
  display: block;
  width: 100%;
  height: 100%;
}

.th-hand .th-die:first-child { transform: rotate(-14deg); }
.th-hand .th-die:last-child { transform: rotate(18deg); }

.th-stage[data-mode="aim"] .th-hand {
  animation: th-bob 1.2s ease-in-out infinite alternate;
}

.th-stage.grabbing .th-hand {
  animation: none;
}

@keyframes th-bob {
  to { margin-bottom: 8px; }
}

.th-arrow {
  position: absolute;
  left: 50%;
  top: 14%;
  width: 26px;
  height: 46%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(246, 215, 125, 0.9), rgba(246, 215, 125, 0));
  clip-path: polygon(50% 0, 100% 22%, 64% 22%, 64% 100%, 36% 100%, 36% 22%, 0 22%);
  opacity: 0.7;
}

.th-stage[data-mode="ready"] .th-arrow,
.th-stage[data-mode="ready"] .th-hint {
  display: none;
}

.th-hint {
  position: absolute;
  left: 50%;
  bottom: 4%;
  margin: 0;
  padding: 2px 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(6, 26, 23, 0.82);
  border: 1px solid rgba(241, 217, 154, 0.5);
  color: var(--brass-hi);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.th-hint.nudge {
  animation: th-nudge 0.4s ease-in-out;
}

@keyframes th-nudge {
  25% { transform: translateX(calc(-50% - 6px)); }
  75% { transform: translateX(calc(-50% + 6px)); }
}

.th-stage[data-mode="result"] .th-result {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 10px 16px;
}

.th-die.big {
  width: clamp(64px, 18vw, 92px);
  height: clamp(64px, 18vw, 92px);
  animation: th-land 0.35s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.th-die.big + .th-die.big {
  animation-delay: 0.06s;
}

@keyframes th-land {
  from { transform: scale(1.35) rotate(-25deg); opacity: 0; }
}

.th-total {
  flex-basis: 100%;
  font-family: "Bodoni Moda", serif;
  font-size: clamp(20px, 5vw, 28px);
  color: var(--ivory);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.th-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.th-actions[hidden] {
  display: none;
}

.th-actions .btn-deal {
  min-width: 180px;
}

@media (max-width: 760px) {
  .th-panel {
    padding: 12px 10px 12px;
  }

  .th-title {
    font-size: 16px;
  }

  .th-actions .btn {
    flex: 1;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .th-stage[data-mode="fly"] .th-gif {
    opacity: 0;
  }

  .th-stage[data-mode="aim"] .th-hand,
  .th-die.big,
  .th-panel {
    animation: none;
  }
}

/* The chip rack on the table: bank, chips and the total on one line. */
.crp-rack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 8px 14px;
}

.crp-rack .dock-head {
  display: contents;
}

.crp-rack .bank {
  order: 1;
}

.crp-rack .chips {
  order: 2;
  flex: 1 1 auto;
  justify-content: center;
}

.crp-rack .bet-sum {
  order: 3;
}

@media (max-width: 760px) {
  .crp-rack {
    justify-content: space-between;
    padding: 8px 10px;
    margin: 0;
  }

  .crp-rack .chips {
    order: 3;
    flex-basis: 100%;
  }

  .crp-rack .bet-sum {
    order: 2;
  }
}
