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

:root {
  --ch1: #2563EB;
  --ch1-light: #EFF6FF;
  --ch1-mid: #BFDBFE;
  --ch2: #7C3AED;
  --ch2-light: #F5F3FF;
  --ch2-mid: #DDD6FE;
  --sec-a: #0F766E;
  --sec-a-light: #F0FDFA;
  --sec-b: #B45309;
  --sec-b-light: #FFFBEB;
  --sec-c: #BE185D;
  --sec-c-light: #FDF2F8;
  --dark: #0F172A;
  --mid: #334155;
  --muted: #64748B;
  --border: #E2E8F0;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.1), 0 12px 32px rgba(0,0,0,0.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER ===== */
.site-header {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #1E1B4B 100%);
  color: white;
  padding: 36px 40px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
}

.header-badge {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 22px; font-weight: 800;
  color: white;
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  z-index: 1;
}

.header-text { flex: 1; z-index: 1; }

.school-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
}

.worksheet-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  line-height: 1.15;
  color: white;
  margin-bottom: 12px;
}

.chapter-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.tag-ch1 { background: rgba(59,130,246,0.25); color: #93C5FD; border: 1px solid rgba(59,130,246,0.3); }
.tag-ch2 { background: rgba(139,92,246,0.25); color: #C4B5FD; border: 1px solid rgba(139,92,246,0.3); }

.marks-badge {
  flex-shrink: 0;
  text-align: center;
  z-index: 1;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: white;
  line-height: 1;
}
.marks-badge span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

/* ===== BLUEPRINT ===== */
.blueprint-section {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 28px 0;
}

.section-label {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.blueprint-table-wrap { overflow-x: auto; }

.blueprint-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.blueprint-table thead tr {
  background: var(--dark);
  color: white;
}
.blueprint-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.th-sub { font-weight: 400; opacity: 0.65; font-size: 11px; }
.blueprint-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.blueprint-table tbody tr:last-child td { border-bottom: none; }
.blueprint-table tbody tr:nth-child(even) { background: #F8FAFC; }
.marks-cell {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  text-align: center;
}

.ch-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.ch-dot.ch1 { background: var(--ch1); }
.ch-dot.ch2 { background: var(--ch2); }

/* ===== STUDENT INFO ===== */
.student-info-section {
  background: white;
  border-bottom: 2px solid var(--border);
  padding: 20px 0;
}

.info-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.info-field { display: flex; flex-direction: column; gap: 4px; }
.info-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.info-line {
  width: 200px;
  height: 1px;
  background: var(--dark);
  margin-top: 18px;
}
.info-line.short { width: 120px; }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.progress-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563EB, #7C3AED);
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--mid);
  white-space: nowrap;
}

/* ===== MAIN WORKSHEET ===== */
.worksheet-main { padding: 40px 0 60px; }

/* ===== SECTION BLOCKS ===== */
.section-block { margin-bottom: 48px; }

.section-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.sec-a { background: var(--sec-a-light); border: 1.5px solid #99F6E4; }
.sec-b { background: var(--sec-b-light); border: 1.5px solid #FDE68A; }
.sec-c { background: var(--sec-c-light); border: 1.5px solid #FBCFE8; }

.sec-letter {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 26px; font-weight: 800;
  flex-shrink: 0;
}
.sec-a .sec-letter { background: var(--sec-a); color: white; }
.sec-b .sec-letter { background: var(--sec-b); color: white; }
.sec-c .sec-letter { background: var(--sec-c); color: white; }

.sec-info h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 2px;
}
.sec-info p { font-size: 13px; color: var(--mid); }

/* ===== CHAPTER GROUPS ===== */
.chapter-group { margin-bottom: 28px; }

.chapter-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.ch1-tag { background: var(--ch1-light); color: var(--ch1); border: 1px solid var(--ch1-mid); }
.ch2-tag { background: var(--ch2-light); color: var(--ch2); border: 1px solid var(--ch2-mid); }

/* ===== QUESTION CARDS ===== */
.question-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.question-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.question-card.answered {
  border-color: #86EFAC;
  background: #F0FDF4;
}

.q-number {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--dark);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.question-card.answered .q-number { background: #16A34A; }

.q-body { flex: 1; }

.q-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 14px;
  line-height: 1.55;
}

/* ===== OPTIONS ===== */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13.5px;
  color: var(--mid);
  background: var(--bg);
  user-select: none;
}

.option:hover {
  border-color: #93C5FD;
  background: #EFF6FF;
  color: var(--dark);
}

.option input[type="radio"] {
  accent-color: var(--ch1);
  width: 15px; height: 15px;
  flex-shrink: 0;
}

.option:has(input:checked) {
  border-color: var(--ch1);
  background: var(--ch1-light);
  color: var(--ch1);
  font-weight: 600;
}

/* ===== TEXTAREA ===== */
.answer-box {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--dark);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.6;
}

.answer-box:focus {
  outline: none;
  border-color: var(--ch1);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: white;
}

.answer-box:not(:placeholder-shown) {
  border-color: #86EFAC;
  background: #F0FDF4;
}

/* ===== SUBMIT ===== */
.submit-area {
  text-align: center;
  padding: 40px 0 20px;
}

.submit-btn {
  display: inline-block;
  padding: 16px 48px;
  background: linear-gradient(135deg, #0F172A, #1E3A5F);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(15,23,42,0.3);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15,23,42,0.4);
  background: linear-gradient(135deg, #1E293B, #2563EB);
}

.submit-btn:active { transform: translateY(0); }

.submit-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: white;
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-icon { font-size: 52px; margin-bottom: 16px; }

.modal-box h2 {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 10px;
}

.modal-box p {
  font-size: 15px;
  color: var(--mid);
  margin-bottom: 20px;
}

.modal-score-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}

.modal-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563EB, #7C3AED);
  border-radius: 99px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.modal-close-btn {
  padding: 12px 36px;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}
.modal-close-btn:hover { background: #1E3A5F; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--dark);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 20px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .site-header { padding: 24px 20px; gap: 16px; }
  .marks-badge { font-size: 32px; }
  .options-grid { grid-template-columns: 1fr; }
  .info-grid { gap: 16px; }
  .info-line, .info-line.short { width: 140px; }
  .section-header { padding: 16px 18px; }
  .question-card { padding: 16px 16px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-block {
  animation: fadeSlideUp 0.5s ease both;
}
#sectionA { animation-delay: 0.1s; }
#sectionB { animation-delay: 0.2s; }
#sectionC { animation-delay: 0.3s; }