/* Klondike — gold-rush solitaire on dark felt. game.js sizes and places everything; --cw and --ch are the card size. */
.kl-table {
  position: absolute;
  top: 2px; right: 6px; bottom: 2px; left: 6px;
  max-width: 920px;
  margin: 0 auto;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 50% 30%, transparent 50%, rgba(5, 12, 26, 0.5)),
    radial-gradient(rgba(255, 241, 214, 0.045) 1px, transparent 1.4px) 0 0 / 5px 5px,
    #20503E;
  box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.28), inset 0 0 0 5px rgba(11, 22, 43, 0.3), 0 10px 30px rgba(0, 0, 0, 0.3);
  direction: ltr;
}
/* z-index: the cards stack inside the board, never above the engine's panels */
.kl-board { position: absolute; top: 10px; right: 8px; bottom: 8px; left: 8px; z-index: 0; --cw: 44px; --ch: 62px; }
.kl-defs { position: absolute; width: 0; height: 0; }

/* ---------------------------------------------------------------- cards */
.kl-card, .kl-slot {
  position: absolute;
  top: 0; left: 0;
  width: var(--cw);
  height: var(--ch);
  padding: 0;
  border: 0;
  border-radius: calc(var(--cw) * 0.1);
}
.kl-card {
  z-index: 1;
  background: none;
  color: var(--w-navy);
  font-family: var(--font-text);
  cursor: pointer;
  transition: transform 0.24s var(--ease-out);
}
.kl-still .kl-card, .kl-card.is-drag { transition: none; }
.kl-card.is-red { color: var(--w-red); }
.kl-card.is-gone { visibility: hidden; }
.kl-in {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(180deg, #FFF9EA, var(--w-cream) 45%, #F5E3BD);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(19, 35, 63, 0.3);
}
/* Big corner index: the rank on the left and the suit on the right, so both show in the thinnest fan. */
.kl-r { position: absolute; top: 3%; left: 8%; font-size: calc(var(--cw) * 0.42); font-weight: 800; line-height: 1; letter-spacing: -0.06em; }
.kl-card svg { position: absolute; fill: currentColor; }
.kl-s { top: 5.5%; right: 7%; width: calc(var(--cw) * 0.3); height: calc(var(--cw) * 0.3); }
.kl-p { left: 22%; bottom: 9%; width: 56%; height: calc(var(--cw) * 0.56); }

/* The back: navy with a mustard star. */
.kl-card.is-down { cursor: default; }
.kl-card.is-down .kl-in {
  background:
    repeating-linear-gradient(45deg, rgba(255, 196, 61, 0.13) 0 1.5px, transparent 1.5px 6px),
    repeating-linear-gradient(-45deg, rgba(255, 196, 61, 0.13) 0 1.5px, transparent 1.5px 6px),
    linear-gradient(165deg, var(--lapis-raise), var(--w-navy));
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.32), inset 0 0 0 1.5px var(--w-cream), inset 0 0 0 3px var(--w-navy), inset 0 0 0 4px rgba(255, 196, 61, 0.7);
}
.kl-card.is-down .kl-in > * { display: none; }
.kl-card.is-down .kl-in::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 54%;
  padding-top: 54%;
  transform: translate(-50%, -50%);
  background: var(--w-mustard);
  clip-path: polygon(50% 2%, 61% 36%, 97% 36%, 68% 58%, 79% 92%, 50% 71%, 21% 92%, 32% 58%, 3% 36%, 39% 36%);
}

.kl-card.is-drag { cursor: grabbing; }
.kl-card.is-drag .kl-in { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(19, 35, 63, 0.3); }
.kl-card.is-hint .kl-in, .kl-slot.is-hint {
  box-shadow: 0 0 0 3px var(--w-mustard), 0 0 16px 4px rgba(255, 196, 61, 0.7);
  animation: kl-pulse 0.6s ease-in-out infinite alternate;
}
.kl-card.is-hint2 .kl-in, .kl-slot.is-hint2, .kl-card.is-over .kl-in, .kl-slot.is-over { box-shadow: 0 0 0 3px var(--w-sky), 0 0 14px 3px rgba(111, 183, 233, 0.6); }
@keyframes kl-pulse { from { filter: brightness(1); } to { filter: brightness(1.14); } }

/* ---------------------------------------------------------------- empty piles and the stock counter */
.kl-slot {
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 22, 43, 0.28);
  box-shadow: inset 0 0 0 1.5px rgba(255, 241, 214, 0.18);
  color: rgba(255, 241, 214, 0.36);
}
.kl-slot svg { width: 46%; height: 46%; }
.kl-mark { fill: currentColor; }
button.kl-slot { cursor: pointer; color: var(--w-mustard); }
.kl-slot.is-off { opacity: 0.4; }
.kl-count {
  position: absolute;
  top: 0; left: 0;
  z-index: 450;
  width: 22px;
  height: 15px;
  margin: calc(var(--ch) - 19px) 0 0 calc((var(--cw) - 22px) / 2);
  border-radius: 8px;
  background: var(--w-cream);
  color: var(--w-navy);
  font-size: 11px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
}
.kl-count:empty { display: none; }

/* ---------------------------------------------------------------- the win */
.kl-fx { position: absolute; top: 0; left: 0; z-index: 2000; width: 100%; height: 100%; pointer-events: none; transition: opacity 0.26s linear; }
.kl-fx.is-out { opacity: 0; }
.kl-gold {
  position: absolute;
  top: 34%; left: 0; right: 0;
  z-index: 2100;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.2s linear, transform 0.4s var(--ease-out);
}
.is-gold .kl-gold { opacity: 1; transform: none; }
.kl-gold b {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(28px, min(10.5vw, 20vh), 84px);
  font-weight: 400;
  line-height: 1.05;
  color: var(--w-mustard);
  text-shadow: 0 3px 0 var(--w-navy), 0 0 22px var(--lapis-deep), 0 0 6px var(--lapis-deep);
}
.kl-gold small {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(11, 22, 43, 0.72);
  color: var(--parchment);
  font-size: 12px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- panels */
/* The start panel keeps its Play button in view even when the rules run long on a short phone. */
.kl-start .fa-panel__actions {
  position: sticky;
  bottom: -20px;   /* the panel's own bottom padding */
  margin: 0 -22px -20px;
  padding: 14px 22px 20px;
  background: linear-gradient(180deg, transparent, var(--lapis) 14px);
}
.kl-start .fa-howto { margin-bottom: 2px; }
@media (max-height: 640px) {
  .kl-start .fa-panel { padding-top: 20px; }
  .kl-start .fa-panel__text { margin-bottom: 12px; font-size: 0.94rem; }
  .kl-start .fa-howto { gap: 7px; font-size: 0.9rem; }
}
/* Four stats on the daily result: keep them on one row on a narrow phone. */
@media (max-width: 400px) {
  .kl-four .fa-stats { gap: 6px; }
  .kl-four .fa-stats > div { padding: 9px 2px 8px; }
  .kl-four .fa-stats dt { font-size: 10px; letter-spacing: 0.04em; }
  .kl-four .fa-stats dd { font-size: 1.16rem; }
}

/* ---------------------------------------------------------------- small and short screens */
@media (max-width: 360px) {
  .kl-table { right: 0; left: 0; border-radius: 0; }
  .kl-board { top: 8px; right: 3px; bottom: 6px; left: 3px; }
  .kl-bar { gap: 5px; padding: 0 4px; }
  .kl-title { font-size: 0.98rem; }
}
@media (max-height: 440px) {
  .kl-board { top: 7px; bottom: 6px; }
  .kl-dock { min-height: 46px; padding-top: 2px; padding-bottom: 6px; }
  .kl-dock .kit-dock-btn { flex-direction: row; gap: 6px; min-height: 40px; padding: 4px 14px; }
}
