/* Reunion Word Game Styles */

:root {
  --primary-color: #5b8c5a;
  --secondary-color: #8fbc8f;
  --accent-color: #98d8c8;
  --background: #e8f5e9;
  --card-bg: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --border-color: #cbd5e0;

  /* Tile colors matching original */
  --tile-yellow: #f4d03f;
  --tile-beige: #e8dcc4;
  --tile-green: #9acd32;
  --tile-gray: #d4d4c4;
  --tile-shadow: rgba(0, 0, 0, 0.1);

  --success-color: #9acd32;
  --warning-color: #f4d03f;
  --selected-bg: #fff8dc;
  --selected-border: #f4d03f;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(to bottom, #e3f2fd 0%, #c8e6c9 50%, #a5d6a7 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  position: relative;
}

/* Nature background overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="80" r="2" fill="%23ffffff" opacity="0.3"/></svg>');
  background-size: 50px 50px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.game-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
}

/* Header */
.game-header {
  text-align: center;
  margin-bottom: 30px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.game-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.help-icon-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  transition: all 0.2s;
}

.help-icon-btn:hover {
  background: var(--accent-color);
  transform: scale(1.1);
}

.game-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.game-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.95rem;
}

.nav-link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

.nav-separator {
  color: var(--text-secondary);
}

/* Game Container */
.game-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (min-width: 900px) {
  .game-container {
    grid-template-columns: 2fr 1fr;
    gap: 40px;
  }
}

@media (min-width: 1200px) {
  .game-container {
    grid-template-columns: 2.5fr 1fr;
    gap: 50px;
  }
}

/* Game Board */
.game-board {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Moves Counter (like original) */
.moves-counter {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.date-display {
  position: absolute;
  top: 0;
  left: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.moves-display {
  display: inline-block;
  text-align: center;
}

.moves-value {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 5px;
}

.moves-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 2px;
}

.puzzle-info {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

#puzzle-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.seed-word-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
}

.seed-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

#seed-word {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 2px;
}

.puzzle-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 15px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Letter Grid */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 25px 0;
  max-width: 450px;
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.letter-cell {
  aspect-ratio: 1;
  background: var(--tile-beige);
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow:
    0 2px 4px var(--tile-shadow),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
  color: #2d3748;
  text-transform: uppercase;
  position: relative;
}

.letter-cell[draggable="true"]:active {
  cursor: grabbing;
}

.letter-cell.dragging {
  opacity: 0.5;
  transform: scale(0.9);
  cursor: grabbing;
}

.letter-cell.drag-over {
  background: #fff8dc;
  transform: scale(1.05);
  box-shadow:
    0 0 0 3px var(--tile-yellow),
    0 6px 12px rgba(244, 208, 63, 0.4);
}

/* Color variations */
.letter-cell.color-yellow {
  background: var(--tile-yellow);
}

.letter-cell.color-green {
  background: var(--tile-green);
}

.letter-cell.color-beige {
  background: var(--tile-beige);
}

.letter-cell:not(.empty):hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 6px 12px var(--tile-shadow),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.letter-cell.empty {
  background: var(--tile-gray);
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.letter-cell.animal-cell {
  background: white;
  opacity: 1;
  font-size: 2.5rem;
  box-shadow:
    0 2px 4px var(--tile-shadow),
    inset 0 -2px 4px rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  position: relative;
}

.letter-cell.animal-cell:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 6px 12px var(--tile-shadow),
    inset 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* Visual hint for animal tiles */
.letter-cell.animal-cell::before {
  content: '↔↕';
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 0.5rem;
  opacity: 0.3;
}

.letter-cell.selected {
  background: #fff8dc;
  transform: translateY(-4px) scale(1.08);
  box-shadow:
    0 8px 16px rgba(244, 208, 63, 0.4),
    0 0 0 3px var(--tile-yellow);
  animation: pulse 0.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateY(-4px) scale(1.08); }
  50% { transform: translateY(-4px) scale(1.1); }
}

.letter-cell.correct {
  background: var(--tile-green);
  animation: correctTile 0.5s ease;
  cursor: not-allowed !important;
  opacity: 0.9;
  position: relative;
}

.letter-cell.correct[draggable="false"] {
  cursor: not-allowed !important;
}

/* Visual indicator that tile is locked */
.letter-cell.correct::after {
  content: '🔒';
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.6rem;
  opacity: 0.6;
}

.letter-cell.correct:hover {
  transform: none;
  box-shadow:
    0 2px 4px var(--tile-shadow),
    inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes correctTile {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(147, 51, 234, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-warning {
  background: var(--warning-color);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
  transform: translateY(-2px);
}

/* Stats Panel */
.stats-panel {
  background: var(--card-bg);
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stats-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
  text-align: center;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 12px;
  background: var(--background);
  border-radius: 10px;
  border-left: 4px solid var(--primary-color);
}

.stat-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
}

#answer-words {
  display: none;
  margin-top: 20px;
  padding: 15px;
  background: var(--correct-bg);
  border-radius: 10px;
  border-left: 4px solid var(--success-color);
  color: var(--text-primary);
  font-weight: 600;
  text-align: center;
}

/* How to Play */
.how-to-play {
  background: var(--card-bg);
  padding: 25px;
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
}

.how-to-play h2 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--primary-color);
}

.how-to-play ol {
  margin-left: 20px;
  line-height: 1.8;
}

.how-to-play li {
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.how-to-play strong {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }

  .letter-grid {
    gap: 6px;
  }

  .letter-cell {
    font-size: 1.2rem;
  }

  .game-board, .stats-panel, .how-to-play {
    padding: 20px;
  }

  .controls {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .game-wrapper {
    padding: 10px;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .letter-grid {
    gap: 4px;
  }

  .letter-cell {
    font-size: 1rem;
    border-width: 2px;
    border-radius: 8px;
  }
}
