/*
 * CLASSROOM GAMES CSS
 * Game UI: stats, quiz grids, feedback, interactive components
 * Used by all Junior Math chapters
 */

/* ========== GAME CARDS ========== */
.game-card {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--secondary-soft) 100%);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.game-icon {
  font-size: 2.2rem;
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.game-subtitle {
  font-size: 0.8rem;
  color: var(--text-light);
}

.game-content {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
}

/* ========== GAME STATS (Pill Style) ========== */
.game-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.game-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
}

.game-stat-value {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--primary);
}

.game-stat-label {
  font-size: 0.65rem;
  color: var(--text-light);
  text-transform: uppercase;
}

/* ========== FORECAST BAR ========== */
.forecast-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 10px;
  margin: 10px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.forecast-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--text-light);
}

.forecast-indicators {
  display: flex;
  gap: 8px;
  flex: 1;
}

.forecast-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: white;
  transition: all 0.3s;
}

.forecast-dot.safe { background: var(--overflow-safe); }
.forecast-dot.likely { background: var(--overflow-likely); }
.forecast-dot.certain { background: var(--overflow-certain); }
.forecast-dot.inactive { background: #E2E8F0; }

.forecast-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-light);
}

.forecast-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.forecast-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

@media (max-width: 480px) {
  .forecast-bar { padding: 6px 8px; margin: 6px 0; }
  .forecast-dot { width: 18px; height: 18px; font-size: 0.55rem; }
  .forecast-label { font-size: 0.65rem; }
}

/* ========== PLACE VALUE CONTAINERS ========== */
.container-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.place-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.container-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: white;
  padding: 4px 12px;
  border-radius: 50px;
  text-transform: uppercase;
}

.container-label.thousands { background: var(--thousands); }
.container-label.hundreds { background: var(--hundreds); }
.container-label.tens { background: var(--tens); }
.container-label.ones { background: var(--ones); }

.container-box {
  width: 60px;
  height: 70px;
  border-radius: 10px;
  border: 2px dashed;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-start;
  padding: 6px;
  position: relative;
  overflow: visible;
  transition: all 0.3s;
}

.container-box.thousands { border-color: var(--thousands); background: var(--thousands-soft); }
.container-box.hundreds { border-color: var(--hundreds); background: var(--hundreds-soft); }
.container-box.tens { border-color: var(--tens); background: var(--tens-soft); }
.container-box.ones { border-color: var(--ones); background: var(--ones-soft); }

.container-box.overflow {
  animation: shake 0.5s ease;
  border-style: solid;
}

.container-item {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin: 2px;
}

.container-item.thousands { background: var(--thousands); }
.container-item.hundreds { background: var(--hundreds); }
.container-item.tens { background: var(--tens); }
.container-item.ones { background: var(--ones); }

.container-count {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
}

.container-limit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .container-box { width: 45px; height: 55px; }
  .container-count { font-size: 0.95rem; }
  .container-label { font-size: 0.55rem; padding: 2px 8px; }
  .container-row { gap: 10px; margin: 10px 0; }
}

/* ========== COMBINE CITIES ENGINE ========== */
.combine-container {
  background: var(--bg-cool);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}

.cities-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.city-block {
  background: var(--card);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
  min-width: 80px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.city-name {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 2px;
}

.city-population {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--primary);
}

.combine-symbol {
  font-size: 1.3rem;
  color: var(--secondary);
}

.combine-result {
  background: var(--card);
  border-radius: 10px;
  padding: 10px 16px;
  text-align: center;
  margin: 10px auto;
  max-width: 180px;
  border: 2px solid var(--success);
}

.combine-result-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.combine-result-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--success);
}

@media (max-width: 480px) {
  .combine-container { padding: 10px; margin: 8px 0; }
  .cities-display { gap: 6px; margin: 8px 0; }
  .city-block { padding: 8px 10px; min-width: 70px; }
  .city-name { font-size: 0.65rem; margin-bottom: 2px; }
  .city-population { font-size: 1.1rem; }
  .combine-symbol { font-size: 1.2rem; }
  .combine-result { padding: 8px 12px; margin: 8px auto; }
  .combine-result-value { font-size: 1.2rem; }
}

/* ========== PREDICTOR ENGINE ========== */
.predictor-container {
  background: var(--bg);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
}

.predictor-question {
  font-family: var(--font-display);
  font-size: 1rem;
  text-align: center;
  color: var(--text);
  margin-bottom: 12px;
  padding: 8px;
  background: var(--primary-soft);
  border-radius: 8px;
}

.predictor-options {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.predictor-option {
  padding: 10px 16px;
  background: var(--card);
  border-radius: 25px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.predictor-option:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.predictor-option.correct {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.predictor-option.wrong {
  background: var(--thinking-soft);
  border-color: var(--thinking);
}

@media (max-width: 480px) {
  .predictor-container { padding: 12px; }
  .predictor-question { font-size: 0.85rem; padding: 8px 10px; margin: 8px 0; }
  .predictor-option { padding: 8px 10px; font-size: 0.8rem; }
}

/* ========== QUIZ ========== */
.quiz-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.4;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 2x2 grid for short options (2-4 words) */
.quiz-options.grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.quiz-option {
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  border: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-options.grid-2x2 .quiz-option {
  padding: 8px;
  gap: 6px;
  font-size: 0.8rem;
}

.quiz-options.grid-2x2 .quiz-option-letter {
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.quiz-option:hover {
  border-color: var(--primary);
}

.quiz-option.correct {
  background: var(--success-soft);
  border-color: var(--success);
}

.quiz-option.wrong {
  background: var(--thinking-soft);
  border-color: var(--thinking);
}

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
}

/* ========== OVERFLOW MANAGER GAME ========== */
.overflow-game-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.overflow-meter {
  height: 30px;
  background: #E2E8F0;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.overflow-meter-fill {
  height: 100%;
  border-radius: 15px;
  transition: width 0.3s, background 0.3s;
}

.overflow-meter-fill.safe { background: var(--overflow-safe); }
.overflow-meter-fill.warning { background: var(--overflow-likely); }
.overflow-meter-fill.danger { background: var(--overflow-certain); }

.overflow-meter-label {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text);
}

/* ========== CALM CALCULATOR ========== */
.calm-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.calm-child {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
}

.calm-child-avatar {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.calm-child-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.calm-child-style {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.calm-child.selected {
  border: 2px solid var(--primary);
}

.calm-child.correct {
  border: 2px solid var(--success);
  background: var(--success-soft);
}

/* ========== REPLAY CONTROLS ========== */
.replay-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.replay-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.replay-btn:hover {
  transform: scale(1.1);
  background: var(--primary-soft);
}

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

/* ========== MOBILE GAME ADJUSTMENTS ========== */
@media (max-width: 480px) {
  .game-card { padding: 14px; margin: 12px 0; }
  .game-header { gap: 10px; margin-bottom: 12px; }
  .game-icon { font-size: 2rem; }
  .game-title { font-size: 1.1rem; }
  .game-content { padding: 12px; }
  .game-stats { gap: 12px; margin-bottom: 8px; }
}
