/* Casino War. The page is built once; states only change content inside fixed regions. */

.game-root { min-height: 50rem; }

.cw-table {
  --card-w: clamp(2.55rem, 16cqw, 4.35rem);
  --card-h: calc(var(--card-w) * 1.452);
  --radius: calc(var(--card-w) * 0.07);
  width: min(100%, 40rem);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.cw-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  height: 2.6rem;
  color: #d8e0d8;
  font-size: 0.85rem;
}

.cw-shoe-icon.playing-card {
  --card-w: 1.5rem;
  --card-h: 2.18rem;
  --radius: 0.2rem;
  flex: none;
  cursor: default;
  pointer-events: none;
}

.cw-shoe-info {
  display: grid;
  gap: 0.25rem;
  width: clamp(7rem, 36cqw, 12rem);
}

.cw-shoe-bar {
  position: relative;
  display: block;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  overflow: visible;
}

.cw-shoe-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.5);
}

.cw-shoe-cut {
  position: absolute;
  top: -0.2rem;
  bottom: -0.2rem;
  width: 3px;
  margin-left: -1px;
  border-radius: 2px;
  background: #f0cf6a;
}

.cw-shoe-text {
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.cw-hand { width: 100%; }

.cw-hand-title {
  height: 1.35rem;
  margin: 0;
  font: normal 0.95rem/1.35rem var(--font-serif);
  color: #e8ebe6;
  text-align: center;
}

.cw-rank {
  height: 1.5rem;
  margin: 0;
  overflow: hidden;
  text-align: center;
  font: 700 1.05rem/1.5rem var(--font-serif);
  color: #fffdf7;
}

.cw-rank.is-win,
.cw-rank.is-push { color: #f0cf6a; }

.cw-rank.is-lose { color: #d7c4c2; }

.cw-cards {
  display: grid;
  grid-template-columns: repeat(2, var(--card-w));
  justify-content: center;
  gap: 0.45rem;
  height: var(--card-h);
}

.cw-slot {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
}

.cw-slot:not(.is-filled) {
  outline: 1px dashed rgba(255, 253, 247, 0.32);
  outline-offset: -1px;
}

.cw-slot .playing-card {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  cursor: default;
  pointer-events: none;
}

.cw-burns {
  --card-w: clamp(1.45rem, 9cqw, 2.2rem);
  --card-h: calc(var(--card-w) * 1.452);
  --radius: calc(var(--card-w) * 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.cw-burn-label {
  height: 1.15rem;
  margin: 0;
  color: #d8e0d8;
  font: 0.75rem/1.15rem var(--font-serif);
  letter-spacing: 0.04em;
  text-align: center;
}

.cw-burn-row {
  display: grid;
  grid-template-columns: repeat(3, var(--card-w));
  gap: 0.35rem;
  height: var(--card-h);
}

.cw-history {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1.7rem));
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  height: 1.7rem;
  margin: 0.35rem 0 0.15rem;
  padding: 0;
  list-style: none;
}

.cw-hist {
  display: grid;
  place-items: center;
  width: 100%;
  height: 1.7rem;
  border-radius: 50%;
  border: 2px solid transparent;
  color: #fffdf7;
  font: 700 0.68rem/1 var(--font-serif);
  letter-spacing: 0.02em;
}

.cw-hist.is-empty { border-color: rgba(255, 253, 247, 0.32); }
.cw-hist--W { background: #1e5c3d; }
.cw-hist--L { background: #8c3b32; }
.cw-hist--S { background: #1e4578; }
.cw-hist.is-latest { box-shadow: inset 0 0 0 1px rgba(255, 253, 247, 0.85); }

.cw-spots {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(6.6rem, 0.72fr);
  align-items: end;
  gap: 0.7rem;
  width: 100%;
  height: 8.75rem;
}

.cw-spots.is-locked { pointer-events: none; }

.cw-spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 8.75rem;
  margin: 0;
  padding: 0.7rem 0.35rem 0.5rem;
  border: 1px solid rgba(255, 253, 247, 0.38);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: #fffdf7;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.cw-spot--tie {
  height: 6.85rem;
  padding-top: 0.4rem;
  border-style: dashed;
  border-color: rgba(224, 185, 72, 0.45);
  background: transparent;
}

.cw-spot--tie.is-open {
  border-style: solid;
  border-color: rgba(224, 185, 72, 0.7);
  background: rgba(224, 185, 72, 0.12);
}

.cw-spot--tie.is-needs-hand {
  opacity: 0.5;
  cursor: not-allowed;
}

.cw-spot-kicker {
  height: 0.95rem;
  overflow: hidden;
  color: #f0cf6a;
  font: 600 0.66rem/0.95rem var(--font-sans);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.cw-spot--tie .cw-spot-name {
  height: 1.35rem;
  font-size: 1.05rem;
}

.cw-spot-name {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.4em;
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 4.2cqw, 1.28rem);
  line-height: 1.15;
  text-align: center;
}

.cw-spot-pay {
  height: 1.2em;
  color: #f0cf6a;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
}

.cw-spot-well {
  position: relative;
  width: 100%;
  height: 2.8rem;
  margin-top: auto;
}

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

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

.cw-spot.is-push { border-color: rgba(255, 253, 247, 0.72); }

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

@media (hover: hover) {
  .cw-spot:not(.cw-spot--tie):hover { background: rgba(255, 253, 247, 0.08); }
  .cw-spot--tie.is-open:hover { background: rgba(224, 185, 72, 0.2); }
}

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

/* Bet buttons and the war choice occupy the same row, so the dock does not grow. */
.cw-actions {
  display: grid;
  width: min(100%, 34rem);
  margin-inline: auto;
  min-height: var(--tap-min);
}

.cw-actions > .casino-controls {
  grid-area: 1 / 1;
  width: 100%;
  margin-inline: 0;
}

.cw-actions > .casino-controls[hidden],
.casino-controls .btn[hidden] { display: none !important; }
