/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: #1a1a2e;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === TOPBAR === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #ff6b35, #e85d2a);
  color: #fff;
  gap: 0.5rem;
  flex-wrap: wrap;
  z-index: 100;
}

.btn-back {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s;
}
.btn-back:hover { background: rgba(255,255,255,0.3); }

.game-title { font-size: 1.3rem; font-weight: 800; white-space: nowrap; }

.stats {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

/* === GAME AREA === */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
}

/* === PYRAMID === */
.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pyramid-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

/* === CARDS === */
.card {
  width: 58px;
  height: 82px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  border: 2px solid rgba(255,255,255,0.2);
  position: relative;
}

.card:hover:not(.removed):not(.blocked) {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.card.selected {
  border-color: #ffd54f;
  box-shadow: 0 0 15px rgba(255,213,79,0.5);
  transform: translateY(-4px);
}

.card.red { background: #fff; color: #d32f2f; }
.card.black { background: #fff; color: #222; }

.card .card-value { font-size: 1.1rem; }
.card .card-suit { font-size: 0.85rem; }

.card.blocked {
  opacity: 0.5;
  cursor: not-allowed;
}

.card.removed {
  visibility: hidden;
}

.card-back {
  width: 58px;
  height: 82px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1565c0, #0d47a1);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.card-back:hover { transform: scale(1.05); }

/* === STOCK AREA === */
.stock-area {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: center;
}

.stock-pile, .waste-pile {
  text-align: center;
  cursor: pointer;
}

.pile-label {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  margin-top: 0.3rem;
}

.waste-pile .card {
  cursor: pointer;
}

.waste-pile .card.selected {
  border-color: #ffd54f;
  box-shadow: 0 0 15px rgba(255,213,79,0.5);
}

.empty-pile {
  width: 58px;
  height: 82px;
  border-radius: 8px;
  border: 2px dashed rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
}

/* === BUTTONS === */
.actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.4rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: #fff;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.1); transform: scale(1.03); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-orange { background: linear-gradient(135deg, #ff6b35, #e85d2a); }
.btn-blue { background: linear-gradient(135deg, #1e88e5, #1565c0); }

/* === MESSAGE === */
.message {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  min-height: 1.5rem;
  color: #ffd54f;
  padding: 0.3rem;
}

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: #16213e;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  max-width: 90%;
  width: 360px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.modal h2 { margin-bottom: 0.5rem; }
.modal p { color: rgba(255,255,255,0.7); margin-bottom: 1.2rem; }

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .topbar { padding: 0.4rem 0.6rem; }
  .game-title { font-size: 1rem; }
  .stats { font-size: 0.8rem; gap: 0.5rem; }
  .card, .card-back, .empty-pile { width: 44px; height: 64px; }
  .card .card-value { font-size: 0.9rem; }
  .card .card-suit { font-size: 0.7rem; }
  .pyramid { gap: 2px; }
  .pyramid-row { gap: 2px; }
  .stock-area { gap: 1rem; }
}

@media (max-width: 360px) {
  .card, .card-back, .empty-pile { width: 38px; height: 56px; }
  .card .card-value { font-size: 0.8rem; }
  .card .card-suit { font-size: 0.6rem; }
}

/* ===== SEO GAME INFO SECTION ===== */
.game-info {
  max-width: 780px;
  margin: 1rem auto;
  padding: 1rem 1.2rem;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  line-height: 1.6;
}
.game-info h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.5rem; }
.game-info h3 { font-size: 0.95rem; font-weight: 700; margin: 0.8rem 0 0.3rem; }
.game-info ul { padding-left: 1.2rem; }
.game-info li { margin-bottom: 0.2rem; }
