* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; -webkit-user-select: none; }
body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #090B1A 0%, #111633 50%, #060814 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  color: #F8FAFC;
  overflow-x: hidden;
  overflow-y: auto;
}

.science-container {
  background: rgba(17, 22, 51, 0.96);
  border-radius: 26px;
  padding: clamp(10px, 1.8vw, 24px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(56, 189, 248, 0.2);
  border: 1.5px solid #0284C7;
  max-width: 1200px;
  width: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(16px);
  position: relative;
}

/* Header */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0284C7, #0369A1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4);
  color: #FFF;
}
.brand-icon-box svg { width: 24px; height: 24px; fill: currentColor; }

h1 {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.3rem, 2vw, 1.85rem);
  font-weight: 800;
  color: #38BDF8;
  text-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
  line-height: 1.1;
}

/* Top Mode Switcher Bar */
.mode-nav {
  display: flex;
  gap: 8px;
  background: #0B0E24;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid #1E293B;
}

.btn-mode {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-family: 'Baloo 2', cursive;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-mode svg { width: 16px; height: 16px; fill: currentColor; }
.btn-mode.active {
  background: #0284C7;
  color: #FFF;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

/* Topic Selector Tabs */
.topic-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  width: 100%;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.topic-tab-btn {
  background: #0F1538;
  border: 1px solid #1E293B;
  border-radius: 50px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #CBD5E1;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
}
.topic-tab-btn svg { width: 14px; height: 14px; fill: currentColor; }
.topic-tab-btn.active {
  background: #38BDF8;
  border-color: #7DD3FC;
  color: #0F172A;
}

/* Score HUD */
.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #0A0D21;
  border: 1px solid #1E293B;
  border-radius: 14px;
  padding: 6px 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 800;
}
.stat-item { display: flex; align-items: center; gap: 5px; }

/* ─── QUIZ MODE LAYOUT ─── */
.quiz-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-box {
  background: #0E1333;
  border: 2px solid #0284C7;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.q-topic-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #0284C7;
  color: #FFF;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 2px 12px;
  border-radius: 50px;
  border: 1px solid #38BDF8;
}

.q-text {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  font-weight: 800;
  color: #FFF;
  line-height: 1.35;
  margin-top: 4px;
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .answers-grid { grid-template-columns: 1fr; }
}

.btn-answer {
  background: #141B45;
  border: 2px solid #23306B;
  border-radius: 16px;
  padding: 14px;
  color: #FFF;
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.18s ease;
}
.btn-answer:hover {
  background: #1E2866;
  border-color: #38BDF8;
  transform: translateY(-2px);
}
.btn-answer.correct {
  background: #065F46 !important;
  border-color: #34D399 !important;
  color: #FFF !important;
}
.btn-answer.wrong {
  background: #881337 !important;
  border-color: #F87171 !important;
  color: #FFF !important;
}

/* Science Explainer Box */
.explainer-box {
  display: none;
  background: #0C1E38;
  border: 1.5px solid #0EA5E9;
  border-radius: 16px;
  padding: 14px 18px;
  text-align: left;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.explainer-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.1rem;
  font-weight: 800;
  color: #38BDF8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.explainer-text {
  font-size: 0.92rem;
  color: #E0F2FE;
  line-height: 1.55;
}

.btn-next-q {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFF;
  border: none;
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 10px 28px;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 10px;
  align-self: center;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4);
  transition: all 0.2s;
}
.btn-next-q:hover {
  transform: scale(1.04);
}

/* ─── LAB SIMULATIONS LAYOUT ─── */
.lab-view {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 12px;
}

.lab-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (max-width: 750px) {
  .lab-selector-grid { grid-template-columns: repeat(2, 1fr); }
}

.lab-card-btn {
  background: #0E1333;
  border: 1.5px solid #1E293B;
  border-radius: 14px;
  padding: 10px 8px;
  color: #CBD5E1;
  font-family: 'Baloo 2', cursive;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.lab-card-btn:hover, .lab-card-btn.active {
  background: #172554;
  border-color: #38BDF8;
  color: #FFF;
  transform: translateY(-2px);
}
.lab-card-btn svg { width: 26px; height: 26px; fill: currentColor; }

.lab-stage-card {
  background: #090C21;
  border: 2px solid #0284C7;
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

canvas#labCanvas {
  background: #020617;
  border-radius: 14px;
  border: 1.5px solid #1E293B;
  width: 100%;
  height: auto;
  max-height: 380px;
}

/* Lab Controls Bar */
.lab-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #0F172A;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 8px 14px;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 800;
}
.lab-slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.lab-slider-group input[type=range] {
  flex: 1;
  accent-color: #0284C7;
  cursor: pointer;
}

.btn-lab-action {
  background: #0284C7;
  border: none;
  color: #FFF;
  font-family: 'Baloo 2', cursive;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 5px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-lab-action:hover {
  background: #0369A1;
  transform: scale(1.05);
}
