/* ==========================================================================
   GREEN SCHOOL COUNTING LAB — STYLESHEET REVISION
   Typography, Responsive Layout, Cute High School Atmosphere,
   Character Companion & Speech Bubble Polish
   ========================================================================== */

:root {
  /* Color Palette - Fresh School Vibes */
  --baby-blue: #E0F2FE;
  --baby-blue-light: #F0F9FF;
  --sky-blue: #38BDF8;
  --sky-blue-hover: #0EA5E9;
  --deep-sky: #0284C7;
  --soft-navy: #1E3A8A;
  --soft-navy-light: #3B82F6;
  --soft-navy-dark: #0F172A;
  --green-school: #10B981;
  --green-light: #D1FAE5;
  --green-dark: #047857;
  --pastel-yellow: #FEF08A;
  --pastel-orange: #FED7AA;
  --pastel-pink: #FCE7F3;
  --pastel-purple: #EDE9FE;
  --white: #FFFFFF;

  /* High Contrast Text Colors */
  --text-main: #1E293B;       /* Slate 800 */
  --text-heading: #0F172A;    /* Slate 900 */
  --text-muted: #475569;      /* Slate 600 */
  --text-light: #64748B;      /* Slate 500 */
  --border-light: #E2E8F0;
  --border-sky: #BAE6FD;

  /* Strict Clean Font Stack (No decorative font for content) */
  --font-main: 'Poppins', 'Nunito', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-math: 'Cambria Math', 'KaTeX_Math', 'Times New Roman', serif;

  /* Typography Scale */
  --text-title: clamp(1.75rem, 3.5vw, 2.2rem);  /* 28px - 35px */
  --text-subtitle: clamp(1.25rem, 2.2vw, 1.45rem); /* 20px - 24px */
  --text-body: 1.0rem;                          /* 16px */
  --text-caption: 0.875rem;                     /* 14px */
  --text-xs: 0.75rem;                           /* 12px */

  /* Radius & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(30, 58, 138, 0.08);
  --shadow-lg: 0 16px 36px rgba(30, 58, 138, 0.12);
  --shadow-float: 0 14px 32px rgba(14, 165, 233, 0.18);

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

/* Base Reset & Overflow Guard */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  max-width: 100%;
}

body {
  font-family: var(--font-main);
  background-color: #F1F7FD;
  color: var(--text-main);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Typography Foundation */
p {
  margin-bottom: 12px;
  line-height: 1.65;
  color: var(--text-main);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

ul, ol {
  margin-left: 24px;
  margin-bottom: 14px;
}

li {
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--text-main);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-family: var(--font-main);
  font-weight: 800;
  line-height: 1.3;
}

strong, b {
  font-weight: 700;
  color: var(--text-heading);
}

/* Background Atmosphere Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    radial-gradient(#CBD5E1 1.2px, transparent 1.2px),
    radial-gradient(#93C5FD 1.2px, transparent 1.2px);
  background-size: 36px 36px;
  background-position: 0 0, 18px 18px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Confetti Fullscreen Canvas */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 99999;
}

/* App Shell Container */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */
.sidebar {
  width: 290px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-right: 2px solid #D6E8FA;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1000;
  box-shadow: 4px 0 24px rgba(30, 58, 138, 0.05);
  transition: transform var(--transition-smooth);
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 2px dashed #E2E8F0;
  background: linear-gradient(180deg, #F0F9FF 0%, #FFFFFF 100%);
}

.school-crest {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  padding: 5px 12px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #065F46;
  margin-bottom: 8px;
}

.sidebar-brand-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--soft-navy);
  line-height: 1.25;
}

.sidebar-class-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sky-blue-hover);
  margin-top: 3px;
}

/* Student Profile Card */
.sidebar-profile-card {
  margin: 12px 16px 6px;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.profile-avatar-box {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFF;
  border: 2px solid var(--sky-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.25);
  cursor: pointer;
  transition: transform var(--transition-bounce);
}

.profile-avatar-box:hover {
  transform: scale(1.1) rotate(6deg);
}

.profile-details {
  flex: 1;
  overflow: hidden;
}

.profile-name {
  font-weight: 800;
  color: var(--soft-navy);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Sidebar Progress Tracker */
.sidebar-progress-box {
  margin: 6px 16px 10px;
  background: #F8FAFC;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid #E2E8F0;
}

.progress-header-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--soft-navy);
  margin-bottom: 6px;
}

.progress-track-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--sky-blue) 0%, var(--green-school) 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Sidebar Nav Scroll */
.sidebar-nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-category-label {
  font-size: 0.68rem;
  font-weight: 900;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 8px 3px;
}

.nav-station-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-station-btn:hover {
  background: #F0F9FF;
  color: var(--deep-sky);
  transform: translateX(3px);
}

.nav-station-btn.active {
  background: #E0F2FE;
  color: var(--soft-navy);
  border-color: #BAE6FD;
  font-weight: 800;
}

.nav-station-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: var(--sky-blue);
  border-radius: 0 4px 4px 0;
}

.nav-station-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-check-badge {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--green-school);
  font-weight: 800;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--transition-bounce);
}

.nav-station-btn.completed .nav-check-badge {
  opacity: 1;
  transform: scale(1);
}

.sidebar-footer-tools {
  padding: 12px 16px;
  border-top: 2px dashed #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFCFF;
}

/* ==========================================================================
   MAIN WRAPPER & TOP BAR
   ========================================================================== */
.main-wrapper {
  flex: 1;
  margin-left: 290px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0; /* Critical for flex shrinking without overflow */
  max-width: 100%;
  position: relative;
}

.top-school-bar {
  height: 68px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid #D6E8FA;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 12px rgba(30, 58, 138, 0.03);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-trigger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--soft-navy);
  cursor: pointer;
  padding: 6px;
}

.top-journey-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-light);
}

.top-journey-trail .current-room {
  color: var(--soft-navy);
  font-weight: 800;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.school-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 800;
  background: #FFF;
  border: 1px solid #CBD5E1;
  color: var(--soft-navy);
  box-shadow: var(--shadow-sm);
}

.school-tag.eco {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

/* ==========================================================================
   PAGE VIEWS & ENVIRONMENT SCENERY LAYOUTS
   ========================================================================== */
.page-view {
  display: none;
  padding: 28px 32px 70px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  animation: pageEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

/* ==========================================================================
   KARTU BIRU MUDA (HEADER CARD), SPEECH BUBBLE & CHARACTER
   ========================================================================== */
.env-header-card {
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 26px;
  position: relative;
  box-shadow: var(--shadow-md);
  border: 2px solid #BAE6FD;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 50%, #7DD3FC 100%);
}

.env-classroom {
  background: linear-gradient(135deg, #FEFCE8 0%, #FEF9C3 60%, #FDE047 100%);
  border-color: #FACC15;
}

.env-math-corner {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 60%, #BFDBFE 100%);
  border-color: #60A5FA;
}

.env-virtual-lab {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 60%, #A7F3D0 100%);
  border-color: #34D399;
}

.env-library {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 60%, #FDE68A 100%);
  border-color: #FBBF24;
}

.env-journal {
  background: linear-gradient(135deg, #FAF5FF 0%, #F3E8FF 60%, #E9D5FF 100%);
  border-color: #C084FC;
}

.env-text-content {
  flex: 1;
  min-width: 0;
}

.env-room-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--soft-navy);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.env-title {
  font-size: var(--text-title);
  font-weight: 900;
  color: var(--soft-navy);
  line-height: 1.25;
  margin-bottom: 8px;
  word-wrap: break-word;
}

.env-subtitle {
  font-size: var(--text-body);
  color: var(--text-main);
  max-width: 720px;
  font-weight: 600;
  line-height: 1.6;
}

/* Character Companion & Speech Bubble */
.character-companion-box {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 280px;
  width: 100%;
}

.character-bubble {
  background: #FFFFFF;
  border: 2px solid #BAE6FD;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--soft-navy);
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.08);
  margin-bottom: 8px;
  position: relative;
  width: fit-content;
  max-width: 270px;
  text-align: center;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: floatBubble 3s ease-in-out infinite;
}

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

.character-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px 8px 0;
  border-style: solid;
  border-color: #FFFFFF transparent;
  display: block;
  width: 0;
}

.student-character-svg {
  width: 95px;
  height: 95px;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.15));
  transition: transform var(--transition-bounce);
  user-select: none;
}

.student-character-svg:hover {
  transform: scale(1.08) rotate(3deg);
}

/* ==========================================================================
   CARDS & CONTAINERS (PREVENT OVERFLOW)
   ========================================================================== */
.card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  width: 100%;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-sky);
}

.card-title {
  font-size: var(--text-subtitle);
  font-weight: 800;
  color: var(--soft-navy);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  line-height: 1.35;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--sky-blue) 0%, var(--deep-sky) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--sky-blue-hover) 0%, #1976D2 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(33, 150, 243, 0.4);
}

.btn-secondary {
  background: var(--white);
  color: var(--soft-navy);
  border: 2px solid #CBD5E1;
}

.btn-secondary:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-sm {
  padding: 6px 14px;
  min-height: 36px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  min-height: 48px;
  font-size: 1.05rem;
}

/* Page Navigation Controls */
.page-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 2px dashed #CBD5E1;
  flex-wrap: wrap;
  gap: 12px;
}

/* Member Pill */
.member-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  transition: all var(--transition-fast);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sky-blue) 0%, var(--deep-sky) 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.member-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.92rem;
}

/* ==========================================================================
   SCHOOL JOURNEY MAP (INTERACTIVE EXPLORATION HUB)
   ========================================================================== */
.school-map-card {
  background: #FFF;
  border: 2px solid #D6E8FA;
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.map-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.map-grid-interactive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  width: 100%;
}

.map-building-door {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-bounce);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.map-building-door:hover {
  transform: translateY(-5px);
  border-color: var(--sky-blue);
  box-shadow: var(--shadow-float);
  background: #FFF;
}

.map-door-icon {
  font-size: 2.6rem;
  margin-bottom: 8px;
}

.map-door-title {
  font-weight: 800;
  color: var(--soft-navy);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.map-door-desc {
  font-size: var(--text-caption);
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.45;
}

.map-door-tag {
  font-size: var(--text-xs);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  background: #EFF6FF;
  color: var(--deep-sky);
  border: 1px solid #BAE6FD;
}

/* ==========================================================================
   HANDBOOK (PAGE 2)
   ========================================================================== */
.handbook-wrapper {
  background: #FFF;
  border: 3px solid #CBD5E1;
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  position: relative;
  box-shadow: var(--shadow-md);
  width: 100%;
}

.instruction-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}

.instruction-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #F8FAFC;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  transition: all var(--transition-fast);
}

.instruction-item:hover {
  background: #F0F9FF;
  border-color: #BAE6FD;
}

.instruction-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft-navy);
  color: var(--white);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.instruction-text {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-main);
  padding-top: 2px;
  line-height: 1.6;
}

/* Sticky Note Component */
.sticky-note {
  background: #FEF9C3;
  border: 1px solid #FDE047;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  position: relative;
  box-shadow: 2px 4px 12px rgba(234, 179, 8, 0.12);
  line-height: 1.6;
}

.sticky-note.blue {
  background: #E0F2FE;
  border-color: #7DD3FC;
  box-shadow: 2px 4px 12px rgba(56, 189, 248, 0.12);
}

.sticky-note.pink {
  background: #FCE7F3;
  border-color: #F472B6;
}

.sticky-note.green {
  background: #DCFCE7;
  border-color: #86EFAC;
}

.pin-icon {
  position: absolute;
  top: -10px;
  left: 18px;
  font-size: 1.2rem;
}

/* ==========================================================================
   MATERIALS (PAGE 3)
   ========================================================================== */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
  width: 100%;
}

.concept-card {
  background: var(--white);
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  width: 100%;
}

.concept-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-float);
  border-color: var(--sky-blue);
}

.concept-card-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 14px;
  margin-bottom: 10px;
  width: fit-content;
}

.concept-card.rule-add .concept-card-badge { background: #FEF3C7; color: #B45309; }
.concept-card.rule-mult .concept-card-badge { background: #E0F2FE; color: #0369A1; }
.concept-card.rule-perm .concept-card-badge { background: #FCE7F3; color: #BE185D; }
.concept-card.rule-comb .concept-card-badge { background: #DCFCE7; color: #15803D; }

.concept-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--soft-navy);
  margin-bottom: 8px;
}

.concept-card-rep {
  font-family: var(--font-math);
  background: #F8FAFC;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--deep-sky);
  margin: 10px 0;
  border: 1px solid #E2E8F0;
}

.concept-card-desc {
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
  flex: 1;
}

.concept-card-example {
  background: #F1F5F9;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 14px;
  line-height: 1.5;
}

/* Tables Responsive Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  border-radius: var(--radius-md);
  border: 2px solid #E2E8F0;
}

.school-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
}

.school-table th {
  background: #F1F5F9;
  color: var(--soft-navy);
  font-weight: 800;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid #CBD5E1;
  font-size: 0.9rem;
}

.school-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.9rem;
  background: var(--white);
}

.school-table tr:nth-child(even) td { background: #F8FAFC; }
.school-table tr:last-child td { border-bottom: none; }

/* ==========================================================================
   INTERACTIVE QUESTION & REVEAL SYSTEM (6-STEP)
   ========================================================================== */
.interactive-qa-unit {
  background: #FFF;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.qa-unit-header {
  padding: 16px 22px;
  background: #F8FAFC;
  border-bottom: 2px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.qa-step-indicator {
  font-size: var(--text-xs);
  font-weight: 800;
  background: #EFF6FF;
  color: var(--deep-sky);
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #BFDBFE;
}

.qa-question-box {
  padding: 22px 24px;
  background: #FFF;
  width: 100%;
}

.qa-question-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--soft-navy);
  line-height: 1.6;
  margin-bottom: 16px;
  word-wrap: break-word;
}

.think-first-trigger {
  background: #F0F9FF;
  border: 2px dashed #7DD3FC;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.qa-interaction-zone {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin: 16px 0;
  width: 100%;
}

.choice-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.choice-option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #FFF;
  border: 2px solid #CBD5E1;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all var(--transition-fast);
  line-height: 1.45;
  text-align: left;
}

.choice-option-label:hover {
  border-color: var(--sky-blue);
  background: #F0F9FF;
  transform: translateX(3px);
}

.choice-option-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--deep-sky);
  flex-shrink: 0;
}

.essay-text-field {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #CBD5E1;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  background: #FFF;
  min-height: 85px;
  resize: vertical;
  margin-top: 8px;
  line-height: 1.5;
}

.essay-text-field:focus {
  border-color: var(--sky-blue);
  outline: none;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

.qa-feedback-banner {
  display: none;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  animation: bounceIn 0.35s var(--transition-bounce) forwards;
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.qa-feedback-banner.correct {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ECFDF5;
  border: 2px solid #86EFAC;
  color: #065F46;
}

.qa-feedback-banner.incorrect {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FEF2F2;
  border: 2px solid #FCA5A5;
  color: #991B1B;
}

.feedback-avatar {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.feedback-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.feedback-hint {
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Discussion Drawer */
.qa-discussion-drawer {
  display: none;
  background: #FFFDF0;
  border-top: 2px dashed #FCD34D;
  padding: 20px 24px;
  animation: slideDown 0.35s ease forwards;
}

.qa-discussion-drawer.revealed { display: block; }

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

.discussion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 900;
  color: #B45309;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.official-lkm-content {
  font-size: var(--text-body);
  color: #78350F;
  line-height: 1.7;
}

.official-formula-highlight {
  background: #FFF;
  border: 2px solid #FDE047;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: var(--font-math);
  font-size: 1.15rem;
  font-weight: 800;
  color: #92400E;
  margin: 10px 0;
}

/* ==========================================================================
   TREE DIAGRAM MASTER (3-LEVEL, 18 LEAVES, RESPONSIVE WRAPPER)
   ========================================================================== */
.tree-diagram-master {
  background: #FFF;
  border: 2px solid #BAE6FD;
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin: 22px 0;
  width: 100%;
  max-width: 100%;
}

.tree-master-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 2px dashed #E2E8F0;
  margin-bottom: 16px;
}

.tree-tool-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tree-viewport-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 8px;
  border-radius: var(--radius-md);
  background: radial-gradient(#E2E8F0 1.2px, #F8FAFC 1.2px);
  background-size: 20px 20px;
  width: 100%;
  max-width: 100%;
  position: relative;
  transition: transform 0.2s ease;
}

.tree-viewport-container.fullscreen-mode {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  border-radius: 0;
  padding: 30px;
  background: #FFF;
}

.tree-branch-system {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 720px; /* Safe scrollable min-width */
}

.branch-location-block {
  background: #FFF;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.branch-loc-header {
  padding: 12px 18px;
  background: #F0F9FF;
  border-bottom: 2px solid #E0F2FE;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.branch-loc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1rem;
  color: var(--soft-navy);
}

.branch-objects-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
}

.branch-object-card {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.branch-obj-title {
  font-weight: 800;
  color: var(--text-main);
  font-size: 0.85rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.branch-leaves-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branch-leaf-chip {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: #FFF;
  border: 1px solid #E2E8F0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.branch-leaf-chip:hover {
  border-color: var(--sky-blue);
  background: #EFF6FF;
  transform: translateX(2px);
}

.branch-leaf-chip.active-path {
  background: #ECFDF5;
  border-color: #10B981;
  color: #065F46;
  font-weight: 800;
}

/* ==========================================================================
   PERMUTATION PODIUM (LKM 2)
   ========================================================================== */
.perm-interactive-lab {
  background: #FFF;
  border: 2px solid #BAE6FD;
  border-radius: var(--radius-xl);
  padding: 22px;
  margin: 18px 0;
  width: 100%;
}

.candidates-palette {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}

.candidate-card-draggable {
  width: 66px;
  height: 78px;
  border-radius: var(--radius-md);
  background: #FFF;
  border: 2px solid #93C5FD;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.candidate-card-draggable:hover {
  transform: translateY(-5px);
  border-color: var(--deep-sky);
  box-shadow: var(--shadow-float);
}

.candidate-card-draggable.placed {
  opacity: 0.4;
  border-style: dashed;
  transform: scale(0.95);
}

.cand-letter {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--soft-navy);
}

.cand-label {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-light);
  text-transform: uppercase;
}

.positions-podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
  width: 100%;
}

.position-slot-box {
  background: #F8FAFC;
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.position-slot-box.filled {
  border-color: #38BDF8;
  background: #F0F9FF;
  border-style: solid;
}

.slot-role-name {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--soft-navy);
  margin-bottom: 6px;
}

.slot-assigned-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #FFF;
  border: 2px solid #38BDF8;
  font-weight: 800;
  color: var(--soft-navy);
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   COMBINATION SCRAMBLER & CHIPS (LKM 3)
   ========================================================================== */
.scramble-box {
  background: #EFF6FF;
  border: 2px solid #BFDBFE;
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  margin: 14px 0;
  width: 100%;
}

.scramble-letters {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
}

.scramble-chip {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #FFF;
  border: 2px solid var(--sky-blue);
  color: var(--soft-navy);
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-candidates-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.candidate-chip {
  padding: 8px 16px;
  border-radius: 30px;
  background: var(--white);
  border: 2px solid #CBD5E1;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.candidate-chip:hover {
  border-color: var(--sky-blue);
  background: #F0F9FF;
  transform: translateY(-2px);
}

.candidate-chip.selected {
  background: var(--green-light);
  border-color: var(--green-school);
  color: var(--green-dark);
}

/* ==========================================================================
   STUDENT DIARY JOURNAL (PAGE 8)
   ========================================================================== */
.diary-book-wrapper {
  background: #FFFDF0;
  border: 4px solid #D97706;
  border-radius: var(--radius-xl);
  padding: 30px 34px;
  box-shadow: var(--shadow-md);
  position: relative;
  width: 100%;
  margin: 18px 0;
}

.diary-ribbon {
  position: absolute;
  top: -12px;
  right: 40px;
  width: 24px;
  height: 54px;
  background: #EF4444;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.diary-page-card {
  min-height: 280px;
}

.diary-page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px dashed #D97706;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   MINI GAMES & MISSIONS CARDS
   ========================================================================== */
.missions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 16px 0;
  width: 100%;
}

.mission-card {
  background: #FAFCFF;
  border: 2px dashed #93C5FD;
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.mission-card:hover {
  border-color: var(--deep-sky);
  transform: translateY(-4px);
  background: #FFF;
}

.cut-line-indicator {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 0.72rem;
  color: #94A3B8;
}

.mission-card-badge {
  background: #EFF6FF;
  color: var(--soft-navy);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 10px;
  width: fit-content;
  margin-bottom: 8px;
}

.mission-card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--soft-navy);
  margin-bottom: 8px;
}

.mission-card-content {
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  flex: 1;
}

/* Whiteboard Schema */
.whiteboard-container {
  background: #0F382A;
  border: 10px solid #78350F;
  border-radius: var(--radius-xl);
  padding: 24px;
  color: #F8FAFC;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.5), var(--shadow-lg);
  margin: 20px 0;
  width: 100%;
}

.whiteboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.whiteboard-item {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.whiteboard-item:hover, .whiteboard-item.selected {
  background: rgba(255, 255, 255, 0.18);
  border-color: #FDE047;
}

.whiteboard-sentence-box {
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(254, 240, 138, 0.5);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #FEF08A;
  margin-top: 14px;
  line-height: 1.55;
}

/* Mini Games Engine */
.game-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.game-tab-btn {
  background: #FFF;
  border: 2px solid #CBD5E1;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.game-tab-btn.active {
  background: var(--soft-navy);
  border-color: var(--soft-navy);
  color: #FFF;
}

.game-panel { display: none; }
.game-panel.active { display: block; }

.game-enhanced-card {
  background: #FFF;
  border: 2px solid #BAE6FD;
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.game-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #F0F9FF;
  border: 2px solid #BAE6FD;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Calculator Grid */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
  width: 100%;
}

.calc-card {
  background: #FFF;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.calc-input-group { margin-bottom: 12px; }
.calc-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calc-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid #CBD5E1;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
}

.calc-result-display {
  background: #F0F9FF;
  border: 2px solid #BAE6FD;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
  text-align: center;
}

.calc-result-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--soft-navy);
}

.calc-steps {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 4px;
  font-family: monospace;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

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

.modal-card {
  background: #FFF;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  border: 2px solid #BAE6FD;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 2px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.modal-title { font-size: 1.2rem; font-weight: 800; color: var(--soft-navy); }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #94A3B8; }
.modal-body { padding: 20px 22px; line-height: 1.6; }

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS (MOBILE & TABLET EXCELLENCE)
   ========================================================================== */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .mobile-menu-trigger { display: block; }
  .env-header-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    gap: 18px;
  }
  .character-companion-box {
    margin-top: 6px;
  }
}

@media (max-width: 768px) {
  .page-view {
    padding: 20px 16px 60px;
  }
  .top-school-bar {
    padding: 0 16px;
  }
  .branch-objects-container {
    grid-template-columns: 1fr;
  }
  .positions-podium {
    grid-template-columns: 1fr;
  }
  .diary-book-wrapper {
    padding: 22px 18px;
  }
  .handbook-wrapper {
    padding: 22px 18px;
  }
  .card {
    padding: 18px 16px;
  }
  .qa-question-box {
    padding: 16px 14px;
  }
  .btn-lg {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .page-view {
    padding: 14px 10px 50px;
  }
  .top-school-bar {
    padding: 0 12px;
  }
  .env-header-card {
    padding: 16px 12px;
    border-radius: var(--radius-md);
  }
  .env-title {
    font-size: 1.45rem;
  }
  .character-companion-box {
    max-width: 100%;
  }
  .character-bubble {
    font-size: 0.82rem;
    padding: 8px 12px;
  }
  .student-character-svg {
    width: 80px;
    height: 80px;
  }
  .tree-master-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .tree-tool-group {
    justify-content: flex-start;
  }
  .qa-unit-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .think-first-trigger {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .think-first-trigger .btn {
    width: 100%;
    justify-content: center;
  }
  .game-score-hud {
    flex-direction: column;
    gap: 10px;
    align-items: center;
    text-align: center;
  }
  .journal-nav-bar {
    flex-direction: column;
    gap: 10px;
  }
  .journal-nav-bar .btn {
    width: 100%;
    justify-content: center;
  }
}
