/* Word Snake game specific styles */

/* Layout */
.word_snake-section {
  padding: 2rem 0 1rem;
}

.word_snake-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2.5rem;
  align-items: start;
  margin-top: 1rem;
}

/* Snake scene */
.word_snake-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.snake-scene {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .snake-scene {
  background: linear-gradient(180deg, #1e3a5f 0%, #1f2937 100%);
  border-color: #374151;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Overlay */
.snake-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.snake-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  color: white;
  padding: 2rem;
}

.overlay-content h3 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}

.overlay-content p {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

/* Life hearts */
.word_snake-life {
  display: flex;
  gap: 0.4rem;
  font-size: 1.4rem;
}

.life-heart {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.life-heart.lost {
  opacity: 0.2;
  transform: scale(0.8);
  filter: grayscale(1);
}

/* Stats */
.word_snake-stats {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.word_snake-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  min-width: 70px;
}

.word_snake-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.word_snake-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Round indicator */
.word_snake-round {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border-radius: var(--radius-lg);
  font-weight: 700;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
}

.round-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.round-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.round-sep {
  opacity: 0.6;
  font-size: 1.2rem;
}

.round-letters {
  font-size: 1rem;
  opacity: 0.95;
}

.round-letters #roundLettersValue {
  font-weight: 800;
  font-size: 1.2rem;
}

/* Target word display */
.word_snake-target {
  text-align: center;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.target-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.target-word {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.target-translation {
  display: block;
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.25rem;
}

/* Progress letters */
.word_snake-progress {
  margin-bottom: 1rem;
}

.progress-letters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.progress-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.8rem;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.progress-letter.current {
  border-color: var(--primary-color);
  color: var(--primary-color);
  animation: pulse 1s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.progress-letter.collected {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
  animation: collectPop 0.4s ease;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.15);
  }
}

@keyframes collectPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* Hint */
.word_snake-hint {
  text-align: center;
  min-height: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-style: italic;
}

/* Feedback */
.word_snake-feedback {
  text-align: center;
  min-height: 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.word_snake-feedback.success {
  color: var(--success-color);
}

.word_snake-feedback.error {
  color: var(--error-color);
}

.word_snake-feedback.info {
  color: var(--primary-color);
}

/* Actions */
.word_snake-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.word_snake-actions .btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
}

/* Virtual D-pad — visible on all devices */
.word_snake-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.dpad-row {
  display: flex;
  gap: 0.5rem;
}

.dpad-btn {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.dpad-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.dpad-btn:active {
  background: var(--primary-color);
  color: white;
  transform: scale(0.95);
}

.dpad-up {
  margin-bottom: 0.25rem;
}

/* Info section */
.word_snake-info {
  padding: 3rem 0;
}

/* Mobile duplicate info panel — hidden on desktop */
.word_snake-mobile-info {
  display: none;
}

/* Responsive */
@media (max-width: 900px) {
  .word_snake-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .word_snake-visual {
    order: -1;
  }

  .snake-scene {
    max-width: 400px;
  }

  .word_snake-mobile-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 420px;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
  }

  .mobile-target {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
  }

  .mobile-target-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
  }

  .mobile-target-word {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
  }

  .mobile-progress {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .mobile-progress .progress-letter {
    width: 1.9rem;
    height: 2.4rem;
    font-size: 1rem;
  }

  .mobile-feedback {
    min-height: 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
  }

  .mobile-feedback.success {
    color: var(--success-color);
  }

  .mobile-feedback.error {
    color: var(--error-color);
  }

  .mobile-feedback.info {
    color: var(--primary-color);
  }
}

@media (max-width: 600px) {
  .word_snake-actions {
    flex-direction: column;
  }

  .word_snake-actions .btn {
    width: 100%;
  }

  .word_snake-round {
    padding: 0.6rem 1rem;
    gap: 0.4rem;
  }

  .round-value {
    font-size: 1.25rem;
  }

  .round-letters {
    font-size: 0.9rem;
  }

  .word_snake-stat {
    min-width: 60px;
    padding: 0.4rem 0.7rem;
  }

  .word_snake-stat-value {
    font-size: 1.1rem;
  }

  .target-word {
    font-size: 1.4rem;
  }

  .progress-letter {
    width: 1.8rem;
    height: 2.4rem;
    font-size: 1rem;
  }

  .snake-scene {
    max-width: 400px;
  }

  .dpad-btn {
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
  }

  .mobile-target-word {
    font-size: 1.35rem;
  }

  .mobile-progress .progress-letter {
    width: 1.6rem;
    height: 2.1rem;
    font-size: 0.9rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

  .progress-letter.current,
  .progress-letter.collected {
    animation: none !important;
    transition: none !important;
  }
}