/* Puzzle 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;
  --tile-size: 80px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #7c3aed 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;
}

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

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

.lang-btn, #newGameBtn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

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

.game-container {
  max-width: 800px;
  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);
}

/* Puzzle Container */
.puzzle-container {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 32px;
  margin-bottom: 20px;
}

.puzzle-board {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(4, var(--tile-size));
  grid-template-rows: repeat(4, var(--tile-size));
  gap: 4px;
  justify-content: center;
  min-height: calc(var(--tile-size) * 4 + 12px);
}

.puzzle-tile {
  width: var(--tile-size);
  height: var(--tile-size);
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neutral-800);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  position: relative;
  touch-action: manipulation;
  min-width: 44px;
  min-height: 44px;
}

.puzzle-tile:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Touch-specific styles */
@media (pointer: coarse) {
  .puzzle-tile {
    min-width: 60px;
    min-height: 60px;
    font-size: 1.25rem;
    padding: 8px;
  }
  
  .puzzle-tile:active {
    transform: scale(1.1);
    background: #f0f9ff;
  }
}

.puzzle-tile.empty {
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  cursor: default;
}

.puzzle-tile.empty:hover {
  transform: none;
  box-shadow: none;
}

.puzzle-tile.moveable {
  background: #fef3c7;
  border-color: var(--accent-orange);
}

.puzzle-tile.correct {
  background: #d1fae5;
  border-color: var(--success-green);
}

/* Preview */
.puzzle-preview {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 16px;
  height: fit-content;
}

.puzzle-preview h3 {
  text-align: center;
  margin-bottom: 12px;
  color: var(--neutral-800);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 35px);
  grid-template-rows: repeat(4, 35px);
  gap: 2px;
  justify-content: center;
}

.preview-tile {
  width: 35px;
  height: 35px;
  background: var(--neutral-100);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--neutral-600);
}

.preview-tile.empty {
  background: var(--neutral-200);
}

/* 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 {
  background: white;
  transform: translateY(-2px);
}

#shuffleBtn {
  background: var(--accent-orange);
  color: white;
}

#shuffleBtn:hover {
  background: #c2410c;
}

#solveBtn {
  background: var(--success-green);
  color: white;
}

#solveBtn: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;
}

/* 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) {
  .puzzle-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .puzzle-preview {
    order: -1;
  }
  
  :root {
    --tile-size: 60px;
  }
  
  .preview-grid {
    grid-template-columns: repeat(4, 25px);
    grid-template-rows: repeat(4, 25px);
  }
  
  .preview-tile {
    width: 25px;
    height: 25px;
    font-size: 0.625rem;
  }
}

@media (max-width: 480px) {
  :root {
    --tile-size: 50px;
  }
  
  .puzzle-tile {
    font-size: 1.25rem;
  }
  
  .game-actions {
    flex-wrap: wrap;
  }
  
  .game-actions button {
    padding: 10px 16px;
    font-size: 0.875rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .puzzle-tile {
    transition: none;
  }
}

/* Animation for tile movement */
.puzzle-tile.moving {
  transition: transform 0.3s ease;
  z-index: 10;
}