/* ==========================================================================
   KNOCK-OUT MATH 9 - STYLESHEET (MATHEMATICS EDTECH DESIGN) (EDTECH MASTER DESIGN)
   100% Chemistry Only
   ========================================================================== */

:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1527;
  --bg-card: rgba(16, 26, 46, 0.75);
  --bg-card-hover: rgba(22, 36, 64, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.35);
  
  --emerald-primary: #38bdf8;
  --emerald-light: #7dd3fc;
  --emerald-dark: #059669;
  --cyan-accent: #06b6d4;
  --blue-accent: #3b82f6;
  --indigo-accent: #6366f1;
  --amber-warning: #f59e0b;
  --rose-danger: #f43f5e;
  --purple-accent: #a855f7;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-highlight: #38bdf8;

  --font-sans: 'Outfit', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  --shadow-glow: 0 0 25px -5px rgba(16, 185, 129, 0.25);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(16, 185, 129, 0.4);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Background Subtle Glowing Gradients */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, rgba(6, 182, 212, 0.03) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-primary);
}

/* HEADER NAVIGATION */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
}

.header-inner {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.brand-text-col h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f8fafc 0%, #34d399 70%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.brand-subtext strong {
  color: #38bdf8;
  font-weight: 600;
}

/* Header Middle Search & Filter */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 650px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--emerald-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

/* Header Toolbar Buttons */
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--emerald-light);
  border-color: var(--emerald-primary);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: inherit;
}

.btn-lab-trigger {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-lab-trigger:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(6, 182, 212, 0.35) 100%);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

/* QUICK STATS BANNER */
.stats-banner {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.05) 50%, rgba(99, 102, 241, 0.08) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.4rem 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stats-inner {
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-item strong {
  color: var(--emerald-light);
  font-weight: 700;
}

/* MAIN SPLIT STUDIO LAYOUT */
.main-studio {
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr 500px;
  gap: 1rem;
  padding: 1rem 1.5rem 1.5rem;
  height: calc(100vh - 105px);
  overflow: hidden;
}

/* STUDIO COLUMN PANE */
.studio-col {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.col-header {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.col-title {
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.col-badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.col-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* ==========================================================================
   LEFT PANE: EXAM CATALOG (60 DE THI)
   ========================================================================== */
.filter-pills {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.filter-pill {
  padding: 0.28rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-pill:hover, .filter-pill.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald-light);
  border-color: var(--emerald-primary);
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.exam-card {
  padding: 0.8rem 0.95rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.exam-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateX(3px);
}

.exam-card.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.08) 100%);
  border-color: var(--emerald-primary);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.exam-card.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--emerald-primary);
}

.exam-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.exam-order {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald-light);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.exam-region-tag {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.exam-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.exam-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.tag-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.tag-badge.special {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   CENTER PANE: EXAM STUDIO & QUESTION PALETTE
   ========================================================================== */
.exam-banner-header {
  padding: 1.15rem 1.4rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(13, 21, 39, 0.6) 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.exam-meta-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.badge-master {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  color: #070b14;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exam-headline {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
}

.exam-subdetail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Question Tabs Bar */
.question-tabs-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.q-tab-btn {
  padding: 0.38rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  font-family: inherit;
}

.q-tab-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}

.q-tab-btn.active {
  background: var(--emerald-primary);
  color: #070b14;
  font-weight: 700;
  border-color: var(--emerald-light);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Question View Content */
.question-view-container {
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.question-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.q-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.q-box-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.q-box-score {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--emerald-light);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.q-text-body {
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--text-main);
}

.q-text-body p {
  margin-bottom: 0.75rem;
}

.subquestion-card {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid #38bdf8;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
}

/* Chemistry Equation KaTeX styling */
.katex-display {
  margin: 0.85rem 0 !important;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* Student Scratchpad */
.scratchpad-container {
  margin-top: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.scratchpad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.scratchpad-textarea {
  width: 100%;
  min-height: 80px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  resize: vertical;
}

.scratchpad-textarea:focus {
  outline: none;
}

/* ==========================================================================
   RIGHT PANE: 5-STEP PEDAGOGY REVEALER & LAB WORKBENCH
   ========================================================================== */
.right-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.right-tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.right-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.right-tab-btn.active {
  color: var(--emerald-light);
  border-bottom-color: var(--emerald-primary);
  background: rgba(16, 185, 129, 0.08);
}

.tab-pane {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  gap: 0.85rem;
}

.tab-pane.active {
  display: flex;
}

/* GOLDEN FORMULA CARDS */
.formula-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.formula-card:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.formula-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.formula-card-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formula-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.formula-badge.geo {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.formula-badge.alg {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.formula-badge.adv {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.formula-body {
  font-size: 0.88rem;
  line-height: 1.75;
  color: #e2e8f0;
}

.formula-body p {
  margin: 0.35rem 0;
}

.formula-body .katex-display {
  margin: 0.55rem 0 !important;
  padding: 0.35rem 0.6rem !important;
  background: rgba(0, 0, 0, 0.22) !important;
  border-radius: var(--radius-sm) !important;
  border-left: 3px solid #38bdf8 !important;
}

/* 5-STEP PEDAGOGICAL CARDS */
.step-card {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: all 0.25s ease;
}

.step-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.step-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.step-title-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.step-title {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.step-content {
  padding: 0.85rem 1rem 1rem;
  font-size: 0.88rem;
  line-height: 1.65;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}

/* Colors for 5 steps */
.step-1 .step-badge { background: rgba(16, 185, 129, 0.2); color: var(--emerald-light); }
.step-1 .step-title { color: var(--emerald-light); }
.step-1.revealed { border-color: rgba(16, 185, 129, 0.4); }

.step-2 .step-badge { background: rgba(6, 182, 212, 0.2); color: var(--cyan-accent); }
.step-2 .step-title { color: var(--cyan-accent); }
.step-2.revealed { border-color: rgba(6, 182, 212, 0.4); }

.step-3 .step-badge { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.step-3 .step-title { color: #a5b4fc; }
.step-3.revealed { border-color: rgba(99, 102, 241, 0.4); }

.step-4 .step-badge { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.step-4 .step-title { color: #fda4af; }
.step-4.revealed { border-color: rgba(244, 63, 94, 0.4); }

.step-5 .step-badge { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.step-5 .step-title { color: #fcd34d; }
.step-5.revealed { border-color: rgba(245, 158, 11, 0.4); }

.step-blurred {
  filter: blur(4px);
  user-select: none;
  opacity: 0.35;
  pointer-events: none;
}

.step-reveal-btn {
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-reveal-btn:hover {
  background: var(--emerald-primary);
  color: #070b14;
}

/* ==========================================================================
   VIRTUAL LAB SIMULATION STUDIO
   ========================================================================== */
.lab-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lab-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lab-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--emerald-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lab-canvas-container {
  width: 100%;
  height: 220px;
  background: radial-gradient(circle at center, #101c36 0%, #080e1c 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lab-controls-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-lab-action {
  flex: 1;
  padding: 0.45rem 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-lab-action:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--emerald-primary);
  color: var(--emerald-light);
}

.lab-feedback-box {
  padding: 0.65rem 0.85rem;
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--emerald-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #a7f3d0;
}

/* ==========================================================================
   PERIODIC TABLE & CONSTANTS PANE
   ========================================================================== */
.periodic-quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.element-pill {
  padding: 0.5rem 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.element-pill:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.elem-symbol {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--emerald-light);
}

.elem-mass {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.elem-name {
  font-size: 0.65rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   MODAL & OVERLAY STYLING
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
  .main-studio {
    grid-template-columns: 320px 1fr 420px;
  }
}

@media (max-width: 1100px) {
  .main-studio {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
  }
  .studio-col {
    height: 600px;
  }
}

/* ==========================================================================
   PRINT STYLESHEET (CHUẨN IN ẤN A4 CHO GIÁO VIÊN & HỌC SINH)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 12pt !important;
  }
  .app-header,
  .stats-banner,
  #col-catalog,
  .scratchpad-container,
  .right-tabs-nav,
  .header-tools,
  .modal-overlay,
  .step-reveal-btn,
  #btn-reveal-all-steps,
  .search-box {
    display: none !important;
  }
  .main-studio {
    display: block !important;
    height: auto !important;
    padding: 0 !important;
  }
  #col-exam-view, #col-solution-pedagogy {
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: auto !important;
    overflow: visible !important;
  }
  .exam-banner-header {
    background: transparent !important;
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 0.5rem !important;
    color: #000000 !important;
  }
  .exam-headline {
    color: #000000 !important;
    font-size: 16pt !important;
  }
  .question-box {
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }
  .step-card {
    background: #f9fafb !important;
    border: 1px solid #e5e7eb !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }
  .step-content {
    display: block !important;
  }
  .step-blurred {
    filter: none !important;
    user-select: auto !important;
  }
  .katex {
    color: #000000 !important;
  }
}

