/* ========================================================
   MathCore Academy — Master Stylesheet
   Modern, Vibrant, Gamified UI for Class 4 / Year 4
   ======================================================== */

:root {
  --font-heading: 'Fredoka', cursive, sans-serif;
  --font-body: 'Nunito', sans-serif;

  /* Color Palette */
  --bg-deep: #090c1a;
  --bg-space: #0f142b;
  --bg-card: rgba(22, 29, 61, 0.85);
  --bg-card-hover: rgba(31, 41, 88, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.08);

  --accent-cyan: #00f0ff;
  --accent-gold: #ffbe0b;
  --accent-orange: #fb5607;
  --accent-magenta: #ff007f;
  --accent-purple: #8338ec;
  --accent-green: #06d6a0;
  --accent-blue: #3a86ff;

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(0, 240, 255, 0.35);
  --shadow-glow-cyan: 0 0 20px rgba(0, 240, 255, 0.3);
  --shadow-glow-gold: 0 0 20px rgba(255, 190, 11, 0.35);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);

  --text-main: #ffffff;
  --text-muted: #a0aec0;
  --text-highlight: #ffeaa7;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(131, 56, 236, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(15, 20, 43, 0.95) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Background Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

/* ----------------------------------------------------
   TOP NAVIGATION BAR
   ---------------------------------------------------- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(15, 20, 43, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition-fast);
}

.nav-brand:hover {
  transform: translateY(-2px);
}

.brand-mascot-orb {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 2px solid var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.nav-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #00f0ff, #ffbe0b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

.nav-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.curriculum-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: rgba(131, 56, 236, 0.25);
  border: 1px solid rgba(131, 56, 236, 0.5);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  color: #d8b4fe;
  letter-spacing: 0.5px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
  font-weight: 800;
}

.star-pill {
  border-color: rgba(255, 190, 11, 0.4);
  background: rgba(255, 190, 11, 0.12);
  color: var(--accent-gold);
}

.level-pill {
  gap: 0.75rem;
  border-color: rgba(0, 240, 255, 0.3);
}

.level-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.level-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.xp-bar-bg {
  width: 90px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #06d6a0);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.icon-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.btn-highlight {
  background: linear-gradient(135deg, #8338ec, #3a86ff);
  border: none;
  color: #fff;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(131, 56, 236, 0.4);
  transition: all var(--transition-fast);
}

.btn-highlight:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 20px rgba(131, 56, 236, 0.6);
}

/* ----------------------------------------------------
   MAIN LAYOUT & VIEWS
   ---------------------------------------------------- */
.main-content {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------
   VIEW 1: HERO & WORLDS MAP
   ---------------------------------------------------- */
.hero-banner-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 2rem;
  background: linear-gradient(135deg, rgba(22, 29, 61, 0.9), rgba(15, 20, 43, 0.95));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-card), var(--shadow-glow-cyan);
  overflow: hidden;
  position: relative;
}

.hero-banner-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid rgba(255, 190, 11, 0.4);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.8rem;
  letter-spacing: 0.5px;
}

.hero-heading {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, #ffffff, #d8e2fd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero-desc strong {
  color: #ff007f;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-banner-art {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-subtle);
  position: relative;
  aspect-ratio: 16/9;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hero-banner-card:hover .hero-img {
  transform: scale(1.03);
}

/* Button Styles */
.btn-primary-large {
  background: linear-gradient(135deg, #00f0ff, #3a86ff);
  border: none;
  color: #050b1e;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4);
  transition: all var(--transition-bounce);
}

.btn-primary-large:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.6);
}

.btn-secondary-large {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary-large:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

/* Section Title */
.section-title-wrap {
  margin-bottom: 1.5rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Worlds Grid */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.world-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-bounce);
  box-shadow: var(--shadow-card);
}

.world-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.25);
}

.world-card.active-world {
  border-color: var(--accent-cyan);
  box-shadow: 0 8px 30px rgba(0, 240, 255, 0.25);
}

.world-card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.world-card-badge.beta {
  background: rgba(255, 190, 11, 0.2);
  color: var(--accent-gold);
  border-color: rgba(255, 190, 11, 0.4);
}

.world-card-badge.coming-soon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.15);
}

.world-icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.bg-world-1 { background: linear-gradient(135deg, rgba(0, 240, 255, 0.3), rgba(58, 134, 255, 0.3)); border: 1px solid var(--accent-cyan); }
.bg-world-2 { background: linear-gradient(135deg, rgba(255, 190, 11, 0.3), rgba(251, 86, 7, 0.3)); border: 1px solid var(--accent-gold); }
.bg-world-3 { background: linear-gradient(135deg, rgba(255, 0, 127, 0.3), rgba(131, 56, 236, 0.3)); border: 1px solid var(--accent-magenta); }
.bg-world-4 { background: linear-gradient(135deg, rgba(6, 214, 160, 0.3), rgba(0, 240, 255, 0.3)); border: 1px solid var(--accent-green); }
.bg-world-5 { background: linear-gradient(135deg, rgba(131, 56, 236, 0.3), rgba(58, 134, 255, 0.3)); border: 1px solid var(--accent-purple); }

.world-details {
  flex: 1;
}

.world-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.world-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.2rem 0 0.5rem;
}

.world-topics {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.world-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.world-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #ffbe0b);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.world-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.stars-earned {
  color: var(--accent-gold);
}

.btn-world-action {
  width: 100%;
  padding: 0.7rem;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(135deg, #00f0ff, #3a86ff);
  color: #060d24;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-world-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

.btn-world-action.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid var(--border-subtle);
}

.btn-world-action.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-world-action.disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.25);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ----------------------------------------------------
   VIEW 2: LEVEL SELECTOR ROADMAP (The Trail)
   ---------------------------------------------------- */
.trail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-back {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-back:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(-3px);
}

.trail-header-title {
  text-align: center;
}

.trail-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

.trail-heading {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
}

.trail-summary-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-stars {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-gold);
}

/* Roadmap Grid & Nodes */
.roadmap-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  position: relative;
}

.level-node-card {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-bounce);
  cursor: pointer;
}

.level-node-card:hover:not(.locked) {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--accent-cyan);
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.25);
}

.level-node-card.locked {
  opacity: 0.65;
  filter: grayscale(0.7);
  cursor: not-allowed;
}

.level-node-card.boss-card {
  border-color: rgba(255, 0, 127, 0.5);
  background: linear-gradient(135deg, rgba(35, 15, 55, 0.9), rgba(22, 10, 35, 0.95));
}

.level-node-card.boss-card:hover:not(.locked) {
  border-color: var(--accent-magenta);
  box-shadow: 0 12px 30px rgba(255, 0, 127, 0.4);
}

.node-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.node-number-badge {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.node-number-badge.boss {
  background: rgba(255, 0, 127, 0.2);
  color: #ff54a2;
  border-color: rgba(255, 0, 127, 0.4);
}

.node-stars-row {
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.node-star-filled {
  color: var(--accent-gold);
  text-shadow: 0 0 8px rgba(255, 190, 11, 0.6);
}

.node-star-empty {
  color: rgba(255, 255, 255, 0.2);
}

.node-content-wrap {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.node-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.node-info {
  flex: 1;
}

.node-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.node-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.node-action-btn {
  margin-top: auto;
  padding: 0.65rem;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(135deg, #00f0ff, #3a86ff);
  color: #04091a;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.node-action-btn:hover {
  transform: translateY(-2px);
}

.node-action-btn.boss {
  background: linear-gradient(135deg, #ff007f, #8338ec);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.4);
}

/* ----------------------------------------------------
   VIEW 3: ACTIVE MISSION SCREEN
   ---------------------------------------------------- */
.mission-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1.2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.mission-status-center {
  text-align: center;
}

.mission-level-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

.mission-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
}

.mission-steps-dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.3rem;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  transform: scale(1.3);
}

.step-dot.completed {
  background: var(--accent-green);
}

.mission-top-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mission-score-pill {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-highlight);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.mission-hearts {
  font-size: 1.2rem;
  letter-spacing: 2px;
}

/* Mascot Dialogue Box */
.mascot-dialogue-box {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(22, 29, 61, 0.95), rgba(15, 20, 43, 0.95));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.6rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.mascot-avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.mascot-talk-img {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
  animation: mascotBob 3s ease-in-out infinite;
}

@keyframes mascotBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.mascot-name-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-gold);
  margin-top: 0.3rem;
}

.mascot-speech-bubble {
  flex: 1;
}

.speech-text {
  font-size: 1.15rem;
  line-height: 1.5;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.6rem;
}

.speech-controls {
  display: flex;
  gap: 0.8rem;
}

.speech-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition-fast);
}

.speech-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.speech-btn.hint-btn {
  background: rgba(255, 190, 11, 0.15);
  border-color: rgba(255, 190, 11, 0.4);
  color: var(--accent-gold);
}

.speech-btn.hint-btn:hover {
  background: rgba(255, 190, 11, 0.25);
}

/* ----------------------------------------------------
   MISSION WORKSPACE & GAME MECHANICS
   ---------------------------------------------------- */
.mission-workspace {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  box-shadow: var(--shadow-card);
}

/* --- STEP 1: CONCEPT LAB (Manipulatives) --- */
.lab-container {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.lab-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
  padding: 1rem 1.4rem;
  border-radius: var(--radius-md);
}

.lab-target-number {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 2px;
}

/* Base-10 Manipulatives Grid */
.base10-blocks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

.block-column {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all var(--transition-fast);
}

.block-column:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.3);
}

.block-col-header {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.3rem;
  text-align: center;
}

.block-col-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* 3D Visual Block Icons */
.block-visual-box {
  height: 90px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.b10-thousands-cube {
  width: 65px;
  height: 65px;
  background: linear-gradient(135deg, #8338ec, #3a86ff);
  border: 2px solid #00f0ff;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  transform: perspective(300px) rotateX(12deg) rotateY(-12deg);
}

.b10-hundreds-flat {
  width: 65px;
  height: 65px;
  background: linear-gradient(135deg, #06d6a0, #00f0ff);
  border: 2px solid #fff;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  gap: 2px;
}

.flat-tile {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.b10-tens-rod {
  width: 20px;
  height: 70px;
  background: linear-gradient(180deg, #ffbe0b, #fb5607);
  border: 2px solid #fff;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 2px 0;
}

.rod-notch {
  height: 2px;
  background: rgba(0, 0, 0, 0.3);
}

.b10-ones-unit {
  width: 26px;
  height: 26px;
  background: #ff007f;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.6);
}

.block-counter-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-counter {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-counter:hover {
  background: var(--accent-cyan);
  color: #000;
  transform: scale(1.1);
}

.counter-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.lab-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.sum-formula {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--accent-gold);
}

/* --- STEP 2: GAME ARENA (Vault Code Breaker / Rocket / Laser) --- */
.arena-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  text-align: center;
}

.challenge-question-card {
  background: rgba(0, 240, 255, 0.08);
  border: 2px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1.8rem 2.5rem;
  max-width: 750px;
  width: 100%;
}

.question-text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.question-target-display {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: #fff;
}

.target-highlight {
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.8);
  text-decoration: underline;
  text-decoration-color: var(--accent-gold);
}

.answers-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  width: 100%;
  max-width: 800px;
}

.answer-card-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.4rem 1rem;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-bounce);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.answer-card-btn:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 25px rgba(0, 240, 255, 0.3);
}

.answer-card-btn.correct {
  background: rgba(6, 214, 160, 0.25);
  border-color: var(--accent-green);
  color: #a7f3d0;
  box-shadow: 0 0 20px rgba(6, 214, 160, 0.5);
  animation: pulseCorrect 0.6s ease;
}

.answer-card-btn.wrong {
  background: rgba(255, 0, 127, 0.2);
  border-color: var(--accent-magenta);
  color: #fca5a5;
  animation: shakeWrong 0.5s ease;
}

@keyframes pulseCorrect {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* --- STEP 3: THE BOSS BATTLE ARENA (Level 6) --- */
.boss-battle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}

.boss-stage-arena {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 1.5rem 2rem;
  background: radial-gradient(circle, rgba(131, 56, 236, 0.2) 0%, rgba(15, 20, 43, 0.8) 100%);
  border: 2px solid rgba(255, 0, 127, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 35px rgba(255, 0, 127, 0.25);
}

.boss-character-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.boss-avatar-img {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-full);
  border: 4px solid var(--accent-magenta);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.6);
  animation: bossFloat 3.5s ease-in-out infinite;
}

@keyframes bossFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

.boss-name {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: #ff54a2;
  margin-top: 0.6rem;
}

.boss-health-bar-bg {
  width: 160px;
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.3rem;
}

.boss-health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff007f, #fb5607);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.versus-lightning {
  font-size: 2.5rem;
  animation: zap 1s infinite alternate;
}

@keyframes zap {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px #ffbe0b); }
  100% { transform: scale(1.2); filter: drop-shadow(0 0 15px #00f0ff); }
}

.cadet-battle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cadet-blaster-img {
  width: 110px;
  height: 110px;
  border-radius: var(--radius-full);
  border: 4px solid var(--accent-cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
}

.cadet-battle-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 0.6rem;
}

/* Ion Laser Beam animation across the arena */
.laser-beam-fx {
  position: absolute;
  top: 50%;
  right: 25%;
  height: 8px;
  background: linear-gradient(90deg, #00f0ff, #fff);
  box-shadow: 0 0 20px #00f0ff, 0 0 40px #fff;
  border-radius: var(--radius-full);
  animation: laserShoot 0.4s forwards ease-in-out;
}

@keyframes laserShoot {
  0% { width: 0; left: 35%; opacity: 1; }
  50% { width: 40%; left: 35%; opacity: 1; }
  100% { width: 0; left: 75%; opacity: 0; }
}

/* Screen shake for boss hit */
.shake-screen {
  animation: screenShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* ----------------------------------------------------
   MODALS: VICTORY & TROPHY ROOM
   ---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 9, 23, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem 1rem 3rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  margin: 1.5rem auto 3rem;
  background: linear-gradient(135deg, rgba(22, 29, 61, 0.98), rgba(15, 20, 43, 0.98));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.6rem 2rem;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7), var(--shadow-glow-cyan);
  animation: modalPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-sizing: border-box;
  position: relative;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* Victory Modal Details */
.victory-card {
  text-align: center;
}

.victory-tag {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-gold);
  letter-spacing: 1px;
}

.victory-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  margin: 0.3rem 0 1.2rem;
}

.stars-awarded-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.star-award {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.2);
  transition: all 0.4s var(--transition-bounce);
}

.star-award.awarded {
  color: var(--accent-gold);
  text-shadow: 0 0 25px rgba(255, 190, 11, 0.8);
  transform: scale(1.25);
  animation: starBounce 0.5s ease;
}

@keyframes starBounce {
  0% { transform: scale(0.5); }
  60% { transform: scale(1.4); }
  100% { transform: scale(1.25); }
}

.victory-score-summary {
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.8rem;
}

.summary-metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.metric-val {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Mystery Chest Interactive Box */
.chest-box-area {
  background: radial-gradient(circle, rgba(255, 190, 11, 0.15) 0%, rgba(0, 0, 0, 0.2) 100%);
  border: 1px dashed rgba(255, 190, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.8rem;
}

.chest-instruction {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 0.8rem;
}

.mystery-chest-interactive {
  width: 90px;
  height: 80px;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.mystery-chest-interactive:hover {
  transform: scale(1.1);
}

.mystery-chest-interactive.shake {
  animation: chestShake 0.6s ease infinite;
}

@keyframes chestShake {
  0%, 100% { transform: rotate(0deg) scale(1.1); }
  25% { transform: rotate(-8deg) scale(1.12); }
  75% { transform: rotate(8deg) scale(1.12); }
}

.chest-lid {
  width: 90px;
  height: 35px;
  background: linear-gradient(135deg, #ffbe0b, #fb5607);
  border-radius: 12px 12px 4px 4px;
  border: 3px solid #ffeaa7;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.chest-body {
  width: 90px;
  height: 45px;
  background: linear-gradient(135deg, #d97706, #92400e);
  border-radius: 4px 4px 12px 12px;
  border: 3px solid #ffeaa7;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chest-lock {
  font-size: 1.2rem;
}

.chest-loot-reveal {
  margin-top: 1rem;
  animation: fadeIn 0.4s ease;
}

.chest-loot-reveal.hidden {
  display: none;
}

.loot-item {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.btn-text-only {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.4rem;
}

.btn-text-only:hover {
  color: #fff;
}

/* --- TROPHY & SANCTUARY MODAL --- */
.trophy-card {
  max-width: 820px;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.tabs-nav {
  display: flex;
  gap: 0.6rem;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(255, 0, 127, 0.3);
  border-color: var(--accent-magenta);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.tab-intro {
  margin-bottom: 1.2rem;
}

.tab-intro h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.tab-intro p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Badges Grid */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.2rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.badge-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all var(--transition-fast);
}

.badge-card.unlocked {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.15);
}

.badge-card.locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.badge-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
}

.badge-card.unlocked .badge-icon-wrap {
  background: linear-gradient(135deg, rgba(255, 190, 11, 0.3), rgba(251, 86, 7, 0.3));
  border-color: var(--accent-gold);
}

.badge-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.badge-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Pet Sanctuary Layout */
.pet-sanctuary-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.pet-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.pet-avatar-stage {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 1rem;
}

.sanctuary-pet-img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 4px solid var(--accent-cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
  animation: petWag 2.5s ease-in-out infinite;
}

@keyframes petWag {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.pet-hat-overlay {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.2rem;
  pointer-events: none;
}

.pet-display-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.pet-mood {
  font-size: 0.85rem;
  color: var(--text-highlight);
  margin-bottom: 1rem;
}

.pet-interact-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.btn-pet-action {
  padding: 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pet-action:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--accent-cyan);
}

.pet-wardrobe h4 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.wardrobe-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.wardrobe-items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.wardrobe-item-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.wardrobe-item-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-cyan);
}

.wardrobe-item-card.equipped {
  border-color: var(--accent-gold);
  background: rgba(255, 190, 11, 0.15);
}

.wardrobe-icon {
  font-size: 1.5rem;
}

.wardrobe-info {
  display: flex;
  flex-direction: column;
}

.wardrobe-item-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.wardrobe-item-status {
  font-size: 0.72rem;
  color: var(--accent-gold);
}

/* Syllabus Accordion */
.curriculum-accordion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  max-height: 380px;
  overflow-y: auto;
}

.curriculum-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.curriculum-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.curr-status {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.curr-status.complete {
  background: rgba(6, 214, 160, 0.2);
  color: var(--accent-green);
}

.curr-status.upcoming {
  background: rgba(255, 190, 11, 0.2);
  color: var(--accent-gold);
}

.curr-list {
  padding-left: 1.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Guide Modal Steps */
.guide-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin: 1.5rem 0 2rem;
}

.guide-step {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.guide-step-icon {
  font-size: 2rem;
  margin-bottom: 0.6rem;
}

.guide-step h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
}

.guide-step p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.guide-action {
  text-align: center;
}

/* ----------------------------------------------------
   WORLD SWITCHER TABS & MULTIPLICATION ARRAY LAB
   ---------------------------------------------------- */
.world-switch-bar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.world-tab-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.world-tab-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  transform: translateY(-2px);
}

.world-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(255, 190, 11, 0.25));
  border-color: var(--accent-gold);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 190, 11, 0.35);
}

/* Multiplication Array Grid Lab */
.array-lab-container {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  align-items: center;
}

.array-controls-card {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem 2rem;
  width: 100%;
  max-width: 650px;
  flex-wrap: wrap;
}

.array-ctrl-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.array-ctrl-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.array-matrix-stage {
  background: radial-gradient(circle, rgba(255, 190, 11, 0.1) 0%, rgba(15, 20, 43, 0.8) 100%);
  border: 2px solid rgba(255, 190, 11, 0.4);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 0 30px rgba(255, 190, 11, 0.2);
}

.array-grid-display {
  display: grid;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.2rem;
}

.neon-orb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: radial-gradient(circle at 35% 35%, #fff 0%, #ffbe0b 60%, #fb5607 100%);
  box-shadow: 0 0 12px rgba(255, 190, 11, 0.8), inset 0 0 4px #fff;
  transition: transform 0.2s ease;
  animation: orbGlow 2s infinite alternate;
}

.neon-orb:hover {
  transform: scale(1.25);
}

@keyframes orbGlow {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.08); filter: brightness(1.2); }
}

.array-equation-banner {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 15px rgba(255, 190, 11, 0.6);
}

.array-repeated-add {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-top: 0.3rem;
}

/* ----------------------------------------------------
   MULTI-SUBJECT SWITCHER BAR
   ---------------------------------------------------- */
.subject-switcher-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  background: rgba(15, 20, 43, 0.7);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.subject-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.6rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.subject-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.subject-tab-btn.active.tab-maths {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25) 0%, rgba(131, 56, 236, 0.3) 100%);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.subject-tab-btn.active.tab-science {
  background: linear-gradient(135deg, rgba(6, 214, 160, 0.25) 0%, rgba(0, 240, 255, 0.25) 100%);
  border-color: var(--accent-green);
  color: #fff;
  box-shadow: 0 0 20px rgba(6, 214, 160, 0.4);
}

.subject-count-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* ----------------------------------------------------
   SCIENCE LAB INTERACTIVE TOYS (State-Shifter & Magnet)
   ---------------------------------------------------- */
.science-lab-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 750px;
  background: rgba(15, 20, 43, 0.85);
  border: 2px solid rgba(6, 214, 160, 0.35);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5), 0 0 30px rgba(6, 214, 160, 0.15);
}

.science-meter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.science-temp-display {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.science-state-badge {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}
.state-solid { background: rgba(0, 240, 255, 0.25); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }
.state-liquid { background: rgba(58, 134, 255, 0.25); color: #70a6ff; border: 1px solid #3a86ff; }
.state-gas { background: rgba(251, 86, 7, 0.25); color: var(--accent-orange); border: 1px solid var(--accent-orange); }

.beaker-chamber {
  position: relative;
  width: 240px;
  height: 240px;
  border: 4px solid rgba(255, 255, 255, 0.6);
  border-top: none;
  border-radius: 0 0 20px 20px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.molecules-canvas-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.molecule-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #00f0ff 60%, #0077b6 100%);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  transition: all 0.5s ease;
}

.burner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.burner-flame {
  font-size: 2.2rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.burner-flame.flame-hot {
  animation: flicker 0.3s infinite alternate;
  filter: drop-shadow(0 0 10px #fb5607);
}
.burner-flame.flame-cold {
  opacity: 0.3;
  filter: drop-shadow(0 0 5px #00f0ff);
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.15) rotate(2deg); }
}

.science-controls-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Magnet Lab */
.magnet-pair-arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 2.5rem;
  width: 100%;
  background: radial-gradient(circle, rgba(6, 214, 160, 0.08) 0%, rgba(15, 20, 43, 0.95) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  position: relative;
  min-height: 200px;
}

.bar-magnet {
  display: flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid #fff;
  user-select: none;
}
.bar-magnet:hover {
  transform: scale(1.05);
}

.pole-north {
  background: linear-gradient(135deg, #ff0055, #c70039);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  padding: 1.2rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
}

.pole-south {
  background: linear-gradient(135deg, #0077b6, #023e8a);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.3rem;
  padding: 1.2rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
}

.magnet-force-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  min-width: 140px;
  text-align: center;
}
.force-attract {
  color: var(--accent-green);
  text-shadow: 0 0 15px rgba(6, 214, 160, 0.8);
}
.force-repel {
  color: var(--accent-magenta);
  text-shadow: 0 0 15px rgba(255, 0, 127, 0.8);
}

/* ----------------------------------------------------
   CADET AUTHENTICATION & PROFILE
   ---------------------------------------------------- */
.profile-pill {
  cursor: pointer;
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.4);
  transition: all var(--transition-fast);
}
.profile-pill:hover {
  background: rgba(0, 240, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}
.profile-pill.needs-auth {
  background: rgba(255, 190, 11, 0.2);
  border-color: rgba(255, 190, 11, 0.8);
  animation: pulseAuthRing 2s infinite ease-in-out;
}
@keyframes pulseAuthRing {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 190, 11, 0.4);
    border-color: rgba(255, 190, 11, 0.7);
  }
  50% {
    box-shadow: 0 0 18px rgba(255, 190, 11, 0.9);
    border-color: rgba(255, 255, 255, 0.9);
  }
}
.profile-avatar {
  font-size: 1.2rem;
}
.profile-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.btn-ladder {
  background: linear-gradient(135deg, #ffbe0b, #fb5607) !important;
  color: #000 !important;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 190, 11, 0.4);
}
.btn-ladder:hover {
  box-shadow: 0 6px 20px rgba(255, 190, 11, 0.6);
  transform: translateY(-2px) scale(1.03);
}

.auth-card {
  max-width: 460px;
  padding: 1.4rem 1.6rem;
}
.auth-form-wrap {
  display: none;
  animation: fadeIn 0.25s ease;
}
.auth-form-wrap.active {
  display: block;
}

.auth-intro {
  text-align: center;
  margin-bottom: 0.9rem;
}
.auth-intro h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 0.2rem;
}
.auth-intro p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 0.85rem;
  text-align: left;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.3rem;
}
.form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(15, 20, 43, 0.9);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
.form-select {
  cursor: pointer;
}
.form-select option {
  background: #0f142b;
  color: #fff;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 0.3rem;
}
.avatar-pick-btn {
  font-size: 1.8rem;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.avatar-pick-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.avatar-pick-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.2);
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.auth-submit-btn {
  width: 100%;
  margin-top: 0.8rem;
}

.auth-alert {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
}
.auth-alert.error {
  background: rgba(255, 0, 127, 0.2);
  border: 1px solid var(--accent-magenta);
  color: #fca5a5;
}
.auth-alert.success {
  background: rgba(6, 214, 160, 0.2);
  border: 1px solid var(--accent-green);
  color: #a7f3d0;
}
.auth-alert.warning {
  background: rgba(255, 190, 11, 0.2);
  border: 1px solid rgba(255, 190, 11, 0.7);
  color: #fef08a;
}
.auth-alert.info {
  background: rgba(0, 240, 255, 0.2);
  border: 1px solid rgba(0, 240, 255, 0.6);
  color: #a5f3fc;
}

.auth-mandatory-notice {
  background: rgba(255, 190, 11, 0.15);
  border: 1px solid rgba(255, 190, 11, 0.5);
  color: #ffbe0b;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  margin-bottom: 0.9rem;
  box-shadow: 0 0 10px rgba(255, 190, 11, 0.2);
}

.auth-switch-link {
  text-align: center;
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.auth-switch-link .btn-text-only {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: 0.88rem;
  transition: color var(--transition-fast);
}
.auth-switch-link .btn-text-only:hover {
  color: #fff;
}

/* Logged-In Profile Card View */
.profile-card-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0;
}
.profile-card-avatar {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.5));
}
.profile-card-name {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: #fff;
}
.profile-card-age {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 1.2rem;
}
.profile-metrics-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}
.prof-metric {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.8rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.prof-val {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-gold);
}
.prof-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* ----------------------------------------------------
   SCORE LADDERBOARD & ACTIVITY JOURNAL
   ---------------------------------------------------- */
.ladder-card {
  max-width: 800px;
}

.leader-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1.2rem;
  margin: 1.5rem 0 2rem;
}
.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
}
.podium-col.rank-1 {
  order: 2;
  width: 140px;
}
.podium-col.rank-2 {
  order: 1;
}
.podium-col.rank-3 {
  order: 3;
}
.podium-avatar {
  font-size: 2.6rem;
  margin-bottom: 0.3rem;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
}
.podium-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.podium-score {
  font-size: 0.82rem;
  color: var(--accent-gold);
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.podium-block {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.podium-block.rank-1 {
  height: 125px;
  background: linear-gradient(180deg, rgba(255, 190, 11, 0.4), rgba(251, 86, 7, 0.25));
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 25px rgba(255, 190, 11, 0.4);
}
.podium-block.rank-2 {
  height: 95px;
  background: linear-gradient(180deg, rgba(160, 174, 192, 0.35), rgba(15, 20, 43, 0.5));
  border: 2px solid #cbd5e1;
}
.podium-block.rank-3 {
  height: 75px;
  background: linear-gradient(180deg, rgba(205, 127, 50, 0.35), rgba(15, 20, 43, 0.5));
  border: 2px solid #cd7f32;
}

.ladder-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: rgba(15, 20, 43, 0.85);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  max-height: 380px;
  overflow-y: auto;
}
.ladder-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.ladder-table th {
  position: sticky;
  top: 0;
  background: #0f142b;
  z-index: 2;
  padding: 0.85rem 1rem;
  color: var(--accent-cyan);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  border-bottom: 2px solid var(--border-subtle);
}
.ladder-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ladder-table tr.user-row-active {
  background: rgba(0, 240, 255, 0.15);
  border-left: 3px solid var(--accent-cyan);
}
.ladder-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}
.rank-badge {
  font-weight: 800;
  font-size: 1.1rem;
}

/* Activity Journal Timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.4rem;
}
.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  background: rgba(15, 20, 43, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast);
}
.activity-item:hover {
  transform: translateX(4px);
  border-color: var(--border-glow);
}
.act-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.act-subject-tag {
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
}
.act-subject-maths {
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}
.act-subject-science {
  background: rgba(6, 214, 160, 0.2);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}
.act-title {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}
.act-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.act-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.act-score {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 1rem;
}
.act-stars {
  font-size: 0.95rem;
}

/* ----------------------------------------------------
   COMPREHENSIVE RESPONSIVE DESIGN & MOBILE ENHANCEMENTS
   ---------------------------------------------------- */

/* --- TABLET BREAKPOINT (max-width: 950px) --- */
@media (max-width: 950px) {
  .hero-banner-card {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.5rem;
    padding: 1.8rem;
  }
  .hero-banner-art {
    order: -1;
    max-width: 280px;
    margin: 0 auto;
  }
  .hero-buttons {
    justify-content: center;
  }
  .base10-blocks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pet-sanctuary-wrap {
    grid-template-columns: 1fr;
  }
  .worlds-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* --- STANDARD TABLET & MOBILE PHONES (max-width: 768px) --- */
@media (max-width: 768px) {
  /* Top Nav: 2-Tier Clean Balanced Layout */
  .top-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem 0.5rem;
    gap: 0.4rem 0.5rem;
  }
  .curriculum-tag, 
  .stat-pill.level-pill, 
  .brand-sub {
    display: none !important;
  }
  .nav-brand {
    flex: 0 0 auto;
    gap: 0.45rem;
  }
  .brand-mascot-orb {
    width: 36px;
    height: 36px;
  }
  .brand-title {
    font-size: 1.18rem;
    letter-spacing: 0.5px;
  }

  .nav-stats {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  /* Row 1 Stats & Profile */
  .stat-pill.star-pill {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    gap: 0.3rem;
  }
  .profile-pill {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    max-width: 140px;
    gap: 0.35rem;
  }
  .profile-avatar {
    font-size: 1.05rem;
  }
  .profile-name {
    font-size: 0.82rem;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Row 2: Full-width dedicated action bar across the bottom of nav */
  .nav-actions {
    width: 100%;
    flex-basis: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-actions .btn-highlight {
    flex: 1 1 0;
    min-width: 0;
    height: 38px;
    padding: 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: center;
    justify-content: center;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .nav-actions .icon-btn {
    flex: 0 0 34px;
    width: 34px;
    height: 38px;
    padding: 0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
  }

  /* Main Viewport & Typography */
  .main-content {
    padding: 0.85rem 0.75rem 2.5rem;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  .section-title {
    font-size: 1.4rem;
  }
  .section-subtitle {
    font-size: 0.85rem;
  }

  /* Multi-Subject Switcher Mobile */
  .subject-switcher-wrap {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1.2rem;
    padding: 0.35rem;
    gap: 0.4rem;
    display: flex;
  }
  .subject-tab-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    font-size: 0.88rem;
    justify-content: center;
    border-radius: var(--radius-full);
  }
  .subject-count-badge {
    display: none;
  }

  /* Hero Card Mobile */
  .hero-banner-card {
    padding: 1.4rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
  }
  .hero-heading {
    font-size: 1.45rem;
    line-height: 1.25;
  }
  .hero-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.2rem;
  }
  .hero-buttons {
    flex-direction: column;
    width: 100%;
    gap: 0.6rem;
  }
  .hero-buttons button {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.98rem;
  }

  /* Worlds Grid Mobile */
  .worlds-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .world-card {
    padding: 1.3rem 1rem;
    border-radius: var(--radius-md);
  }
  .world-title {
    font-size: 1.25rem;
  }
  .world-topics {
    font-size: 0.86rem;
    line-height: 1.4;
  }
  .btn-world-action {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  /* Level Selector Trail Header & Centered Stars Pill */
  .trail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
  }
  .trail-header .btn-back {
    align-self: flex-start;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
  }
  .trail-header-title {
    text-align: center;
    width: 100%;
  }
  .trail-tag {
    font-size: 0.72rem;
    display: block;
    margin-bottom: 0.2rem;
  }
  .trail-heading {
    font-size: 1.35rem;
    line-height: 1.25;
  }
  .trail-summary-card {
    width: auto;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    background: rgba(255, 190, 11, 0.12);
    border: 1px solid rgba(255, 190, 11, 0.35);
    border-radius: var(--radius-full);
    margin: 0.2rem auto 0;
  }
  .summary-label {
    font-size: 0.78rem;
  }
  .summary-stars {
    font-size: 0.95rem;
  }

  /* Touch-Friendly World Switcher Carousel Bar (Strict single row, horizontal scroll) */
  .world-switch-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.5rem;
    padding: 0.3rem 0.1rem 0.7rem;
    margin-bottom: 1.2rem;
    width: 100%;
  }
  .world-switch-bar::-webkit-scrollbar {
    display: none;
  }
  .world-tab-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    padding: 0.55rem 0.95rem;
    font-size: 0.85rem;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: var(--radius-full);
  }

  /* Level Cards Mobile: Strict 1-Column full width */
  .roadmap-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.9rem !important;
    width: 100% !important;
    padding: 0 !important;
  }
  .level-node-card {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 1.1rem 1rem !important;
    border-radius: var(--radius-md);
    margin: 0 !important;
  }
  .node-title {
    font-size: 1.05rem;
  }
  .node-desc {
    font-size: 0.85rem;
  }
  .node-action-btn {
    width: 100% !important;
    min-height: 46px;
    font-size: 0.95rem;
  }

  /* Mission Screen Top Bar Mobile */
  .mission-top-bar {
    padding: 0.65rem 0.8rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.5rem;
  }
  .mission-top-bar .btn-back {
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
  }
  .mission-status-center {
    grid-column: 1 / -1;
    order: 3;
    margin-top: 0.2rem;
  }
  .mission-title {
    font-size: 1.15rem;
  }
  .mission-top-right {
    gap: 0.5rem;
  }
  .mission-score-pill {
    font-size: 0.82rem;
    padding: 0.3rem 0.65rem;
  }
  .mission-hearts {
    font-size: 1.05rem;
    letter-spacing: 1px;
  }

  /* Mascot Bubble Mobile */
  .mascot-dialogue-box {
    padding: 1rem 0.9rem;
    gap: 0.8rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
  }
  .mascot-talk-img {
    width: 52px;
    height: 52px;
  }
  .speech-text {
    font-size: 0.95rem;
    line-height: 1.45;
  }
  .speech-controls {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }
  .speech-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.4rem;
    font-size: 0.8rem;
    min-height: 40px;
  }

  /* Mission Workspace Canvas */
  .mission-workspace {
    padding: 1.2rem 0.8rem;
    min-height: 360px;
    border-radius: var(--radius-md);
  }

  /* Question & Quiz Cards */
  .challenge-question-card {
    padding: 1.2rem 0.85rem;
  }
  .question-text {
    font-size: 1.15rem;
  }
  .question-target-display {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    padding: 0.6rem;
  }
  .answers-options-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .answer-card-btn {
    min-height: 52px;
    font-size: 1.05rem;
    padding: 0.8rem 1rem;
  }

  /* Manipulatives Mobile */
  .base10-blocks-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .block-column {
    padding: 0.85rem 0.6rem;
  }
  .block-col-header {
    font-size: 0.72rem;
  }
  .block-counter-controls {
    gap: 0.35rem;
  }
  .btn-counter {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }
  .counter-value {
    min-width: 32px;
    font-size: 1.2rem;
  }
  .lab-summary-row {
    flex-direction: column;
    gap: 0.8rem;
  }
  .sum-formula {
    font-size: 0.95rem;
    text-align: center;
    word-break: break-all;
  }
  #btn-submit-lab {
    width: 100%;
    min-height: 48px;
  }

  /* Multi-Array Stage Mobile */
  .array-controls-card {
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 0.8rem;
  }
  .array-matrix-stage {
    padding: 1.2rem 0.5rem;
    min-height: 180px;
  }
  .array-grid-display {
    gap: 5px;
  }
  .neon-orb {
    width: clamp(18px, 6vw, 28px);
    height: clamp(18px, 6vw, 28px);
  }
  .array-equation-banner {
    font-size: 1.25rem;
  }
  .array-repeated-add {
    font-size: 0.85rem;
  }
  #btn-submit-array {
    width: 100%;
    min-height: 48px;
  }

  /* Science State-Shifter Mobile */
  .science-lab-stage {
    padding: 1.2rem 0.8rem;
    gap: 1.2rem;
  }
  .science-meter-row {
    padding: 0.6rem 0.85rem;
  }
  .science-temp-display {
    font-size: 1.25rem;
  }
  .science-state-badge {
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
  }
  .beaker-chamber {
    width: min(210px, 65vw);
    height: min(210px, 65vw);
  }
  .science-controls-row {
    flex-direction: column;
    width: 100%;
    gap: 0.6rem;
  }
  .science-controls-row button,
  #btn-complete-shift {
    width: 100%;
    min-height: 48px;
  }

  /* Science Magnet Lab Mobile */
  .magnet-pair-arena {
    flex-direction: column;
    gap: 1.2rem;
    padding: 1.4rem 0.8rem;
    min-height: auto;
  }
  .bar-magnet {
    width: 100%;
    max-width: 250px;
  }
  .pole-north, .pole-south {
    min-width: 60px;
    padding: 0.9rem 1.2rem;
    font-size: 1.15rem;
  }
  .magnet-force-field {
    font-size: 1.15rem;
  }
  #btn-submit-magnet {
    width: 100%;
    min-height: 48px;
  }

  /* Boss Arena Mobile */
  .boss-stage-arena {
    padding: 1rem 0.5rem;
    gap: 0.5rem;
  }
  .cadet-blaster-img, 
  .boss-avatar-img {
    width: 65px;
    height: 65px;
    border-width: 3px;
  }
  .versus-lightning {
    font-size: 1.35rem;
  }
  .boss-name, 
  .cadet-battle-name {
    font-size: 0.82rem;
  }
  .boss-health-bar-bg {
    width: 95px;
    height: 8px;
  }

  /* Modals Mobile Optimization */
  .modal-overlay {
    padding: 0.65rem;
  }
  .modal-card {
    padding: 1.25rem 0.9rem;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }
  .victory-actions {
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
  }
  .victory-actions button {
    width: 100%;
    min-height: 48px;
  }
  .victory-score-summary {
    gap: 0.4rem;
  }
  .summary-metric {
    padding: 0.6rem 0.4rem;
  }
  .metric-val {
    font-size: 1.15rem;
  }

  /* Trophy & Syllabus Modal Mobile */
  .tabs-nav {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.35rem;
    margin-bottom: 1rem;
    width: 100%;
  }
  .tabs-nav::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex-shrink: 0;
    padding: 0.5rem 0.8rem;
    font-size: 0.84rem;
    white-space: nowrap;
  }
  .badges-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.6rem;
  }
  .badge-card {
    padding: 0.8rem 0.5rem;
  }
  .badge-icon-wrap {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }
  .badge-name {
    font-size: 0.88rem;
  }
  .badge-desc {
    font-size: 0.72rem;
  }

  /* Pet Sanctuary Mobile */
  .sanctuary-pet-img {
    width: 120px;
    height: 120px;
  }
  .pet-interact-buttons {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  .btn-pet-action {
    width: 100%;
    min-height: 44px;
  }
  /* Leaderboard & Podium Mobile */
  .leader-podium {
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
  }
  .podium-col {
    width: 95px;
  }
  .podium-col.rank-1 {
    width: 110px;
  }
  .podium-avatar {
    font-size: 2.1rem;
  }
  .podium-name {
    font-size: 0.85rem;
  }
  .podium-score {
    font-size: 0.75rem;
  }
  .podium-block.rank-1 {
    height: 95px;
    font-size: 1.15rem;
  }
  .podium-block.rank-2 {
    height: 75px;
    font-size: 1rem;
  }
  .podium-block.rank-3 {
    height: 60px;
    font-size: 0.95rem;
  }
  .ladder-table th, 
  .ladder-table td {
    padding: 0.55rem 0.5rem;
    font-size: 0.82rem;
  }

  /* Activity Journal Mobile */
  .activity-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.75rem 0.8rem;
  }
  .act-right {
    align-self: flex-end;
  }

  .wardrobe-items {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* --- EXTRA-SMALL SCREENS (max-width: 380px) --- */
@media (max-width: 380px) {
  .top-nav {
    padding: 0.4rem 0.5rem 0.45rem;
    gap: 0.35rem;
  }
  .brand-title {
    font-size: 1.05rem;
  }
  .profile-pill {
    padding: 0.3rem 0.5rem;
    max-width: 110px;
  }
  .profile-name {
    max-width: 65px;
    font-size: 0.75rem;
  }
  .nav-actions {
    gap: 0.25rem;
  }
  .nav-actions .btn-highlight {
    padding: 0 0.2rem;
    font-size: 0.72rem;
    height: 34px;
    gap: 0.2rem;
  }
  .nav-actions .icon-btn {
    flex: 0 0 30px;
    width: 30px;
    height: 34px;
    font-size: 0.85rem;
  }
  .base10-blocks-grid {
    grid-template-columns: 1fr;
  }
  .subject-tab-btn {
    font-size: 0.82rem;
    padding: 0.55rem 0.4rem;
  }
  .cadet-blaster-img, 
  .boss-avatar-img {
    width: 55px;
    height: 55px;
  }
}


