/* =============== Sic Bo: shared (TV and phone) =============== */
.sb-dice { display: inline-flex; gap: 2px; align-items: center; justify-content: center; }
.sb-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.9em; height: 1.6em; padding: 0 0.35em;
  border-radius: 999px; font-weight: 900; color: #fff; border: 2px solid rgba(255, 255, 255, 0.3);
}
.sb-pill.small { background: #2f63b8; }
.sb-pill.big { background: #b5302b; }
.sb-pill.triple { background: #c99a1e; color: #2a1e00; }

/* The dice cup: a dome over the dice. Modes: mine (pulses, ready to shake) · wait · rattle · lift (dice show) */
.sb-cupbox { --cup: 150px; position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity 0.45s; }
.sb-cupbox.fade { opacity: 0; }
.sb-cup-dice { display: flex; gap: 8px; height: calc(var(--cup) * 0.34); align-items: flex-end; margin-bottom: calc(var(--cup) * -0.34); opacity: 0; }
.sb-cup-dice .die { --s: calc(var(--cup) * 0.3); }
.sb-cup {
  position: relative; width: var(--cup); height: calc(var(--cup) * 0.72); border-radius: 50% 50% 14% 14% / 70% 70% 14% 14%;
  background: radial-gradient(ellipse at 35% 25%, #ffe8a0, #d9a93a 35%, #8a5f14 80%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6), inset 0 -8px 0 rgba(0, 0, 0, 0.25), 0 0 0 3px #5a3a0a;
}
.sb-cup::after { content: ''; position: absolute; left: -6%; right: -6%; bottom: -6%; height: 16%; border-radius: 8px; background: #7a1d22; box-shadow: 0 0 0 2px #3a0a0e; }
.sb-cup i { position: absolute; left: 50%; top: -12%; width: 18%; height: 18%; transform: translateX(-50%); border-radius: 50%; background: #c62f2b; box-shadow: 0 0 0 3px #5a3a0a; }
.sb-cup-say { min-height: 1.3em; font-weight: 900; text-align: center; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); white-space: nowrap; }
.sb-cup-say b { display: block; font-size: 1.5em; color: var(--accent); }
.sb-cup-say span { display: block; }
.sb-cup-say .up { color: #7be09a; }
.sb-cup-say .down { color: #ff8f99; }
.sb-cupbox.mine { pointer-events: auto; cursor: pointer; }
.sb-cupbox.mine .sb-cup { animation: sb-ready 1.2s ease-in-out infinite; }
.sb-cupbox.rattle .sb-cup { animation: sb-rattle 0.16s linear infinite; }
.sb-cupbox.lift .sb-cup { animation: sb-lift 0.7s ease-in forwards; }
.sb-cupbox.lift .sb-cup-dice { opacity: 1; transition: opacity 0.2s 0.25s; }
.sb-cupbox.still .sb-cup { animation: none; }
.sb-cupbox.lift.still .sb-cup { opacity: 0; }
@keyframes sb-ready { 50% { transform: scale(1.06); filter: drop-shadow(0 0 14px rgba(245, 197, 66, 0.9)); } }
@keyframes sb-rattle { 0% { transform: translate(-4px, 0) rotate(-5deg); } 25% { transform: translate(3px, -5px) rotate(4deg); }
  50% { transform: translate(5px, 1px) rotate(6deg); } 75% { transform: translate(-3px, -4px) rotate(-3deg); } 100% { transform: translate(-4px, 0) rotate(-5deg); } }
@keyframes sb-lift { to { transform: translateY(-130%) rotate(-8deg); opacity: 0; } }

/* =============== Sic Bo: phone =============== */
#sb.screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; gap: 5px; padding: 10px 16px 8px; position: relative; }
.sb-hist { display: flex; gap: 4px; align-items: center; font-size: 12px; flex-wrap: nowrap; overflow: hidden; height: 24px; min-height: 24px; flex-shrink: 0; }
.sb-hist .muted { margin-right: 4px; font-weight: 700; white-space: nowrap; }
.sb-hist .sb-pill:nth-child(2) { outline: 2px solid var(--accent); }
.sb-body { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; gap: 5px; }
/* "On the table" sits centred under the timer, between the emote and ⏱ bubbles (they're 46px wide at each side) */
.sb-line { display: flex; justify-content: center; align-items: center; font-size: 13px; height: 20px; flex-shrink: 0; padding: 0 50px; white-space: nowrap; }
.sb-line b { color: var(--accent); }
.sb-felt {
  flex: 1 1 0; min-height: 0; display: flex; padding: 4px;
  background: radial-gradient(ellipse at 50% 30%, var(--felt-1), var(--felt-2) 90%); border: 5px solid var(--rail);
  border-radius: 14px; box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.5);
}
.sb-board { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sb-row { flex: 1 1 0; min-height: 0; display: flex; }
.sb-row.top { flex-grow: 1.15; }
.sb-phone .sb-cell {
  position: relative; flex: 1 1 0; min-width: 0; padding: 0 1px; border-radius: 0; color: #fff; background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.7); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  line-height: 1; touch-action: manipulation; font-weight: 900;
}
.sb-phone .sb-cell.has { touch-action: none; }
.sb-phone .sb-cell.wide { flex-grow: 1.4; }
.sb-phone .sb-cell.any { flex-grow: 1.2; background: rgba(201, 154, 30, 0.22); }
.sb-phone .sb-cell b { font-size: clamp(11px, 2.2vh, 15px); letter-spacing: 0.5px; }
.sb-phone .sb-row.top .sb-cell b { font-size: clamp(11px, 2vh, 14px); }
.sb-phone .sb-cell i { font-style: normal; font-size: 10px; color: rgba(255, 255, 255, 0.8); }
.sb-phone .sb-cell small { font-size: clamp(8px, 1.4vh, 10px); color: #ffe08a; font-weight: 800; }
.sb-phone .sb-cell .die { --s: clamp(10px, 2.1vh, 15px); padding: 1px; border-radius: 2px; box-shadow: none; }
.sb-phone .sb-row.triples .sb-cell .die { --s: clamp(9px, 1.9vh, 13px); }
.sb-phone .sb-cell.num b { font-size: clamp(13px, 2.6vh, 18px); }
.sb-phone .sb-cell.drop { background: rgba(245, 197, 66, 0.45); }
.sb-phone .sb-cell.win { background: rgba(245, 197, 66, 0.35); box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }
.sb-felt.frozen .sb-cell { pointer-events: none; }
.sb-hint { flex-shrink: 0; font-size: 11px; height: 14px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sb .bj-actions-bar { position: static; padding: 2px 0 0; flex-shrink: 0; }
#sb .bj-actions-bar.cr-bar-alt { position: relative; }
#sb .chip-tray { padding: 2px 0 6px; }
#sb .row3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
#sb .row3 button { height: 46px; padding: 0 6px; font-size: 17px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#sb .row3.sb-row4 { grid-template-columns: 1fr 1fr 1.15fr 1.35fr; gap: 6px; }
#sb .row3.sb-row4 button { font-size: 15px; padding: 0 4px; }
/* the status is always one line, so the felt never moves down */
#sb .bj-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sb .cr-bar-over .big-button { width: 100%; height: 100%; margin: 0; }
#sbFx { position: absolute; z-index: 30; pointer-events: none; }
/* on the phone the cup sits on a dim layer over the whole board, so its text reads clearly */
#sbFx .sb-cupbox { --cup: min(38vw, 150px); font-size: 15px; inset: 0; left: 0; top: 0; transform: none; justify-content: center;
  background: rgba(6, 14, 10, 0.62); border-radius: 10px; }
@media (max-height: 700px) {
  #sb .sb-hint { display: none; }
  #sb .casino-chip { width: 52px; height: 52px; }
  #sb .casino-chip span { inset: 7px; font-size: 15px; }
}

/* =============== Sic Bo: TV =============== */
.sb-tv { display: flex; flex-direction: column; overflow: hidden; }
.sb-history { display: flex; flex-wrap: wrap; gap: 0.5vw; font-size: 0.95vw; align-content: flex-start; padding: 3px; }
.sb-hrow { display: flex; flex-direction: column; align-items: center; gap: 0.3vh; padding: 0.4vh 0.4vw; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.sb-hrow:first-child { outline: 3px solid var(--accent); }
.sb-hrow .die { --s: 1.3vw; padding: 0.12vw; border-radius: 0.2vw; box-shadow: none; }
.sb-tvrow { display: flex; gap: 0.3vw; flex: 1 1 0; min-height: 0; }
.sb-tvrow.top { flex-grow: 2.2; }
.sb-tvcol { display: flex; flex-direction: column; gap: 0.3vw; min-width: 0; }
.sb-tvcol.side { flex: 1.6 1 0; }
.sb-tvcol.mid { flex: 6 1 0; }
.sb-tvcol.mid .sb-tvrow { flex: 1 1 0; }
.sb-tvboard .sb-cell {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 0; border: 2px solid rgba(255, 255, 255, 0.5); border-radius: 0.4vw;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2vh; color: #fff; font-weight: 900; overflow: hidden;
}
.sb-tvboard .sb-cell b { font-size: 1.5vw; letter-spacing: 0.1vw; }
.sb-tvboard .sb-cell.any { flex: 1.3 1 0; background: rgba(201, 154, 30, 0.22); }
.sb-tvboard .sb-cell.any b { font-size: 1.2vw; text-align: center; }
.sb-tvboard .sb-cell i { font-style: normal; font-size: 0.85vw; color: rgba(255, 255, 255, 0.8); }
.sb-tvboard .sb-cell small { font-size: 0.8vw; color: #ffe08a; }
.sb-tvboard .sb-cell .die { --s: 1.35vw; padding: 0.12vw; border-radius: 0.2vw; box-shadow: none; }
.sb-tvboard .sb-cell.win { box-shadow: 0 0 0 3px var(--accent), 0 0 22px rgba(245, 197, 66, 0.8); border-color: var(--accent); background: rgba(245, 197, 66, 0.25); z-index: 1; }
/* chips in fixed slots on the tile's top and bottom edges (absolute, so the tile's dice and pay never move) */
.sb-dots { position: absolute; left: 0; right: 0; display: flex; justify-content: center; gap: 0.12vw; pointer-events: none; z-index: 2; }
.sb-dots.top { top: 0.12vw; }
.sb-dots.bot { bottom: 0.12vw; }
.sb-tvboard .sb-cell .sb-dot {
  width: 1.05vw; height: 1.05vw; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 0.55vw; font-weight: 900; color: #111; background: var(--c, #ddd);
  border: 0.12vw dashed rgba(0, 0, 0, 0.5); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); line-height: 1; letter-spacing: -0.03vw;
}
.sb-tvboard .sb-cell .sb-dot.long { font-size: 0.42vw; letter-spacing: -0.04vw; }
.sb-tvboard .sb-cell .sb-dot.empty { visibility: hidden; }
.sb-tvboard .sb-cell .sb-dot.more { background: #fff; font-size: 0.55vw; }
.sb-tvboard .sb-cell > small { position: relative; z-index: 1; }
/* every tile keeps a band at its top and bottom for the chips, always (chips or not), so the dice, number and pay
   sit in the middle and are never covered */
.sb-tvboard .sb-cell { padding: 1.2vw 0.1vw; gap: 0; }
.sb-tvboard .sb-cell b, .sb-tvboard .sb-cell i, .sb-tvboard .sb-cell small { line-height: 1.1; }
.sb-tvboard .sb-cell .sb-dice { margin-bottom: 0.15vw; }

/* Roll history sheet (tap the strip): the last 30 rolls and simple stats */
.sb-hist { cursor: pointer; }
.sb-hist .rl-hist-more { margin-left: auto; }
.sb-hist-all .sb-pill { min-width: 28px; text-align: center; }
.sb-hist-all .sb-pill:first-child { outline: 2px solid var(--accent); }
.sb-faces { display: flex; flex-direction: column; gap: 4px; }
.sb-face { display: grid; grid-template-columns: 26px 1fr 28px; gap: 8px; align-items: center; font-size: 13px; }
.sb-face .die { --s: 20px; }
.sb-face b { color: var(--accent); text-align: right; }

/* ---------- TV: the house frame (tv-frame.js), laid out like Craps. The felt: the cup in the top corner (where the card
   games keep their shoe), the game's name printed in the open felt, the betting board along the bottom. ---------- */
.sb-felt-tv { position: relative; min-height: 0; box-sizing: border-box; display: flex; flex-direction: column; padding: 1vw;
  border-radius: 2vw; border: 1vw solid var(--rail); background: radial-gradient(ellipse at 50% 30%, var(--felt-1), var(--felt-2) 85%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5); }
.sb-tv .hf-felt-name { top: 7%; --hf-name: 3.6vw; }
.sb-stage { position: absolute; top: 0; right: 1.5vw; width: 13vw; height: 34%; z-index: 3; pointer-events: none; }
.sb-stage .sb-cupbox { --cup: min(8.5vw, 15vh); top: 52%; font-size: 1.2vw; }
.sb-tvboard { margin-top: auto; height: 64%; display: flex; flex-direction: column; gap: 0.3vw; position: relative; z-index: 1; }
/* the three dice next to the call in the status box */
.sb-tv .hf-status .t { display: flex; align-items: center; justify-content: center; gap: 0.8vw; }
.sb-tv .hf-status .sb-dice { gap: 0.3vw; }
.sb-tv .hf-status .die { --s: 2.3vw; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45); }
/* the last rolls, in the side panel's extra */
.sb-tv .hf-extra .sb-hrow:first-child { outline-offset: 0; }
