/* =========================================================
   Solitaire — the Klondike table.
   Uses the shared .card faces from styles.css and the stat
   boxes / buttons from arcade.css.
   ========================================================= */

.sol-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.2rem;
}

.sol-bar .arcade-stats {
  flex: 1 1 340px;
  max-width: 520px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sol-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sol-controls .arcade-segment {
  min-width: 170px;
}

/* The table: piles and cards are absolutely placed by solitaire.js. */
.sol-board {
  position: relative;
  width: 100%;
  min-height: 360px;
  /* Swiping the empty felt scrolls the page; cards themselves are touch-action: none. */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.sol-slot {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--cw, 100px);
  aspect-ratio: 121 / 193;
  border: 2px dashed rgba(255, 255, 255, 0.24);
  border-radius: calc(var(--cw, 100px) * 0.075);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.22);
  font-family: var(--display);
  font-size: calc(var(--cw, 100px) * 0.34);
  font-weight: 700;
}

.sol-slot[data-key="stock"] {
  cursor: pointer;
}

.sol-recycle {
  opacity: 0;
  color: var(--lime);
  font-size: calc(var(--cw, 100px) * 0.5);
  transition: opacity 0.2s ease;
}

.sol-slot.is-recycle .sol-recycle {
  opacity: 1;
}

.sol-board .sol-card {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  width: var(--cw, 100px);
  animation: none;
  cursor: grab;
  touch-action: none;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.sol-board .sol-card.is-down {
  cursor: pointer;
}

.sol-board .sol-card.is-dragging {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 20px 34px rgba(0, 0, 0, 0.55);
}

.sol-board.is-instant .sol-card,
.sol-board.is-celebrating .sol-card {
  transition: none;
}

.sol-board.is-celebrating {
  overflow: hidden;
}

.sol-slot.is-target,
.sol-board .sol-card.is-target {
  box-shadow:
    0 0 0 3px var(--lime),
    0 0 22px rgba(196, 222, 0, 0.6);
}

.sol-board .sol-card.is-shake {
  animation: solShake 0.3s ease;
}

@keyframes solShake {
  0%,
  100% {
    translate: 0 0;
  }

  25% {
    translate: -6px 0;
  }

  75% {
    translate: 6px 0;
  }
}

/* Big corner labels for small (phone-sized) cards, where the art's own index is too small. */
.sol-index {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  padding: 0.05em 0.22em 0.08em 0.16em;
  border-radius: 0 0 6px 0;
  background: #fff;
  color: #12141a;
  font-family: var(--font);
  font-size: max(11px, calc(var(--cw, 100px) * 0.32));
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  pointer-events: none;
}

.sol-index.is-red {
  color: #d4003c;
}

.sol-board.is-compact .sol-index {
  display: block;
}

.sol-board .card.is-down .sol-index {
  display: none;
}

.sol-message {
  min-height: 1.5rem;
  margin: 1rem 0 0;
  color: #eef5da;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 620px) {
  /* Give the cards every pixel of width on a phone. */
  .felt:has(.sol-board) {
    padding-inline: 0.5rem;
  }

  .sol-bar .arcade-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sol-controls {
    width: 100%;
  }

  .sol-controls .btn {
    flex: 1 1 auto;
  }
}
