/* ============================================================
   NAROTTAMA ACADEMY — Premium Redesign
   Aesthetic: Editorial luxury meets modern edtech
   ============================================================ */

/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  --ink:       #0f1923;
  --ink-mid:   #374151;
  --ink-soft:  #6b7280;
  --ink-faint: #9ca3af;
  --canvas:    #f8f9fc;
  --white:     #ffffff;
  --accent:    #1a56db;
  --accent-lt: #3b82f6;
  --accent-dk: #1e3a8a;
  --gold:      #f59e0b;
  --gold-lt:   #fef3c7;
  --green:     #059669;
  --green-lt:  #d1fae5;
  --red:       #dc2626;
  --red-lt:    #fee2e2;
  --purple:    #7c3aed;
  --purple-lt: #ede9fe;
  --border:    #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'DM Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden;
}

/* === BACKGROUND ORBS === */
.bg-orbs {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #bfdbfe, transparent 70%);
  top: -200px; left: -150px;
  animation-delay: 0s;
}
.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #ddd6fe, transparent 70%);
  top: 50%; right: -180px;
  animation-delay: -6s;
}
.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #bbf7d0, transparent 70%);
  bottom: -150px; left: 30%;
  animation-delay: -12s;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, 30px) scale(1.08); }
}

/* === HEADER / HERO === */
.site-header {
  position: relative;
  background: linear-gradient(145deg, #0f1923 0%, #1e3a8a 55%, #1a56db 100%);
  color: white;
  padding: 80px 24px 100px;
  overflow: hidden;
  z-index: 1;
}
.site-header::before {
  content: '';
  position: absolute; inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 60px 60px;
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 60px;
  background: var(--canvas);
  clip-path: ellipse(55% 100% at 50% 100%);
}
.header-inner {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  z-index: 2;
}
.logo-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  padding: 8px 18px 8px 10px;
  border-radius: 50px;
  margin-bottom: 40px;
  animation: fadeInDown .7s ease both;
}
.logo-icon { display: flex; align-items: center; }
.logo-icon.small { display: flex; }
.logo-text {
  font-family: var(--font-sans);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(255,255,255,.9);
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -.02em;
  animation: fadeInUp .7s ease .1s both;
}
.hero-title em {
  font-style: italic;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,.75);
  max-width: 520px;
  margin: 0 auto 40px;
  font-weight: 300;
  animation: fadeInUp .7s ease .2s both;
}
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  animation: fadeInUp .7s ease .3s both;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 50px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all .25s ease;
  box-shadow: 0 4px 20px rgba(245,158,11,.4);
  letter-spacing: .01em;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 30px rgba(245,158,11,.5);
}
.hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
  padding: 14px 28px;
  border-radius: 50px;
}
.stat { text-align: center; }
.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
}
.stat-label {
  display: block;
  font-size: .7rem;
  color: rgba(255,255,255,.55);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,.2);
}
.scroll-hint {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.4);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  z-index: 2;
  animation: fadeIn 1s ease 1s both;
}
.scroll-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, rgba(255,255,255,.4), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: .5; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.1); }
}

/* === SUBJECTS SECTION === */
.section-subjects {
  position: relative;
  padding: 80px 24px 60px;
  z-index: 1;
}
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  text-align: center;
}
.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -.02em;
}
.section-sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto 48px;
}

/* Exam Grid */
.exam-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.exam-card {
  position: relative;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: all .25s ease;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.exam-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-lt));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.exam-card:hover {
  border-color: var(--accent-lt);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
.exam-card:hover::before { transform: scaleX(1); }
.exam-card.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12), var(--shadow-md);
}
.exam-card.active::before { transform: scaleX(1); }
.exam-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 50px;
  margin-bottom: 14px;
}
.badge-school  { background: var(--gold-lt);   color: #92400e; }
.badge-jee     { background: #fce7f3;           color: #9d174d; }
.badge-neet    { background: var(--green-lt);   color: #065f46; }
.badge-mbbs    { background: var(--purple-lt);  color: #4c1d95; }
.badge-default { background: #f3f4f6;           color: var(--ink-mid); }
.exam-name {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}
.exam-desc {
  font-size: .82rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.exam-arrow {
  position: absolute;
  bottom: 20px; right: 20px;
  color: var(--accent-lt);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.exam-card:hover .exam-arrow { opacity: 1; transform: translateX(2px); }

/* === CONTENT PANEL === */
.section-content {
  padding: 20px 24px 80px;
  position: relative;
  z-index: 1;
}
.content-panel {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--r-xl);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.content-panel-header {
  padding: 28px 36px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to right, #f8faff, var(--white));
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.bc-home {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 500;
}
.bc-sep { color: var(--border); font-size: 1.1rem; }
.panel-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}
.panel-body {
  padding: 36px;
  min-height: 300px;
}

/* Welcome state */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-faint);
}
.welcome-icon { margin-bottom: 20px; }
.welcome-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin-bottom: 8px;
}
.welcome-state p { font-size: .9rem; max-width: 360px; }

/* === SUBJECT DETAIL LAYOUT === */
.subject-detail { }
.subject-desc {
  font-size: 1rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

/* Chapter Selector */
.chapter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
  background: #f8faff;
  padding: 20px 24px;
  border-radius: var(--r-md);
  border: 1px solid #e0eaff;
}
.form-group { }
.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
#chapter-select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: .95rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
#chapter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
#chapter-select:hover { border-color: var(--accent-lt); }

/* Num Questions */
.num-q-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#num-questions {
  width: 120px;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: .95rem;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  text-align: center;
  font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}
#num-questions:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* Action Buttons */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-mid);
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
}
.action-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.action-tile .tile-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  transition: transform .2s;
}
.action-tile:hover .tile-icon { transform: scale(1.1); }
.tile-notes    .tile-icon { background: #eff6ff; }
.tile-quiz     .tile-icon { background: #fef3c7; }
.tile-flash    .tile-icon { background: var(--green-lt); }
.tile-video    .tile-icon { background: #fce7f3; }
.tile-slide    .tile-icon { background: var(--purple-lt); }

.tile-notes:hover  { border-color: var(--accent-lt);  background: #eff6ff; color: var(--accent); }
.tile-quiz:hover   { border-color: var(--gold);        background: var(--gold-lt); color: #92400e; }
.tile-flash:hover  { border-color: var(--green);       background: var(--green-lt); color: #065f46; }
.tile-video:hover  { border-color: #ec4899;            background: #fce7f3; color: #9d174d; }
.tile-slide:hover  { border-color: var(--purple);      background: var(--purple-lt); color: #4c1d95; }

/* Legacy action button (kept for JS compatibility) */
.action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 11px 22px;
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.action-button:hover {
  background: var(--accent-dk);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* === QUIZ INTERFACE === */
#quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--ink), #1e3a8a);
  color: white;
  padding: 16px 24px;
  border-radius: var(--r-md);
  margin-bottom: 20px;
  font-family: var(--font-sans);
}
#quiz-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #86efac;
}
#timer {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  background: rgba(255,255,255,.1);
  padding: 6px 14px;
  border-radius: 50px;
  letter-spacing: .04em;
}
#quiz-body {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: #f8faff;
  border: 1px solid #e0eaff;
  border-radius: var(--r-md);
  padding: 16px;
  max-height: 600px;
  overflow-y: auto;
}
.main {
  flex: 1;
  min-width: 0;
}
.legend {
  margin-bottom: 16px;
}
.legend p {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--ink-mid);
  margin-bottom: 5px;
}
.legend-box {
  width: 14px; height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-box.unanswered { background: #d1d5db; }
.legend-box.answered   { background: #6ee7b7; }
.legend-box.review     { background: #c4b5fd; }
.legend-box.current    { background: white; border: 2px solid var(--accent); }
.question-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.nav-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink);
}
.nav-btn.unanswered { background: #d1d5db; color: var(--ink-mid); }
.nav-btn.answered   { background: #6ee7b7; color: #065f46; }
.nav-btn.review     { background: #c4b5fd; color: #4c1d95; }
.nav-btn.current    { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.nav-btn:hover      { transform: scale(1.1); }

.question-block {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.question-block p strong {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}
.question-block label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  font-size: .95rem;
  color: var(--ink-mid);
}
.question-block label:hover {
  border-color: var(--accent-lt);
  background: #eff6ff;
  color: var(--ink);
}
.question-block em {
  font-style: italic;
  color: var(--ink-soft);
  font-size: .92rem;
}

/* Custom radio/checkbox */
input[type="radio"],
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  margin-top: 2px;
  transition: all .15s;
}
input[type="radio"] { border-radius: 50%; }
input[type="radio"]:checked,
input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
  content: "✔";
  color: white;
  font-size: 11px;
  position: absolute;
  top: -1px; left: 2px;
}
input[type="radio"]:checked::after {
  content: "";
  width: 7px; height: 7px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px; left: 3px;
}

/* Quiz nav buttons */
.nav-buttons {
  display: flex;
  gap: 10px;
  margin: 16px 0 8px;
}
.nav-buttons button {
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--ink-mid);
  cursor: pointer;
  transition: all .2s;
}
.nav-buttons button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #eff6ff;
}

/* Question actions */
.question-block button {
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 600;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  margin: 10px 6px 0 0;
  transition: all .15s;
}
.question-block button:hover {
  background: #f3f4f6;
  color: var(--ink);
  border-color: #9ca3af;
}

/* Match table */
.match-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: .92rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  table-layout: fixed;
}

/* Column widths: left label 45%, right select 55% */
.match-table col.col-left  { width: 45%; }
.match-table col.col-right { width: 55%; }

.match-table th {
  padding: 12px 18px;
  background: #f0f5ff;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  border-bottom: 1.5px solid var(--border);
  text-align: left;
}

/* No vertical border between the two header cells */
.match-table th:first-child {
  border-right: 2px solid var(--border);
}

.match-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

/* Left cell — item label */
.match-table td:first-child {
  font-weight: 600;
  color: var(--ink);
  border-right: 2px solid var(--border);
  background: #fafbff;
}

/* Last row — no bottom border */
.match-table tr:last-child td {
  border-bottom: none;
}

/* Subtle alternating row tint */
.match-table tbody tr:nth-child(even) td { background: #f8faff; }
.match-table tbody tr:nth-child(even) td:first-child { background: #f2f5ff; }

/* Hover highlight across the whole row */
.match-table tbody tr:hover td { background: #eff6ff; }
.match-table tbody tr:hover td:first-child { background: #e8f0ff; }

/* Select inside match table */
.match-table select {
  width: 100%;
  padding: 9px 36px 9px 12px;
  font-family: var(--font-sans);
  font-size: .9rem;
  color: var(--ink);
  background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  appearance: none;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}
.match-table select:hover {
  border-color: var(--accent-lt);
}
.match-table select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
  background-color: #f8faff;
}
/* Highlight the cell when a value is selected */
.match-table select.has-value {
  border-color: var(--green);
  color: #065f46;
  background-color: #f0fdf8;
}

@media (max-width: 480px) {
  .match-table { table-layout: auto; }
  .match-table td, .match-table th { padding: 10px 12px; }
  .match-table select { font-size: .83rem; }
}

#question-container {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* === QUIZ RESULTS === */
/* Quiz results — scoped to .quiz-results wrapper added by JS */
.quiz-results h3 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--ink);
}
.quiz-results > p > strong {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--ink);
}

/* === FLASHCARDS === */
.flashcard {
  width: 90%;
  max-width: 860px;
  height: 420px;
  margin: 24px auto;
  perspective: 1200px;
}
.card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .65s cubic-bezier(.4, 0, .2, 1);
  cursor: pointer;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.card.flip { transform: rotateY(180deg); }
.front, .back {
  position: absolute;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-family: var(--font-sans);
  border-radius: var(--r-xl);
  padding: 40px;
  text-align: center;
  line-height: 1.6;
}
.front {
  background: linear-gradient(135deg, #1e3a8a, var(--accent));
  color: white;
  font-weight: 400;
}
.front::before {
  content: 'QUESTION';
  position: absolute;
  top: 20px; left: 24px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
}
.back {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: var(--ink);
  font-weight: 500;
  transform: rotateY(180deg);
}
.back::before {
  content: 'ANSWER';
  position: absolute;
  top: 20px; left: 24px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(15,25,35,.4);
}

/* Flashcard controls */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.controls button:hover {
  transform: scale(1.12);
  box-shadow: var(--shadow-md);
}
.controls button img.icon {
  width: 28px; height: 28px;
  object-fit: contain;
}
.progress {
  text-align: center;
  margin-top: 20px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-mid);
  font-family: var(--font-mono);
}

/* === VIDEO SECTION === */
.video-section {
  max-width: 100%;
  margin: 0;
  background: transparent;
  padding: 0;
}
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  margin-top: 12px;
  box-shadow: var(--shadow-md);
}
.video-container iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* === NOTES / SLIDE CONTENT === */
/* Anchor button style scoped away from notes — notes have their own links */
#content-body > a,
#content-body > p > a,
.subject-detail > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: #eff6ff;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
  transition: all .2s;
  border: 1px solid #bfdbfe;
}
#content-body > a:hover,
#content-body > p > a:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Message / coming soon */
.message {
  text-align: center;
  padding: 48px 24px;
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
}
.message h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.message p { color: var(--ink-soft); }

/* Color utility */
.text-blue  { color: var(--accent); }
.text-green { color: var(--green); }

/* === FOOTER === */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,.55);
  padding: 28px 24px;
  position: relative;
  z-index: 1;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.85);
  font-weight: 600;
  font-size: .95rem;
}
.footer-copy { font-size: .8rem; }

/* === ANIMATIONS === */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fadeInDown{ from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

.exam-card { animation: fadeInUp .4s ease both; }
.exam-card:nth-child(1)  { animation-delay: .05s; }
.exam-card:nth-child(2)  { animation-delay: .1s;  }
.exam-card:nth-child(3)  { animation-delay: .15s; }
.exam-card:nth-child(4)  { animation-delay: .2s;  }
.exam-card:nth-child(5)  { animation-delay: .25s; }
.exam-card:nth-child(6)  { animation-delay: .3s;  }
.exam-card:nth-child(7)  { animation-delay: .35s; }
.exam-card:nth-child(8)  { animation-delay: .4s;  }
.exam-card:nth-child(9)  { animation-delay: .45s; }
.exam-card:nth-child(10) { animation-delay: .5s;  }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .site-header { padding: 60px 20px 80px; }
  .hero-title { font-size: 2.2rem; }
  .hero-stats { gap: 14px; padding: 12px 18px; flex-wrap: wrap; justify-content: center; }
  .chapter-row { grid-template-columns: 1fr; }
  #quiz-body { flex-direction: column; }
  .sidebar { width: 100%; max-height: none; }
  .content-panel-header { padding: 20px 20px 16px; }
  .panel-body { padding: 20px; }
  .footer-inner { justify-content: center; text-align: center; }
}
@media (max-width: 480px) {
  .hero-stats { display: none; }
  .flashcard { height: 280px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
}

#pdf-viewer canvas {
  transform: scale(0.75);
  transform-origin: top left;

}

/* ── Global table rules scoped to notes only ──────────────────
   These were originally unscoped and were overriding .match-table.
   Now safely scoped to .notes-content so quiz tables are unaffected.
   ────────────────────────────────────────────────────────────── */
.notes-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  background-color: #fdfdfd;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border-radius: 6px;
  overflow: hidden;
}
.notes-content table thead th {
  background-color: #004d80;
  color: #ffffff;
  text-align: center;
  padding: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.notes-content table tbody td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
}
.notes-content table tbody td:first-child {
  font-weight: 600;
  text-align: left;
  background-color: #f7f9fc;
  color: #333;
}
.notes-content table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}
.notes-content table tbody tr:hover {
  background-color: #eaf4ff;
  transition: background-color 0.2s ease-in-out;
}
.high-yield {
  color: #d32f2f;
  font-weight: 700;
  background-color: #fff3f3;
  padding: 2px 6px;
  border-radius: 4px;
}
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid #ddd;
  border-radius: 6px;
}




/* ============================================================
   NOTES CONTENT SCOPE
   Notes HTML files are loaded into #content-body.
   The .notes-content wrapper (added by loadNotes in script.js)
   isolates notes styles from the rest of the site.
   All rules here ONLY apply inside the notes panel.
   ============================================================ */

.notes-content {
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

.notes-content h1 {
  text-align: center;
  color: #004d80;
  font-size: 26px;
  margin-bottom: 28px;
  border-bottom: 3px solid #004d80;
  padding-bottom: 10px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: normal;
}

.notes-content h2 {
  color: #004d80;
  font-size: 20px;
  margin-top: 32px;
  margin-bottom: 12px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  border-bottom: none;
  letter-spacing: normal;
  text-align: left;
}

.notes-content h3 {
  color: #006699;
  font-size: 17px;
  margin-top: 24px;
  margin-bottom: 8px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 600;
}

.notes-content p {
  font-size: 15px;
  color: #444;
  margin-bottom: 14px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  font-style: normal;
  background: none;
  border: none;
  padding: 0;
}

.notes-content ul,
.notes-content ol {
  margin-left: 24px;
  margin-bottom: 14px;
  padding: 0;
  list-style: revert;
}

.notes-content ul li,
.notes-content ol li {
  font-size: 15px;
  color: #444;
  margin-bottom: 7px;
  font-family: "Segoe UI", Arial, sans-serif;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* Case study boxes — notes use section h3 + p/ul pattern */
.notes-content section h3 + p,
.notes-content section h3 + ul,
.notes-content section h3 + ol {
  background-color: #fff;
  border-left: 4px solid #006699;
  padding: 12px;
  margin: 8px 0 18px 0;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  list-style: revert;
}

/* Exam question list items */
.notes-content ol li {
  background-color: #fff;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-bottom: 10px;
}

/* Highlighted answers in exam questions */
.notes-content ol li strong {
  color: #004d80;
}

.notes-content strong {
  color: #222;
  font-weight: 700;
}

/* High-yield emphasis (red italic in notes) */
.notes-content em {
  color: #d32f2f;
  font-weight: 600;
  font-style: normal;
}

/* Summary last section */
.notes-content section:last-of-type ul {
  background-color: #fff;
  padding: 15px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Tables inside notes */
.notes-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  background-color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  border-radius: 6px;
  overflow: hidden;
  min-width: unset;
}

.notes-content thead th {
  background-color: #004d80;
  color: #fff;
  padding: 11px 12px;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.notes-content tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
}

.notes-content tbody td:first-child {
  font-weight: 600;
  text-align: left;
  background-color: #f7f9fc;
  color: #333;
}

.notes-content tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.notes-content tbody tr:hover {
  background-color: #eaf4ff;
}

.notes-content .table-container {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.notes-content .high-yield {
  color: #d32f2f;
  font-weight: 700;
  background-color: #fff3f3;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Links inside notes — render as normal links, not buttons */
.notes-content a {
  display: inline;
  color: #006699;
  font-weight: 500;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}
.notes-content a:hover {
  color: #004d80;
  background: none;
  border: none;
}
