/* ── Solitaire Board ── */

.solitaire-container {
  background: #1a5c2a;
  background: linear-gradient(145deg, #0d3b1e, #1a5c2a 40%, #1e6b32 70%, #0d3b1e);
  border-radius: var(--radius-lg, 16px);
  padding: 16px;
  box-shadow:
    inset 0 2px 20px rgba(0, 0, 0, 0.3),
    0 4px 24px rgba(0, 0, 0, 0.2);
  border: 3px solid #2a4a35;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ── Controls Bar ── */
.sol-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sol-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.15s ease;
}

.sol-btn:hover { background: rgba(255, 255, 255, 0.25); }
.sol-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.sol-btn-new {
  background: #ffd700;
  color: #1a1a2e;
  border-color: #e6c200;
}
.sol-btn-new:hover { background: #ffed4a; }

.sol-draw-toggle {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sol-draw-opt {
  padding: 6px 12px;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  transition: background 0.15s ease, color 0.15s ease;
}

.sol-draw-opt.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.sol-stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
}

.sol-stats span {
  font-weight: 600;
  color: #fff;
}

/* ── Board Layout ── */
.sol-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sol-top-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.sol-stock-waste {
  display: flex;
  gap: 10px;
}

.sol-foundations {
  display: flex;
  gap: 10px;
}

/* ── Piles (empty slots) ── */
.sol-pile {
  width: clamp(55px, 9vw, 90px);
  aspect-ratio: 5 / 7;
  border-radius: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  position: relative;
  flex-shrink: 0;
}

.sol-pile.has-cards {
  border-color: transparent;
}

.sol-foundation {
  background: rgba(0, 0, 0, 0.15);
}

.sol-foundation-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(18px, 3vw, 28px);
  color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.sol-stock {
  cursor: pointer;
}

.sol-stock.empty {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.15);
  cursor: pointer;
}

.sol-stock.empty::after {
  content: '↺';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(20px, 3vw, 30px);
  color: rgba(255, 255, 255, 0.3);
}

.sol-waste {
  position: relative;
}

.sol-waste .playing-card {
  position: absolute;
  top: 0;
  left: 0;
}

/* Waste card fan (draw 3) */
.sol-waste .playing-card:nth-last-child(2) {
  left: 14px;
}
.sol-waste .playing-card:nth-last-child(1) {
  left: 28px;
}

.sol-waste.draw-1 .playing-card {
  left: 0 !important;
}

/* ── Tableau ── */
.sol-tableau {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.sol-tableau-col {
  width: clamp(55px, 9vw, 90px);
  min-height: 180px;
  position: relative;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
}

.sol-tableau-col.has-cards {
  border-color: transparent;
}

.sol-tableau-col .playing-card {
  position: absolute;
  left: 0;
  cursor: pointer;
}

.sol-tableau-col .playing-card.face-down {
  cursor: default;
}

/* ── Valid drop highlight ── */
.sol-pile.drop-target,
.sol-tableau-col.drop-target {
  outline: 2px solid rgba(59, 130, 246, 0.7);
  outline-offset: -2px;
  background: rgba(59, 130, 246, 0.1);
}

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

.sol-drag-ghost .playing-card {
  position: relative;
  margin-top: -85%;
}

.sol-drag-ghost .playing-card:first-child {
  margin-top: 0;
}

/* ── Win Overlay ── */
.sol-win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.sol-win-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.sol-win-text {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
  margin-bottom: 8px;
}

.sol-win-stats {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  margin-bottom: 24px;
}

.sol-win-btn {
  padding: 12px 36px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #ffd700;
  color: #1a1a2e;
  transition: background 0.15s ease;
}

.sol-win-btn:hover { background: #ffed4a; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .solitaire-container {
    padding: 10px 6px;
  }

  .sol-controls {
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .sol-btn { padding: 5px 10px; font-size: 0.75rem; }
  .sol-draw-opt { padding: 5px 8px; font-size: 0.72rem; }

  .sol-stats {
    gap: 10px;
    font-size: 0.75rem;
  }

  .sol-top-row, .sol-tableau {
    gap: 4px;
  }

  .sol-stock-waste, .sol-foundations {
    gap: 4px;
  }

  .sol-pile, .sol-tableau-col {
    width: clamp(42px, 12vw, 70px);
  }

  .sol-tableau-col {
    min-height: 140px;
  }

  .sol-waste .playing-card:nth-last-child(2) { left: 10px; }
  .sol-waste .playing-card:nth-last-child(1) { left: 20px; }
}

@media (max-width: 480px) {
  .sol-pile, .sol-tableau-col {
    width: clamp(36px, 13vw, 55px);
  }

  .sol-controls {
    justify-content: center;
  }

  .sol-stats {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .sol-tableau-col {
    min-height: 110px;
  }

  .sol-win-text { font-size: 1.8rem; }
}
