/* MMM Study — Chemistry Subject Architecture Styles */
@import "../design_system.css";

:root {
  --subject-accent: #059669;
  --subj-chem-accent: #059669;
  --subj-chem-light: #ECFDF5;
  --subj-chem-border: #A7F3D0;
  --subj-chem-dark: #065F46;
  --subj-chem-hover: #047857;
  --subj-chem-surface: #FFFFFF;
  --subj-chem-bg: #F8FAFC;
  --subj-chem-border-subtle: #F1F5F9;
  --subj-chem-text-primary: #0F172A;
  --subj-chem-text-secondary: #475569;
  --subj-chem-text-muted: #64748B;
  --subj-chem-radius: 10px;
  --subj-chem-radius-sm: 6px;
  --subj-chem-radius-lg: 12px;
}

/* Container Layout */
main {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Progressive Curriculum Navigation Bar */
.curriculum-nav-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px 18px;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(11, 30, 54, 0.05));
  width: 100%;
  box-sizing: border-box;
}

.curriculum-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-pill, 9999px);
  background: var(--brand-navy-900, #0B1E36);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid var(--brand-gold-border, rgba(197, 155, 39, 0.3));
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: inherit;
  min-height: 38px;
}

.curriculum-back-btn:hover {
  background: var(--brand-gold, #C59B27);
  color: var(--brand-navy-950, #071324);
  transform: translateX(-2px);
  box-shadow: 0 4px 12px rgba(197, 155, 39, 0.3);
}

.curriculum-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary, #64748B);
  flex-wrap: wrap;
}

.curriculum-breadcrumbs a,
.breadcrumb-link,
.crumb-link {
  color: var(--brand-navy-800, #143058);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease;
}

.curriculum-breadcrumbs a:hover,
.breadcrumb-link:hover,
.crumb-link:hover {
  color: var(--subj-chem-accent, #059669);
}

.curriculum-breadcrumbs .crumb-sep,
.curriculum-breadcrumbs .separator {
  color: #CBD5E1;
  user-select: none;
}

.curriculum-breadcrumbs strong,
.curriculum-breadcrumbs .current {
  color: var(--subj-chem-dark, #065F46);
  font-weight: 700;
}

/* Screen 1: Primary Mode Cards (Notes vs Practice) */
.subject-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 18px;
  margin-bottom: 32px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px 24px;
  background: var(--surface-card, #FFFFFF);
  border: 2px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-lg, 16px);
  text-decoration: none;
  color: inherit;
  transition: all 0.22s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(11, 30, 54, 0.05));
}

.mode-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--subj-chem-accent, #059669);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mode-card:hover {
  border-color: var(--subj-chem-accent, #059669);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(5, 150, 105, 0.12);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-icon-box,
.mode-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-dark, #065F46);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
  border: 1px solid var(--subj-chem-border, #A7F3D0);
}

.mode-title,
.mode-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0 0 4px 0;
}

.mode-title-burmese {
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-gold, #C59B27);
  margin: 0 0 10px 0;
}

.mode-desc,
.mode-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary, #64748B);
  margin: 0 0 18px 0;
}

.mode-badge-wrap {
  margin-bottom: 12px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--subj-chem-dark, #065F46);
  background: var(--subj-chem-light, #ECFDF5);
  padding: 4px 12px;
  border-radius: var(--radius-pill, 9999px);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-action-btn,
.mode-card-action {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md, 8px);
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.mode-card:hover .mode-action-btn,
.mode-card:hover .mode-card-action {
  background: var(--subj-chem-dark, #065F46);
}

/* Chemistry Chapters Grid (Notes & Practice) */
.chem-chapter-grid,
.chapter-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.chem-chapter-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-md, 12px);
  text-decoration: none;
  color: inherit;
  transition: all 0.18s ease;
  cursor: pointer;
  min-height: 150px;
  box-sizing: border-box;
}

.chem-chapter-card:hover {
  border-color: var(--subj-chem-accent, #059669);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.1);
}

.chem-chapter-card .card-top,
.chem-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chem-chapter-card .chapter-badge,
.chem-chapter-num {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subj-chem-dark, #065F46);
  background: var(--subj-chem-light, #ECFDF5);
  padding: 3px 10px;
  border-radius: var(--radius-pill, 9999px);
}

.chem-chapter-card .chapter-type-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 9999px);
  background: #F1F5F9;
  color: #475569;
}

.chem-chapter-card .chapter-name,
.chem-chapter-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.chem-chapter-card .chapter-preview {
  font-size: 13px;
  color: var(--text-secondary, #64748B);
  margin: 0 0 14px 0;
  line-height: 1.45;
}

.chem-chapter-card .chapter-btn,
.chem-chapter-action {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--subj-chem-accent, #059669);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

/* Chemistry 4 Question Categories (True/False, MCQ, Blank, Questions) */
.chem-types-grid,
.chem-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.chem-type-card,
.chem-cat-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-md, 14px);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  box-sizing: border-box;
}

.chem-type-card:hover,
.chem-cat-card:hover {
  border-color: var(--subj-chem-accent, #059669);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.12);
}

.chem-type-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
}

.chem-type-header .qtype-label-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chem-type-badge,
.chem-cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
  white-space: nowrap;
}

.chem-type-icon {
  font-size: 18px;
  line-height: 1;
}

.cat-tf,
[data-category="True/False"] .chem-type-badge {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.cat-mcq,
[data-category="MCQ"] .chem-type-badge {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.cat-blank,
[data-category="Blank"] .chem-type-badge {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.cat-questions,
[data-category="Questions"] .chem-type-badge {
  background: #F5F3FF;
  color: #5B21B6;
  border: 1px solid #DDD6FE;
}

.chem-type-title,
.chem-cat-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0 0 4px 0;
}

.chem-type-subtitle {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--subj-chem-accent, #059669);
  margin-bottom: 10px;
}

.chem-type-desc,
.chem-cat-card p {
  font-size: 13px;
  color: var(--text-secondary, #64748B);
  line-height: 1.45;
  margin: 0 0 16px 0;
  flex-grow: 1;
}

.btn-start-chem-type,
.chem-cat-card .btn-start {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.btn-start-chem-type:hover,
.chem-cat-card:hover .btn-start {
  background: var(--subj-chem-dark, #065F46);
}

/* Notes Reader & Resources */
.notes-reader-container,
.notes-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 16px;
}

.resource-detail-card,
.note-resource-card {
  padding: 22px;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(11, 30, 54, 0.05));
}

.resource-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.resource-tag {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subj-chem-dark, #065F46);
  background: var(--subj-chem-light, #ECFDF5);
  padding: 3px 10px;
  border-radius: var(--radius-pill, 9999px);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
}

.resource-heading,
.note-resource-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0;
}

.resource-text,
.note-resource-card .note-desc {
  font-size: 14px;
  color: var(--text-secondary, #64748B);
  line-height: 1.5;
  margin: 0 0 14px 0;
}

.resource-body,
.note-body-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--brand-navy-900, #0B1E36);
  background: #FAF8F5;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #EFEAE2;
  overflow-x: auto;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.resource-image-wrap,
.note-image-wrap {
  width: 100%;
  max-width: 600px;
  margin: 12px auto;
  text-align: center;
}

.resource-responsive-image,
.note-image-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,0.1));
}

.resource-attachment {
  margin-top: 12px;
}

.resource-download-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md, 8px);
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-dark, #065F46);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--subj-chem-border, #A7F3D0);
  text-decoration: none;
  transition: all 0.15s ease;
}

.resource-download-link:hover {
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
}

.notes-footer-action {
  margin-top: 24px;
  text-align: center;
}

/* Polished Empty & Error States */
.empty-notes-card,
.empty-curriculum-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-lg, 16px);
  margin-top: 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.empty-notes-icon,
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-notes-title,
.empty-curriculum-state h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0 0 8px 0;
}

.empty-notes-desc,
.empty-curriculum-state p {
  font-size: 14px;
  color: var(--text-secondary, #64748B);
  line-height: 1.55;
  margin: 0 0 24px 0;
}

.empty-notes-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-chem-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md, 8px);
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.btn-chem-primary:hover {
  background: var(--subj-chem-dark, #065F46);
}

.btn-chem-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md, 8px);
  background: #F1F5F9;
  color: #475569;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid #CBD5E1;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.btn-chem-secondary:hover {
  background: #E2E8F0;
  color: #0F172A;
}

/* Loading state */
.notes-loading-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary, #64748B);
  font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .subject-mode-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .chem-types-grid,
  .chem-category-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .chem-chapter-grid,
  .chapter-selector-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* ==========================================================================
   CHEMISTRY NOTES IMAGE READER & PREVIEW (STEP 6 & STEP 8)
   Mobile-First, Touch-Optimized, Aspect-Ratio Preserving
   ========================================================================== */

.chem-notes-avail-pill {
  background: #DCFCE7 !important;
  color: #166534 !important;
  border: 1px solid #BBF7D0 !important;
}

.chem-notes-prep-pill {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border: 1px solid #FDE68A !important;
}

/* ==========================================================================
   CHEMISTRY NOTES THUMBNAIL GALLERY
   Mobile-First, Responsive CSS Grid, Aspect-Ratio 3:4
   ========================================================================== */

.chem-gallery-wrap {
  max-width: 1040px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 0 4px;
}

.chem-gallery-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chem-gallery-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chem-gallery-ch-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0;
}

.chem-gallery-count-badge {
  font-size: 13px;
  font-weight: 600;
  color: #166534;
  background: #DCFCE7;
  border: 1px solid #BBF7D0;
  padding: 4px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}

.chem-gallery-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-chem-gallery-practice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #F8FAFC;
  color: var(--brand-blue-700, #1D4ED8);
  border: 1.5px solid var(--brand-blue-200, #BFDBFE);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-chem-gallery-practice:hover {
  background: var(--brand-blue-50, #EFF6FF);
  border-color: var(--brand-blue-500, #2563EB);
  color: var(--brand-blue-800, #1E40AF);
}

.chem-gallery-instruction {
  font-size: 14px;
  color: var(--text-secondary, #64748B);
  margin: 0 0 20px 0;
  line-height: 1.5;
}

/* Gallery Grid:
   Desktop (≥1280px): 4 columns
   Medium Desktop (1024–1279px): 3 columns
   Tablet (768–1023px): 3 columns
   Mobile (360–767px): Exactly 2 columns
*/
.chem-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1279px) and (min-width: 1024px) {
  .chem-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 1023px) and (min-width: 768px) {
  .chem-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 767px) {
  .chem-gallery-wrap {
    padding: 0;
  }
  .chem-gallery-header-bar {
    gap: 10px;
    margin-bottom: 6px;
  }
  .chem-gallery-ch-title {
    font-size: 17px;
  }
  .chem-gallery-instruction {
    font-size: 13px;
    margin: 0 0 12px 0;
  }
  .chem-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* Thumbnail Card */
.chem-thumb-card {
  min-width: 0;
  width: 100%;
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(11, 30, 54, 0.04));
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
}

.chem-thumb-card:hover {
  transform: translateY(-2px);
  border-color: #60A5FA;
  box-shadow: 0 6px 16px rgba(11, 30, 54, 0.08);
}

.chem-thumb-card:focus-visible {
  outline: 2px solid var(--brand-blue-500, #2563EB);
  outline-offset: 2px;
}

/* Image preview container */
.chem-thumb-preview-wrap {
  width: 100%;
  height: 175px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .chem-thumb-preview-wrap {
    height: 145px;
  }
}

.chem-thumb-img {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  display: block;
  pointer-events: none;
  transition: transform 0.2s ease;
  border-radius: 4px;
}

.chem-thumb-card:hover .chem-thumb-img {
  transform: scale(1.02);
}

.chem-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 30, 54, 0.35);
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.chem-thumb-card:hover .chem-thumb-overlay,
.chem-thumb-card:focus-visible .chem-thumb-overlay {
  opacity: 1;
}

.chem-thumb-open-pill {
  background: #FFFFFF;
  color: var(--brand-navy-900, #0B1E36);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9999px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Card Body */
.chem-thumb-body {
  padding: 8px 2px 2px 2px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.chem-thumb-page-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  line-height: 1.3;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 35px;
}

@media (max-width: 767px) {
  .chem-thumb-page-label {
    font-size: 12px;
    min-height: 31px;
    line-height: 1.25;
  }
}

.chem-thumb-caption {
  font-size: 11.5px;
  color: var(--text-secondary, #64748B);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chem-thumb-page-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #DBEAFE;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.2px;
}

@media (max-width: 767px) {
  .chem-thumb-caption {
    font-size: 11px;
  }
  .chem-thumb-page-pill {
    font-size: 10px;
    padding: 0 4px;
  }
}

/* Reader Gallery Return Button */
.chem-reader-gallery-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #F1F5F9;
  color: var(--brand-navy-900, #0B1E36);
  border: 1px solid var(--border-color, #CBD5E1);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chem-reader-gallery-btn:hover {
  background: #E2E8F0;
  color: #0F172A;
}

.chem-reader-gallery-btn:focus-visible {
  outline: 2px solid var(--brand-blue-500, #2563EB);
  outline-offset: 1px;
}

.chem-reader-card {
  background: var(--surface-card, #FFFFFF);
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: var(--radius-lg, 16px);
  padding: 20px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(11, 30, 54, 0.05));
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

.chem-reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chem-reader-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chem-reader-ch-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #065F46;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  padding: 4px 10px;
  border-radius: 9999px;
}

.chem-reader-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-navy-900, #0B1E36);
  margin: 0;
}

.chem-reader-page-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-blue-700, #1D4ED8);
  background: var(--brand-blue-50, #EFF6FF);
  border: 1px solid var(--brand-blue-200, #BFDBFE);
  padding: 4px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Reader Viewport */
.chem-reader-viewport {
  position: relative;
  width: 100%;
  height: 68vh;
  min-height: 440px;
  max-height: 740px;
  background: #0B132B;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.chem-reader-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chem-reader-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
  display: block;
  pointer-events: none;
}

/* Spinner Loader */
.chem-reader-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #94A3B8;
  font-size: 13px;
  z-index: 5;
}

.chem-reader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #38BDF8;
  border-radius: 50%;
  animation: chemSpin 0.75s linear infinite;
}

@keyframes chemSpin {
  to { transform: rotate(360deg); }
}

/* Error State inside Viewport */
.chem-reader-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  max-width: 360px;
  text-align: center;
  color: #FFFFFF;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 24px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 6;
}

.chem-reader-error p {
  font-size: 13.5px;
  color: #FCA5A5;
  margin: 0;
  line-height: 1.5;
}

.btn-chem-retry {
  padding: 8px 18px;
  background: #EF4444;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-chem-retry:hover {
  background: #DC2626;
}

/* Floating Zoom Controls */
.chem-zoom-controls {
  position: absolute;
  bottom: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 10;
}

.chem-zoom-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #F8FAFC;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.chem-zoom-btn:hover,
.chem-zoom-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  outline: 2px solid #38BDF8;
  outline-offset: 1px;
}

.chem-zoom-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: #E2E8F0;
  padding: 0 4px;
  min-width: 38px;
  text-align: center;
}

/* Bottom Navigation Controls */
.chem-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.chem-nav-btn {
  min-height: 48px;
  padding: 10px 20px;
  background: #FFFFFF;
  color: var(--brand-navy-900, #0B1E36);
  border: 1.5px solid var(--border-color, #E2E8F0);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1 1 120px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chem-nav-btn:hover:not(:disabled) {
  background: #F8FAFC;
  border-color: #CBD5E1;
  color: #0F172A;
}

.chem-nav-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  background: #F1F5F9;
  border-color: #E2E8F0;
}

.chem-nav-btn:focus-visible {
  outline: 2px solid var(--brand-blue-500, #2563EB);
  outline-offset: 2px;
}

.chem-page-selector-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-secondary, #64748B);
  font-weight: 500;
}

.chem-page-select {
  min-height: 44px;
  padding: 6px 14px;
  border: 1.5px solid var(--border-color, #E2E8F0);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--brand-navy-900, #0B1E36);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.chem-page-select:focus-visible {
  outline: 2px solid var(--brand-blue-500, #2563EB);
  outline-offset: 2px;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .chem-reader-card {
    padding: 14px 10px;
    border-radius: 12px;
  }
  .chem-reader-viewport {
    height: 60vh;
    min-height: 360px;
  }
  .chem-reader-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .chem-nav-controls {
    flex-direction: row;
    gap: 8px;
  }
  .chem-nav-btn {
    min-width: 0;
    padding: 10px 12px;
    font-size: 13px;
  }
  .chem-page-selector-group {
    width: 100%;
    justify-content: center;
    order: 3;
    margin-top: 4px;
  }
}

/* ==========================================================================
   MMM Study — Chemistry Academic Benchmark Refinements (Phase 3.4)
   ========================================================================== */

/* Primary Mode Cards (Screen 1) */
.subject-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 18px;
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .subject-mode-grid {
    grid-template-columns: 1fr;
  }
}

.mode-card {
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  background: var(--subj-chem-surface, #FFFFFF);
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.mode-card:hover {
  border-color: #6EE7B7;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.08);
}

.mode-card:focus-visible {
  outline: 2px solid var(--subj-chem-accent, #059669);
  outline-offset: 2px;
}

.mode-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.mode-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-accent, #059669);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  font-size: initial;
}

.mode-card:hover .mode-icon-box {
  transform: scale(1.05);
}

.mode-badge-wrap .mode-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #E2E8F0;
  letter-spacing: 0.02em;
}

.mode-card-body {
  margin-top: 16px;
  flex-grow: 1;
}

.mode-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--subj-chem-text-primary, #0F172A);
  margin: 0;
  line-height: 1.35;
}

.mode-title-burmese {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--subj-chem-text-secondary, #475569);
  margin: 4px 0 0 0;
  line-height: 1.6;
}

.mode-desc {
  font-size: 13.5px;
  color: var(--subj-chem-text-secondary, #475569);
  line-height: 1.6;
  margin: 8px 0 0 0;
}

.mode-card-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.mode-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.mode-card:hover .mode-action-btn {
  background: var(--subj-chem-hover, #047857);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Chapter Selector Grid (Screen 2 & Screen 4) */
.chem-chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 18px;
  margin-bottom: 32px;
}

@media (max-width: 1024px) {
  .chem-chapter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .chem-chapter-grid {
    grid-template-columns: 1fr;
  }
}

.chem-chapter-card {
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  background: var(--subj-chem-surface, #FFFFFF);
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  position: relative;
  min-height: 128px;
}

.chem-chapter-card:hover {
  border-color: #6EE7B7;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.chem-chapter-card:focus-visible {
  outline: 2px solid var(--subj-chem-accent, #059669);
  outline-offset: 2px;
}

.chem-chapter-card .card-top,
.chem-chapter-card .chem-chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chem-chapter-num {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.03em;
}

.chem-notes-avail-pill,
.chapter-type-pill.chem-pill-practice {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-accent, #059669);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
}

.chem-notes-prep-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F8FAFC;
  color: var(--subj-chem-text-muted, #64748B);
  border: 1px solid #E2E8F0;
}

.chem-chapter-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--subj-chem-text-primary, #0F172A);
  margin: 0;
  line-height: 1.4;
  flex-grow: 1;
}

.chem-chapter-card .chapter-preview {
  font-size: 12.5px;
  color: var(--subj-chem-text-muted, #64748B);
  line-height: 1.5;
  margin: 6px 0 10px 0;
}

.chem-chapter-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--subj-chem-accent, #059669);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
  margin-top: auto;
  min-height: 24px;
}

.chem-chapter-card:hover .chem-chapter-action {
  transform: translateX(2px);
  color: var(--subj-chem-hover, #047857);
}

/* Question-Type Selection Grid (Screen 5) */
.chem-category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 18px;
  margin-bottom: 32px;
}

@media (max-width: 640px) {
  .chem-category-grid {
    grid-template-columns: 1fr;
  }
}

.chem-cat-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  background: var(--subj-chem-surface, #FFFFFF);
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.chem-cat-card:hover {
  border-color: #6EE7B7;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.08);
}

.chem-cat-card:focus-visible {
  outline: 2px solid var(--subj-chem-accent, #059669);
  outline-offset: 2px;
}

.chem-type-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.chem-cat-card .chem-type-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-accent, #059669);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chem-cat-card .chem-type-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--subj-chem-text-primary, #0F172A);
  margin: 0;
  line-height: 1.3;
}

.chem-type-subtitle {
  font-size: 12px;
  color: var(--subj-chem-text-muted, #64748B);
  font-weight: 500;
  margin: 2px 0 6px 0;
}

.chem-cat-pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--subj-chem-light, #ECFDF5);
  color: var(--subj-chem-accent, #059669);
  border: 1px solid var(--subj-chem-border, #A7F3D0);
}

.chem-cat-pill.cat-questions {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #DBEAFE;
}

.chem-type-desc {
  font-size: 13px;
  color: var(--subj-chem-text-secondary, #475569);
  line-height: 1.55;
  margin: 0 0 16px 0;
  flex-grow: 1;
}

.btn-start-chem-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--subj-chem-accent, #059669);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  transition: all 0.15s ease;
  min-height: 42px;
}

.chem-cat-card:hover .btn-start-chem-type {
  background: var(--subj-chem-hover, #047857);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Safeguards */
[lang="my"], .mode-title-burmese, .myanmar-text {
  line-height: 1.65 !important;
}

@media (prefers-reduced-motion: reduce) {
  .mode-card, .chem-chapter-card, .chem-cat-card, .chem-reader-img, .btn-start-chem-type {
    transition: none !important;
    transform: none !important;
  }
}

/* Structured Questions: Honest Coming Soon / Future-Version Styling */
.card-future-version {
  background: #FCFDFE !important;
  border: 1.5px dashed #CBD5E1 !important;
  opacity: 0.95;
}

.chem-cat-card:hover:not(.card-future-version) {
  border-color: #A7F3D0;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.08);
}

.cat-future {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border: 1px solid #FDE68A !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
}

.btn-future-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #F8FAFC;
  color: #475569;
  border: 1px solid #CBD5E1;
  padding: 8px 14px;
  border-radius: var(--subj-chem-radius-sm, 6px);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.btn-future-version:hover {
  background: #F1F5F9;
  color: #0F172A;
  border-color: #94A3B8;
}

.future-notice-banner {
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--subj-chem-radius-sm, 6px);
  font-size: 12.5px;
  color: #92400E;
  line-height: 1.5;
  text-align: left;
}

.future-notice-banner.show {
  display: block;
}
