/* ============ GAME MODES STYLES ============ */

/* Container */
#game-mode-container { margin-bottom: 0.8rem; }

/* ============ BATTLE MODE ============ */
.gm-battle-field { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0.5rem; }
.gm-player, .gm-enemy { text-align: center; flex: 1; }
.gm-player-avatar { font-size: 2rem; animation: playerIdle 2s ease infinite; }
.gm-enemy-avatar { font-size: 2.5rem; animation: enemyIdle 1.5s ease infinite; }
.gm-enemy-avatar.gm-hit { animation: enemyHit 0.4s ease; }
.gm-vs { font-size: 0.8rem; font-weight: 800; color: var(--red); background: #fee2e2; padding: 0.2rem 0.5rem; border-radius: 8px; }
.gm-hp-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-top: 0.3rem; }
.gm-hp-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.gm-hp-player { background: linear-gradient(90deg, var(--green), #34d399); }
.gm-hp-enemy { background: linear-gradient(90deg, var(--red), #f87171); }
.gm-hp-label { font-size: 0.6rem; color: var(--text-light); margin-top: 0.15rem; font-weight: 600; }

@keyframes playerIdle { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes enemyIdle { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes enemyHit { 0% { transform: scale(1); } 25% { transform: translateX(-8px) scale(0.9); filter: brightness(2); } 50% { transform: translateX(8px); } 100% { transform: scale(1); } }

/* Battle Victory State */
.gm-battle-victory { text-align: center; padding: 0.8rem; background: linear-gradient(135deg, #ecfdf5, #d1fae5); border-radius: 12px; border: 2px solid var(--green); }
.gm-victory-text { font-size: 1rem; font-weight: 800; color: var(--green); }
.gm-victory-sub { font-size: 0.7rem; color: var(--text-light); margin-top: 0.2rem; }

/* ============ CHEST MODE ============ */
.gm-chest { text-align: center; padding: 0.5rem; }
.gm-chest-row { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.gm-chest-item { font-size: 1.8rem; transition: all 0.3s; }
.gm-chest-item.gm-chest-open { animation: chestOpen 0.5s ease; }
.gm-chest-label { font-size: 0.7rem; color: var(--gold); font-weight: 700; }

@keyframes chestOpen { 0% { transform: scale(1); } 50% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1); } }

/* ============ BRIDGE MODE ============ */
.gm-bridge { text-align: center; padding: 0.5rem; }
.gm-bridge-path { display: flex; align-items: center; justify-content: center; gap: 0.2rem; flex-wrap: wrap; }
.gm-bridge-step { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; background: #e5e7eb; border: 2px solid #d1d5db; transition: all 0.3s; }
.gm-step-done { background: #d1fae5; border-color: var(--green); }
.gm-step-current { background: #fef3c7; border-color: var(--gold); animation: stepPulse 1s ease infinite; }
.gm-step-goal { background: linear-gradient(135deg, #fef3c7, #fde68a); border-color: var(--gold); }
.gm-bridge-label { font-size: 0.7rem; color: var(--text-light); font-weight: 600; margin-top: 0.3rem; }

@keyframes stepPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ============ RACE MODE ============ */
.gm-race { padding: 0.5rem; }
.gm-race-track { display: flex; flex-direction: column; gap: 0.4rem; }
.gm-race-lane { position: relative; height: 32px; background: #f3f4f6; border-radius: 16px; border: 2px solid #e5e7eb; overflow: visible; }
.gm-race-lane.gm-race-opponent { border-color: #fecaca; background: #fef2f2; }
.gm-race-runner { position: absolute; top: 50%; transform: translateY(-50%); font-size: 1.3rem; z-index: 2; transition: left 0.5s ease; }
.gm-race-progress { position: absolute; top: 0; left: 0; height: 100%; background: linear-gradient(90deg, var(--turquoise), var(--green)); border-radius: 14px; transition: width 0.5s ease; opacity: 0.3; }
.gm-race-progress-enemy { background: linear-gradient(90deg, #fca5a5, var(--red)); }
.gm-race-label { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 0.55rem; font-weight: 700; color: var(--text-light); }
.gm-race-status { text-align: center; font-size: 0.75rem; font-weight: 700; margin-top: 0.3rem; color: var(--purple); }

/* ============ FEED MODE ============ */
.gm-feed { text-align: center; padding: 0.5rem; }
.gm-feed-creature { margin-bottom: 0.3rem; transition: transform 0.3s; }
.gm-feed-creature.gm-feed-happy { animation: feedHappy 0.5s ease; }
.gm-feed-emoji { font-size: 2.5rem; display: block; }
.gm-feed-name { font-size: 0.65rem; font-weight: 700; color: var(--text-light); }
.gm-feed-hearts { display: flex; justify-content: center; gap: 0.3rem; margin: 0.3rem 0; }
.gm-heart { font-size: 1.2rem; transition: transform 0.3s; }
.gm-heart-full { animation: heartPop 0.4s ease; }
.gm-feed-label { font-size: 0.7rem; font-weight: 700; color: var(--purple); }

@keyframes feedHappy { 0% { transform: scale(1); } 50% { transform: scale(1.15) rotate(5deg); } 100% { transform: scale(1); } }
@keyframes heartPop { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ============ BUILD MODE ============ */
.gm-build { text-align: center; padding: 0.5rem; }
.gm-build-project { margin-bottom: 0.3rem; }
.gm-build-emoji { font-size: 2.2rem; display: inline-block; transition: transform 0.3s; }
.gm-build-emoji.gm-build-done { animation: buildComplete 0.8s ease; }
.gm-build-name { display: block; font-size: 0.65rem; font-weight: 700; color: var(--text-light); }
.gm-build-bar { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; margin: 0.3rem 0; }
.gm-build-fill { height: 100%; background: linear-gradient(90deg, var(--gold), #f59e0b); border-radius: 5px; transition: width 0.5s ease; }
.gm-build-blocks { display: flex; justify-content: center; gap: 0.2rem; margin: 0.2rem 0; }
.gm-block { font-size: 1rem; transition: all 0.3s; opacity: 0.3; }
.gm-block-placed { opacity: 1; animation: blockPlace 0.4s ease; }
.gm-build-label { font-size: 0.7rem; font-weight: 700; color: var(--gold); }

@keyframes buildComplete { 0% { transform: scale(1); } 30% { transform: scale(1.3) rotate(-5deg); } 60% { transform: scale(1.2) rotate(5deg); } 100% { transform: scale(1); } }
@keyframes blockPlace { 0% { transform: translateY(-10px) scale(0); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

/* ============ POWER MODE ============ */
.gm-power { text-align: center; padding: 0.5rem; }
.gm-power-orb { width: 60px; height: 60px; margin: 0 auto 0.3rem; border-radius: 50%; background: linear-gradient(135deg, #1e1b4b, #4c1d95); display: flex; align-items: center; justify-content: center; border: 3px solid #7c3aed; box-shadow: 0 0 15px rgba(124,58,237,0.3); transition: all 0.3s; }
.gm-power-orb.gm-power-full { background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: var(--gold); box-shadow: 0 0 25px rgba(245,158,11,0.5); animation: powerGlow 1s ease infinite; }
.gm-power-icon { font-size: 1.5rem; }
.gm-power-bar { height: 10px; background: #1e1b4b; border-radius: 5px; overflow: hidden; margin: 0.3rem auto; max-width: 200px; border: 1px solid #4c1d95; }
.gm-power-fill { height: 100%; background: linear-gradient(90deg, #7c3aed, #a78bfa, #c4b5fd); border-radius: 5px; transition: width 0.5s ease; box-shadow: 0 0 8px rgba(124,58,237,0.5); }
.gm-power-label { font-size: 0.75rem; font-weight: 700; color: var(--purple); }

@keyframes powerGlow { 0%,100% { box-shadow: 0 0 15px rgba(245,158,11,0.4); } 50% { box-shadow: 0 0 30px rgba(245,158,11,0.7); } }

/* ============ AI MESSAGE ============ */
.gm-ai-message {
  text-align: center; padding: 0.4rem 0.8rem; margin-top: 0.3rem;
  font-size: 0.85rem; font-weight: 700; border-radius: 10px;
  animation: aiPop 0.3s ease;
  display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.gm-ai-correct { color: var(--green); background: #ecfdf5; }
.gm-ai-wrong { color: var(--gold); background: #fef9e7; }
.gm-ai-streak { color: var(--purple); background: #f5f0ff; font-size: 1rem; }

@keyframes aiPop { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ============ ENHANCED OPTIONS ============ */
.option-btn { position: relative; overflow: hidden; }
.option-btn::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  background: rgba(124,58,237,0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}
.option-btn:active::after { width: 200px; height: 200px; }

.option-btn.correct::before {
  content: '⚡';
  position: absolute; top: -10px; right: -5px;
  font-size: 1.2rem;
  animation: sparkle 0.5s ease forwards;
}
@keyframes sparkle { 0% { opacity: 0; transform: scale(0); } 50% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(0) translateY(-10px); } }

/* ============ PASSAGE DISPLAY (Reading Comprehension) ============ */
.passage-display {
  background: linear-gradient(135deg, #fef9e7, #fdf6e3);
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  position: relative;
  line-height: 1.7;
  font-size: 1rem;
  color: var(--text);
}
.passage-display::before {
  content: '📖';
  position: absolute;
  top: -12px;
  left: 12px;
  font-size: 1.3rem;
  background: var(--card);
  padding: 0 0.3rem;
  border-radius: 50%;
}
.passage-display p {
  margin-bottom: 0.4rem;
}
.passage-display p:last-child {
  margin-bottom: 0;
}

/* ============ WORD ORDERING (Drag & Arrange Tiles) ============ */
.word-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.8rem;
  min-height: 60px;
}
.word-tile {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  touch-action: manipulation;
  min-width: 60px;
  text-align: center;
}
.word-tile:active {
  transform: scale(0.93);
}
.word-tile.selected {
  background: linear-gradient(135deg, var(--purple), #6d28d9);
  color: #fff;
  border-color: #6d28d9;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.word-tile.placed {
  opacity: 0.4;
  pointer-events: none;
}
.word-tile.correct {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-color: var(--green);
  color: var(--green);
}
.word-tile.incorrect {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: var(--red);
  color: var(--red);
  animation: tileShake 0.4s ease;
}

@keyframes tileShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Drop zone for ordered tiles */
.word-drop-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  min-height: 52px;
  padding: 0.6rem;
  margin-bottom: 0.8rem;
  background: #f3f4f6;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.word-drop-zone.active {
  border-color: var(--purple);
  background: #f5f3ff;
}
.word-drop-zone .word-tile {
  background: linear-gradient(135deg, var(--purple), #6d28d9);
  color: #fff;
  border-color: #6d28d9;
  cursor: pointer;
}

/* ============ MATCHING PAIRS (Two-Column Layout) ============ */
.match-container {
  display: flex;
  gap: 0.8rem;
  padding: 0.5rem;
  align-items: stretch;
}
.match-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.match-column-left {
  align-items: flex-end;
}
.match-column-right {
  align-items: flex-start;
}
.match-item {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  user-select: none;
  touch-action: manipulation;
  min-width: 80px;
}
.match-item:active {
  transform: scale(0.95);
}
.match-item.match-selected {
  border-color: var(--purple);
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.2);
  transform: scale(1.03);
}
.match-item.match-paired {
  border-color: var(--green);
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: var(--green);
  pointer-events: none;
}
.match-item.match-error {
  border-color: var(--red);
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  color: var(--red);
  animation: tileShake 0.4s ease;
}

/* Connection indicator between columns */
.match-connector {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 24px;
}
.match-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
}
.match-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
  transform: scale(1.3);
}

/* ============ FILL-IN-THE-BLANK ============ */
.fill-blank-sentence {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
  text-align: center;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}
.fill-blank-word {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid var(--purple);
  padding: 0.1rem 0.4rem;
  margin: 0 0.2rem;
  font-weight: 700;
  color: var(--purple);
  text-align: center;
  transition: all 0.2s ease;
  border-radius: 4px 4px 0 0;
  background: #f5f3ff;
}
.fill-blank-word.filled {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-bottom-color: var(--purple);
}
.fill-blank-word.correct {
  border-bottom-color: var(--green);
  color: var(--green);
  background: #ecfdf5;
}
.fill-blank-word.incorrect {
  border-bottom-color: var(--red);
  color: var(--red);
  background: #fef2f2;
}

/* Fill-blank options */
.fill-blank-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem;
}
.fill-blank-option {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #166534;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
}
.fill-blank-option:active {
  transform: scale(0.93);
}
.fill-blank-option.selected {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  border-color: #059669;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
}
.fill-blank-option.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============ TRUE/FALSE BUTTONS ============ */
.true-false-buttons {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  padding: 0.8rem;
}
.tf-btn {
  flex: 1;
  max-width: 160px;
  padding: 1rem 1.2rem;
  border: 3px solid var(--border);
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
  background: var(--card);
  color: var(--text);
}
.tf-btn:active {
  transform: scale(0.93);
}
.tf-btn-true {
  border-color: var(--green);
  color: var(--green);
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}
.tf-btn-true:active,
.tf-btn-true.selected {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff;
  border-color: #059669;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.tf-btn-false {
  border-color: var(--red);
  color: var(--red);
  background: linear-gradient(135deg, #fef2f2, #fff1f2);
}
.tf-btn-false:active,
.tf-btn-false.selected {
  background: linear-gradient(135deg, var(--red), #dc2626);
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.tf-btn .tf-icon {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
}
.tf-btn.correct {
  background: linear-gradient(135deg, var(--green), #059669) !important;
  color: #fff !important;
  border-color: var(--green) !important;
  animation: tfCorrect 0.5s ease;
}
.tf-btn.incorrect {
  background: linear-gradient(135deg, var(--red), #dc2626) !important;
  color: #fff !important;
  border-color: var(--red) !important;
  animation: tileShake 0.4s ease;
}

@keyframes tfCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ============ MOBILE RESPONSIVE - NEW QUESTION TYPES ============ */
@media (max-width: 400px) {
  .passage-display {
    padding: 0.8rem;
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .word-tile {
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    min-width: 50px;
  }

  .word-tiles {
    gap: 0.4rem;
    padding: 0.5rem;
  }

  .match-container {
    gap: 0.4rem;
    padding: 0.3rem;
  }

  .match-item {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    min-width: 65px;
  }

  .match-connector {
    width: 16px;
  }

  .fill-blank-sentence {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
  }

  .fill-blank-word {
    min-width: 60px;
  }

  .fill-blank-option {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }

  .true-false-buttons {
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .tf-btn {
    padding: 0.8rem 0.8rem;
    font-size: 0.9rem;
    border-radius: 14px;
  }

  .tf-btn .tf-icon {
    font-size: 1.5rem;
  }
}

/* Tablet-friendly larger targets for younger children */
@media (min-width: 401px) and (max-width: 768px) {
  .word-tile {
    padding: 0.7rem 1.1rem;
    font-size: 1.05rem;
  }

  .tf-btn {
    padding: 1.2rem 1.5rem;
    font-size: 1.1rem;
    max-width: 180px;
  }

  .tf-btn .tf-icon {
    font-size: 2rem;
  }

  .match-item {
    padding: 0.7rem 1rem;
    font-size: 1rem;
  }

  .fill-blank-option {
    padding: 0.6rem 1.1rem;
    font-size: 1rem;
  }
}
