#game-area {
  padding: 4px 0;
  touch-action: none;
}

.solitaire-top, .solitaire-tableau {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.solitaire-top {
  align-items: flex-start;
}

/* Spacer between waste/stock and foundations */
.top-spacer {
  flex: 1;
}

.pile {
  position: relative;
  width: 68px;
  min-height: 96px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  background: rgba(0,0,0,0.04);
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.08);
}
body.dark .pile {
  border-color: rgba(240, 220, 190, 0.28);
  background: rgba(255,255,255,0.04);
}

/* Tableau columns grow to hold stacked cards */
.tableau-pile {
  position: relative;
  width: 68px;
  min-height: 96px;
  flex-shrink: 0;
}

.card {
  position: absolute;
  width: 68px;
  height: 96px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #ffffff 0%, #f0ece8 100%);
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.14), 0 1px 2px rgba(0,0,0,0.10);
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  padding: 4px;
  font-size: 14px;
  font-weight: 800;
  box-sizing: border-box;
  transition: box-shadow 0.15s, transform 0.1s;
  left: 0;
  overflow: hidden;
}

.card-face-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: inherit;
  pointer-events: none;
}

.card:hover:not(.face-down) {
  box-shadow: 0 6px 16px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.card.face-down {
  background: repeating-linear-gradient(
    45deg, #8f7a66, #8f7a66 3px, #776e65 3px, #776e65 6px
  );
  cursor: default;
}

.card.face-down .card-rank,
.card.face-down .card-suit,
.card.face-down .card-corner {
  visibility: hidden;
}

.card.selected {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(237,194,46,0.30), 0 6px 18px rgba(237,194,46,0.25), 0 2px 6px rgba(0,0,0,0.14);
  transform: translateY(-2px);
}

.card.red { color: #c0392b; }
.card.black { color: #1a1410; }

body.dark .card.black { color: #f5ece0; }
body.dark .card { background: linear-gradient(160deg, #3e3530 0%, #2e2820 100%); }
body.dark .card.face-down {
  background: repeating-linear-gradient(
    45deg, #5a4a3a, #5a4a3a 3px, #4a3c2e 3px, #4a3c2e 6px
  );
}

.card-corner {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 11px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-corner-rank { font-size: 12px; font-weight: 900; }
.card-corner-suit { font-size: 10px; }

.card-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.foundation-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: rgba(119, 110, 101, 0.35);
  pointer-events: none;
  border-radius: var(--radius-md);
}
body.dark .foundation-label {
  color: rgba(240, 220, 190, 0.30);
}

/* Stock pile clickable empty state */
.stock-pile {
  cursor: pointer;
}

.stock-empty-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--accent);
  opacity: 0.6;
  border-radius: var(--radius-md);
}

/* Waste: only show top card (draw-1), or fan of 3 (draw-3) */
.waste-pile {
  position: relative;
}

/* Draw-3: widen waste pile to show fanned cards */
.waste-pile-3 {
  width: 100px; /* 68px card + 2 * 16px offset */
}

/* Win overlay */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.win-overlay[hidden] { display: none; }

.win-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 240px;
}

.win-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-strong);
}

.win-sub {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

/* Drag ghost */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  opacity: 0.9;
}

/* Responsive card sizing */
@media (max-width: 520px) {
  .card, .pile, .tableau-pile {
    width: calc((100vw - 48px) / 7);
  }
  .card {
    height: calc((100vw - 48px) / 7 * 1.41);
  }
  .pile {
    min-height: calc((100vw - 48px) / 7 * 1.41);
  }
  .tableau-pile {
    min-height: calc((100vw - 48px) / 7 * 1.41);
  }
  .card-center { font-size: 16px; }
  .card-corner-rank { font-size: 10px; }
  .card-corner-suit { font-size: 8px; }
  .solitaire-top, .solitaire-tableau { gap: 4px; }
}

@media (max-width: 380px) {
  .card-center { display: none; }
}
