/* Klondike Solitaire Styles */
:root {
  --bg: #0d5016;
  --felt: #1a7a24;
  --panel: #1a1a2e;
  --border: #2a2a4a;
  --text: #f0f0f5;
  --muted: #8888aa;
  --accent: #b7ff3c;
  --card-width: 70px;
  --card-height: 100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--felt) 100%);
  color: var(--text);
  font-family: 'Chivo', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

nav {
  background: rgba(0,0,0,0.3);
}

.game-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 12px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  margin-bottom: 12px;
}

.game-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.stats {
  display: flex;
  gap: 16px;
}

.stat {
  text-align: center;
}

.stat-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.controls {
  display: flex;
  gap: 8px;
}

.control-btn {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.5);
}

/* Table Layout */
.table {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

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

.foundations {
  display: flex;
  gap: 8px;
}

/* Card Slots */
.card-slot {
  width: var(--card-width);
  height: var(--card-height);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  position: relative;
}

#stock, #waste {
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
}

.foundation {
  width: var(--card-width);
  height: var(--card-height);
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
}

.foundation::after {
  content: attr(data-suit);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: rgba(255,255,255,0.15);
}

/* Tableau */
.tableau {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.tableau-pile {
  width: var(--card-width);
  min-height: var(--card-height);
  position: relative;
}

/* Cards */
.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: 8px;
  position: absolute;
  top: 0;
  left: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
}

.card.back {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  border: 2px solid #2a5298;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card.back::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 5px,
    rgba(255,255,255,0.05) 5px,
    rgba(255,255,255,0.05) 10px
  );
}

.card.face-up {
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
}

.card.face-up.red {
  color: #d63031;
}

.card.face-up.black {
  color: #2d3436;
}

.card .rank {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.card .suit {
  font-size: 1.5rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.card .rank.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card.empty {
  background: rgba(0,0,0,0.1);
  border: 2px dashed rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card.empty.refresh {
  font-size: 2rem;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
}

.card.selected {
  transform: translateY(-8px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.4), 0 0 0 3px var(--accent);
}

.card:hover:not(.back):not(.empty) {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

#stock .card, #waste .card {
  position: relative;
}

/* Win Screen */
#win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

#win-screen.show {
  opacity: 1;
  visibility: visible;
}

.win-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 340px;
}

.win-trophy {
  font-size: 4rem;
  margin-bottom: 16px;
}

.win-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
}

.win-stats {
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.8;
}

#play-again-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a14;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

#play-again-btn:hover {
  transform: scale(1.03);
}

/* Responsive */
@media (max-width: 520px) {
  :root {
    --card-width: 48px;
    --card-height: 68px;
  }

  .game-container { padding: 8px; }
  .game-title { font-size: 1.1rem; }
  .stat-value { font-size: 0.95rem; }
  .control-btn { padding: 6px 12px; font-size: 0.75rem; }

  .card .rank { font-size: 0.8rem; }
  .card .suit { font-size: 1.2rem; }

  .stock-waste { gap: 8px; }
  .foundations { gap: 4px; }
  .tableau { gap: 4px; }
  .top-row { gap: 8px; }

  .tableau-pile .card {
    top: 0 !important;
  }

  .tableau-pile .card:nth-child(n+2) {
    top: 18px !important;
  }
  .tableau-pile .card:nth-child(n+3) {
    top: 36px !important;
  }
  .tableau-pile .card:nth-child(n+4) {
    top: 54px !important;
  }
  .tableau-pile .card:nth-child(n+5) {
    top: 72px !important;
  }
  .tableau-pile .card:nth-child(n+6) {
    top: 90px !important;
  }
  .tableau-pile .card:nth-child(n+7) {
    top: 108px !important;
  }
}

@media (max-width: 380px) {
  :root {
    --card-width: 42px;
    --card-height: 60px;
  }
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  background: rgba(0,0,0,0.3);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.breadcrumb {
  display: flex;
  list-style: none;
  gap: 8px;
}

.breadcrumb li::after {
  content: '›';
  margin-left: 8px;
  color: rgba(255,255,255,0.5);
}

.breadcrumb li:last-child::after { display: none; }

.breadcrumb a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.more-link {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
}

@media (max-width: 500px) {
  .breadcrumb { display: none; }
}

/* Game Content */
.game-content {
  max-width: 600px;
  margin: 32px auto;
  padding: 0 16px;
}

.game-content section {
  margin-bottom: 32px;
}

.game-content h2 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.game-content p {
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.game-content ol,
.game-content ul {
  color: rgba(255,255,255,0.7);
  line-height: 1.8;
  padding-left: 24px;
  font-size: 0.9rem;
}

.game-content li { margin-bottom: 8px; }
.game-content strong { color: #fff; }

/* Footer */
.bp-footer {
  margin-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 24px 16px;
  background: rgba(0,0,0,0.3);
}

.bp-footer__inner {
  max-width: 600px;
  margin: 0 auto;
}

.bp-footer__social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.bp-footer__social-link {
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.bp-footer__social-link.instagram { background: rgba(225,48,108,0.2); color: #e1306c; }
.bp-footer__social-link.twitter { background: rgba(29,161,242,0.2); color: #1da1f2; }
.bp-footer__social-link.feedback { background: rgba(183,255,60,0.2); color: var(--accent); }
.bp-footer__social-link:hover { transform: translateY(-2px); }

.bp-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}

.bp-footer__bottom nav { display: flex; gap: 16px; }
.bp-footer__bottom a { color: rgba(255,255,255,0.5); text-decoration: none; }
.bp-footer__bottom a:hover { color: var(--accent); }
