/* =============== Craps: shared =============== */
.die {
  --s: 60px;
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.18); background: #fbfaf5;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: calc(var(--s) * 0.14); flex-shrink: 0;
}
.die i { width: 70%; height: 70%; margin: auto; border-radius: 50%; background: #1d1d1d; visibility: hidden; }
.die i.on { visibility: visible; }
.die.red i { background: #c8202f; }
.dice { display: flex; gap: 12px; justify-content: center; }
.dice.tumbling .die { animation: tumble 0.35s linear infinite; }
@keyframes tumble { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(180deg) translateY(-12%); } 100% { transform: rotate(360deg) translateY(0); } }
.cr-chip {
  display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; padding: 1px 7px 1px 2px;
  font-weight: 900; color: #fff; background: rgba(0, 0, 0, 0.55); border: 2px solid var(--c); white-space: nowrap;
}
.cr-chip b { width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--c); display: inline-flex; align-items: center; justify-content: center; color: #111; font-size: 0.85em; }

/* =============== Craps: TV =============== */
.cr-tv { display: flex; flex-direction: column; overflow: hidden; }
.cr-main { flex: 1; display: grid; grid-template-columns: 1fr 24vw; gap: 1.5vw; padding: 0 1.5vw 1.5vh; min-height: 0; }
.cr-layout {
  position: relative; border-radius: 2vw; border: 1vw solid var(--rail);
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 85%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5); padding: 1.2vw; display: grid; gap: 0.8vw; font-size: 1vw;
  grid-template-columns: 1fr 17vw; grid-template-rows: 1.45fr 0.9fr 0.8fr 0.38fr 0.75fr;
  grid-template-areas: "points props" "come props" "field props" "dp props" "pass props";
}
.cr-box {
  border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 0.8vw; padding: 0.6vw; position: relative;
  display: flex; flex-direction: column; gap: 0.4vw; min-height: 0; overflow: hidden;
}
.cr-box .t { font-weight: 900; letter-spacing: 0.15vw; text-transform: uppercase; font-size: 1.2vw; color: #f3f1e8; }
.cr-box .t small { font-weight: 700; letter-spacing: 0; text-transform: none; color: rgba(255, 255, 255, 0.6); font-size: 0.9vw; margin-left: 0.5vw; }
.cr-box .chips { display: flex; flex-wrap: wrap; gap: 0.3vw; align-content: flex-start; }
.cr-box .cr-chip { font-size: 0.95vw; }
.cr-points { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6vw; }
.cr-points .cr-box { align-items: stretch; }
.cr-points .num { font-size: 2.6vw; font-weight: 900; text-align: center; line-height: 1; color: #fff; }
.cr-points .pays { text-align: center; color: rgba(255, 255, 255, 0.6); font-weight: 700; font-size: 0.85vw; }
.cr-points .lane { font-size: 0.75vw; color: rgba(255, 255, 255, 0.65); font-weight: 800; }
.cr-points .cr-box.is-point { border-color: var(--accent); box-shadow: 0 0 18px rgba(245, 197, 66, 0.55); }
.puck {
  position: absolute; top: 0.4vw; right: 0.4vw; width: 2.4vw; height: 2.4vw; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-weight: 900; font-size: 0.8vw; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.puck.on { background: #fff; color: #111; }
.puck.off { background: #111; color: #fff; border: 2px solid #fff; }
.cr-row { display: grid; gap: 1vw; }
.cr-row.mid { grid-template-columns: 1.3fr 2fr 1fr; }
.cr-row.line { grid-template-columns: 1fr; }
.cr-row .field-nums { color: #f5c542; font-weight: 900; font-size: 1.3vw; letter-spacing: 0.2vw; }
.cr-side { display: flex; flex-direction: column; gap: 1vh; min-height: 0; }
.cr-side .panel-box { background: var(--panel); border-radius: 14px; padding: 1vw; }
.cr-side .dice .die { --s: 5.5vw; }
.cr-msg { text-align: center; font-size: 1.5vw; font-weight: 900; margin-top: 1vh; }
.cr-msg .sub { font-size: 1vw; color: var(--muted); font-weight: 700; margin-top: 0.4vh; }
.cr-msg .timer-bar { margin-top: 1vh; }
/* Layout pieces: Come big, Don't Come / Don't Pass small, props down the right like the centre of a real table */
.cr-points { grid-area: points; }
.cr-come { grid-area: come; display: grid; grid-template-columns: 3fr 1fr; gap: 0.8vw; min-height: 0; }
.cr-field { grid-area: field; }
.cr-dp { grid-area: dp; flex-direction: row !important; align-items: center; padding: 0.3vw 0.6vw !important; }
.cr-pass { grid-area: pass; }
.cr-box.small .t { font-size: 0.8vw; letter-spacing: 0.05vw; color: rgba(255, 255, 255, 0.75); }
.cr-box.small .t small { font-size: 0.65vw; }
.cr-box.small { border-width: 1px; border-color: rgba(255, 255, 255, 0.35); }
.cr-box.big .t, .cr-pass .t { font-size: 1.8vw; }
.cr-field .t { font-size: 1.5vw; }
.cr-props { grid-area: props; display: flex; flex-direction: column; gap: 0.45vw; border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 0.8vw; padding: 0.5vw; min-height: 0; overflow: hidden; background: rgba(0, 0, 0, 0.15); }
.cr-props-title { text-align: center; font-weight: 900; font-size: 0.8vw; letter-spacing: 0.2vw; text-transform: uppercase; color: var(--accent); }
.cr-prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4vw; }
.cr-prop { border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 0.5vw; padding: 0.3vw 0.4vw; text-align: center; min-height: 0; }
.cr-prop .pt { font-weight: 900; font-size: 0.95vw; color: #fff; line-height: 1.1; }
.cr-prop.hard .pt { color: #ffd27a; }
.cr-prop.seven { border-color: rgba(255, 120, 130, 0.8); }
.cr-prop.seven .pt { color: #ff9aa3; }
.cr-prop .pp { font-size: 0.7vw; color: rgba(255, 255, 255, 0.6); font-weight: 700; }
.cr-prop .chips { display: flex; flex-wrap: wrap; gap: 0.2vw; justify-content: center; }
.cr-prop .cr-chip { font-size: 0.75vw; }
/* Roll counter and history: big enough to read from the sofa */
.cr-count { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6vw; }
.cr-count div { background: var(--panel); border-radius: 12px; padding: 0.8vh 0.6vw; text-align: center; }
.cr-count b { display: block; font-size: 2.6vw; font-weight: 900; line-height: 1; color: var(--accent); }
.cr-count span { font-size: 0.85vw; color: var(--muted); font-weight: 700; }
.cr-history { background: var(--panel); border-radius: 12px; padding: 0.8vh 0.6vw; }
.cr-hist-title { font-size: 0.85vw; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.1vw; margin-bottom: 0.6vh; }
.cr-hist-row { display: flex; gap: 0.45vw; flex-wrap: wrap; align-items: center; }
.cr-hist-row span {
  position: relative; width: 2.7vw; height: 2.7vw; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.35vw; background: #f2f0e8; color: #1b1b1b;
}
.cr-hist-row span.green { background: #1e9e5a; color: #fff; }
.cr-hist-row span.red { background: #d7263d; color: #fff; }
.cr-hist-row span.newest { width: 3.6vw; height: 3.6vw; font-size: 1.9vw; box-shadow: 0 0 0 0.25vw var(--accent), 0 0 1vw rgba(245, 197, 66, 0.7); }
.cr-hist-row span i { position: absolute; bottom: -0.2vw; right: -0.2vw; font-style: normal; font-size: 0.65vw; background: #111; color: #ffd27a; border-radius: 4px; padding: 0 0.2vw; }
.cr-players { display: flex; flex-direction: column; gap: 0.5vh; overflow: hidden; }
.cr-player { display: flex; align-items: center; gap: 0.6vw; background: var(--panel); border-radius: 10px; padding: 0.6vh 0.8vw; font-size: 1vw; font-weight: 700; border-left: 0.4vw solid var(--c); }
.cr-player .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-player .st { color: var(--muted); font-size: 0.85vw; }
.cr-player .up { color: #6be39a; } .cr-player .down { color: #ff8a80; }

/* =============== Craps: phone =============== */
.cr-phone.screen { padding: 12px 16px 8px; gap: 10px; }
/* The puck on the phone felt, like the TV's: ON on the point number, OFF on the Pass Line during the come-out */
#cr .cr-tile .puck { top: 3px; right: 3px; width: 20px; height: 20px; font-size: 8px; z-index: 2; pointer-events: none; }
/* a place number is too small to hold the puck without covering it: the puck sits on its top-right corner instead */
#cr .cr-main-col .cr-tile.is-point { overflow: visible; z-index: 2; }
#cr .cr-tile .puck.inline { position: relative; top: auto; right: auto; display: inline-flex; vertical-align: middle; margin: -3px 0 0 8px; width: 22px; height: 22px; }
#cr .cr-tile.is-point .puck { top: -7px; right: -6px; width: 19px; height: 19px; }
/* with no dice row, the first row under the timer clears the round emoji / timeout buttons beside the status */
#cr .cr-track:not(.hidden), #cr .cr-track.hidden + .cr-body { margin-top: 14px; }
#cr .cr-tile.is-point { border-color: var(--accent); box-shadow: 0 0 10px rgba(245, 197, 66, 0.55); }
.cr-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cr-phone .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cr-phone .row2 button { padding: 16px 6px; font-size: 17px; }
.cr-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-tiles.place { grid-template-columns: repeat(3, 1fr); }
.cr-section { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: -2px; }
.cr-tile {
  position: relative; text-align: left; background: var(--felt-1); color: #fff; border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px; padding: 10px 10px 8px; min-height: 62px; display: flex; flex-direction: column; justify-content: space-between;
}
.cr-tile .nm { font-weight: 900; font-size: 15px; }
.cr-tile .py { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.7); }
.cr-tile .mine { font-weight: 900; color: var(--accent); font-size: 14px; }
.cr-tile.has { border-color: var(--accent); }
.cr-tile.dont { background: #4a1a22; }
.cr-tile.field { background: #1d5d73; }
/* Phone table: place numbers on top, Come, Field, Pass Line at the bottom; Props / Bonus on the side */
.cr-felt-phone {
  display: grid; grid-template-columns: 1fr 46px; gap: 6px; padding: 8px; border-radius: 14px; border: 5px solid var(--rail);
  background: radial-gradient(ellipse at 50% 30%, var(--felt-1), var(--felt-2) 90%);
}
.cr-main-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cr-tiles.six { grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cr-tiles.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cr-tiles.one { grid-template-columns: 1fr; }
.cr-tiles.come-row, .cr-tiles.pass-row { grid-template-columns: 2.6fr 1fr; gap: 6px; }
.cr-felt-phone .cr-tile { background: rgba(0, 0, 0, 0.18); border-color: rgba(255, 255, 255, 0.55); min-height: 48px; padding: 6px 7px; touch-action: manipulation; }
.cr-felt-phone .cr-tile.has { touch-action: none; }
.cr-tile.place { text-align: center; padding: 5px 2px; min-height: 58px; align-items: center; }
.cr-tile.place .nm { font-size: 20px; }
.cr-tile.place .py { font-size: 9px; }
.cr-tile.big .nm { font-size: 17px; letter-spacing: 1px; text-transform: uppercase; }
.cr-tile.small { min-height: 40px !important; padding: 4px 6px !important; }
.cr-tile.small .nm { font-size: 11px; color: rgba(255, 255, 255, 0.8); }
.cr-tile.small .py { font-size: 9px; }
.cr-tile.field .nm small { font-size: 11px; color: var(--accent); margin-left: 6px; letter-spacing: 1px; }
.cr-tiles.dont-row .cr-tile { background: rgba(60, 10, 18, 0.45); }
.cr-tile.na { opacity: 0.38; }
.cr-tile.drop { outline: 3px solid var(--accent); outline-offset: 1px; }
.cr-side-col { display: flex; flex-direction: column; gap: 6px; }
.cr-side-btn {
  flex: 1; padding: 4px 0; border-radius: 10px; font-size: 12px; font-weight: 900; letter-spacing: 1px; writing-mode: vertical-rl;
  text-orientation: mixed; background: rgba(0, 0, 0, 0.35); color: #fff; border: 2px solid rgba(255, 255, 255, 0.55);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.cr-side-btn.on { border-color: var(--accent); color: var(--accent); }
.cr-side-btn.off { opacity: 0.4; }
.cr-side-btn small { writing-mode: horizontal-tb; background: var(--accent); color: #2a1e00; border-radius: 8px; padding: 1px 4px; font-size: 11px; }
.cr-hint { font-size: 12px; }
.cr-sheet { position: fixed; inset: 0; z-index: 58; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; }
.cr-sheet-box {
  width: 100%; max-width: 480px; margin: 0 auto; background: var(--bg); border-top: 3px solid var(--accent); border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px;
}
.cr-sheet-head { display: flex; justify-content: space-between; align-items: center; }
.cr-sheet-head button { padding: 8px 16px; }
.cr-sheet .cr-tile { background: var(--felt-2); min-height: 50px; }
.cr-tile.prop .nm { font-size: 15px; }
.cr-tile.seven { background: #5a1823 !important; }
.cr-mybets { background: var(--panel); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.cr-mybets div { display: flex; justify-content: space-between; padding: 3px 0; }
.cr-mybets .off { color: var(--muted); }
.cr-roll { font-size: 26px; padding: 26px; width: 100%; border-radius: 18px; }
.cr-big-dice { display: flex; justify-content: center; padding: 14px 0; }
.cr-big-dice .die { --s: 76px; }

/* Phone: the on/off switches (Bets in the bottom row, hardways in the Props panel) */
.cr-sw { padding: 8px 6px; font-size: 13px; background: var(--panel-2); color: var(--text); border: 2px solid var(--line); border-radius: 10px; }
.cr-sw.is-on b { color: #6be39a; }
.cr-sw.is-off { border-color: var(--danger); background: rgba(224, 48, 63, 0.18); }
.cr-sw.is-off b { color: #ff8a80; }
.cr-tiles.hops { grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cr-tile.hop { min-height: 40px !important; padding: 4px 2px !important; text-align: center; align-items: center; }
.cr-tile.hop .nm { font-size: 12px !important; }
.cr-tile.hop .py { display: none; }
.cr-sheet-box { max-height: 88vh; overflow-y: auto; }

/* TV: chips that are off this roll, hops, the floating winnings and the wins list */
.cr-chip.off { opacity: 0.45; }
.cr-chip.off::after { content: 'OFF'; font-size: 0.7em; margin-left: 2px; color: #ff8a80; }
.off-tag { color: #ff8a80; }
.cr-hops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3vw; }
.cr-fly {
  position: fixed; z-index: 80; transform: translate(-50%, -50%); pointer-events: none; font-weight: 900; font-size: 1.7vw;
  color: #fff; background: var(--c); border: 2px solid #fff; border-radius: 999px; padding: 0.1vw 0.7vw; box-shadow: 0 0 1vw rgba(0, 0, 0, 0.6);
  transition: transform 1.3s cubic-bezier(0.5, 0, 0.3, 1), opacity 1.3s ease-in; animation: cr-fly-in 0.4s ease-out;
}
@keyframes cr-fly-in { from { transform: translate(-50%, -50%) scale(0.3); opacity: 0; } }
.cr-wins { background: var(--panel); border-radius: 12px; padding: 0.8vh 0.8vw; }
.cr-wins .w {
  display: flex; align-items: baseline; gap: 0.5vw; font-size: 1.15vw; font-weight: 900; color: #6be39a; padding: 0.2vh 0;
  border-left: 0.3vw solid var(--c); padding-left: 0.5vw; margin-bottom: 0.3vh; opacity: 0; animation: cr-win-in 0.4s ease-out forwards;
}
.cr-wins .w b { color: var(--text); }
.cr-wins .w span { font-size: 0.85vw; color: var(--muted); font-weight: 700; }
.cr-wins .w.none { color: var(--muted); border: 0; animation-delay: 0.2s; }
@keyframes cr-win-in { from { opacity: 0; transform: translateX(1vw); } to { opacity: 1; transform: none; } }

/* Crapless: 10 point boxes fit inside their column */
.cr-points { min-width: 0; }
.cr-points.many { gap: 0.35vw; }
.cr-points.many .cr-box { padding: 0.35vw; }
.cr-points.many .num { font-size: 1.9vw; }
.cr-points.many .pays { font-size: 0.65vw; }
.cr-points.many .puck { width: 1.7vw; height: 1.7vw; font-size: 0.6vw; }
.cr-props { min-width: 0; }

/* Crapless: the 10 numbers in two short rows */
.cr-tiles.six.tworow .cr-tile.place { min-height: 40px; padding: 2px 2px; }
.cr-tiles.six.tworow .cr-tile.place .nm { font-size: 17px; }

/* ---------- Phone: the betting screen fits one screen (no scrolling) ---------- */
#cr.screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; gap: 6px; padding-top: 10px; }
#cr .cr-body { flex: 1 1 0; min-height: 0; gap: 6px; }
/* Phone: the last rolls strip above the table (newest on the left) */
#cr .cr-phist { flex-shrink: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--panel); border-radius: 10px; overflow: hidden; }
.cr-phist-lbl { flex: 0 0 auto; font-size: 10px; line-height: 1.1; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.cr-phist-row { flex: 1 1 0; min-width: 0; display: flex; gap: 5px; align-items: center; overflow: hidden; }
.cr-phist-row em { font-style: normal; font-size: 12px; color: var(--muted); }
.cr-phist-row span { position: relative; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 12px; background: #f2f0e8; color: #1b1b1b; }
.cr-phist-row span.green { background: #1e9e5a; color: #fff; }
.cr-phist-row span.red { background: #d7263d; color: #fff; }
.cr-phist-row span.newest { width: 30px; height: 30px; font-size: 15px; margin: 0 2px; box-shadow: 0 0 0 2px var(--accent), 0 0 8px rgba(245, 197, 66, 0.7); }
.cr-phist-row span i { position: absolute; bottom: -3px; right: -2px; font-style: normal; font-size: 8px; line-height: 1; background: #111; color: #ffd27a; border-radius: 3px; padding: 1px 2px; }
/* Phone: four buttons in the bottom row (Clear, Bets, Layouts, Ready) */
#cr .cr-row4 { display: grid; grid-template-columns: 0.85fr 1fr 1.1fr 1.05fr; gap: 6px; align-items: stretch; }
#cr .cr-row4 button { font-size: 14px; width: 100%; margin: 0; }
#cr .cr-row4 .cr-bets-btn { padding: 0 4px; }
.cr-sw-wide { width: 100%; padding: 10px; font-size: 14px; }
#cr .cr-felt-phone { flex: 1 1 0; min-height: 0; padding: 6px; }
#cr .cr-main-col { min-height: 0; gap: 5px; }
#cr .cr-main-col > .cr-tiles { flex: 1 1 0; min-height: 0; }
#cr .cr-main-col > .cr-tiles.six { flex-grow: 1.2; }
#cr .cr-main-col .cr-tile { min-height: 0 !important; height: 100%; padding-top: 3px !important; padding-bottom: 3px !important; overflow: hidden; }
#cr .cr-side-col .cr-side-btn { flex: 1 1 0; min-height: 0; }
#cr .bj-actions-bar { position: static; flex-shrink: 0; padding: 2px 0 0; }
#cr .chip-tray { padding: 2px 0 6px; }
#cr .row2 button { padding: 12px 6px; }
#cr .cr-hint { flex-shrink: 0; font-size: 11px; }
#cr .link-btn { padding: 2px; flex-shrink: 0; font-size: 14px; }
@media (max-height: 700px) {
  #cr .cr-hint { display: none; }
  #cr .casino-chip { width: 52px; height: 52px; }
  #cr .casino-chip span { inset: 7px; font-size: 15px; }
  #cr .cr-tile.place .nm { font-size: 17px; }
}

/* ---------- Bonus bet trackers (phone and TV): the numbers hit so far light up ---------- */
.cr-track { display: flex; gap: 6px; align-items: center; justify-content: center; }
.cr-track.hidden { display: none; }
.cr-trk { display: flex; gap: 1px; flex: 1 1 0; min-width: 0; max-width: 150px; }
.cr-trk.fire { flex-grow: 1.2; }
.cr-trk i { flex: 1 1 0; min-width: 0; font-style: normal; text-align: center; font-size: 10px; font-weight: 900; line-height: 18px;
  border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.45); }
.cr-trk i.lbl { flex: 0 0 auto; padding: 0 3px; background: none; color: var(--accent); }
.cr-trk i.hit { background: var(--accent); color: #2a1e00; box-shadow: 0 0 6px rgba(245, 197, 66, 0.6); }
.cr-trk.fire i.hit { background: #f08c3a; color: #2a0e00; box-shadow: 0 0 6px rgba(240, 140, 58, 0.7); }
.cr-trk.hard i.hit { background: #ffd27a; }
#cr .cr-track { flex-shrink: 0; margin: -2px 0; }
.cr-track.in-sheet { margin-bottom: 4px; }
.cr-track.in-sheet .cr-trk i { line-height: 24px; font-size: 13px; }
.cr-sheet-box .cr-section { text-transform: none; letter-spacing: 0; line-height: 1.3; }
/* TV: the trackers sit in the Bonus part of the props column */
.cr-props .cr-track { flex-wrap: wrap; gap: 0.3vw; }
.cr-props .cr-trk { max-width: none; flex-basis: 45%; }
.cr-props .cr-trk.fire, .cr-props .cr-trk.hard { flex-basis: 45%; }
.cr-props .cr-trk i { font-size: 0.75vw; line-height: 1.3vw; border-radius: 0.25vw; }

/* ---------- Phone table, Phase 2: full-width place numbers, Props / Bonus along the bottom, readable bets ---------- */
#cr .cr-felt-phone { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
#cr .cr-side-row { flex-direction: row; gap: 6px; }
#cr .cr-side-row .cr-side-btn { writing-mode: horizontal-tb; flex: 1 1 0; padding: 5px 0; min-height: 30px; font-size: 13px; }
#cr .cr-side-row .cr-side-btn small { font-size: 12px; }
#cr .cr-main-col > .cr-tiles.six { flex-grow: 1.35; gap: 5px; }
#cr .cr-main-col > .cr-tiles.six.tworow { flex-grow: 2.3; }
.cr-tile.place { justify-content: flex-start; gap: 1px; }
.cr-tile.place .nm { line-height: 1.05; white-space: nowrap; }
#cr .cr-tile.place .py { font-size: 11px; line-height: 1.1; white-space: nowrap; color: rgba(255, 255, 255, 0.8); }
/* lock icon on place boxes: overlay corner so it never reflows the number or payout */
#cr .cr-tile.place .nm .lock-mark { position: absolute; top: 2px; right: 2px; font-size: 8px; margin: 0; line-height: 1; }
/* hide lock icons during the 7-out result */
#cr.seven-out .lock-mark { display: none; }
#cr .cr-tiles.six.tworow .cr-tile.place .nm { font-size: 16px; }
/* your chips on a spot: a gold pill you can read at a glance (bottom-right; centred on the number squares) */
.cr-tile .mine {
  position: absolute; right: 4px; bottom: 3px; min-width: 24px; padding: 1px 6px; border-radius: 999px; text-align: center;
  background: var(--accent); color: #2a1e00; font-size: 13px; line-height: 17px; font-weight: 900; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.cr-tile.place .mine { position: relative; right: auto; bottom: auto; align-self: center; margin-top: auto; font-size: 12px; line-height: 16px; padding: 0 4px; min-width: 0; max-width: 100%; }
.cr-tile.small .mine { font-size: 11px; line-height: 14px; padding: 0 4px; min-width: 18px; }
.cr-tile.has { border-color: var(--accent) !important; box-shadow: inset 0 0 0 1px var(--accent); }

/* the big "Remove bet" drop area that covers the chip tray while you drag a bet */
.remove-zone {
  position: fixed; z-index: 99; display: none; align-items: center; justify-content: center; gap: 10px; pointer-events: none;
  border: 3px dashed #ff8a80; border-radius: 16px; background: rgba(120, 16, 28, 0.88); color: #fff; font-size: 20px; font-weight: 900;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
}
.remove-zone.show { display: flex; }
.remove-zone .rz-x { width: 30px; height: 30px; border-radius: 50%; background: var(--danger); display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.remove-zone.hot { background: var(--danger); border-style: solid; border-color: #fff; transform: scale(1.03); }
/* the place numbers keep a fixed, readable size; the rows below share what's left */
#cr .cr-main-col > .cr-tiles.six { flex: 0 0 auto; grid-auto-rows: 56px; }
#cr .cr-main-col > .cr-tiles.six.tworow { grid-auto-rows: 42px; flex: 0 0 auto; }
#cr .cr-tiles.six.tworow .cr-tile.place {
  display: grid; grid-template-columns: auto auto; justify-content: center; align-content: center; align-items: baseline; column-gap: 4px; row-gap: 2px; padding: 2px !important;
}
#cr .cr-tiles.six.tworow .cr-tile.place .mine { grid-column: 1 / -1; margin: 0; justify-self: center; }
@media (max-height: 700px) { #cr .cr-tiles.six:not(.tworow) .cr-tile.place .nm { font-size: 18px; } }
.cr-sheet-head { position: sticky; top: -12px; z-index: 3; background: var(--bg); margin: -12px -14px 0; padding: 12px 14px 6px; }

/* ---------- Phase 4: the TV table never moves ---------- */
/* Every track is fixed (minmax(0, …)) so chips landing can never grow a row or column; boxes clip their own chips */
.cr-main { grid-template-rows: minmax(0, 1fr); }
.cr-layout { grid-template-rows: minmax(0, 1.45fr) minmax(0, 0.9fr) minmax(0, 0.8fr) minmax(0, 0.38fr) minmax(0, 0.75fr); grid-template-columns: minmax(0, 1fr) 17vw; min-height: 0; }
.cr-points { min-height: 0; grid-template-rows: minmax(0, 1fr); }
.cr-come { grid-template-rows: minmax(0, 1fr); }
.cr-box .chips, .cr-prop .chips { min-height: 0; overflow: hidden; }
/* Side column, top to bottom: dice + message (fixed height), roll counter, players (fixed rows, seat order), this roll, last rolls */
.cr-side { display: flex; flex-direction: column; }
.cr-side > .panel-box { flex: 0 0 auto; height: 11vw; max-height: 22vh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.cr-side .dice .die { --s: min(5.5vw, 9vh); }
.cr-msg { overflow: hidden; }
.cr-msg .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-count, .cr-history { flex: 0 0 auto; }
.cr-players { flex: 0 0 auto; }
.cr-player { height: 2.4vw; min-height: 22px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.cr-player .net { min-width: 3.2vw; text-align: right; }
.cr-player .ch { min-width: 3.4vw; text-align: right; }
.cr-player .st { max-width: 8vw; overflow: hidden; text-overflow: ellipsis; }
.cr-wins-slot { flex: 1 1 0; min-height: 0; overflow: hidden; }
.cr-wins-slot .cr-wins { max-height: 100%; overflow: hidden; }
.cr-history { overflow: hidden; }
.cr-hist-row { flex-wrap: nowrap; overflow: hidden; }

/* ---------- Phase 4: bonus bets along the top of the TV ---------- */
.cr-bonus { flex: 0 0 auto; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 1vw; padding: 0 1.5vw 1vh; }
.cr-bonus.hidden { display: none; }
.crb {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.8vw; align-items: center;
  height: 4.6vw; min-height: 52px; box-sizing: border-box; padding: 0.4vw 0.8vw; border-radius: 0.8vw; overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.25)), var(--panel); border: 2px solid rgba(245, 197, 66, 0.45);
}
.crb.fire { border-color: rgba(240, 140, 58, 0.7); }
.crb-h { grid-row: 1; grid-column: 1; font-weight: 900; font-size: 1.15vw; color: var(--accent); white-space: nowrap; }
.crb.fire .crb-h { color: #ffb067; }
.crb-h small { color: var(--muted); font-size: 0.8em; margin-left: 0.3vw; }
.crb-d { grid-row: 2; grid-column: 1; font-size: 0.8vw; color: var(--muted); font-weight: 700; white-space: nowrap; }
.crb-n { grid-row: 1 / 3; grid-column: 2; display: flex; gap: 0.25vw; align-items: center; justify-content: center; min-width: 0; }
.crb-n b { font-size: 0.8vw; color: var(--accent); margin: 0 0.15vw 0 0.4vw; }
.crb-n i {
  font-style: normal; width: 1.9vw; height: 1.9vw; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95vw; font-weight: 900; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.45); flex: 0 0 auto;
}
.crb-n i.hit { background: var(--accent); color: #2a1e00; box-shadow: 0 0 0.6vw rgba(245, 197, 66, 0.7); }
.crb.fire .crb-n i.hit { background: #f08c3a; color: #2a0e00; box-shadow: 0 0 0.7vw rgba(240, 140, 58, 0.8); }
.crb-n i.pop { animation: crbPop 0.9s ease-out; }
@keyframes crbPop { 0% { transform: scale(0.6); } 35% { transform: scale(1.55); box-shadow: 0 0 1.6vw 0.4vw rgba(255, 220, 120, 0.95); } 100% { transform: scale(1); } }
.crb-p { grid-row: 1; grid-column: 3; font-size: 0.75vw; color: rgba(255, 255, 255, 0.6); font-weight: 700; text-align: right; white-space: nowrap; }
.crb .chips { grid-row: 2; grid-column: 3; display: flex; gap: 0.2vw; justify-content: flex-end; overflow: hidden; max-width: 14vw; }
.crb .chips .cr-chip { font-size: 0.75vw; }
.crb.paid { animation: crbPaid 1.2s ease-in-out 4; border-color: #ffe08a; }
@keyframes crbPaid { 0%, 100% { box-shadow: 0 0 0 rgba(255, 224, 138, 0); } 50% { box-shadow: 0 0 2vw 0.5vw rgba(255, 224, 138, 0.85); transform: scale(1.02); } }
/* bonus card: title | numbers on top, description | pays + chips below; the numbers shrink before anything overlaps */
.crb { grid-template-columns: auto minmax(0, 1fr); }
.crb-n { grid-row: 1; grid-column: 2; justify-content: flex-end; overflow: hidden; }
.crb-n i { width: auto; height: auto; flex: 0 1 1.8vw; aspect-ratio: 1; min-width: 0; }
.crb-f { grid-row: 2; grid-column: 2; display: flex; align-items: center; justify-content: flex-end; gap: 0.6vw; min-width: 0; overflow: hidden; }
.crb-f .crb-p { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crb-f .chips { flex: 0 0 auto; max-width: 12vw; }

/* ---------- Phase 5: Come odds in a sheet; the board never reflows ---------- */
.cr-tile { position: relative; }
.cr-odds-pill { position: absolute; top: 3px; right: 3px; font-size: 11px; font-weight: 900; line-height: 1; padding: 4px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); color: var(--accent); border: 1px solid rgba(245, 197, 66, 0.7); pointer-events: auto; }
.cr-odds-pill.on { background: var(--accent); color: #1a1a1a; }
.cr-odds-pill .lock-mark { font-size: 9px; margin-left: 2px; }
.cr-odds-row { display: grid; grid-template-columns: 1fr 96px 74px; gap: 8px; align-items: center; margin: 6px 0; }
.cr-odds-info { display: flex; flex-direction: column; font-size: 14px; }
.cr-odds-info span { color: var(--muted); font-size: 12px; }
.cr-odds-row .cr-tiles.one { margin: 0; }
.cr-odds-del { font-size: 12px; padding: 8px 6px; }

#crLayout { position: relative; }
.cr-main { position: relative; }
#crFeltFx { position: absolute; pointer-events: none; z-index: 25; }

/* ---------- Phase 5: the board stays up through the roll; dice on the felt ---------- */
.cr-felt-phone.frozen .cr-tile { pointer-events: none; }
.cr-felt-phone.frozen .cr-side-btn { pointer-events: none; opacity: 0.7; }
.cr-bar-alt { position: relative; }
.cr-bar-alt > :not(.cr-bar-over) { visibility: hidden; }
.cr-bar-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 2; }
.cr-bar-over .cr-roll { padding: 14px; font-size: 24px; height: 100%; }
.cr-phone { position: relative; }
#crFx { position: absolute; z-index: 30; pointer-events: none; }
#crFx .cr-grab { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); display: flex; gap: 10px; padding: 14px;
  pointer-events: auto; touch-action: none; cursor: grab; border-radius: 16px; background: rgba(0, 0, 0, 0.35); box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.6);
  animation: cr-grab-pulse 1.4s ease-in-out infinite; }
#crFx .cr-grab .die { width: 44px; height: 44px; }
#crFx .cr-grab.held { animation: none; cursor: grabbing; box-shadow: 0 0 0 3px var(--accent); }
/* Set the dice: while the shooter holds the dice, a drop zone takes the Roll button's place (the button hides) */
#cr.cr-holding .cr-bar-over .cr-roll, #cr.cr-setting .cr-bar-over .cr-roll { visibility: hidden; }
#crFx .cr-setzone { position: absolute; display: flex; align-items: center; justify-content: center; z-index: 1;
  border: 2px dashed rgba(245, 197, 66, 0.75); border-radius: 12px; background: #0b3a22; color: var(--accent);
  font-weight: 800; font-size: 14px; text-align: center; transition: background 0.15s, box-shadow 0.15s; }
#crFx .cr-setzone.over { background: #3d4a1c; box-shadow: 0 0 0 2px var(--accent), 0 0 18px rgba(245, 197, 66, 0.6); }
#crFx .cr-grab { z-index: 2; }
#crFx .cr-setter { position: absolute; inset: 0; z-index: 3; pointer-events: auto; touch-action: none; border-radius: 12px;
  background: #08281a; box-shadow: inset 0 0 0 2px rgba(245, 197, 66, 0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; }
.cr-set-head { font-weight: 900; font-size: 18px; color: var(--accent); }
.cr-set-dice { display: flex; align-items: flex-end; gap: 8px; }
/* Each die in the setter is a 3D cube seen from straight above: it turns with your finger, then settles on a face.
   The die box is 84px (68 + padding); its arc is drawn in a 160px square centered on it, so each column leaves 34px
   on its outer side and above for the arc's touch band. */
.cr-set-col { position: relative; padding-top: 34px; }
.cr-set-col:first-child { padding-left: 34px; }
.cr-set-col:last-child { padding-right: 34px; }
.cr-set-die { --d: 68px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); cursor: grab; touch-action: none;
  perspective: 420px; }
.cr-arc { position: absolute; width: 160px; height: 160px; top: -4px; left: -4px; pointer-events: none; overflow: visible; color: var(--accent); }
.cr-set-col:last-child .cr-arc { left: -38px; }
.cr-arc-line { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; opacity: 0.75; }
.cr-arc-hit { fill: none; stroke: transparent; stroke-width: 28; pointer-events: stroke; touch-action: none; cursor: grab; }
/* The middle pad: drag it to tip both dice a little and peek at their sides; they settle back when you let go */
.cr-peek { width: 64px; height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 2px dashed rgba(245, 197, 66, 0.45); border-radius: 14px; color: var(--muted); font-size: 11px; font-weight: 800;
  touch-action: none; cursor: grab; user-select: none; }
.cr-peek span { display: flex; align-items: center; gap: 3px; }
.cr-peek i { font-style: normal; font-size: 9px; opacity: 0.8; }
.cr-peek.held { border-color: var(--accent); color: var(--accent); background: rgba(245, 197, 66, 0.08); }
.cr-cube { --h: calc(var(--d) / 2); position: relative; width: var(--d); height: var(--d); transform-style: preserve-3d; will-change: transform; }
.cr-cube.settle { transition: transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.cr-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cr-face .die { --s: var(--d); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), inset 0 0 calc(var(--d) * 0.12) rgba(0, 0, 0, 0.18); }
@media (prefers-reduced-motion: reduce) { .cr-cube.settle { transition: none; } }
.cr-set-sum { font-weight: 900; font-size: 16px; }
.cr-set-hint { font-size: 12px; color: var(--muted); text-align: center; }
.cr-set-btns { align-self: stretch; display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.cr-set-btns button { padding: 12px 16px; font-size: 16px; }
.cr-set-btns .ok { flex: 1; max-width: 60%; }
@keyframes cr-grab-pulse { 50% { box-shadow: 0 0 0 2px rgba(245, 197, 66, 0.6), 0 0 22px rgba(245, 197, 66, 0.6); } }
/* the bar keeps its size when the Roll button / a line replaces the chips (the overlay sits inside it) */
#cr .bj-actions-bar.cr-bar-alt, #rl .bj-actions-bar.cr-bar-alt { position: relative; }
/* "↩ Back to betting" fits on one line, so Ready ⇄ Back to betting never changes the bar's height */
#cr .cr-row3 button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding-left: 6px; padding-right: 6px; }
#cr .cr-row3 button[data-act="unready"] { font-size: 14px; }
/* fading toast for locked-bet notes and layout messages (shown in mid-screen, not the bottom bar) */
#crToast { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 50;
  background: rgba(0, 0, 0, 0.78); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; text-align: center; pointer-events: none; opacity: 0; transition: none; max-width: 90%; }
#crToast.cr-toast-show { animation: cr-toast-anim 3.5s forwards; }
@keyframes cr-toast-anim { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- TV: the house frame (tv-frame.js; Blackjack is the model). The betting layout is the felt; the side panel
   has the dice and the call in the status box, the players, the last rolls and Scan to join. ---------- */
#crGame .hf-main { position: relative; }
#crGame .cr-layout { min-height: 0; }
/* the dice of the last roll, next to the call in the status box */
#crGame .hf-status .t { display: flex; align-items: center; justify-content: center; gap: 0.8vw; }
#crGame .hf-status .t > span:last-child { overflow: hidden; text-overflow: ellipsis; }
#crGame .hf-status .dice { gap: 0.35vw; }
#crGame .hf-status .die { --s: 2.5vw; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); }
/* the game's name, printed in the open space under the one-roll bets */
#crGame .cr-props { position: relative; }
#crGame .cr-props > :not(.hf-felt-name) { position: relative; z-index: 1; }
#crGame .cr-props .hf-felt-name { top: auto; bottom: 2.2vw; --hf-name: 2.8vw; }
#crGame .cr-props .hf-felt-name .n { letter-spacing: 0.25em; padding-left: 0.25em; }
#crGame .cr-props .hf-felt-name .v { font-size: 0.7vw; letter-spacing: 0.12em; line-height: 1.5; padding: 0 0.6vw; }
/* the last rolls, in the side panel's extra */
#crGame .hf-extra .cr-history { background: none; padding: 0; }
#crGame .cr-counts { margin-top: 1vh; font-size: 0.85vw; color: var(--muted); }
#crGame .cr-counts b { color: var(--text); }
/* the tops of the dice on the hardways and the horn numbers (like Sic Bo's layout) */
#crGame .cr-prop .pt { display: flex; align-items: center; justify-content: center; gap: 0.3vw; white-space: nowrap; letter-spacing: -0.01em; }
#crGame .cr-tops { display: inline-flex; gap: 0.1vw; flex-shrink: 0; }
#crGame .cr-tops .die { --s: 1.15vw; padding: 0.1vw; border-radius: 0.18vw; box-shadow: none; }
/* the newest roll's ring and glow need room around them (the row clips anything outside it) */
#crGame .cr-history, #crGame .cr-hist-row { overflow: visible; }
#crGame .cr-hist-row { padding: 0.9vw 0.6vw; margin: -0.4vw -0.6vw 0; }
