/* ─── Solitaire Setup ─── */
.sol-setup {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}

.sol-setup-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  overflow: hidden;
}

.sol-setup-header {
  text-align: center;
  padding: 36px 24px 20px;
  border-bottom: 1px solid var(--surface-border);
}

.sol-setup-icon { font-size: 48px; display: block; margin-bottom: 8px; opacity: 0.7; }
.sol-setup-header h1 { font-size: 32px; font-weight: 900; margin-bottom: 4px; }
.sol-setup-header p { color: var(--text-secondary); font-size: 15px; }
.sol-setup-body { padding: 24px; }

/* ─── Solitaire Game ─── */
.sol-game {
  max-width: min(1100px, 100vw);
  margin: 0 auto;
  padding: 0 12px 24px;
  overflow-x: hidden;
  box-sizing: border-box;
}

.sol-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.sol-topbar-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sol-topbar-stats { display: flex; gap: 20px; font-size: 14px; color: var(--text-muted); font-weight: 600; }
.sol-topbar-stats strong { color: var(--text); }
.sol-topbar-right { display: flex; gap: 8px; }
.sol-stat { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.sol-stat strong { color: var(--text); }

/* ─── Board Layout ─── */
.sol-board {
  user-select: none;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  position: relative;
  isolation: isolate;
}
.sol-board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
  z-index: 0;
  background: url('/assets/boards/felt-green.svg') center / cover no-repeat;
  opacity: 0.26;
  mix-blend-mode: soft-light;
}
.sol-board > * {
  position: relative;
  z-index: 1;
}

.sol-pyramid,
.sol-peaks-board {
  flex-shrink: 0;
}

.sol-top-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  max-width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.sol-stock-waste { display: flex; gap: 12px; flex-shrink: 0; }

.sol-foundations { display: flex; gap: 12px; flex-shrink: 0; }

.sol-tableau {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  max-width: 100%;
}

/* ─── Piles ─── */
.sol-pile {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}

.sol-placeholder {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 10px;
  border: 2px dashed rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 700;
  opacity: 0.5;
}

.sol-stock { cursor: pointer; }

.sol-stock .card.back { cursor: pointer; }
.sol-stock .card.back:hover { transform: translateY(-2px); }

.sol-column { min-height: 160px; }

.sol-column .card {
  position: absolute;
  left: 0;
}

.sol-column .card.face-down {
  background: linear-gradient(135deg, #1a5c35 0%, #0d3a20 100%);
  color: rgba(255,255,255,0.3);
}

/* ─── Card interactions ─── */
.sol-game .card.selectable { cursor: pointer; }
.sol-game .card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  z-index: 10 !important;
}

.sol-pile.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 12px;
}

/* ─── Win Overlay ─── */
.sol-win {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.sol-win-card {
  text-align: center;
  padding: 40px;
  background: linear-gradient(160deg, #162040 0%, #0e1528 100%);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.sol-win-card h2 {
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  margin-bottom: 16px;
}

.sol-win-card p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ─── FreeCell Cells ─── */
.sol-cells { display: flex; gap: 12px; flex-shrink: 0; }
.sol-cell { cursor: pointer; }

/* ─── Tableau columns (alt class used by Canfield, Golf Sol) ─── */
.sol-tableau-col {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}
.sol-tableau-col .card {
  position: absolute;
  left: 0;
}

/* ─── Custom column counts ─── */
.sol-tableau-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 100%;
}
.sol-tableau-8 {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  max-width: 100%;
}
.sol-tableau-10 {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  max-width: 100%;
}

/* ─── Bottom rows (Golf Sol, Calculation) ─── */
.sol-bottom-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  justify-content: center;
}
.sol-bottom-section {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

/* ─── Calculation ─── */
.sol-drawn { }
.sol-waste-piles { display: flex; gap: 12px; }
.calc-fnd-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 4px;
}
.calc-wp-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

/* ─── Pyramid ─── */
.sol-pyramid {
  position: relative;
  margin: 0 auto 16px;
}

/* ─── TriPeaks ─── */
.sol-peaks {
  position: relative;
  margin: 0 auto 16px;
}

/* ─── Clock ─── */
.sol-clock {
  position: relative;
  width: 500px;
  height: 500px;
  max-width: 100%;
  margin: 16px auto;
}
.clock-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 56px;
  min-height: 56px;
}
.clock-pile.clock-active {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}
.clock-pile-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-align: center;
}
.clock-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}
.clock-mini-card {
  transform: scale(0.55);
  transform-origin: center top;
}

/* ─── Accordion ─── */
.sol-accordion {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-start;
  padding: 16px 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.acc-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.sol-accordion .card { position: relative; }
.sol-accordion .card.valid-target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sol-game { padding: 0 6px 16px; --card-w: 52px; --card-h: 74px; }
  .sol-top-row { gap: 10px; margin-bottom: 16px; }
  .sol-stock-waste { gap: 8px; }
  .sol-foundations { gap: 6px; }
  .sol-tableau { gap: 4px; }
  .sol-tableau-10 { gap: 2px; }
  .sol-cells { gap: 6px; }
  .sol-topbar-left { gap: 10px; }
  .sol-topbar-stats { gap: 12px; font-size: 13px; }
  .sol-topbar-right .btn { padding: 8px 12px; font-size: 12px; }
  .sol-column { min-height: 120px; }
  .sol-placeholder { border-radius: 8px; font-size: 16px; }
  .sol-setup-header h1 { font-size: 26px; }
  .sol-clock { width: 400px; height: 400px; }
  .sol-accordion { gap: 4px; }
  .sol-waste-piles { gap: 6px; }
}

@media (max-width: 520px) {
  .sol-game { --card-w: 44px; --card-h: 62px; }
  .sol-top-row { gap: 6px; margin-bottom: 12px; }
  .sol-stock-waste { gap: 6px; }
  .sol-foundations { gap: 4px; }
  .sol-tableau { gap: 3px; }
  .sol-tableau-10 { gap: 1px; }
  .sol-cells { gap: 4px; }
  .sol-column { min-height: 90px; }
  .sol-topbar { padding: 8px 0; margin-bottom: 8px; flex-wrap: wrap; }
  .sol-topbar-stats { gap: 8px; font-size: 12px; }
  .sol-win-card { padding: 24px; }
  .sol-win-card h2 { font-size: 28px; }
  .sol-setup { padding: 16px; }
  .sol-setup-body { padding: 16px; }
  .sol-setup-header { padding: 24px 16px 16px; }
  .sol-setup-header h1 { font-size: 22px; }
  .sol-clock { width: 320px; height: 320px; }
  .clock-mini-card { transform: scale(0.45); }
  .sol-waste-piles { gap: 4px; }
}

@media (max-width: 400px) {
  .sol-game { --card-w: 38px; --card-h: 54px; }
  .sol-tableau { gap: 2px; }
  .sol-tableau-10 { gap: 1px; }
  .sol-cells { gap: 3px; }
  .sol-foundations { gap: 3px; }
  .sol-stock-waste { gap: 4px; }
  .sol-column { min-height: 70px; }
  .sol-pile .card { border-radius: 6px; }
  .sol-clock { width: 280px; height: 280px; }
  .clock-mini-card { transform: scale(0.4); }
}
