:root {
  --eco-forest: #064e3b;
  --eco-green: #10b981;
  --eco-lime: #84cc16;
  --eco-amber: #f59e0b;
  --eco-orange: #ea580c;
  --eco-blue: #0284c7;
  --eco-cyan: #06b6d4;
  --eco-sand: #fef3c7;
  --eco-dark: #0f172a;
  --eco-card-bg: rgba(255, 255, 255, 0.95);
  --shadow-chunky: 0 10px 0 rgba(15, 23, 42, 0.12), 0 20px 30px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 15% 15%, #ecfdf5 0%, #e0f2fe 50%, #fef3c7 100%);
  color: var(--eco-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header */
.app-header {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid rgba(16, 185, 129, 0.2);
  position: sticky;
  top: 0;
  z-index: 50;
}

.home-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 2.5px solid #059669;
  color: #059669;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 4px 0 #059669;
  transition: transform 0.1s, box-shadow 0.1s;
}

.home-nav-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #059669;
}

.title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-badge .logo-icon {
  font-size: 28px;
}

.title-badge h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--eco-forest);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-toggle-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b45309;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s;
}

.mode-toggle-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b45309;
}

.voice-toggle {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* Main Container */
.game-container {
  max-width: 1080px;
  width: 100%;
  margin: 20px auto 40px;
  padding: 0 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Category Navigation Tabs */
.realm-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.realm-tab {
  background: #ffffff;
  border: 3px solid #cbd5e1;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 5px 0 #94a3b8;
  transition: all 0.15s ease;
  font-family: inherit;
  color: var(--eco-dark);
}

.realm-tab:hover {
  border-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #059669;
}

.realm-tab.active {
  background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
  border-color: #059669;
  box-shadow: 0 5px 0 #047857;
  transform: translateY(1px);
}

.realm-tab.active .tab-label {
  color: #059669;
}

.realm-tab.active .tab-badge {
  background: #059669;
  color: #ffffff;
}

.realm-tab .tab-emoji {
  font-size: 26px;
}

.realm-tab .tab-label {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  text-align: center;
}

.realm-tab .tab-badge {
  font-size: 11px;
  font-weight: 800;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Mode Switch Bar (Explorer Encyclopedia vs Wild Quiz Challenge) */
.view-modes-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 10px 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.mode-switches {
  display: flex;
  gap: 8px;
}

.mode-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 800;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.mode-btn.active {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 3px 0 #047857;
}

.quiz-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: #d97706;
  background: #fef3c7;
  border: 1.5px solid #f59e0b;
  padding: 4px 14px;
  border-radius: 999px;
}

/* Creature Cards Grid (Encyclopedia View) */
.creature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
}

.creature-card {
  background: var(--eco-card-bg);
  border: 3.5px solid #e2e8f0;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-chunky);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  cursor: pointer;
}

.creature-card:hover {
  transform: translateY(-6px);
  border-color: #10b981;
  box-shadow: 0 16px 0 rgba(16, 185, 129, 0.25), 0 25px 35px rgba(0, 0, 0, 0.1);
}

.creature-card.playing-now {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px #fef08a, 0 16px 0 rgba(245, 158, 11, 0.35);
  transform: translateY(-4px);
}

.card-top-banner {
  height: 170px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.tap-hear-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.78);
  color: #fef08a;
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(254, 240, 138, 0.4);
  font-size: 11px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.04em;
}

.card-actions-bar {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn-creature-speak {
  flex: 1;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 12px 16px;
  border-radius: 18px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #064e3b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s, background 0.15s;
}

.btn-creature-speak:hover {
  background: linear-gradient(135deg, #10b981, #059669);
}

.btn-creature-speak:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #064e3b;
}

.btn-creature-roar {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  color: #b45309;
  padding: 12px 14px;
  border-radius: 18px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d97706;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s;
}

.btn-creature-roar:hover {
  background: #fde68a;
}

.btn-creature-roar:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d97706;
}

.dino-banner {
  background: radial-gradient(circle at 50% 30%, #fef3c7 0%, #fed7aa 60%, #fdba74 100%);
}

.shark-banner {
  background: radial-gradient(circle at 50% 30%, #e0f2fe 0%, #7dd3fc 60%, #0284c7 100%);
}

.cat-banner {
  background: radial-gradient(circle at 50% 30%, #fef08a 0%, #fde047 60%, #ea580c 100%);
}

.savanna-banner {
  background: radial-gradient(circle at 50% 30%, #fef3c7 0%, #fde68a 60%, #d97706 100%);
}

.creature-huge-emoji {
  font-size: 84px;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.creature-card:hover .creature-huge-emoji {
  transform: scale(1.15) rotate(4deg);
}

.sound-roaring-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #cbd5e1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 3px 0 #94a3b8;
  backdrop-filter: blur(8px);
  transition: all 0.1s ease;
}

.sound-roaring-btn:hover {
  transform: scale(1.1);
  border-color: #059669;
  background: #ecfdf5;
}

.sound-roaring-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #94a3b8;
}

.creature-diet-tag {
  position: absolute;
  bottom: 12px;
  left: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.tag-carnivore {
  background: #ef4444;
}

.tag-herbivore {
  background: #10b981;
}

.tag-apex {
  background: #0284c7;
}

.card-details {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.creature-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--eco-dark);
}

.creature-era {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.creature-nickname {
  font-size: 13px;
  font-weight: 800;
  color: #d97706;
  margin-bottom: 12px;
}

.creature-stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  background: #f8fafc;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.08em;
}

.stat-val {
  font-size: 13px;
  font-weight: 900;
  color: var(--eco-dark);
}

.creature-fact-box {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #78350f;
  font-weight: 600;
  margin-bottom: 16px;
  flex: 1;
}

.btn-creature-speak {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 0 #064e3b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s;
}

.btn-creature-speak:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #064e3b;
}

/* Interactive Quiz Challenge Mode */
.quiz-stage {
  display: none; /* Shown in Quiz Mode */
  background: var(--eco-card-bg);
  border: 4px solid #10b981;
  border-radius: 32px;
  padding: 32px;
  box-shadow: var(--shadow-chunky);
}

.quiz-hero-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.quiz-avatar-box {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: #fef3c7;
  border: 4px solid #f59e0b;
  display: grid;
  place-items: center;
  font-size: 68px;
  flex-shrink: 0;
  box-shadow: 0 6px 0 #d97706;
}

.quiz-question-meta .quiz-category-tag {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #f59e0b;
  text-transform: uppercase;
}

.quiz-question-meta h2 {
  font-size: 26px;
  font-weight: 900;
  color: var(--eco-dark);
  line-height: 1.25;
  margin: 6px 0 8px;
}

.quiz-question-meta p {
  font-size: 16px;
  color: #475569;
  font-weight: 600;
  line-height: 1.5;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.quiz-option-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.quiz-option-card {
  background: #ffffff;
  border: 3.5px solid #e2e8f0;
  border-radius: 22px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1;
  transition: all 0.12s ease;
  flex: 1;
  text-align: left;
}

.quiz-option-card:hover {
  border-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #059669;
}

.quiz-option-card:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #059669;
}

.quiz-option-card.correct {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 6px 0 #047857;
}

.quiz-option-card.incorrect {
  border-color: #ef4444;
  background: #fff1f2;
  box-shadow: 0 6px 0 #b91c1c;
}

.quiz-option-icon {
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #f8fafc;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.quiz-option-text b {
  font-size: 17px;
  font-weight: 900;
  display: block;
  color: var(--eco-dark);
}

.quiz-option-text small {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.quiz-feedback-box {
  display: none;
  background: #ecfdf5;
  border: 3px solid #10b981;
  border-radius: 24px;
  padding: 20px 24px;
  box-shadow: 0 6px 0 #059669;
}

.quiz-feedback-box.show {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popIn 0.25s ease;
}

.btn-next-question {
  align-self: flex-start;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 5px 0 #064e3b;
}

.btn-next-question:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #064e3b;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
  .realm-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .creature-grid {
    grid-template-columns: 1fr;
  }
  .quiz-hero-row {
    flex-direction: column;
    text-align: center;
  }
  .app-header {
    padding: 0 14px;
  }
  .title-badge h1 {
    font-size: 16px;
  }
}
