/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5 */
:root {
    --kl-felt: oklch(0.25 0.045 238);
    --kl-felt-deep: oklch(0.20 0.035 238);
    --kl-felt-line: oklch(0.44 0.045 238);
    --kl-paper: oklch(0.97 0.022 88);
    --kl-paper-shade: oklch(0.92 0.030 88);
    --kl-text: oklch(0.98 0.012 88);
    --kl-text-soft: oklch(0.85 0.025 225);
    --kl-action: oklch(0.60 0.185 29);
    --kl-action-deep: oklch(0.47 0.155 29);
    --kl-brass: oklch(0.76 0.095 83);
    --kl-shadow: oklch(0.08 0.025 238 / 0.45);
    --kl-focus: oklch(0.88 0.14 85);
    --kl-font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --kl-font-text: "Public Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --kl-radius: 12px;
    --kl-card-ratio: 317 / 548;
    --kl-card-width: clamp(39px, 12.25vw, 106px);
}

html, body { overflow-x: clip; }

.klondike-game {
    box-sizing: border-box;
    min-height: 100svh;
    color: var(--kl-text);
    background: radial-gradient(circle at 50% 0%, var(--kl-felt) 0, var(--kl-felt-deep) 74%);
    font-family: var(--kl-font-text);
}

.klondike-game *, .klondike-game *::before, .klondike-game *::after { box-sizing: border-box; }

.klondike-game__bar {
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 8px clamp(10px, 3vw, 32px);
    border-bottom: 1px solid var(--kl-felt-line);
}

.klondike-game__brand {
    color: var(--kl-text);
    font: 700 clamp(.82rem, 2.4vw, 1.15rem)/1 var(--kl-font-display);
    letter-spacing: .1em;
    text-decoration: none;
    white-space: nowrap;
}
.klondike-game__brand span { font-size: .6em; }
.klondike-game__status { margin: 0; color: var(--kl-text-soft); font-size: .82rem; text-align: center; }

.klondike-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: var(--kl-radius);
    color: var(--kl-paper);
    background: var(--kl-action);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 0 var(--kl-action-deep);
}
.klondike-button:hover { filter: brightness(1.06); }
.klondike-button:active { translate: 0 2px; box-shadow: 0 2px 0 var(--kl-action-deep); }
.klondike-button:focus-visible, .klondike-game button:focus-visible, .klondike-game a:focus-visible { outline: 3px solid var(--kl-focus); outline-offset: 3px; }
.klondike-button--new { justify-self: end; }

.klondike-board { position: relative; width: min(100%, 1120px); min-height: calc(100svh - 104px); margin: auto; padding: clamp(12px, 3vw, 32px); }
.klondike-board__top { display: flex; justify-content: space-between; gap: 12px; }
.klondike-pile-group, .klondike-foundations { display: flex; gap: clamp(5px, 1.5vw, 16px); }
.klondike-pile-group form { margin: 0; }

.klondike-slot, .klondike-column__card {
    appearance: none;
    position: relative;
    width: var(--kl-card-width);
    aspect-ratio: var(--kl-card-ratio);
    display: block;
    margin: 0;
    padding: 0;
    border: 1px solid var(--kl-felt-line);
    border-radius: clamp(5px, 1vw, 9px);
    background: transparent;
    color: var(--kl-text-soft);
}
.klondike-game button { cursor: pointer; touch-action: manipulation; }
.klondike-game button:disabled { cursor: default; opacity: .72; }
.klondike-card-image, .klondike-card-back { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; box-shadow: 0 5px 12px var(--kl-shadow); }
.klondike-card-back { border: 2px solid var(--kl-paper); background: repeating-linear-gradient(45deg, var(--kl-action-deep) 0 5px, var(--kl-action) 5px 8px); }
.klondike-stock .klondike-card-back { position: absolute; inset: 0; }
.klondike-count { position: absolute; right: -5px; bottom: -5px; min-width: 24px; min-height: 24px; padding: 3px; border-radius: 999px; color: var(--kl-felt-deep); background: var(--kl-paper); font-size: .72rem; font-weight: 800; }
.klondike-stock--empty { display: grid; place-content: center; gap: 2px; font-size: 1.3rem; }
.klondike-stock--empty small { font-size: clamp(.48rem, 1.5vw, .7rem); }
.klondike-foundation > button > span { position: absolute; inset: 0; display: grid; place-content: center; font-size: clamp(1.2rem, 5vw, 2.5rem); opacity: .56; }
.klondike-foundation--diamonds > span, .klondike-foundation--hearts > span { color: var(--kl-action); }

.klondike-tableau { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(4px, 1.5vw, 16px); margin-top: clamp(18px, 4vw, 40px); }
.klondike-column { position: relative; min-width: 0; min-height: min(59svh, 500px); }
.klondike-column__base { position: absolute; inset: 0 auto auto 0; width: 100%; }
.klondike-column__card { position: absolute; top: calc(var(--card-index) * clamp(17px, 3.6vw, 34px)); left: 0; width: 100%; border: 0; transition: translate 160ms ease, filter 160ms ease; }
.klondike-column__card.is-hidden { height: auto; aspect-ratio: var(--kl-card-ratio); }
.klondike-source:hover { translate: 0 -2px; }
.klondike-source.is-selected { translate: 0 -7px; filter: drop-shadow(0 0 5px var(--kl-brass)); z-index: 20; }
.klondike-destination:hover { border-color: var(--kl-brass); }
.klondike-win { position: absolute; z-index: 50; inset: 24px 50% auto auto; translate: 50% 0; min-width: min(90%, 360px); display: grid; gap: 10px; justify-items: center; padding: 24px; border-radius: 18px; color: var(--kl-felt-deep); background: var(--kl-paper); box-shadow: 0 20px 60px var(--kl-shadow); text-align: center; }
.klondike-win strong { font: 700 1.5rem/1.15 var(--kl-font-display); }
.klondike-game__footer { min-height: 40px; display: flex; justify-content: center; gap: 24px; padding: 10px 16px; color: var(--kl-text-soft); font-size: .75rem; }

@media (max-width: 520px) {
    .klondike-game__bar { grid-template-columns: minmax(0, 1fr) auto; }
    .klondike-game__status { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
    .klondike-button--new { padding-inline: 12px; }
    .klondike-board { padding-inline: 7px; }
    .klondike-tableau { gap: 3px; }
    .klondike-foundations, .klondike-pile-group { gap: 4px; }
    .klondike-game__footer { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
    .klondike-game *, .klondike-game *::before, .klondike-game *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
