.window {
  height: clamp(56px, 13dvh, 120px);
  position: relative;
  overflow: hidden;
  border-bottom: 5px ridge #92734e;
}
.window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 47%;
  image-rendering: pixelated;
}
#deal-origin { position: absolute; bottom: 6px; left: 15%; width: 1px; height: 1px }
.felt {
  position: relative;
  padding: 12px 12px 0;
  background: #184d43 url(felt.png);
  border-bottom: 5px ridge #94734b;
  box-shadow: inset 0 10px 19px #0b302780;
}
.phase {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 15px;
}
.phase span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: #a2e1aa;
  border-radius: 50%;
}
.phase b {
  font-variant-numeric: tabular-nums;
  color: #ffe3a0;
}
.hands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 9px 3px 11px;
}
.hand {
  text-align: center;
  padding: 3px 0 6px;
  border-radius: 10px;
}
.player,
[data-market="player"],
[data-market="player_pair"] {
  --side: #a9d6f7;
  --field: #245879;
}
.banker,
[data-market="banker"],
[data-market="banker_pair"] {
  --side: #ffb7a4;
  --field: #793f44;
}
.tie,
[data-market="tie"],
[data-market="either_pair"] {
  --side: #abe1a8;
  --field: #365f42;
}
.hand header,
.legend span {
  color: var(--side);
}
.hand header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 25px;
}
.hand header b {
  color: var(--ink);
  font: 700 25px/0.9 Arc;
}
.hand.won {
  box-shadow: inset 0 0 0 2px var(--gold);
  background: #0d30294d;
}
.cards {
  height: clamp(66px, 17vw, 92px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  --cw: clamp(38px, 10.6vw, 54px);
}
.cards:empty::before,
.cards:empty::after {
  content: "";
  width: var(--cw);
  aspect-ratio: 0.69;
  border: 1px solid #c1d3ac46;
  border-radius: 5px;
}
.markets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.market {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 63px;
  color: var(--side);
  background: var(--field);
  border: 1px solid var(--side);
  border-radius: 18px 18px 6px 6px;
}
.market strong {
  font-size: clamp(14px, 4.2vw, 18px);
}
.market small {
  font-size: 12px;
  color: #f6efdf;
}
.market .stake {
  display: none;
}
.market.has .stake {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #fff4ce;
}
.market.has {
  outline: 2px solid #f6cb7b;
  outline-offset: -3px;
}
.market:disabled {
  cursor: default;
}
.extras {
  grid-template-columns: 1fr 1fr 1fr;
  padding: 5px 0 10px;
}
.extras .market {
  border-radius: 5px;
  min-height: 52px;
}
.extras strong {
  font-size: 12px;
}
.history-strip {
  background: #152e29;
  color: var(--ink);
  min-height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 14px;
  text-align: left;
}
.history-title {
  font-size: 13px;
}
.history-strip > span:last-child {
  font-size: 25px;
  color: #decca2;
}
.history-strip #latest {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.bead {
  display: inline-grid;
  place-items: center;
  background: var(--field);
  color: var(--side);
  border: 1px solid var(--side);
  border-radius: 50%;
  font-size: 12px;
  width: 22px;
  height: 22px;
  line-height: 1;
  position: relative;
}
.bead.last {
  box-shadow: 0 0 0 2px #e4c485;
}
.history-strip .muted {
  font-size: 11px;
}
.tray {
  padding: 9px 13px 6px;
}
.tray h2 {
  font-size: 23px;
}
.text-btn {
  min-height: 38px;
  color: #e3cd9e;
  font-size: 13px;
  background: transparent;
  padding: 4px 7px;
}
.text-btn:disabled {
  opacity: 0.4;
}
.chips {
  display: flex;
  gap: clamp(6px, 2.5vw, 14px);
  align-items: center;
  padding: 1px 0 9px;
}
.chip {
  background: var(--chip);
  color: #fff5d8;
  border: 3px dashed #e4d5b7;
  border-radius: 50%;
  width: clamp(40px, 12vw, 53px);
  aspect-ratio: 1;
  box-shadow:
    inset 0 0 0 2px var(--chip),
    inset 0 0 0 3px #fff7dc80;
  font: 700 21px Arc;
}
.chip[aria-pressed="true"] {
  outline: 2px solid #fff3b7;
  outline-offset: 2px;
}
.bet-ticket {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bet-ticket > div {
  min-width: 72px;
}
.bet-ticket small {
  display: block;
  color: var(--dim);
  font-size: 11px;
}
.bet-ticket .primary {
  flex: 1;
}
.receipt {
  min-height: 27px;
  color: #e0d7b9;
  font-size: 12px;
}
.receipt .text-btn {
  margin-left: auto;
}
.road-tabs,
.legend {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.road-tabs button {
  flex: 1;
  padding: 10px;
  color: var(--dim);
  background: #203e33;
  border-radius: 5px;
}
.road-tabs button[aria-pressed="true"] {
  background: #e9cb92;
  color: #21352c;
}
.legend {
  font-size: 12px;
  justify-content: space-between;
}
.road-scroll {
  overflow: auto;
  background: #0d221c;
  border: 1px solid #536352;
}
.road-grid,
#road-grid {
  display: grid;
  width: max-content;
  grid-template-rows: repeat(6, 26px);
  grid-auto-columns: 26px;
  min-width: 100%;
  min-height: 156px;
  background-size: 26px 26px;
  background-image:
    linear-gradient(to right, #b1c8ae22 1px, transparent 1px),
    linear-gradient(to bottom, #b1c8ae22 1px, transparent 1px);
}
#road-grid .bead {
  align-self: center;
  justify-self: center;
}
.road-big .bead {
  background: #112e24;
  border-width: 2px;
}
.bead.tie-mark::after {
  content: "";
  position: absolute;
  inset: 9px 0 auto;
  background: #adf1a7;
  height: 2px;
  transform: rotate(-48deg);
}
.pair-dot {
  position: absolute;
  border: 1px solid #10261e;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.pair-dot.p {
  top: -2px;
  left: -1px;
  background: #afd8ff;
}
.pair-dot.b {
  bottom: -1px;
  right: -1px;
  background: #ffb6a2;
}
@media (max-height: 690px) {
  .window {
    height: clamp(44px, 8dvh, 62px);
  }
  .hands {
    padding-top: 2px;
    padding-bottom: 4px;
  }
  .tray {
    padding-top: 3px;
  }
  .market {
    min-height: 54px;
  }
}
#road-grid button.bead {
  padding: 0;
}
.tie-count {
  position: absolute;
  top: -3px;
  right: -4px;
  color: #12291d;
  background: #b0e2a7;
  border-radius: 3px;
  font-size: 8px;
  padding: 1px 2px;
}

.extras .market { min-height: 47px; color: var(--side); background: #143b33; border-color: color-mix(in srgb,var(--side) 48%,#143b33); border-radius: 5px 5px 12px 12px }
.chip-heading,.chip-rail { display:flex; align-items:center; justify-content:space-between; gap:8px }
.chip-heading label { color:var(--dim); font-size:13px }
.chip-heading .text-btn { min-height:38px }
.chip-rail { margin:0 0 10px }
.chip-rail .stake-box { flex:1; max-width:175px }
.chip-rail .chips { flex:0 1 auto; gap:clamp(4px,1.3vw,8px); padding:0 3px }
.chip { width:clamp(38px,10.6vw,49px); touch-action:manipulation }
.receipt:has(#receipt:empty):has(#repeat[hidden]) { min-height:4px }
@media (max-height:650px) {
  .bar { min-height:44px }
  .felt { padding-top:4px }
  .phase { min-height:22px }
  .history-strip { min-height:40px }
  .chip-heading .text-btn { min-height:32px }
}
