/* ThePit · Copyright (C) 2026 abel0x
   SPDX-License-Identifier: AGPL-3.0-or-later
   Free software with ABSOLUTELY NO WARRANTY; see LICENSE for the terms. */

/* =========================================================
   Table 7: offline craps
   The dice, the puck and the layout: the numbers, Come and Don't
   come, the Field, the line bets with their odds and the bets in the
   middle. The frame and the chips come from shared/css.
   ========================================================= */
:root {
  --print: rgba(240, 222, 168, .78);
  --print-soft: rgba(240, 222, 168, .3);
  --rail: clamp(8px, 1.3vh, 13px);
  --die: #c8202a;
  --pip: #fff8ea;
}

/* ----------------------- Top bar on phones ----------------------- */
/* The language stays one tap away in the settings, and the way back to the
   lobby stands in for the table's mark. */
@media (max-width: 600px) {
  .topbar { gap: 8px; padding-inline: 10px; }
  .subtitle,
  .topbar .lang-switch,
  .brand-mark { display: none; }
  .topbar-actions { gap: 6px; }
  .brand { gap: 8px; }
  .brand-text h1 { font-size: 14px; letter-spacing: 2.2px; gap: 6px; }
  .brand-number { min-width: 28px; padding: 2px 5px; }
  .balance-pill { min-width: 0; padding: 4px 10px; }
  .balance-value { font-size: 17px; }
  .icon-btn { width: 36px; height: 36px; }
  .toast { top: 64px; }
}

/* ----------------------- The table ----------------------- */
.table-wrap {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.3vh, 14px);
  padding: clamp(6px, 1.4vh, 20px) clamp(8px, 2vw, 26px);
  padding-bottom: max(clamp(6px, 1.4vh, 16px), env(safe-area-inset-bottom));
  overflow: hidden;
}

.table {
  position: relative;
  width: min(1180px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* One felt with a walnut rail, as at the other tables of the pit. */
.table-felt {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(6px, 1.4vh, 16px);
  padding: clamp(10px, 1.8vh, 22px) clamp(10px, 2vw, 30px);
  border: var(--rail) solid transparent;
  border-radius: clamp(22px, 4vh, 44px);
  background:
    radial-gradient(ellipse 70% 60% at 30% -10%, rgba(255, 247, 218, .1), transparent 66%) padding-box,
    repeating-linear-gradient(4deg, rgba(255,255,255,.016) 0 1px, transparent 1px 4px) padding-box,
    repeating-linear-gradient(94deg, rgba(0,0,0,.024) 0 1px, transparent 1px 5px) padding-box,
    radial-gradient(130% 110% at 50% 10%, var(--felt-highlight) 0%, var(--felt-1) 26%, var(--felt-2) 64%, var(--felt-edge) 100%) padding-box,
    linear-gradient(142deg, rgba(255,232,164,.3), transparent 24%, rgba(0,0,0,.42) 72%, rgba(255,214,117,.2)) border-box,
    repeating-linear-gradient(102deg, #25160b 0 10px, #52371a 10px 18px, #30200f 18px 29px, #694821 29px 34px) border-box;
  box-shadow:
    inset 0 0 0 1px rgba(241, 211, 130, .18),
    inset 0 0 110px rgba(0, 0, 0, .55),
    inset 0 9px 34px rgba(255, 255, 255, .05),
    0 0 0 1px #0b0704,
    0 0 0 4px rgba(105, 72, 31, .58),
    0 30px 60px rgba(0, 0, 0, .6);
}
.table-rim {
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  border: 2px solid rgba(225, 190, 99, .5);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.5), 0 1px 0 rgba(255,244,205,.16);
  z-index: 0;
}

/* ----------------------- Dice, banner and plaque ----------------------- */
.felt-head {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

/* The dice and the last rolls beside them. */
.dice-zone {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.dice { display: flex; gap: 8px; }
.die, .mini-die {
  --size: clamp(30px, 4.6vh, 42px);
  --p: calc(var(--size) * .09);
  width: var(--size);
  height: var(--size);
  border-radius: 22%;
  background-color: var(--die);
  background-repeat: no-repeat;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), inset 0 2px 3px rgba(255,255,255,.25), 0 4px 8px rgba(0,0,0,.45);
}
.mini-die { --size: 15px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
/* The pips of each face, as dots of the die's ivory. */
[data-face="1"] { background-image: radial-gradient(circle at 50% 50%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
[data-face="2"] { background-image: radial-gradient(circle at 27% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
[data-face="3"] { background-image: radial-gradient(circle at 27% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 50% 50%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
[data-face="4"] { background-image: radial-gradient(circle at 27% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 27% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
[data-face="5"] { background-image: radial-gradient(circle at 27% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 27%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 50% 50%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 27% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 73%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
[data-face="6"] { background-image: radial-gradient(circle at 27% 25%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 25%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 27% 50%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 50%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 27% 75%, var(--pip) var(--p), transparent calc(var(--p) + .6px)), radial-gradient(circle at 73% 75%, var(--pip) var(--p), transparent calc(var(--p) + .6px)); }
.dice.rolling .die { animation: tumble .18s linear infinite; }
.dice.rolling .die + .die { animation-direction: reverse; }
@keyframes tumble {
  25% { transform: translate(2px, -4px) rotate(90deg); }
  50% { transform: translate(-2px, -1px) rotate(180deg); }
  75% { transform: translate(1px, -3px) rotate(270deg); }
  100% { transform: rotate(360deg); }
}
.history {
  list-style: none;
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}
.history li {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--cream);
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(217, 182, 95, .3);
  font-variant-numeric: tabular-nums;
}
.history li.seven { background: #8e1a22; border-color: #e8737a; }
.history li.pair { box-shadow: inset 0 0 0 2px rgba(244, 226, 166, .5); }
.history li.latest { transform: scale(1.15); border-color: var(--gold-bright); }
.history li:nth-child(n + 9) { opacity: .55; }

.banner {
  min-width: 0;
  max-width: min(460px, 52vw);
  pointer-events: none;
  padding: 7px 18px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .42);
  border: 1px solid rgba(217, 182, 95, .35);
  font-weight: 600;
  letter-spacing: 1px;
  font-size: clamp(10.5px, 1.6vh, 14px);
  text-transform: uppercase;
  text-align: center;
  color: var(--gold-bright);
  line-height: 1.3;
  text-wrap: balance;
  transition: background .25s, border-color .25s, color .25s;
}
.banner small {
  display: block;
  margin-top: 1px;
  font-size: .8em;
  letter-spacing: .9px;
  opacity: .78;
}
.banner small:empty { display: none; }
.banner.flash-lose { background: rgba(0, 0, 0, .5); border-color: rgba(226, 104, 95, .55); color: #ffd9d6; }

.table-specs {
  justify-self: end;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(205,169,82,.46);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(18,24,20,.78), rgba(5,10,8,.78));
  box-shadow: 0 5px 12px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.05);
}
.table-spec { min-width: 50px; padding: 5px 10px 6px; text-align: left; }
.table-spec small {
  display: block;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: rgba(232, 202, 125, .62);
}
.table-spec strong {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--cream);
}

/* ----------------------- The layout ----------------------- */
.layout {
  position: relative;
  z-index: 2;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, .9fr) repeat(6, minmax(0, 1fr)) minmax(170px, 1.7fr);
  grid-template-rows: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "dc    n4    n5    n6    n8    n9    n10   props"
    "come  come  come  come  come  come  come  props"
    "field field field field field field field props"
    "dp    dp    dp    dp    dodds dodds dodds props"
    "pass  pass  pass  pass  podds podds podds props";
  gap: clamp(4px, .7vw, 8px);
}
.spot {
  --spot-ink: var(--print);
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 1px;
  padding: clamp(4px, .8vh, 8px) 4px clamp(24px, 3.8vh, 36px);
  border: 1.5px solid var(--print);
  border-radius: 10px;
  background: rgba(0, 0, 0, .1);
  color: var(--spot-ink);
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.spot:not(:disabled):hover { background: rgba(255, 238, 190, .1); }
.spot:focus-visible, .mini-spot:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.spot:disabled { cursor: default; }
.spot-name {
  font-size: clamp(10px, 1.7vh, 15px);
  font-weight: 700;
  letter-spacing: clamp(1px, .2vw, 2.5px);
  text-transform: uppercase;
  line-height: 1.1;
  text-align: center;
}
.spot-pay {
  font-size: clamp(8px, 1.15vh, 10px);
  font-weight: 600;
  letter-spacing: .8px;
  opacity: .8;
  text-align: center;
}
.spot-stack {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 2vh, 18px);
  width: 0;
  height: 0;
}
.spot-stack .bet-chip { --chip: clamp(24px, 3.4vh, 32px); left: 0; top: 0; }
.spot-stack .bet-chip.payout { left: calc(var(--chip) * 1.05); }
.bet-chip.pending { opacity: .82; }
.spot.won, .number-box.won { border-color: var(--gold-bright); box-shadow: 0 0 0 1px rgba(244, 226, 166, .5), 0 0 22px rgba(244, 226, 166, .25); }

.spot-dc { grid-area: dc; }
.spot-come { grid-area: come; --spot-ink: #f3dfa2; }
.spot-field { grid-area: field; --spot-ink: #f3dfa2; }
.spot-dp { grid-area: dp; }
.spot-dodds { grid-area: dodds; }
.spot-pass { grid-area: pass; --spot-ink: #fff; border-width: 2.2px; }
.spot-podds { grid-area: podds; }
.spot-come .spot-name, .spot-pass .spot-name, .spot-field .spot-name { font-size: clamp(13px, 2.2vh, 20px); letter-spacing: clamp(2px, .5vw, 6px); }
/* Odds go behind a bet only once there is a point. */
body[data-point="off"] .spot-podds,
body[data-point="off"] .spot-dodds,
body[data-point="off"] .spot-come,
body[data-point="off"] .spot-dc { opacity: .55; }
body:not([data-point="off"]) .spot-pass,
body:not([data-point="off"]) .spot-dp { --spot-ink: var(--print); }
.field-numbers { font-size: clamp(11px, 1.8vh, 16px); font-weight: 700; letter-spacing: 3px; color: var(--cream); }
.field-numbers b { display: inline-grid; place-items: center; min-width: 1.6em; border: 1px solid currentColor; border-radius: 50%; }
.field-print { font-size: clamp(7px, 1vh, 9px); letter-spacing: 1px; opacity: .7; }

/* A number box: lay bets above, the place bet in the middle, come bets
   and their odds below, the puck on the point. */
.number-box {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(22px, .7fr) minmax(0, 1.4fr) minmax(22px, .8fr);
  border: 1.5px solid var(--print);
  border-radius: 10px;
  background: rgba(0, 0, 0, .12);
  overflow: visible;
}
.number-box[data-number="4"] { grid-area: n4; }
.number-box[data-number="5"] { grid-area: n5; }
.number-box[data-number="6"] { grid-area: n6; }
.number-box[data-number="8"] { grid-area: n8; }
.number-box[data-number="9"] { grid-area: n9; }
.number-box[data-number="10"] { grid-area: n10; }
.number-box .spot-place { border: 0; border-radius: 0; background: none; padding-bottom: 4px; align-content: center; }
/* A place bet stands in the lower corner, clear of the number and its odds. */
.number-box .spot-place .spot-stack { left: auto; right: clamp(14px, 1.6vw, 20px); bottom: 6px; }
.box-number { font-family: var(--font-display); font-size: clamp(18px, 3.4vh, 30px); font-weight: 800; color: var(--cream); line-height: 1; }
.lane {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 2px 4px;
  min-height: 22px;
}
.lane-dc { border-bottom: 1px dashed var(--print-soft); }
.lane-come { border-top: 1px dashed var(--print-soft); }
.lane > .spot-stack { position: relative; left: 14px; bottom: auto; top: 22%; }
.lane > .spot-stack .bet-chip { --chip: clamp(18px, 2.6vh, 24px); }
.mini-spot {
  position: relative;
  margin-left: auto;
  min-width: 36px;
  padding: 2px 4px 14px;
  border: 1px solid var(--print);
  border-radius: 6px;
  background: rgba(0, 0, 0, .25);
  color: var(--gold-bright);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .8px;
  cursor: pointer;
}
.mini-spot[hidden] { display: none; }
.mini-spot .spot-stack { bottom: 6px; }
.mini-spot .spot-stack .bet-chip { --chip: 16px; }
.puck {
  position: absolute;
  top: -10px;
  right: -8px;
  z-index: 3;
  display: none;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #e9e3d4 70%);
  border: 3px solid #1a1a1a;
  color: #111;
  font-size: 9px;
  font-weight: 800;
  box-shadow: 0 4px 8px rgba(0,0,0,.5);
}
.number-box.is-point { border-color: var(--gold-bright); box-shadow: 0 0 18px rgba(244, 226, 166, .25); }
.number-box.is-point .puck { display: grid; }

/* The middle of the table: Hardways and the one-roll bets. */
.props {
  grid-area: props;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 4px;
  padding: 6px;
  border: 1.5px solid var(--print);
  border-radius: 12px;
  background: rgba(0, 0, 0, .18);
}
.spot-prop { padding: 3px 3px clamp(20px, 3vh, 28px); border-width: 1px; border-radius: 8px; }
.spot-prop .spot-name { font-size: clamp(8.5px, 1.3vh, 11px); letter-spacing: .8px; }
.prop-any7, .prop-anyCraps { grid-column: 1 / -1; }
.prop-any7 { --spot-ink: #ff9a8f; }
.prop-anyCraps { --spot-ink: #ff9a8f; }
.prop-dice { display: flex; gap: 2px; }

/* The Fire Bet lights each point the shooter has made. */
.prop-fire { --spot-ink: #ffb46b; }
.fire-points { display: flex; gap: 2px; font-size: clamp(7px, 1vh, 9px); font-weight: 700; }
.fire-points b {
  min-width: 1.6em;
  padding: 0 1px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: .45;
  text-align: center;
}
.fire-points b.lit { opacity: 1; background: #ff8a3d; border-color: #ff8a3d; color: #2a1000; }
.prop-hop.has-bets { border-color: var(--gold-bright); }

/* Hop bets open over the middle of the table: one spot for each pair of
   dice that has no spot of its own. */
.hop-panel {
  position: absolute;
  z-index: 6;
  inset: auto 0 0 auto;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 8px;
  border: 1.5px solid var(--gold-bright);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--modal-top), var(--modal-bottom));
  box-shadow: 0 14px 30px rgba(0, 0, 0, .55);
}
.hop-panel[hidden] { display: none; }
.hop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--gold-bright);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hop-close { width: 30px; height: 30px; }
.hop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; }
.spot-hop { min-height: 62px; padding: 4px 3px 24px; border-width: 1px; border-radius: 8px; }
.spot-hop .spot-pay { font-size: 9px; }
.spot-hop .spot-stack .bet-chip { --chip: 20px; }
.spot-prop .spot-stack .bet-chip { --chip: clamp(20px, 2.8vh, 26px); }

/* ----------------------- Controls ----------------------- */
.controls {
  position: relative;
  z-index: 3;
  width: min(1180px, 100%);
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.2vh, 14px) clamp(8px, 1.6vw, 22px);
}
.chips-tray {
  flex: 0 0 auto;
  display: flex;
  gap: clamp(6px, 1.1vw, 14px);
  justify-content: center;
  padding: clamp(8px, 1.3vh, 13px) clamp(10px, 1.6vw, 18px);
  padding-top: clamp(12px, 1.8vh, 18px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.045), transparent 36%),
    linear-gradient(180deg, var(--tray-top), var(--tray-bottom));
  border: 1px solid rgba(217,182,95,.25);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.055), inset 0 -8px 16px rgba(0,0,0,.24), 0 12px 25px rgba(0,0,0,.24);
}
.action-row {
  flex: 1 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(8px, 1.4vw, 18px);
}
.bet-actions { display: flex; gap: clamp(5px, .7vw, 9px); }
.bet-total {
  display: grid;
  justify-items: end;
  gap: 1px;
  min-width: 92px;
  text-align: right;
}
.bet-total small {
  color: rgba(244, 239, 226, .55);
  font-size: 9px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.bet-total strong {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.3vh, 22px);
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bet-total .last-win { letter-spacing: .6px; text-transform: none; font-size: 10px; }
.bet-total .last-win b { color: rgba(214, 255, 233, .85); font-variant-numeric: tabular-nums; }

/* Roll: a brass plaque beside the tray. */
.deal-btn {
  flex: 0 0 auto;
  min-width: clamp(96px, 13vh, 132px);
  height: clamp(48px, 7.4vh, 64px);
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid rgba(80, 56, 12, .9);
  background:
    radial-gradient(120% 90% at 40% 20%, rgba(255,255,255,.45), transparent 45%),
    linear-gradient(180deg, #f3d985, #c9a24b 62%, #8c6a1c);
  box-shadow:
    0 0 0 3px rgba(20, 13, 4, .55),
    0 0 0 4px rgba(240, 215, 143, .45),
    0 10px 22px rgba(0,0,0,.45),
    inset 0 -5px 8px rgba(110, 76, 14, .5);
  color: #2a1d05;
  font-family: var(--font-display);
  font-size: clamp(14px, 2.2vh, 19px);
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .14s ease, filter .2s ease;
}
.deal-btn:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.05); }
.deal-btn:not(:disabled):active { transform: translateY(1px) scale(.98); }
.deal-btn:disabled { cursor: not-allowed; filter: grayscale(.55) brightness(.62); }
.deal-btn.ready { animation: dealReady 2.4s ease-in-out infinite; }
@keyframes dealReady {
  0%, 100% { box-shadow: 0 0 0 3px rgba(20,13,4,.55), 0 0 0 4px rgba(240,215,143,.45), 0 10px 22px rgba(0,0,0,.45), inset 0 -5px 8px rgba(110,76,14,.5); }
  50% { box-shadow: 0 0 0 3px rgba(20,13,4,.55), 0 0 0 4px rgba(244,226,166,.9), 0 0 24px rgba(244,226,166,.4), inset 0 -5px 8px rgba(110,76,14,.5); }
}

.bet-total .new-bets { letter-spacing: .6px; text-transform: none; font-size: 10px; }
.bet-total .new-bets b { color: var(--gold-bright); font-variant-numeric: tabular-nums; }

/* ----------------------- Dialogs ----------------------- */
/* A miniature of this table on each cloth: two dice. */
.theme-preview::before,
.theme-preview::after {
  content: "";
  position: absolute;
  top: 30%;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #c8202a radial-gradient(circle, #fff8ea 2px, transparent 2.5px);
  box-shadow: 0 3px 6px rgba(0,0,0,.45);
}
.theme-preview::before { left: 30%; transform: rotate(-12deg); }
.theme-preview::after { right: 30%; transform: rotate(14deg); }
.theme-option[data-set-theme="midnight"] { --preview-felt-top: #2b6288; --preview-felt-bottom: #0b2b47; }
.theme-option[data-set-theme="bordeaux"] { --preview-felt-top: #8e3a49; --preview-felt-bottom: #3e111c; }
.theme-option[data-set-theme="onyx"] { --preview-felt-top: #5d6268; --preview-felt-bottom: #2a2d31; }
.theme-option[data-set-theme="amethyst"] { --preview-felt-top: #7a54a8; --preview-felt-bottom: #36215a; }
.rules-title {
  margin-top: 6px;
  font-size: 13px;
  color: var(--gold-bright);
  letter-spacing: .6px;
}
.payout-table .settings-hint + .settings-hint { margin-top: 0; }


/* ----------------------- Phones and short screens ----------------------- */
@media (max-width: 760px) {
  .felt-head { grid-template-columns: minmax(0, 1fr) auto; }
  .table-specs { display: none; }
  .banner { justify-self: end; max-width: 100%; }
  .history li:nth-child(n + 6) { display: none; }
  /* The layout may run longer than the felt; it scrolls inside it. */
  .table-felt { grid-template-rows: auto minmax(0, 1fr); }
  .layout {
    overflow-y: auto;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: none;
    /* Rows as tall as their bets need; the layout scrolls rather than squeezes them. */
    grid-auto-rows: minmax(min-content, auto);
    grid-template-areas:
      "n4    n5    n6    n8    n9    n10"
      "dc    dc    dc    come  come  come"
      "field field field field field field"
      "dp    dp    dp    dodds dodds dodds"
      "pass  pass  pass  podds podds podds"
      "props props props props props props";
    padding-top: 10px;
  }
  .number-box { min-height: 120px; grid-template-rows: 24px minmax(0, 1fr) 26px; }
  .number-box .spot-place { padding-bottom: 26px; }
  .number-box .spot-place .spot-stack { right: 50%; bottom: 4px; }
  .layout > .spot { min-height: 66px; }
  .props { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(min-content, auto); }
  .spot-prop { min-height: 58px; }
  .prop-any7, .prop-anyCraps, .prop-fire, .prop-hop { grid-column: span 2; }
  .controls { justify-content: center; }
  .chips-tray { width: 100%; gap: 4px; padding-inline: 6px; }
  .chips-tray .chip { --size: clamp(36px, 12vw, 50px); }
  .action-row { width: 100%; justify-content: space-between; }
  .btn-tool { min-width: 0; padding-inline: 7px; }
}

@media (max-width: 420px) {
  /* PUT and ODDS fit the narrow come lane of each number. */
  .lane { padding-inline: 1px; }
  .mini-spot { min-width: 0; padding: 2px 2px 12px; font-size: 7px; letter-spacing: 0; }
  .bet-total { min-width: 0; }
  .bet-total .last-win, .bet-total .new-bets { display: none; }
  .bet-actions { gap: 4px; }
  .btn-tool span { display: none; }
  .deal-btn { min-width: 84px; padding: 0 14px; }
  .dice .die { --size: 28px; }
}

/* Phones on their side and short windows: the layout scrolls inside the felt. */
@media (max-height: 560px) {
  .topbar { padding-block: 4px; }
  .table-wrap { padding-block: 4px; gap: 4px; }
  .table-felt { padding: 6px 12px; gap: 4px; border-radius: 20px; }
  .layout { overflow-y: auto; grid-template-rows: repeat(5, minmax(min-content, auto)); }
  .layout > .spot, .number-box { min-height: 56px; }
  .banner { padding: 3px 12px; font-size: 10px; }
  .banner small { display: inline; margin-left: 6px; }
  .controls { flex-wrap: nowrap; gap: 8px; }
  .chips-tray { width: auto; padding: 6px 8px; }
  .chips-tray .chip { --size: 34px; }
  .action-row { width: auto; }
  .deal-btn { height: 42px; min-width: 76px; }
  .bet-total .last-win, .bet-total .new-bets { display: none; }
}

/* Small phones on their side: the tray and every action share one row, so
   the chips are slimmer and the tools keep only their icons. */
@media (max-height: 560px) and (max-width: 700px) {
  .chips-tray { gap: 4px; }
  .chips-tray .chip { --size: 30px; }
  .action-row { gap: 8px; }
  .bet-actions { gap: 4px; }
  .btn-tool { min-width: 0; padding: 6px 7px; }
  .btn-tool span { display: none; }
  .bet-total { min-width: 0; }
  .deal-btn { padding-inline: 12px; }
}

/* No transitions at all for reduced motion: each step appears in place. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}
