/* ═══ Solitaire — design system jeux.html ═══ */
.jeu-v-wrap { max-width: 740px; margin: 0 auto; }
#game-content { overflow: hidden; }

/* ── Variables de jeu ── */
:root {
  --felt:        #1a6b3c;
  --felt-dark:   #145a30;
  --felt-light:  #1e7d45;
  --card-w:      80px;
  --card-h:      112px;
  --card-radius: 8px;
  --gold:        #d4a843;
  --gold-light:  #e8c36a;
  --sol-shadow:  0 2px 8px rgba(0, 0, 0, .35);
}

/* ── Tapis vert (zone de jeu) ── */
#game {
  position: relative;
  background: radial-gradient(ellipse at 50% 30%, var(--felt-light), var(--felt) 55%, var(--felt-dark) 100%);
  padding: 14px 12px 24px;
  user-select: none;
  -webkit-user-select: none;
}

#game::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='6' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' x='2' y='2' fill='rgba(255,255,255,0.03)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Top row ── */
.top-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.top-left  { display: flex; gap: 10px; }
.top-right { display: flex; gap: 10px; }

/* ── Slots (emplacements vides) ── */
.slot {
  width: var(--card-w);
  height: var(--card-h);
  border: 2px dashed rgba(255, 255, 255, .2);
  border-radius: var(--card-radius);
  position: relative;
  flex-shrink: 0;
}

.slot.foundation::after {
  content: attr(data-suit);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  opacity: .22;
  color: #fff;
}

/* ── Tableau ── */
.tableau {
  display: flex;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.pile {
  width: var(--card-w);
  position: relative;
  min-height: var(--card-h);
  flex-shrink: 0;
}

/* ── Cartes ── */
.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  position: absolute;
  left: 0;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  box-shadow: var(--sol-shadow);
  z-index: 1;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }

.card.selected {
  box-shadow: 0 0 0 3px var(--gold-light), 0 4px 14px rgba(0, 0, 0, .45);
  transform: translateY(-4px);
}

/* ── Face visible ── */
.card-front {
  width: 100%; height: 100%;
  background: #fff;
  border-radius: var(--card-radius);
  display: flex;
  flex-direction: column;
  padding: 5px 6px;
  position: relative;
  border: 1px solid #ddd;
}

.card-front .corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-weight: 600;
}

.corner .rank       { font-size: 15px; }
.corner .suit-small { font-size: 13px; }

.card-front .corner-bottom {
  position: absolute;
  bottom: 5px; right: 6px;
  transform: rotate(180deg);
}

.card-front .center-suit {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
}

.card-front.red   { color: #c0392b; }
.card-front.black { color: #2c3e50; }

/* ── Face cachée ── */
.card-back {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a3a5c 0%, #2c5f8a 50%, #1a3a5c 100%);
  border-radius: var(--card-radius);
  border: 1px solid #345;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card-back::before {
  content: '';
  position: absolute; inset: 5px;
  border: 1.5px solid rgba(255, 255, 255, .15);
  border-radius: 5px;
}

.card-back::after {
  content: '✦';
  color: rgba(255, 255, 255, .18);
  font-size: 36px;
}

/* ── Pioche ── */
.stock-area .slot { cursor: pointer; }

.stock-area .slot.empty-stock::after {
  content: '↻';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  color: rgba(255, 255, 255, .3);
}

.waste-area { position: relative; min-width: var(--card-w); }

/* ── Bouton auto-compléter (fixe) ── */
.auto-complete-btn {
  display: none;
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: 999px;
  padding: 11px 26px;
  color: #fff;
  background: var(--a1);
  box-shadow: 0 4px 18px rgba(109, 92, 255, .35);
  cursor: pointer;
  white-space: nowrap;
  animation: solBounce 2s ease infinite;
}

.auto-complete-btn.show { display: block; }

@keyframes solBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-5px); }
}

/* ── Overlay victoire (fixe) ── */
.win-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.win-overlay.show { display: flex; }

.win-card {
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: var(--r2);
  padding: 32px 24px;
  box-shadow: var(--s4);
  text-align: center;
  width: min(100%, 360px);
}

.win-title {
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 800;
  color: var(--ok);
  margin-bottom: 10px;
  animation: winPulse 1.5s ease infinite;
}

.win-card p {
  font-size: 13px;
  color: var(--tx2);
  margin-bottom: 20px;
  font-family: var(--mono);
}

@keyframes winPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

/* ── HTML page overlays (démarrage / fin) ── */
.jvsol-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: var(--cd, #fff);
  overflow: hidden;
}

.jvsol-overlay.hidden { display: none; }

.jvsol-overlay > .snk-screen {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.jvsol-overlay .snk-screen {
  justify-content: center;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
}

/* ── Responsive ── */
@media (max-width: 620px) {
  :root {
    /* 7 piles + 6 gaps de 5px + 12px padding #game → (100vw - 42px) / 7
       min() plafonne à 46px sur les écrans assez larges               */
    --card-w: min(46px, calc((100vw - 42px) / 7));
    --card-h: calc(var(--card-w) * 1.4);
  }

  .jeu-v-wrap { max-width: none; }
  .tableau { gap: 5px; }
  .top-left, .top-right { gap: 5px; }
  #game { padding: 10px 6px 18px; }

  .corner .rank       { font-size: clamp(8px, calc(var(--card-w) * 0.25), 11px); }
  .corner .suit-small { font-size: clamp(7px, calc(var(--card-w) * 0.22), 9px); }
  .card-front .center-suit { font-size: clamp(14px, calc(var(--card-w) * 0.42), 18px); }
  .slot.foundation::after { font-size: clamp(16px, calc(var(--card-w) * 0.48), 20px); }
}
