/* =========================================
   CANDY CRUSH VOCABULARY GAME STYLES
   ========================================= */
.candy-game-wrapper {
  max-width: 650px;
  margin: 0 auto;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  border-radius: 20px;
  padding: 20px;
  color: white;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.2);
  border: 2px solid #6366f1;
  position: relative;
  overflow: hidden;
}

.candy-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.candy-stat-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.candy-stat-badge .stat-label {
  font-size: 11px;
  color: #a5b4fc;
  font-weight: 600;
  text-transform: uppercase;
}

.candy-stat-badge .stat-val {
  font-size: 20px;
  font-weight: 800;
  color: #fef08a;
}

.candy-actions {
  display: flex;
  gap: 8px;
}

.candy-btn {
  background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(217, 70, 239, 0.4);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.candy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(217, 70, 239, 0.6);
}

.candy-btn:active {
  transform: translateY(0);
}

.candy-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.candy-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

/* Flash Word Popup Banner */
.candy-flash-banner {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #78350f;
  padding: 10px 16px;
  border-radius: 12px;
  margin-bottom: 14px;
  text-align: center;
  font-weight: bold;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.candy-flash-banner.celebrate {
  animation: banner-pop 0.4s ease;
}

@keyframes banner-pop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* 6x6 Candy Grid */
.candy-board-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.candy-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  padding: 10px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  user-select: none;
  touch-action: manipulation;
}

/* Candy Tile Styles */
.candy-tile {
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.4), 0 4px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: transform 0.15s ease, opacity 0.15s ease;
  user-select: none;
  padding: 2px;
}

.candy-tile:hover {
  transform: scale(1.06);
  z-index: 5;
}

.candy-tile.selected {
  outline: 3px solid #fef08a;
  transform: scale(1.1);
  z-index: 10;
  box-shadow: 0 0 15px #fef08a;
  animation: candy-pulse 0.8s infinite alternate;
}

@keyframes candy-pulse {
  from { transform: scale(1.05); }
  to { transform: scale(1.12); }
}

.candy-tile.crushing {
  animation: candy-explode 0.35s forwards ease-out;
}

@keyframes candy-explode {
  0% { transform: scale(1); opacity: 1; filter: brightness(1.5); }
  50% { transform: scale(1.3) rotate(15deg); opacity: 0.8; filter: brightness(2); }
  100% { transform: scale(0); opacity: 0; }
}

/* 6 Candy Color Variations */
.candy-type-0 {
  background: radial-gradient(circle at 35% 35%, #f87171, #dc2626 70%, #991b1b);
}
.candy-type-1 {
  background: radial-gradient(circle at 35% 35%, #fb923c, #ea580c 70%, #9a3412);
}
.candy-type-2 {
  background: radial-gradient(circle at 35% 35%, #fde047, #ca8a04 70%, #854d0e);
}
.candy-type-3 {
  background: radial-gradient(circle at 35% 35%, #4ade80, #16a34a 70%, #166534);
}
.candy-type-4 {
  background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb 70%, #1e40af);
}
.candy-type-5 {
  background: radial-gradient(circle at 35% 35%, #c084fc, #9333ea 70%, #6b21a8);
}

.candy-py {
  font-size: 11.5px;
  font-weight: 700;
  color: #fef08a; /* Bright yellow tone for high readability */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  letter-spacing: -0.2px;
  line-height: 1.1;
  margin-bottom: 2px;
  max-width: 96%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candy-word {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  word-break: break-all;
  letter-spacing: -0.3px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

@media (max-width: 480px) {
  .candy-py {
    font-size: 9.5px;
    margin-bottom: 1px;
  }
  .candy-word {
    font-size: 13.5px;
  }
}

.candy-icon {
  font-size: 10px;
  opacity: 0.8;
  margin-bottom: 1px;
}

/* Vocabulary Legend / Collection bar */
.candy-legend {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.candy-legend-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #c7d2fe;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.candy-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.candy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.candy-chip:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.candy-chip-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Victory / Game Over Modal */
.candy-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.candy-modal.active {
  display: flex;
}

.candy-modal-box {
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 100%);
  border: 2px solid #818cf8;
  border-radius: 20px;
  padding: 24px 30px;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-stars {
  font-size: 40px;
  margin-bottom: 8px;
  letter-spacing: 4px;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: #fef08a;
  margin-bottom: 6px;
}

.modal-score {
  font-size: 18px;
  color: white;
  margin-bottom: 16px;
}

.modal-btn-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}
