/* Sic Bo. Wallet · sticky stage · felt · sticky dock. Built once; states only change content. */

.game-root { min-height: 0; }

.sb-layout {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(100%, 40rem);
  margin-inline: auto;
  min-width: 0;
}

.sb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  align-self: stretch;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.35rem 0.4rem 0.4rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--felt-dark) 94%, #000);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.28);
}

.sb-dice {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  height: 5.2rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.35);
}

.sb-die-slot {
  width: 3.9rem;
  height: 3.9rem;
  display: grid;
  place-items: center;
}

.sb-dice .die-wrap { gap: 0; }
.sb-dice .die-tag { display: none; }

.sb-dice .die {
  width: 3.8rem;
  cursor: default;
}

.sb-dice .die:disabled { opacity: 1; }

.sb-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 2.9rem;
  margin: 0;
  text-align: center;
}

.sb-readout b {
  font: 700 1.2rem/1.1 var(--font-serif);
  color: #fffdf7;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.sb-readout span {
  margin-top: 0.1rem;
  height: 1.15em;
  color: #d5ddd6;
  font-size: 0.78rem;
  line-height: 1.15;
}

.sb-readout--triple b { color: #f0cf6a; }

.sb-history {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.25rem;
  width: 100%;
  max-width: 24rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sb-hist {
  display: grid;
  place-items: center;
  height: 1.55rem;
  border-radius: 999px;
  border: 2px solid transparent;
  color: #fffdf7;
  font: 700 0.6rem/1 var(--font-serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sb-hist.is-empty { border-color: rgba(255, 253, 247, 0.32); }
.sb-hist--roll { background: #2a3a48; }
.sb-hist--pair { background: #3d4f3a; }
.sb-hist--triple { background: #c4a24a; color: #1d2433; }
.sb-hist.is-latest { box-shadow: inset 0 0 0 1px rgba(255, 253, 247, 0.85); }

.sb-felt {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.sb-felt.is-locked { pointer-events: none; }

.sb-group-title {
  margin: 0.2rem 0 0;
  color: #d5ddd6;
  font: 600 0.72rem/1.2 var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sb-grid {
  display: grid;
  gap: 0.35rem;
  width: 100%;
}

.sb-grid--even { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sb-grid--total { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.sb-grid--single,
.sb-grid--double { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sb-grid--combo { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sb-grid--triple { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.sb-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 4.6rem;
  margin: 0;
  padding: 0.3rem 0.15rem 0.25rem;
  border: 1px solid rgba(255, 253, 247, 0.38);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  color: #fffdf7;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
}

.sb-spot--even { min-height: 5.2rem; }

.sb-spot--any {
  background: rgba(224, 185, 72, 0.14);
  border-color: rgba(224, 185, 72, 0.55);
}

.sb-spot-name {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  min-height: 1.35rem;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: clamp(0.85rem, 3.6cqw, 1.15rem);
  line-height: 1.05;
  text-align: center;
}

.sb-spot--even .sb-spot-name {
  font-size: clamp(0.95rem, 4cqw, 1.25rem);
  min-height: 1.5rem;
}

.sb-spot--total .sb-spot-name,
.sb-spot--single .sb-spot-name {
  font-size: clamp(1rem, 4.2cqw, 1.35rem);
}

.sb-spot-pay {
  flex: none;
  height: 1rem;
  color: #f0cf6a;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  line-height: 1rem;
  white-space: nowrap;
}

.sb-spot-well {
  position: relative;
  flex: none;
  width: 100%;
  height: 1.85rem;
  margin-top: auto;
}

.sb-spot-well .casino-marker {
  transform: scale(0.82);
  transform-origin: center center;
}

.sb-spot.is-win {
  border-color: #f0cf6a;
  box-shadow: inset 0 0 0 1px #f0cf6a;
}

.sb-spot.is-lose { border-color: rgba(255, 253, 247, 0.16); }

.sb-spot:focus-visible {
  outline: 3px solid #e0b948;
  outline-offset: 2px;
}

@media (hover: hover) {
  .sb-spot:hover { background: rgba(255, 253, 247, 0.08); }
  .sb-spot--any:hover { background: rgba(224, 185, 72, 0.22); }
}

.sb-spot:active { background: rgba(255, 253, 247, 0.12); }

/* Dock stays reachable while the felt scrolls */
.game-root > .sb-dock {
  position: sticky;
  bottom: 0;
  z-index: 30;
  gap: 0.3rem;
  margin-top: 0.6rem;
  padding: 0.3rem 0.4rem 0.4rem;
  border-top: 1px solid rgba(255, 253, 247, 0.18);
  border-radius: 12px;
  background: color-mix(in srgb, var(--felt-dark) 94%, #000);
  box-shadow: 0 -8px 14px rgba(0, 0, 0, 0.28);
}

.sb-dock .casino-msg {
  height: 2.4em;
  font-size: 0.88rem;
  line-height: 1.2;
}

.sb-dock .casino-controls { gap: 0.3rem; }

/* One row of chips on a phone; scroll sideways instead of stacking */
@container (max-width: 36rem) {
  .sb-dock .casino-dock-chips--seven {
    min-height: calc(var(--tap-min) + 0.1rem);
  }

  .sb-dock .casino-chip-tray {
    flex-wrap: nowrap;
    justify-content: safe center;
    gap: 0.15rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .sb-dock .casino-chip-tray::-webkit-scrollbar { display: none; }
}

@container (max-width: 26rem) {
  .sb-dice { height: 4.4rem; gap: 0.35rem; }
  .sb-die-slot { width: 3.2rem; height: 3.2rem; }
  .sb-dice .die { width: 3.1rem; }
  .sb-readout { height: 2.6rem; }
  .sb-readout b { font-size: 1.05rem; }
  .sb-hist { height: 1.4rem; font-size: 0.55rem; }

  .sb-grid--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sb-grid--total { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; }
  .sb-grid--combo { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.25rem; }
  .sb-grid--triple { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .sb-spot { min-height: 4.2rem; padding: 0.25rem 0.1rem 0.2rem; }
  .sb-spot--even { min-height: 4.8rem; }
  .sb-spot-pay { font-size: 0.55rem; letter-spacing: 0; }
  .sb-spot-well { height: 1.65rem; }
}

@container (max-width: 20rem) {
  .sb-grid--total { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .sb-spot-name { font-size: 0.78rem; }
}
