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

/* ===== Layout rows ===== */
.spider-top {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.spider-tableau {
  display: flex;
  gap: 5px;
}

/* ===== Stock piles area ===== */
.stock-area {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

/* ===== Completed sets area ===== */
.completed-area {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
  align-items: flex-start;
}

/* ===== Generic pile placeholder ===== */
.pile {
  position: relative;
  width: 58px;
  min-height: 82px;
  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);
}

/* Stock pile */
.stock-pile {
  cursor: pointer;
  width: 58px;
  min-height: 82px;
}
.stock-pile:hover .card {
  filter: brightness(1.06);
}

.stock-count {
  position: absolute;
  bottom: 4px;
  left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  pointer-events: none;
}

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

/* Completed set slot */
.completed-slot {
  width: 58px;
  min-height: 82px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: rgba(0,180,0,0.06);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
body.dark .completed-slot {
  background: rgba(0,180,0,0.08);
}
.completed-slot .card {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
}

/* Tableau column */
.tableau-pile {
  position: relative;
  width: 58px;
  min-height: 82px;
  flex-shrink: 0;
}

/* ===== Card ===== */
.card {
  position: absolute;
  width: 58px;
  height: 82px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #ffffff 0%, #f0ece8 100%);
  border: 1px solid var(--border);
  box-shadow: 0 2px 5px rgba(0,0,0,0.13), 0 1px 2px rgba(0,0,0,0.09);
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  padding: 3px;
  font-size: 12px;
  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 5px 14px rgba(0,0,0,0.17), 0 2px 4px rgba(0,0,0,0.11);
  transform: translateY(-1px);
}

.card.face-down {
  background: repeating-linear-gradient(
    45deg, #2d6e3e, #2d6e3e 3px, #245830 3px, #245830 6px
  );
  cursor: default;
}

.card.face-down .card-corner,
.card.face-down .card-center {
  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.22), 0 2px 6px rgba(0,0,0,0.13);
  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, #1d4d2a, #1d4d2a 3px, #173d22 3px, #173d22 6px
  );
}

/* Card labels */
.card-corner {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 10px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.card-corner-rank { font-size: 11px; font-weight: 900; }
.card-corner-suit { font-size: 9px; }

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

/* Drop zone label inside empty column */
.col-empty-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: rgba(119, 110, 101, 0.25);
  pointer-events: none;
  border-radius: var(--radius-md);
}
body.dark .col-empty-label { color: rgba(240, 220, 190, 0.22); }

/* ===== 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;
}

/* Deal blocked feedback */
.btn-warn {
  background: var(--danger) !important;
  color: #fff !important;
  transition: background 0.1s;
}

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

/* ===== Completed sequence fly-off animation ===== */
@keyframes completeFlyOff {
  0%   { transform: scale(1); opacity: 1; }
  60%  { transform: scale(1.06) translateY(-8px); opacity: 0.9; }
  100% { transform: scale(0.85) translateY(0); opacity: 0; }
}
.complete-animate {
  animation: completeFlyOff 0.45s ease forwards;
  pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .card, .pile, .tableau-pile, .stock-pile, .completed-slot {
    width: calc((100vw - 60px) / 10);
  }
  .card {
    height: calc((100vw - 60px) / 10 * 1.41);
  }
  .pile, .stock-pile, .completed-slot {
    min-height: calc((100vw - 60px) / 10 * 1.41);
  }
  .tableau-pile {
    min-height: calc((100vw - 60px) / 10 * 1.41);
  }
  .card-center { font-size: 13px; }
  .card-corner-rank { font-size: 9px; }
  .card-corner-suit { font-size: 7px; }
  .spider-top, .spider-tableau { gap: 3px; }
  .stock-area { gap: 2px; }
  .completed-area { gap: 2px; }
}

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