.klondike-play {
  --felt: #174e49;
  --felt-deep: #123d39;
  --felt-edge: #285e55;
  --felt-trim: #436d61;
  --felt-ink: #e8f3e9;
  --paper: #fdf9ed;
  --paper-ink: #253438;
  --paper-red: #a42d45;
  --selected: #ffd77b;
  --gap: clamp(3px, 1vw, 9px);
  --stack-step: clamp(16px, 2.15vw, 24px);
}

.klondike-play .game-page-play-inner { width: min(100%, 615px); }
.klondike-toolbar, .klondike-actions, .klondike-stats, .klondike-victory-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}
.klondike-toolbar { margin-bottom: 10px; }
.klondike-toolbar label { color: var(--game-muted, #526573); font-size: .9rem; }
.klondike-toolbar select { max-inline-size: min(51vw, 14rem); }
.klondike-stats { margin-bottom: 12px; gap: clamp(10px, 3vw, 23px); font-size: .88rem; }
.klondike-stats strong { font-variant-numeric: tabular-nums; }
.klondike-actions { margin-top: 14px; }
.klondike-status {
  margin: 12px 0 0;
  text-align: center;
  min-block-size: 2.65em;
  line-height: 1.4;
  font-size: .89rem;
}
.klondike-status[data-warning] { color: #9a3e30; }

.klondike-board {
  padding: clamp(8px, 2.3vw, 20px);
  border: 1px solid var(--felt-edge);
  border-radius: 13px;
  color: var(--felt-ink);
  background: radial-gradient(ellipse at 50% 15%, var(--felt) 0 27%, var(--felt-deep) 100%);
  box-shadow: inset 0 0 0 2px var(--felt-deep), inset 0 0 0 3px var(--felt-trim);
}
.klondike-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: start;
  gap: var(--gap);
}
.klondike-tableau { margin-top: clamp(10px, 2.5vw, 22px); min-height: clamp(111px, 35vw, 180px); }
#foundations { display: contents; }
.klondike-pile { display: grid; justify-items: center; gap: 4px; }
.klondike-pile > span {
  white-space: nowrap;
  font-size: clamp(.68rem, 1.7vw, .8rem);
  letter-spacing: .04em;
}
.klondike-column {
  position: relative;
  padding-top: calc(var(--last-card, 0) * var(--stack-step));
}
.klondike-column::before { content: ""; display: block; aspect-ratio: 5 / 7; }
.klondike-card {
  display: grid;
  position: relative;
  place-items: center;
  inline-size: 100%;
  aspect-ratio: 5 / 7;
  padding: 1px;
  border: 1px solid #e5dcc3;
  border-radius: clamp(4px, 1vw, 8px);
  overflow: hidden;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: Georgia, "Noto Serif", serif;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 2px #0a241d4d;
  touch-action: manipulation;
  user-select: none;
}
.klondike-column > .klondike-card {
  position: absolute;
  inset: calc(var(--card-index, 0) * var(--stack-step)) 0 auto;
}
button.klondike-card { cursor: pointer; }
button.klondike-card:disabled { opacity: 1; cursor: default; }
.klondike-card:focus-visible {
  z-index: 2;
  outline: 2px solid #fff9db;
  outline-offset: 1px;
}
.klondike-card[aria-pressed="true"], .klondike-card[data-in-stack] {
  border-color: var(--selected);
  background: #fff1c2;
}
.klondike-card[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--selected), 0 2px 2px #0a241d4d; }
.klondike-card.is-red { color: var(--paper-red); }
.klondike-card.is-back {
  border-color: #71a699;
  background: repeating-linear-gradient(130deg, #2b625d 0 3px, #306a63 3px 6px);
  box-shadow: inset 0 0 0 3px #386c63, 0 2px 2px #0a241d4d;
}
.klondike-card.is-empty {
  border: 1px dashed #7ba99d;
  background: #092d2870;
  color: #a6cabb;
  box-shadow: none;
}
.klondike-slot-mark, .klondike-face { font-size: clamp(15px, 4.4vw, 33px); }
.klondike-face { opacity: .79; margin-top: 13%; }
.klondike-corner {
  display: flex;
  position: absolute;
  inset: clamp(2px, .5vw, 6px) auto auto clamp(2px, .5vw, 6px);
  align-items: center;
  gap: 1px;
  font-size: clamp(10px, 2.05vw, 17px);
}
.klondike-mini-suit { font-size: .9em; }

.klondike-victory {
  width: min(calc(100% - 32px), 390px);
  padding: 0;
  border: 1px solid var(--felt-edge);
  border-radius: 16px;
  box-shadow: 0 24px 75px #0a251c7d;
  color: #1d3e38;
  background: #f7faf7;
}
.klondike-victory::backdrop { background: #142f29a6; }
.klondike-victory-body { padding: clamp(18px, 5vw, 30px); text-align: center; }
.klondike-victory h2 { margin: 0 0 9px; font-size: 1.4rem; }
.klondike-victory p { margin: 0 0 21px; line-height: 1.55; }
.klondike-victory[open] { animation: klondike-result .19s ease-out both; }
@keyframes klondike-result { from { opacity: 0; transform: translateY(7px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  .klondike-victory[open] { animation: none; }
}

:is([data-theme="dark"], .dark) .klondike-victory {
  background: #193732;
  color: #eff7f0;
}
:is([data-theme="dark"], .dark) .klondike-status[data-warning] { color: #f8b5a6; }
