/* Solitaire Game Styles */
:root {
  --primary-blue: #2563eb;
  --secondary-teal: #0891b2;
  --accent-orange: #ea580c;
  --success-green: #059669;
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;
  --card-width: 70px;
  --card-height: 100px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0f766e 0%, #1e40af 100%);
  min-height: 100vh;
  color: var(--neutral-700);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.game-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 16px 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--secondary-teal);
}

.game-header h1 {
  color: var(--neutral-800);
  font-size: 1.5rem;
}

.game-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lang-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}

#newGameBtn {
  background: var(--success-green);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

#newGameBtn:hover {
  background: #047857;
}

/* Game Instructions */
.game-instructions {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 24px;
  margin-top: 20px;
}

.game-instructions h3 {
  color: var(--neutral-800);
  margin-bottom: 16px;
  text-align: center;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.instruction-item {
  background: var(--neutral-50);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.instruction-item h4 {
  color: var(--primary-blue);
  margin-bottom: 8px;
  font-size: 1rem;
}

.instruction-item p {
  color: var(--neutral-900);
  font-size: 0.875rem;
}

.game-rules {
  background: var(--neutral-50);
  padding: 16px;
  border-radius: 8px;
}

.game-rules h4 {
  color: var(--neutral-800);
  margin-bottom: 12px;
}

.game-rules ul {
  list-style-type: disc;
  padding-left: 20px;
}

.game-rules li {
  color: var(--neutral-900);
  margin-bottom: 8px;
  font-size: 0.875rem;
}

/* Game Main */
.game-main {
  padding: 20px 0;
}

.game-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

.game-info {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.game-info > div {
  font-weight: 500;
}

.game-info span:last-child {
  font-weight: 700;
  color: var(--primary-blue);
}

/* Solitaire Board */
.solitaire-board {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.foundation-area {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.stock-area {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
  margin-bottom: 32px;
}

.tableau-area {
  display: flex;
  gap: 12px;
  justify-content: center;
  min-height: 300px;
}

/* Card Piles */
.foundation-pile,
.stock-pile,
.waste-pile,
.tableau-pile {
  width: var(--card-width);
  min-height: var(--card-height);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  position: relative;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.foundation-pile.valid-drop,
.tableau-pile.valid-drop {
  border-color: var(--success-green);
  background: rgba(5, 150, 105, 0.2);
}

.tableau-pile {
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

/* Playing Cards */
.playing-card {
  width: var(--card-width);
  height: var(--card-height);
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  cursor: pointer;
  user-select: none;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  touch-action: manipulation;
  min-width: 44px;
  min-height: 62px;
}

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

/* Touch-specific styles */
@media (pointer: coarse) {
  .playing-card {
    min-width: 50px;
    min-height: 70px;
    padding: 2px;
  }
  
  .playing-card:active {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary-blue);
  }
  
  .card-rank {
    font-size: 12px;
  }
  
  .card-suit {
    font-size: 10px;
  }
}

.playing-card.dragging {
  transform: rotate(5deg);
  z-index: 1000;
  opacity: 0.8;
}

.playing-card.face-down {
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  cursor: default;
}

.playing-card.face-down:hover {
  transform: none;
}

.card-rank {
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

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

.playing-card.red {
  color: #dc2626;
}

.playing-card.black {
  color: #000;
}

/* Stacked cards in tableau */
.tableau-pile .playing-card {
  position: absolute;
  top: 0;
}

.tableau-pile .playing-card:nth-child(1) { top: 0px; }
.tableau-pile .playing-card:nth-child(2) { top: 20px; }
.tableau-pile .playing-card:nth-child(3) { top: 40px; }
.tableau-pile .playing-card:nth-child(4) { top: 60px; }
.tableau-pile .playing-card:nth-child(5) { top: 80px; }
.tableau-pile .playing-card:nth-child(6) { top: 100px; }
.tableau-pile .playing-card:nth-child(7) { top: 120px; }
.tableau-pile .playing-card:nth-child(8) { top: 140px; }
.tableau-pile .playing-card:nth-child(9) { top: 160px; }
.tableau-pile .playing-card:nth-child(10) { top: 180px; }
.tableau-pile .playing-card:nth-child(11) { top: 200px; }
.tableau-pile .playing-card:nth-child(12) { top: 220px; }
.tableau-pile .playing-card:nth-child(13) { top: 240px; }

/* Game Actions */
.game-actions {
  text-align: center;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.game-actions button {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.game-actions button:hover:not(:disabled) {
  background: white;
  transform: translateY(-2px);
}

.game-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#undoBtn:disabled {
  background: rgba(200, 200, 200, 0.5);
}

/* Fixed Privacy Controls */
.fixed-privacy-controls {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.privacy-choices-btn {
  background: var(--neutral-800);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
  }
  
  .game-info {
    flex-direction: column;
    gap: 8px;
  }
  
  .solitaire-board {
    padding: 16px;
  }
  
  :root {
    --card-width: 50px;
    --card-height: 70px;
  }
  
  .foundation-area,
  .stock-area,
  .tableau-area {
    gap: 8px;
  }
  
  .tableau-area {
    overflow-x: auto;
    padding-bottom: 20px;
  }
  
  .game-actions {
    flex-wrap: wrap;
  }
  
  .game-actions button {
    padding: 10px 16px;
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  :root {
    --card-width: 40px;
    --card-height: 56px;
  }
  
  .card-rank {
    font-size: 10px;
  }
  
  .card-suit {
    font-size: 8px;
  }
}

/* Accessibility */
.playing-card:focus {
  outline: 3px solid var(--accent-orange);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .playing-card,
  .game-actions button {
    transition: none;
  }
}