/* ============================================================
   Chemistry IA Studio — Playful education-brand aesthetic
   Nunito headings · gradient CTAs · 24px radius · doodles
   ============================================================ */
:root {
  --ink: #1f2233;
  --ink-soft: #4b5066;
  --muted: #7a8099;
  --line: #e7e3f3;
  --bg: #faf8ff;
  --card: #ffffff;
  --violet: #7c4dff;
  --violet-2: #9d6bff;
  --teal: #16c2a3;
  --pink: #ff6fae;
  --amber: #ffb020;
  --grad: linear-gradient(135deg, #7c4dff 0%, #16c2a3 100%);
  --grad-soft: linear-gradient(135deg, #f1ebff 0%, #e6fbf6 100%);
  --radius: 24px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(124, 77, 255, 0.10);
  --shadow-sm: 0 4px 14px rgba(31, 34, 51, 0.07);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  padding-bottom: 90px;
}
h1, h2, h3, h4 { font-family: var(--font); font-weight: 800; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
a { color: var(--violet); }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font);
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.6em 1.2em;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(124, 77, 255, 0.28); }
.btn-primary:hover { box-shadow: 0 9px 24px rgba(124, 77, 255, 0.36); }
.btn-soft { background: #f0ebff; color: var(--violet); }
.btn-soft:hover { background: #e6dcff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--violet-2); color: var(--violet); }
.btn-google { background: #fff; color: #333; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-google span { font-weight: 900; color: #4285f4; }
.btn.full { width: 100%; }
.btn.sm { padding: 0.4em 0.9em; font-size: 0.85rem; }
.btn.xs { padding: 0.3em 0.7em; font-size: 0.78rem; }
.center { display: flex; gap: 10px; justify-content: center; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 1.6rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.save-status { font-size: 0.8rem; color: var(--teal); font-weight: 700; }
.save-status.warn { color: var(--pink); }
.tier-badge { font-size: 0.75rem; font-weight: 800; padding: 5px 11px; border-radius: 999px; background: #f0ebff; color: var(--violet); }
.tier-badge.paid { background: linear-gradient(135deg, #ffe9b8, #ffd36e); color: #7a5600; }

/* ---------- hero ---------- */
.hero { background: var(--grad-soft); padding: 48px 22px 40px; position: relative; overflow: hidden; }
.hero-inner { max-width: 880px; margin: 0 auto; position: relative; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.9rem); font-weight: 900; margin: 0 0 14px; letter-spacing: -0.5px; }
.hero-sub { font-size: 1.1rem; color: var(--ink-soft); max-width: 640px; }
.hero-cta-row { display: flex; gap: 12px; margin: 22px 0 26px; flex-wrap: wrap; }
.hero-doodle { position: absolute; font-size: 2.2rem; opacity: 0.5; animation: float 6s ease-in-out infinite; }
.hero-doodle.d1 { top: 4px; right: 8%; }
.hero-doodle.d2 { bottom: 30px; right: 24%; animation-delay: 1.5s; }
.hero-doodle.d3 { top: 30px; right: 38%; animation-delay: 3s; font-size: 1.7rem; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }

.notice-strip { display: grid; gap: 12px; margin-top: 8px; }
.notice {
  background: #fff; border-radius: var(--radius-sm); padding: 14px 18px;
  border-left: 5px solid var(--teal); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
}
.notice strong { font-size: 0.95rem; }
.notice span { color: var(--ink-soft); font-size: 0.92rem; }
.notice-warn { border-left-color: var(--pink); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 340px;
  gap: 22px;
  max-width: 1320px;
  margin: 26px auto;
  padding: 0 22px;
  align-items: start;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 76px;
  background: var(--card); border-radius: var(--radius); padding: 18px 14px;
  box-shadow: var(--shadow-sm);
}
.nav-title { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 0 6px 10px; }
.nav ol { list-style: none; margin: 0; padding: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 9px 8px; border-radius: 12px; font-family: var(--font); font-weight: 700;
  color: var(--ink-soft); font-size: 0.9rem; transition: background 0.12s;
}
.nav-item:hover { background: #f6f2ff; }
.nav-item.active { background: var(--grad-soft); color: var(--violet); }
.nav-num { width: 22px; height: 22px; border-radius: 50%; background: #efeaff; color: var(--violet); font-size: 0.78rem; font-weight: 800; display: grid; place-items: center; flex: none; }
.nav-item.active .nav-num { background: var(--violet); color: #fff; }
.nav-label { flex: 1; }
.nav-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.nav-dot.done { background: var(--teal); box-shadow: 0 0 0 3px rgba(22,194,163,0.18); }
.nav-progress { margin: 14px 6px 10px; }
.bar { height: 8px; background: #eee6ff; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--grad); border-radius: 999px; transition: width 0.3s; }
.nav-progress small { color: var(--muted); font-size: 0.76rem; display: block; margin-top: 6px; }

/* ---------- editor cards ---------- */
.editor { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-sm); scroll-margin-top: 80px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 1.25rem; margin: 0; }
.why-btn { background: none; border: none; color: var(--violet); font-family: var(--font); font-weight: 700; font-size: 0.82rem; cursor: pointer; white-space: nowrap; }
.why-btn:hover { text-decoration: underline; }
.card-why { color: var(--ink-soft); font-size: 0.92rem; margin: 6px 0 14px; }

.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 9px;
  padding: 5px 10px; cursor: pointer; font-family: var(--font); font-size: 0.85rem; color: var(--ink-soft);
}
.toolbar button:hover { border-color: var(--violet-2); color: var(--violet); background: #faf7ff; }
.toolbar .tb-fig { margin-left: auto; }
.tb-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 3px; }

/* inline "Cite" dropdown on each section toolbar */
.tb-cite-wrap { position: relative; display: inline-flex; }
.toolbar .tb-cite { font-weight: 700; }
.cite-menu {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 60;
  min-width: 240px; max-width: 340px; max-height: 300px; overflow-y: auto;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16); padding: 6px;
}
.cite-menu .cite-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 7px 10px; border: none; background: none; border-radius: 8px;
  cursor: pointer; font-family: var(--font); color: var(--ink-soft);
}
.cite-menu .cite-item:hover { background: #faf7ff; }
.cite-key { font-weight: 700; font-size: 0.9rem; color: var(--violet); }
.cite-src { font-size: 0.78rem; color: var(--muted); }
.cite-menu .cite-manage { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; font-weight: 700; }
.cite-menu .cite-manage:hover { background: #f3f0fb; }
.cite-empty { padding: 8px 10px; font-size: 0.85rem; }

/* symbol palette above tables */
.symbar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.symbar-label { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.symbar button {
  border: 1.5px solid var(--line); background: #fff; border-radius: 9px;
  padding: 4px 9px; cursor: pointer; font-family: Arial, Helvetica, sans-serif;
  font-size: 0.88rem; color: var(--ink-soft);
}
.symbar button:hover { border-color: var(--violet-2); color: var(--violet); background: #faf7ff; }
.symbar-hint { font-size: 0.74rem; color: var(--muted); }
.symbar-hint code { background: #f0ebff; padding: 1px 5px; border-radius: 5px; }

.writebox {
  min-height: 90px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 1.7;
  background: #fffdfb; outline: none; transition: border-color 0.15s; position: relative;
}
.writebox:focus { border-color: var(--violet-2); box-shadow: 0 0 0 4px rgba(124,77,255,0.10); }
.writebox[data-show-ph]::before {
  content: attr(data-ph); color: var(--muted); font-style: italic; pointer-events: none;
  position: absolute; top: 14px; left: 16px; right: 16px;
}
.writebox figure { margin: 12px 0; text-align: center; position: relative; }
.writebox img { max-width: 100%; border-radius: 10px; box-shadow: var(--shadow-sm); }
.writebox figcaption { font-size: 0.85rem; color: var(--muted); font-style: italic; margin-top: 6px; font-family: var(--font); }
.writebox .fig-del {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.94);
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.writebox figure:hover .fig-del, .writebox .fig-del:focus-visible { opacity: 1; }
.writebox .fig-del:hover { color: #b00020; border-color: #b00020; }
.writebox ul, .writebox ol { margin: 6px 0; padding-left: 26px; }

/* ---------- tables in editor ---------- */
.tbl-wrap { margin-top: 14px; }
.tbl-label { font-size: 0.82rem; color: var(--muted); margin: 0 0 6px; }
.ia-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ia-table th { text-align: left; background: #f6f2ff; padding: 8px 10px; font-size: 0.8rem; color: var(--violet); }
.ia-table th:first-child { border-top-left-radius: 10px; }
.ia-table td { padding: 4px; border-bottom: 1px solid var(--line); }
.ia-table input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font-family: var(--font); font-size: 0.88rem; }
.ia-table input:focus { outline: none; border-color: var(--violet-2); }
.row-del { background: none; border: none; color: var(--pink); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.add-row { margin-top: 10px; }

/* ---------- guidance panel ---------- */
.guide {
  position: sticky; top: 76px;
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); max-height: calc(100vh - 96px); overflow-y: auto;
}
.guide.hidden { display: none; }
.guide-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.guide-tag { background: var(--grad); color: #fff; font-size: 0.72rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.5px; }
.guide-close { background: none; border: none; font-size: 1.4rem; color: var(--muted); cursor: pointer; line-height: 1; }
.guide-h { font-size: 1.05rem; margin: 4px 0 10px; }
.guide h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 16px 0 8px; }
.rubric-chip { background: var(--grad-soft); border-radius: 12px; padding: 10px 12px; font-size: 0.86rem; color: var(--ink-soft); font-weight: 600; }
.guide-tips { margin: 0; padding-left: 18px; }
.guide-tips li { font-size: 0.89rem; margin-bottom: 8px; color: var(--ink-soft); }
.starters { margin: 0; padding-left: 18px; }
.starters li { font-size: 0.86rem; color: var(--violet); margin-bottom: 6px; font-style: italic; }

.ex { border-radius: 12px; padding: 11px 13px; margin: 9px 0; font-size: 0.85rem; }
.ex p { margin: 5px 0; font-family: var(--serif); }
.ex small { color: var(--muted); }
.ex-tag { font-weight: 800; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; }
.ex-bad { background: #fff2f6; }
.ex-bad .ex-tag { background: #ffd9e6; color: #c0286a; }
.ex-good { background: #ecfbf6; }
.ex-good .ex-tag { background: #c3f3e6; color: #0c8c72; }

.voice-reminder { margin-top: 16px; background: #fff7e8; border-radius: 12px; padding: 11px 13px; font-size: 0.85rem; color: #8a6400; }
.band { margin: 10px 0; }
.band-label { font-weight: 800; color: var(--violet); font-size: 0.85rem; }
.band p { margin: 3px 0 0; font-size: 0.88rem; color: var(--ink-soft); }

/* ---------- export bar ---------- */
.exportbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 35;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(31,34,51,0.06);
}
.exportbar-inner { max-width: 1320px; margin: 0 auto; padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.export-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.export-meta strong { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.export-meta small { color: var(--muted); font-size: 0.8rem; }
.export-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.export-actions.center { margin-top: 16px; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(31,34,51,0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff; border-radius: var(--radius); padding: 28px; width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto; position: relative; box-shadow: var(--shadow);
}
.modal-wide { max-width: 720px; }
.modal-doc { max-width: 820px; }
.modal-x { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 1.6rem; color: var(--muted); cursor: pointer; line-height: 1; }
.modal h2 { margin: 0 0 6px; font-size: 1.4rem; }
.modal label { display: block; font-weight: 700; font-size: 0.85rem; margin: 12px 0 0; color: var(--ink-soft); }
.modal label small { font-weight: 600; color: var(--muted); }
.modal input, .modal select { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-family: var(--font); font-size: 0.92rem; }
.modal input:focus, .modal select:focus { outline: none; border-color: var(--violet-2); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.82rem; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-btn-row { display: flex; gap: 10px; margin-top: 14px; }
.auth-error { color: var(--pink); font-size: 0.85rem; margin-top: 10px; background: #fff2f6; padding: 8px 12px; border-radius: 10px; }
.demo-note { margin-top: 18px; font-size: 0.82rem; color: var(--ink-soft); background: var(--grad-soft); padding: 12px 14px; border-radius: 12px; }
.demo-note code { background: rgba(124,77,255,0.12); padding: 1px 5px; border-radius: 5px; font-size: 0.85em; }

/* references */
.ref-style-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 10px 0 4px; }
.ref-style-row label { margin: 0; }
.ref-style-row select { width: auto; min-width: 140px; }
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ref-grid label { margin-top: 10px; }
.ref-form { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 8px; }
.ref-preview { background: var(--grad-soft); border-radius: 12px; padding: 12px 14px; font-size: 0.88rem; margin: 12px 0; font-family: Arial, Helvetica, sans-serif; }
.ref-list-head { font-size: 1rem; margin: 14px 0 8px; }
.ref-list { padding-left: 20px; margin: 0; }
.ref-list li { margin-bottom: 14px; font-family: Arial, Helvetica, sans-serif; font-size: 0.92rem; }
.ref-list .ref-empty { list-style: none; font-family: var(--font); }
.ref-text { margin-bottom: 6px; }
.ref-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* document preview */
.doc-preview, .pdf-render { background: #fff; }
.doc-preview { border: 1px solid var(--line); border-radius: 12px; padding: 28px 34px; max-height: 60vh; overflow-y: auto; }
/* Exported document: sans-serif, 12 pt everywhere (IB requirement) */
.doc { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #1a1a1a; line-height: 1.5; }
.doc-titlepage { text-align: center; padding: 30px 0 26px; border-bottom: 2px solid var(--line); margin-bottom: 22px; }
.doc-titlepage h1 { font-size: 12pt; }
.doc-sub { color: var(--muted); margin: 2px 0; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; }
.doc-section { margin-bottom: 20px; break-inside: avoid; page-break-inside: avoid; }
.doc-section h2 { font-size: 12pt; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.doc-body, .doc-refs { line-height: 2; } /* double spaced prose */
.doc-body ol, .doc-body ul { margin: 6px 0; padding-left: 28px; }
.doc-body figure { text-align: center; margin: 12px 0; }
.doc-body img { max-width: 100%; border-radius: 6px; }
/* The delete button rides along in the saved section HTML — it is an editor
   affordance only, so it must never appear in the preview, export or print. */
.doc .fig-del, #ia-print-doc .fig-del { display: none !important; }
.doc-body figcaption { font-style: italic; color: var(--muted); font-size: 12pt; }
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 1.4; }
.doc-table th, .doc-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.doc-table th { background: #f6f2ff; }
.doc-refs li { margin-bottom: 8px; }
.pdf-render { position: absolute; left: -9999px; top: 0; width: 794px; padding: 10px 40px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  .nav, .guide { position: static; max-height: none; }
  .nav { order: -1; }
  .guide { order: 3; }
}
@media (max-width: 560px) {
  .ref-grid { grid-template-columns: 1fr; }
  .export-meta strong { max-width: 38vw; }
  .hero-doodle { display: none; }
}

/* ============================================================
   PART 2 — Data analysis
   ============================================================ */
.part-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 34px 0 6px; font-family: var(--font);
  font-weight: 900; font-size: 1.15rem; color: var(--ink-soft);
}
.part-divider::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.pd-state { font-size: 0.75rem; font-weight: 700; font-style: normal; padding: 3px 10px; border-radius: 99px; }
.pd-state.locked { background: #fff3e6; color: #b35c00; }
.pd-state.unlocked { background: #e6f7ee; color: #0b7a44; }

/* lock gate */
.gate-card { text-align: center; padding: 38px 28px; }
.gate-lock { font-size: 2.6rem; }
.gate-card h2 { margin: 8px 0 6px; }
.gate-list {
  list-style: none; padding: 0; margin: 16px auto 20px; max-width: 420px; text-align: left;
}
.gate-list li { padding: 7px 0 7px 28px; position: relative; border-bottom: 1px dashed var(--line); }
.gate-list li::before { content: "✦"; position: absolute; left: 6px; color: var(--violet); }

/* nav extras */
.nav-group {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 12px 0 4px; padding-left: 8px; list-style: none;
}
.nav-lock { font-size: 0.7rem; margin-left: auto; }
.nav-item.nav-locked { opacity: 0.6; }

/* multi-table builder */
.mt-wrap { margin-top: 14px; }
.mt-table {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 14px;
  margin-bottom: 16px; background: #fcfbff;
}
.mt-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.mt-title {
  flex: 1; border: none; border-bottom: 2px dashed var(--line); background: transparent;
  font-family: var(--font); font-weight: 700; font-size: 1rem; padding: 4px 2px;
}
.mt-title:focus { outline: none; border-bottom-color: var(--violet-2); }
.mt-scroll { overflow-x: auto; }
.mt-grid th { min-width: 130px; vertical-align: top; }
.mt-th { display: flex; align-items: center; gap: 4px; }
.mt-header {
  width: 100%; border: 1px solid transparent; background: transparent; font-weight: 700;
  font-size: 0.82rem; padding: 3px 4px; border-radius: 6px;
}
.mt-header:hover, .mt-header:focus { border-color: var(--violet-2); background: #fff; outline: none; }
.mt-del-col {
  border: none; background: none; color: var(--muted); cursor: pointer; font-size: 0.9rem;
  padding: 0 2px; line-height: 1;
}
.mt-del-col:hover { color: #c92a2a; }
.mt-addcol-th { width: 60px; }
.mt-add-row { margin-top: 8px; }
.dp-warn {
  margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 0.82rem;
  background: #fff8e1; border: 1.5px solid #ffe08a; color: #7a5800;
}

/* graph builder */
.graph-wrap { margin-top: 16px; }
.graph-controls {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end;
  padding: 12px; border: 1.5px solid var(--line); border-radius: 14px; background: #fcfbff;
  margin-bottom: 12px;
}
.graph-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.graph-controls select, .graph-controls input[type="text"] {
  border: 1.5px solid var(--line); border-radius: 9px; padding: 6px 8px; font-size: 0.88rem; min-width: 130px;
}
.graph-controls .gcheck { flex-direction: row; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--ink-soft); }
.gpp { padding: 10px 12px; border: 1.5px dashed var(--line); border-radius: 12px; margin-bottom: 12px; }
.gpp-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.gpp-row { display: flex; gap: 12px; align-items: center; padding: 3px 0; font-size: 0.86rem; }
.gpp-pt { min-width: 130px; font-family: monospace; }
.gpp-row input { width: 90px; border: 1.5px solid var(--line); border-radius: 7px; padding: 3px 6px; }
.graph-canvas-wrap { text-align: center; }
#gCanvas { max-width: 100%; border: 1.5px solid var(--line); border-radius: 12px; }
.graph-empty { color: var(--muted); font-size: 0.9rem; padding: 28px 0; }
.graph-stats {
  margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #f3f0fa;
  font-size: 0.9rem; line-height: 1.7;
}

/* exported doc bits */
.doc-tbl-caption { margin: 14px 0 4px; }
.doc-graph { text-align: center; margin: 12px 0; }
.doc-graph img { max-width: 100%; border: 1px solid #ddd; }
.doc-graph figcaption { font-size: 0.85rem; font-style: italic; color: #555; margin-top: 6px; }

/* ============================================================
   LANDING / SUBJECT HUB
   ============================================================ */
.brand-home {
  text-decoration: none; color: var(--violet); font-weight: 900; font-size: 1.2rem;
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
  border: 1.5px solid var(--line); margin-right: 4px;
}
.brand-home:hover { background: #f6f2ff; border-color: var(--violet-2); }

.hub-body { padding-bottom: 40px; }
.hub-topbar {
  display: flex; align-items: center; padding: 14px 26px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.hub-hero { background: var(--grad-soft); padding: 52px 22px 48px; text-align: left; position: relative; overflow: hidden; }
.hub-hero::before, .hub-hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
  opacity: 0.55; pointer-events: none;
}
.hub-hero::before { width: 440px; height: 440px; background: #dcc9ff; top: -160px; left: -130px; }
.hub-hero::after { width: 400px; height: 400px; background: #bdf2e2; bottom: -170px; right: -110px; }
.hub-hero-inner {
  max-width: 1080px; margin: 0 auto; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px; align-items: center;
}
.hub-hero-copy .hub-sub { margin: 0 0 18px; }
.hub-hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); font-weight: 900; letter-spacing: -0.5px; margin: 0 0 16px; }
.hub-sub { font-size: 1.15rem; color: var(--ink-soft); max-width: 620px; margin: 0 auto 18px; }
.hub-pick { font-weight: 800; color: var(--violet); margin: 8px 0 0; }

.hub-grid {
  max-width: 1080px; margin: -20px auto 0; padding: 0 22px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px;
}
.subject-card {
  position: relative; display: block; text-decoration: none; color: inherit;
  background: var(--card); border-radius: var(--radius); padding: 26px 24px 58px;
  box-shadow: var(--shadow); border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(124,77,255,0.18); border-color: var(--violet-2); }
.subject-card.disabled { opacity: 0.62; }
.subject-emoji {
  width: 56px; height: 56px; display: grid; place-items: center;
  font-size: 1.75rem; line-height: 1; border-radius: 16px;
  background: var(--acc-soft, #f0ebff); border: 1.5px solid var(--acc-line, #e2d6ff);
}
.hub-group.g-core { --acc-soft: #f0ebff; --acc-line: #ded2ff; }
.hub-group.g1 { --acc-soft: #ffeef5; --acc-line: #ffd4e5; }
.hub-group.g2 { --acc-soft: #fff4e2; --acc-line: #ffe2ba; }
.hub-group.g3 { --acc-soft: #e8f3ff; --acc-line: #cde4ff; }
.hub-group.g4 { --acc-soft: #e6faf3; --acc-line: #c6efe0; }
.hub-group.g5 { --acc-soft: #eff0ff; --acc-line: #dbdeff; }
.hub-group.g6 { --acc-soft: #fdeff2; --acc-line: #f9d7de; }
.subject-card h2 { font-size: 1.5rem; margin: 12px 0 8px; }
.subject-card > p { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 14px; }
.subject-feats { list-style: none; margin: 0; padding: 0; }
.subject-feats li { font-size: 0.85rem; color: var(--ink-soft); padding: 6px 0 6px 22px; position: relative; border-top: 1px dashed var(--line); }
.subject-feats li::before { content: "✓"; position: absolute; left: 2px; color: var(--teal); font-weight: 900; }
.subject-go { position: absolute; bottom: 22px; left: 24px; font-weight: 800; color: var(--violet); }
.subject-go.muted { color: var(--muted); }
.subject-badge { position: absolute; top: 20px; right: 20px; font-size: 0.7rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; }
.subject-badge.ready { background: #e6f7ee; color: #0b7a44; }
.subject-badge.soon { background: #f0ecfa; color: var(--muted); }
.subject-card.bio.ready:hover { border-color: var(--teal); }
.hub-foot { max-width: 1080px; margin: 30px auto 0; padding: 0 26px; text-align: center; }

/* ============================================================
   LIVE EXAMINER — mark-readiness chips
   ============================================================ */
.exm { margin: 0 0 12px; }
.exm:empty { display: none; }
.exm-head {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: none; border: none; font-family: var(--font); padding: 0; margin-bottom: 6px;
}
.exm-chip { font-size: 0.78rem; font-weight: 800; padding: 4px 11px; border-radius: 99px; }
.exm-chip.ok { background: #e6f7ee; color: #0b7a44; }
.exm-chip.todo { background: #fff3e0; color: #b35c00; }
.exm-score { font-size: 0.76rem; font-weight: 800; color: var(--muted); }
.exm-caret { font-size: 0.7rem; color: var(--muted); }
.exm-list {
  list-style: none; margin: 2px 0 0; padding: 10px 14px; border-radius: 12px;
  background: #fbf7ff; border: 1.5px solid var(--line);
}
.exm-list li { font-size: 0.84rem; color: var(--ink-soft); padding: 3px 0; }
.exm-list li.exm-warn { color: #b3261e; font-weight: 700; }
.exm-list li.exm-alldone { color: #0b7a44; }
.exm.is-done .exm-list { background: #f0fbf5; border-color: #cdeedd; }

.readiness-wrap { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.readiness-top { display: flex; justify-content: space-between; font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); margin-bottom: 5px; }
.readiness-top strong { color: var(--amber); }
.bar-amber .bar-fill { background: linear-gradient(135deg, #ffb020, #ff8a3d); }
.readiness-wrap small { color: var(--muted); font-size: 0.72rem; display: block; margin-top: 6px; }

/* ============================================================
   SEO content + FAQ (hub)
   ============================================================ */
.seo { max-width: 860px; margin: 40px auto 0; padding: 0 26px; }
.seo-inner h2 { font-size: 1.5rem; margin: 28px 0 10px; }
.seo-inner h3 { font-size: 1.12rem; margin: 20px 0 6px; color: var(--violet); }
.seo-inner p { color: var(--ink-soft); font-size: 0.98rem; line-height: 1.7; margin: 0 0 10px; }
.faq { margin-top: 8px; }
.seo-acc .faq { margin: 2px 0 14px; }
.seo-acc .faq details, .seo-acc .seo-acc { background: #fbf9ff; }
.seo-acc > .seo-acc:last-of-type { margin-bottom: 14px; }
.faq details {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px 18px; margin-bottom: 10px; background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.faq details:hover { border-color: var(--violet-2); }
.faq details[open] { border-color: var(--violet-2); box-shadow: var(--shadow-sm); }
.faq summary {
  cursor: pointer; font-weight: 800; color: var(--ink); padding: 13px 0;
  list-style: none; font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: #f0ebff; color: var(--violet); font-weight: 900; font-size: 1.05rem;
  display: grid; place-items: center; line-height: 1;
  transition: transform 0.2s ease, background 0.15s, color 0.15s;
}
.faq details[open] summary::after { content: "+"; transform: rotate(45deg); background: var(--violet); color: #fff; }
.faq details p { padding-bottom: 16px; margin: 0; animation: acc-fade 0.22s ease; }
@keyframes acc-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   2026-07 conversion additions: trust strip, price notes,
   gate sneak-peek, email capture, feedback bar
   ============================================================ */

/* ---------- trust strip (hero) ---------- */
.trust-strip {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px;
  margin: 14px 0 0; padding: 0;
}
.trust-strip li {
  font-size: 0.85rem; font-weight: 700; color: var(--ink-soft);
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 5px 13px;
}

/* ---------- price notes ---------- */
.price-note {
  margin: 12px 0 0; font-size: 0.92rem; color: var(--ink-soft);
}
.price-note strong { color: var(--violet); }
.gate-price-note {
  margin-top: 10px; font-size: 0.88rem; color: var(--muted);
}

/* ---------- gate sneak peek ---------- */
.gate-peek {
  text-align: left; background: #faf8ff; border: 1.5px solid var(--line);
  border-radius: 16px; padding: 16px 18px; margin: 18px 0;
}
.gate-peek-title { font-weight: 800; font-size: 0.92rem; margin: 0 0 10px; }
.gate-peek-more { font-size: 0.85rem; margin: 10px 0 0; }

/* ---------- email capture ---------- */
.lead-box {
  background: #fff; border: 2px solid var(--line); border-radius: 20px;
  padding: 22px 24px; margin: 30px 0;
}
.lead-box h3 { margin: 0 0 6px; }
.lead-box p { margin: 0 0 12px; color: var(--ink-soft); font-size: 0.95rem; }
.lead-form { display: flex; gap: 10px; flex-wrap: wrap; }
.lead-form input[type="email"] {
  flex: 1 1 220px; padding: 0.65em 1em; border: 1.5px solid var(--line);
  border-radius: 12px; font-family: inherit; font-size: 0.95rem;
}
.lead-form input[type="email"]:focus { outline: none; border-color: var(--violet); }
.lead-done { font-weight: 700; color: var(--ink); }

/* ---------- feedback bar ---------- */
.fb-bar {
  position: fixed; right: 18px; bottom: 104px; z-index: 60;
  background: #fff; border: 2px solid var(--line); border-radius: 18px;
  padding: 14px 18px; max-width: 330px;
  box-shadow: 0 12px 34px rgba(31, 34, 51, 0.16);
}
.fb-bar .fb-x {
  position: absolute; top: 6px; right: 10px; border: none; background: none;
  font-size: 1.1rem; color: var(--muted); cursor: pointer;
}
.fb-q { font-weight: 700; font-size: 0.92rem; margin: 0 14px 8px 0; }
.fb-stars { display: flex; gap: 4px; }
.fb-star {
  border: none; background: none; font-size: 1.5rem; cursor: pointer;
  color: var(--muted); padding: 0 2px;
}
.fb-star.on { color: #f5a623; }
.fb-follow { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.fb-comment {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 0.88rem; padding: 8px 10px; resize: vertical;
}
.fb-thanks { font-weight: 700; margin: 4px 0 0; }
@media (max-width: 560px) { .fb-bar { right: 10px; left: 10px; max-width: none; } }

/* ---------- homepage subject carousels (2026-07-06) ---------- */
.hub-group { position: relative; scroll-margin-top: 76px; }
.hub-grid.carousel .subject-card h2 { font-size: 1.22rem; }
.hub-grid.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 22px;
  padding: 8px 22px 26px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.hub-grid.carousel::-webkit-scrollbar { display: none; }
.hub-grid.carousel .subject-card {
  flex: 0 0 320px;
  max-width: 320px;
  scroll-snap-align: start;
}
@media (max-width: 560px) {
  .hub-grid.carousel .subject-card { flex-basis: 84vw; max-width: 84vw; }
}
.hub-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff; color: var(--violet);
  font-size: 1.25rem; font-weight: 900; cursor: pointer;
  box-shadow: 0 6px 18px rgba(31, 34, 51, 0.12);
  display: grid; place-items: center;
  transition: opacity 0.15s, border-color 0.15s;
}
.hub-arrow:hover { border-color: var(--violet-2); }
.hub-arrow.prev { left: 10px; }
.hub-arrow.next { right: 10px; }
.hub-arrow[disabled] { opacity: 0.25; cursor: default; }
.hub-arrow.hidden { display: none; }
@media (max-width: 700px) { .hub-arrow { display: none; } }

/* ---------- testimonial wall (hidden until quotes exist) ---------- */
.testi-grid {
  max-width: 1080px; margin: 14px auto 0; padding: 0 22px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px;
}
.testi-card {
  margin: 0; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px;
  border: 2px solid transparent;
}
.testi-stars { color: #f5a623; font-size: 1.05rem; letter-spacing: 2px; margin-bottom: 8px; }
.testi-card blockquote {
  margin: 0 0 12px; font-size: 0.98rem; line-height: 1.55; color: var(--ink);
}
.testi-card figcaption { font-weight: 800; font-size: 0.88rem; color: var(--violet); }
.testi-card .testi-where { color: var(--muted); font-weight: 700; }

/* ---------- subject cards: two-link layout (frame + ideas) ---------- */
.subject-card { cursor: pointer; }
.subject-go { text-decoration: none; }
.subject-ideas {
  position: absolute; bottom: 18px; right: 20px;
  font-weight: 800; font-size: 0.82rem; text-decoration: none;
  color: var(--ink-soft); background: #fff;
  border: 1.5px solid var(--line); border-radius: 999px; padding: 5px 12px;
  transition: border-color 0.12s, color 0.12s;
}
.subject-ideas:hover { border-color: var(--violet-2); color: var(--violet); }

/* footer row inside cards that have both a frame link and an ideas pill */
.subject-links {
  position: absolute; left: 24px; right: 20px; bottom: 16px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 9px;
}
.subject-links .subject-go, .subject-links .subject-ideas { position: static; }
.subject-card:has(.subject-links) { padding-bottom: 96px; }

/* ---------- homepage hero rework (2026-07-07) ---------- */
html { scroll-behavior: smooth; }
.hub-announce {
  display: inline-block; margin-bottom: 18px; text-decoration: none;
  font-size: 0.9rem; font-weight: 700; color: var(--violet);
  background: #efeafe; border: 1.5px solid #ded2ff; border-radius: 999px;
  padding: 7px 16px; transition: border-color 0.15s, transform 0.15s;
}
.hub-announce:hover { border-color: var(--violet); transform: translateY(-1px); }
.hub-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 16px; }
.btn-lg { padding: 0.85em 1.8em; font-size: 1.05rem; }
.hub-hero .price-note { max-width: 620px; margin: 0; }
a.btn { text-decoration: none; }

/* ---------- hero product mock (2026-07-16) ---------- */
.mock-window {
  background: #fff; border-radius: 20px; border: 1.5px solid var(--line);
  box-shadow: 0 26px 60px rgba(124, 77, 255, 0.20);
  overflow: hidden; transform: rotate(1.25deg);
}
.mock-bar {
  display: flex; align-items: center; gap: 6px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); background: #faf8ff;
}
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: #e4def2; }
.mock-bar em { font-style: normal; font-size: 0.72rem; font-weight: 800; color: var(--muted); margin-left: 8px; }
.mock-cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; padding: 18px 16px; }
.mock-h { height: 12px; width: 62%; border-radius: 6px; background: #e5ddf9; margin: 2px 0 12px; }
.mock-h.w2 { width: 46%; margin-top: 16px; }
.mock-l { height: 8px; border-radius: 4px; background: #f0edf9; margin-bottom: 9px; }
.mock-l.short { width: 68%; }
.mock-panel {
  background: #fbf9ff; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 12px 14px; align-self: start;
}
.mock-crit {
  margin: 0 0 9px; font-size: 0.68rem; font-weight: 900;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--violet);
}
.mock-check { margin: 0 0 6px; font-size: 0.78rem; font-weight: 700; }
.mock-check.ok { color: #0b7a44; }
.mock-check.todo { color: #b35c00; }
.mock-ready { height: 8px; border-radius: 99px; background: #ece7f9; overflow: hidden; margin-top: 11px; }
.mock-ready span { display: block; height: 100%; width: 72%; border-radius: 99px; background: var(--grad); }
.mock-ready-label { margin: 6px 0 0; font-size: 0.72rem; font-weight: 800; color: var(--muted); }
@media (max-width: 980px) {
  .hub-hero { text-align: center; }
  .hub-hero-inner { grid-template-columns: 1fr; gap: 0; }
  .hub-hero-mock { display: none; }
  .hub-hero-copy .hub-sub { margin: 0 auto 18px; }
  .hub-cta-row { justify-content: center; }
  .hub-hero .price-note { margin: 0 auto; }
}

/* Diploma Pass thank-you banner (homepage, ?pass=1) */
.pass-banner {
  background: var(--grad, linear-gradient(90deg, #7c4dff, #ff6fae)); color: #fff;
  text-align: center; font-weight: 700; font-size: 0.95rem;
  padding: 12px 20px;
}

/* ---------- homepage SEO prose as compact accordions ---------- */
.seo-acc {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 4px 18px; margin-bottom: 10px; background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.seo-acc:hover { border-color: var(--violet-2); }
.seo-acc[open] { border-color: var(--violet-2); box-shadow: var(--shadow-sm); }
.seo-acc > summary {
  cursor: pointer; font-weight: 800; color: var(--ink); padding: 13px 0;
  list-style: none; font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.seo-acc > summary h3 { display: inline; font-size: 1rem; margin: 0; }
.seo-acc > summary::-webkit-details-marker { display: none; }
.seo-acc > summary::after {
  content: "+"; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: #f0ebff; color: var(--violet); font-weight: 900; font-size: 1.05rem;
  display: grid; place-items: center; line-height: 1;
  transition: transform 0.2s ease, background 0.15s, color 0.15s;
}
.seo-acc[open] > summary::after { transform: rotate(45deg); background: var(--violet); color: #fff; }
.seo-acc p { padding-bottom: 16px; margin: 0; animation: acc-fade 0.22s ease; }

/* ---------- subject-picker group tabs ---------- */
.group-tabs {
  max-width: 1080px; margin: 30px auto 0; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.group-tab {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  font-family: var(--font); font-weight: 800; font-size: 0.92rem;
  border-radius: 999px; padding: 9px 18px; cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s, transform 0.12s;
}
.group-tab:hover { border-color: var(--violet-2); color: var(--violet); transform: translateY(-1px); }
.group-tab.active {
  background: var(--grad, linear-gradient(90deg, #7c4dff, #9d6bff)); color: #fff;
  border-color: transparent;
}

/* ---------- official IB subject brief reference link ---------- */
.ib-official {
  font-size: 0.88rem; color: var(--muted); margin: 8px 0 0;
}
.ib-official a {
  color: var(--violet); font-weight: 700; text-decoration: none;
  border-bottom: 1.5px dashed var(--violet-2);
}
.ib-official a:hover { border-bottom-style: solid; }

/* ---------- sub-headings inside consolidated seo accordions ---------- */
.seo-acc h4 {
  font-size: 0.95rem; font-weight: 800; color: var(--violet);
  margin: 14px 0 4px;
}
.seo-acc h4:first-of-type { margin-top: 4px; }
