/* Chemdu — Chemistry for Everyone
   Brand palette + shared styles */

:root {
  --blue: #1a3c5e;
  --blue-dark: #122c46;
  --blue-light: #2a557f;
  --yellow: #f4c542;
  --yellow-dark: #d9ad2c;
  --green: #2e7d32;
  --green-dark: #225a26;
  --bg-light: #f8f9fa;
  --text-dark: #212529;
  --text-light: #ffffff;
  --text-muted: #5a6470;
  --border: #dee2e6;
  --shadow: 0 2px 8px rgba(26, 60, 94, 0.08);
  --shadow-lg: 0 8px 24px rgba(26, 60, 94, 0.12);
  --radius: 8px;
  --radius-lg: 14px;
  --max: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text-dark);
  background: var(--text-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--blue);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header / Nav ---------- */
.site-header {
  background: var(--text-light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  max-width: var(--max);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--blue);
}
.brand:hover { text-decoration: none; }
.brand svg { width: 36px; height: 36px; flex-shrink: 0; }
.brand small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a.active { color: var(--blue); text-decoration: none; }
.nav-links a.active { border-bottom: 2px solid var(--yellow); padding-bottom: 2px; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 1.5rem;
  color: var(--blue);
  cursor: pointer;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    gap: 0.9rem;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  border: 0;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-size: 1rem;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-secondary { background: var(--green); color: #fff; }
.btn-secondary:hover { background: var(--green-dark); color: #fff; }
.btn-yellow { background: var(--yellow); color: var(--blue); }
.btn-yellow:hover { background: var(--yellow-dark); }
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: #fff; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---------- Sections ---------- */
section { padding: 4rem 0; }
section.alt { background: var(--bg-light); }
.section-title { text-align: center; margin-bottom: 0.4em; }
.section-lead { text-align: center; max-width: 720px; margin: 0 auto 2.5rem; color: var(--text-muted); font-size: 1.1rem; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(circle at 85% 20%, rgba(244,197,66,0.18), transparent 55%),
    radial-gradient(circle at 15% 90%, rgba(46,125,50,0.12), transparent 55%),
    linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: #fff;
  padding: 5rem 0 5.5rem;
  position: relative;
  overflow: hidden;
}
.hero h1 { color: #fff; max-width: 850px; }
.hero .lead {
  font-size: 1.25rem;
  max-width: 720px;
  margin: 1rem 0 2rem;
  color: rgba(255,255,255,0.92);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; }

/* decorative molecule */
.hero-deco {
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  width: 380px;
  height: 380px;
  opacity: 0.18;
  pointer-events: none;
}
@media (max-width: 820px) { .hero-deco { display: none; } }

/* ---------- Page header (sub-pages) ---------- */
.page-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: #fff;
  padding: 3.5rem 0 3rem;
}
.page-header h1 { color: #fff; }
.page-header p { color: rgba(255,255,255,0.92); font-size: 1.15rem; max-width: 760px; }

/* ---------- Cards / Grids ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.step-card {
  text-align: center;
  position: relative;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--blue);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

/* ---------- Stats / Counters ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }
.stat {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: #fff;
}
.stat .num {
  font-family: 'Poppins', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--yellow);
  display: block;
  line-height: 1;
}
.stat .label { font-size: 1rem; margin-top: 0.5rem; opacity: 0.95; }

/* ---------- Quote / Testimonial ---------- */
.quote {
  border-left: 4px solid var(--yellow);
  padding: 1rem 1.5rem;
  background: var(--bg-light);
  font-style: italic;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quote cite { display: block; font-style: normal; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.9rem; }

/* ---------- CTA band ---------- */
.cta-band {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: #fff;
  padding: 4rem 0;
  text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band .btn-row { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- Forms ---------- */
.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 760px;
  margin: 0 auto;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--blue);
}
.field .req { color: #c0392b; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 60, 94, 0.15);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-help { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

.form-success {
  display: none;
  background: #e8f5e9;
  border: 1px solid var(--green);
  color: var(--green-dark);
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  font-weight: 500;
}
.form-success.show { display: block; }

/* ---------- Eligibility list ---------- */
.check-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.check-list li {
  position: relative;
  padding: 0.5rem 0 0.5rem 2rem;
}
.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 22px;
  height: 22px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ---------- Chart container ---------- */
.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.chart-source {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* ---------- Curriculum cards (detailed) ---------- */
.curr-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}
.curr-card:hover { box-shadow: var(--shadow-lg); }
.curr-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, #1a3c5e 0%, #2a557f 100%);
  color: #fff;
  cursor: pointer;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
}
.curr-head:hover { background: linear-gradient(135deg, #122c46 0%, #1a3c5e 100%); }
.curr-num {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--yellow);
  color: var(--blue);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}
.curr-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
}
.curr-meta {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}
.curr-toggle {
  font-size: 1.4rem;
  color: var(--yellow);
  transition: transform 0.2s ease;
}
.curr-card.open .curr-toggle { transform: rotate(180deg); }

.curr-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.curr-card.open .curr-body { max-height: 1500px; }
.curr-body-inner { padding: 1.5rem; }

.curr-body h4 {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green);
}
.curr-body h4:first-child { margin-top: 0; }
.curr-body p { margin: 0 0 0.5rem; }
.curr-body ul { padding-left: 1.25rem; margin: 0 0 0.5rem; }
.curr-key {
  background: var(--bg-light);
  border-left: 4px solid var(--yellow);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 0.85rem 0;
  font-style: italic;
}
.curr-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) { .curr-row { grid-template-columns: 1fr; } }

.curr-actions {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.curr-actions .btn { font-size: 0.9rem; }

@media (max-width: 700px) {
  .curr-head { grid-template-columns: auto 1fr auto; gap: 0.6rem; padding: 0.9rem 1rem; }
  .curr-meta { display: none; }
  .curr-actions { justify-content: stretch; }
  .curr-actions .btn { width: 100%; text-align: center; }
  .curr-title { font-size: 0.95rem; }
}

/* ---------- US Map ---------- */
.us-map {
  width: 100%;
  max-width: 900px;
  margin: 2rem auto 0;
}
.us-map svg { width: 100%; height: auto; }
.us-map .state { fill: #cdd5dd; stroke: #fff; stroke-width: 0.6; transition: fill 0.15s ease; }
.us-map .state.high-need { fill: var(--yellow); }
.us-map .state:hover { fill: var(--blue); cursor: pointer; }
.us-map .state.high-need:hover { fill: var(--yellow-dark); }
.map-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.legend-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin: 0 auto; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: #fff;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  background: none;
  border: 0;
  padding: 1.1rem 1.25rem;
  text-align: left;
  font: 600 1.05rem 'Poppins', sans-serif;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-q::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--yellow-dark);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.faq-item.open .faq-q::after { content: "−"; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.2s ease;
  padding: 0 1.25rem;
  color: var(--text-dark);
}
.faq-item.open .faq-a { max-height: 500px; padding: 0 1.25rem 1.1rem; }

/* ---------- Curriculum lectures ---------- */
.lecture-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
@media (max-width: 700px) { .lecture-grid { grid-template-columns: 1fr; } }
.lecture {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--yellow);
}
.lecture .num {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--blue);
  min-width: 1.8rem;
}
.lecture .title { font-weight: 600; color: var(--blue); }
.lecture .desc { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--blue-dark);
  color: #cfd8e3;
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 1000px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: 1rem; }
.site-footer a { color: #cfd8e3; }
.site-footer a:hover { color: var(--yellow); text-decoration: none; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 0.45rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: #8c98a6;
}
.site-footer .brand { color: #fff; }
.site-footer .brand small { color: #8c98a6; }

/* ---------- Admin ---------- */
.gate {
  max-width: 420px;
  margin: 5rem auto;
  padding: 2.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: center;
}
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  background: none;
  border: 0;
  padding: 0.75rem 1.25rem;
  font: 600 0.95rem 'Poppins', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--yellow); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

table.admin {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.admin th, table.admin td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
table.admin th { background: var(--bg-light); color: var(--blue); font-family: 'Poppins', sans-serif; }
table.admin tr:last-child td { border-bottom: 0; }
.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status.new { background: #fff3cd; color: #8a6d09; }
.status.contacted { background: #cfe2ff; color: #084298; }
.status.matched { background: #d1e7dd; color: #0f5132; }
.status.active { background: #d1e7dd; color: #0f5132; }
.status.attention { background: #f8d7da; color: #842029; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.matchmaker {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) { .matchmaker { grid-template-columns: 1fr; } }
.matchmaker select { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); }

.email-log {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.email-log .entry {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.email-log .entry:last-child { border-bottom: 0; }
.email-log .entry time { color: var(--text-muted); font-size: 0.8rem; margin-right: 0.5rem; }

/* ---------- Classroom (whiteboard + molecule viewer + slides) ---------- */
.tool-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

/* ===== Whiteboard ===== */
.wb-card.fs {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999;
  margin: 0 !important;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.wb-card.fs .wb-shell { flex: 1; min-height: 0; }
.wb-card.fs .wb-toolbar { flex-shrink: 0; }

.wb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
/* Secondary toolbar row: collapsible. */
.wb-toolbar-secondary {
  background: #fff;
  border-bottom: 1px solid var(--border);
  transition: padding 0.18s ease, opacity 0.18s ease;
  overflow: hidden;
}
.wb-toolbar-secondary.collapsed {
  padding: 0;
  height: 0;
  border-bottom: 0;
  opacity: 0;
  pointer-events: none;
}
#wb-more-toggle.active { background: var(--blue); color: #fff; }
.wb-toolbar > .wb-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 0.25rem;
}
.wb-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.4rem 0.6rem;
  font: 500 0.85rem 'Open Sans', sans-serif;
  color: var(--blue);
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s, transform 0.05s;
  min-width: 36px;
  height: 36px;
}
.wb-tool-btn:hover { border-color: var(--blue); }
.wb-tool-btn.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue-dark);
}
.wb-tool-btn svg { width: 18px; height: 18px; }
.wb-pens {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.2rem;
  padding: 0 0.15rem;
}
.wb-pen {
  width: 36px;
  height: 44px;
  border: 0; padding: 0; background: transparent;
  cursor: pointer;
  border-radius: 4px;
  position: relative;
  transition: transform 0.12s ease, filter 0.15s ease;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
}
.wb-pen svg { display: block; width: 100%; height: 100%; }
.wb-pen:hover { transform: translateY(-3px); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.22)); }
.wb-pen.active {
  transform: translateY(-6px);
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.28));
}
.wb-pen.active::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px;
  bottom: -7px;
  height: 4px;
  background: var(--yellow);
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(244,197,66,0.5);
}
.wb-toolbar label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0.15rem;
}
.wb-toolbar select,
.wb-toolbar input[type="color"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
  height: 36px;
}
.wb-toolbar input[type="color"] { padding: 2px; width: 36px; }

.wb-save-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  min-width: 220px;
  padding: 0.3rem;
  flex-direction: column;
  display: none;        /* default: hidden until JS opens it */
}
.wb-save-menu.open { display: flex; }
.wb-save-menu[hidden] { display: none; }
.wb-save-menu button {
  background: transparent;
  border: 0;
  padding: 0.55rem 0.75rem;
  font: 500 0.9rem 'Open Sans', sans-serif;
  color: var(--blue);
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
}
.wb-save-menu button:hover { background: var(--bg-light); }

.wb-page-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  height: 36px;
  padding: 0 0.6rem;
  background: var(--blue);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 6px;
}

/* Layout */
.wb-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  transition: grid-template-columns 0.25s ease;
}
.wb-shell.collapsed { grid-template-columns: 36px 1fr; }
.wb-shell.collapsed .wb-palette > *:not(.wb-collapse) { display: none; }
.wb-shell.collapsed .wb-palette { padding: 0.5rem 0; align-items: center; }
.wb-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 0.85rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--blue);
  transition: background 0.15s ease;
}
.wb-collapse:hover { background: var(--bg-light); }
.wb-shell.collapsed .wb-collapse {
  margin-bottom: 0;
  border: 0;
  background: transparent;
}
@media (max-width: 820px) { .wb-shell { grid-template-columns: 1fr; } .wb-shell.collapsed { grid-template-columns: 1fr; } .wb-collapse { display: none; } }

.wb-palette {
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 0.85rem;
  overflow-y: auto;
  max-height: 580px;
}
.wb-card.fs .wb-palette { max-height: none; }
@media (max-width: 820px) {
  .wb-palette { border-right: 0; border-bottom: 1px solid var(--border); max-height: 280px; }
}

.wb-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.85rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px;
}
.wb-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 0.4rem 0.5rem;
  font: 600 0.82rem 'Poppins', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 5px;
}
.wb-tab.active { background: var(--blue); color: #fff; }
.wb-panel { display: none; }
.wb-panel.active { display: block; }

.wb-palette h4 {
  color: var(--blue);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0.85rem 0 0.4rem;
  font-weight: 700;
}
.wb-palette h4:first-of-type { margin-top: 0.25rem; }

.wb-stamps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}
.wb-stamp {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  transition: border-color 0.1s ease, transform 0.1s ease;
}
.wb-stamp:hover { border-color: var(--blue); transform: translateY(-1px); }
.wb-stamp svg { width: 100%; height: 100%; }
.wb-stamp.active { border-color: var(--yellow-dark); border-width: 2px; box-shadow: 0 0 0 2px rgba(244,197,66,0.25); }

/* Periodic table */
.wb-ptable {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  grid-auto-rows: minmax(0, auto);
  gap: 2px;
  font-family: 'Poppins', sans-serif;
}
.wb-elem {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  color: var(--blue);
  padding: 1px;
  text-align: center;
  line-height: 1;
  user-select: none;
}
.wb-elem:hover { background: var(--yellow); border-color: var(--yellow-dark); }
.wb-elem.cat-1 { background: #fde7d8; }   /* alkali */
.wb-elem.cat-2 { background: #f9d39c; }   /* alkaline earth */
.wb-elem.cat-3 { background: #cfe6f6; }   /* transition */
.wb-elem.cat-4 { background: #d6e3f7; }   /* post-transition */
.wb-elem.cat-5 { background: #d0e9d4; }   /* metalloid */
.wb-elem.cat-6 { background: #fff5b8; }   /* nonmetal */
.wb-elem.cat-7 { background: #f7c8c4; }   /* halogen */
.wb-elem.cat-8 { background: #c5e0fa; }   /* noble */
.wb-elem.cat-9 { background: #e6d2ec; }   /* lanthanide */
.wb-elem.cat-10 { background: #f1c9d8; }  /* actinide */
.wb-elem.spacer { background: transparent; border: 0; cursor: default; pointer-events: none; }
.wb-elem.spacer:hover { background: transparent; }
.wb-ptable-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.wb-ptable-legend span::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.leg-1::before { background: #fde7d8; }
.leg-2::before { background: #f9d39c; }
.leg-3::before { background: #cfe6f6; }
.leg-4::before { background: #d6e3f7; }
.leg-5::before { background: #d0e9d4; }
.leg-6::before { background: #fff5b8; }
.leg-7::before { background: #f7c8c4; }
.leg-8::before { background: #c5e0fa; }
.leg-9::before { background: #e6d2ec; }
.leg-10::before { background: #f1c9d8; }

/* Selection overlay handles (Select tool & Lasso) */
.wb-sel-handle {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--yellow);
  border: 2px solid var(--blue);
  border-radius: 3px;
  z-index: 7;
  box-sizing: border-box;
}
.wb-sel-nw { top: -6px;  left: -6px;  cursor: nwse-resize; }
.wb-sel-n  { top: -6px;  left: 50%; margin-left: -6px; cursor: ns-resize; }
.wb-sel-ne { top: -6px;  right: -6px; cursor: nesw-resize; }
.wb-sel-e  { top: 50%; margin-top: -6px; right: -6px; cursor: ew-resize; }
.wb-sel-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.wb-sel-s  { bottom: -6px; left: 50%; margin-left: -6px; cursor: ns-resize; }
.wb-sel-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.wb-sel-w  { top: 50%; margin-top: -6px; left: -6px; cursor: ew-resize; }

/* Live drag-to-size preview overlay */
.wb-place-preview {
  position: absolute;
  border: 2px dashed var(--yellow-dark);
  background: rgba(244,197,66,0.08);
  pointer-events: none;
  z-index: 4;
}
.wb-place-preview img {
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0.85;
}
.wb-place-hint {
  position: absolute;
  background: var(--blue);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 4;
  font-family: 'Poppins', sans-serif;
}

/* Use explicit dimensions and absolute-positioned canvases so the drawing
   canvas and grid canvas always match exactly (no flex/intrinsic-size races). */
.wb-stage {
  position: relative;
  background: #fff;
  height: 540px;
}
.wb-card.fs .wb-stage { flex: 1; height: auto; }
#wb-grid-canvas,
#whiteboard {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#whiteboard {
  background: transparent;
  cursor: crosshair;
  touch-action: none;
  z-index: 1;
}
#wb-grid-canvas { z-index: 0; pointer-events: none; }
.wb-card.fs #wb-grid-canvas, .wb-card.fs #whiteboard { position: absolute; }
/* Make sure the toolbar (with grid button) is visible in fullscreen */
.wb-card.fs .wb-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
.wb-card.fs #wb-grid {
  background: var(--yellow);
  color: var(--blue);
}
.wb-text-input {
  position: absolute;
  border: 2px dashed var(--blue);
  background: rgba(255,255,255,0.95);
  padding: 4px 8px;
  font: 600 16px 'Open Sans', sans-serif;
  color: var(--blue);
  outline: none;
  border-radius: 4px;
  z-index: 5;
  min-width: 100px;
  display: inline-block;
  min-height: 1.2em;
  white-space: nowrap;
  caret-color: var(--blue);
  line-height: 1.4;
}
.wb-text-input sub, .wb-text-input sup {
  font-size: 0.7em;
  line-height: 0;
}
.wb-text-input sub { vertical-align: sub; }
.wb-text-input sup { vertical-align: super; }

/* Persistent text objects on the whiteboard. They wrap at word boundaries
   when they hit the right edge of the canvas (max-width is set in JS based
   on the text's left position so it never spills off). */
.wb-text-obj {
  position: absolute;
  white-space: pre-wrap;       /* preserves spacing AND allows wrapping */
  word-break: break-word;      /* break very long unbreakable words */
  overflow-wrap: break-word;
  font: 600 18px 'Open Sans', sans-serif;
  color: var(--blue);
  cursor: pointer;
  z-index: 4;
  padding: 2px 4px;
  border: 1px solid transparent;
  user-select: none;
  line-height: 1.4;
  /* JS sets a dynamic max-width based on the available canvas width. */
}
.wb-text-obj sub, .wb-text-obj sup { font-size: 0.7em; line-height: 0; }
.wb-text-obj sub { vertical-align: sub; }
.wb-text-obj sup { vertical-align: super; }
.wb-text-obj:hover { border-color: rgba(244,197,66,0.5); }
.wb-text-obj.selectable {
  cursor: pointer;
}
.wb-text-obj.selectable:hover {
  border-color: var(--blue);
  background: rgba(26, 60, 94, 0.04);
  box-shadow: 0 0 0 1px rgba(26, 60, 94, 0.15);
}
.wb-text-obj.selected {
  border: 2px dashed #f4c542;
  cursor: move;
  box-shadow: 0 0 0 1px rgba(244,197,66,0.25);
}
.wb-text-obj[contenteditable="true"] {
  outline: 2px dashed var(--blue);
  cursor: text;
  user-select: text;
  background: rgba(255,255,255,0.96);
}
/* Tiny edit button on a selected text object */
.wb-text-edit {
  position: absolute;
  top: -28px; right: -28px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 8;
}
.wb-text-edit:hover { background: var(--blue-dark); }

/* Molecule editor (2D drawer + element list + 3D viewer) */
.mol-editor {
  display: grid;
  grid-template-columns: 360px 60px 1fr;
  gap: 0;
  background: #fff;
}
@media (max-width: 1100px) { .mol-editor { grid-template-columns: 320px 56px 1fr; } }
@media (max-width: 900px)  { .mol-editor { grid-template-columns: 1fr; grid-auto-rows: auto; } }

.mol-2d-pane {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 480px;
}
@media (max-width: 900px) { .mol-2d-pane { border-right: 0; border-bottom: 1px solid var(--border); } }
.mol-2d-frame {
  flex: 1;
  width: 100%;
  border: 0;
  display: block;
  min-height: 420px;
  background: #fff;
}
.mol-2d-actions {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  flex-wrap: wrap;
  align-items: center;
}
.mol-2d-actions input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.85rem;
}

.mol-elements {
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 0.5rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  overflow-y: auto;
  min-height: 480px;
}
@media (max-width: 900px) {
  .mol-elements {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    min-height: auto;
    padding: 0.6rem;
  }
}
.mol-elem {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--blue);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.1s, background 0.1s;
}
.mol-elem:hover { border-color: var(--blue); background: rgba(26,60,94,0.05); }
.mol-elem.active { background: var(--blue); color: #fff; border-color: var(--blue-dark); }

.atom-pick {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font: 600 0.9rem 'Poppins', sans-serif;
  color: var(--blue);
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  transition: border-color 0.1s, transform 0.05s;
}
.atom-pick:hover { border-color: var(--blue); transform: translateY(-1px); }
.atom-pick .num { color: var(--text-muted); font-size: 0.72rem; font-weight: 500; }
.atom-pick .sym { font-size: 0.95rem; }
#mol-atom-list { max-height: 100px; overflow-y: auto; }

.mol-3d-pane { min-height: 480px; position: relative; }
.mol-3d-pane #mol-viewer { width: 100%; height: 100%; min-height: 480px; background: #f8f9fa; }

.mol-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.orbital-row, .geometry-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 700px) { .orbital-row, .geometry-row { grid-template-columns: repeat(2, 1fr); } }
.orbital, .geometry {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.orbital:hover, .geometry:hover { box-shadow: var(--shadow); }
.orbital canvas, .geometry canvas {
  display: block;
  width: 100%;
  height: 130px;
  background:
    radial-gradient(circle at 50% 50%, rgba(244,197,66,0.06), transparent 70%);
  border-radius: 8px;
}
.orbital svg, .geometry svg { width: 100%; height: 100px; }
.orbital .label, .geometry .label {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--blue);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}
.orbital .desc, .geometry .desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Presentation: chat + file share */
.present-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 900px) { .present-grid { grid-template-columns: 1fr; } }

.chat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 380px;
}
.chat-head {
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 1rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.chat-msg {
  background: var(--bg-light);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  max-width: 85%;
  align-self: flex-start;
}
.chat-msg.me {
  background: var(--blue);
  color: #fff;
  align-self: flex-end;
}
.chat-msg .who { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 2px; }
.chat-msg.me .who { color: rgba(255,255,255,0.78); }
.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border);
}
.chat-form input { flex: 1; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; }

.files-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.files-drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.files-drop.over { border-color: var(--blue); background: rgba(26,60,94,0.04); }
.files-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.files-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-light);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}
.files-list .meta { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }
.files-list a.dl { color: var(--blue); font-weight: 600; }

/* ===== Live room (camera + screen share via PeerJS) ===== */
.room-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 1.5rem;
}
.room-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
.room-toolbar input[type="text"] {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}
.room-toolbar .room-code {
  background: var(--blue);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font: 700 0.95rem 'Poppins', sans-serif;
  letter-spacing: 0.08em;
  user-select: all;
}
.room-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: auto;
  padding: 0.3rem 0.6rem;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.room-status .dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: #cbd5e1;
  margin-right: 0.4rem;
  vertical-align: 1px;
}
.room-status.connected .dot { background: #16a34a; }
.room-status.connecting .dot { background: #f4c542; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem;
  padding: 0.85rem;
  background: #0f0f0f;
  min-height: 240px;
}
.room-tile {
  position: relative;
  background: #1a1f2a;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-tile video {
  width: 100%; height: 100%; object-fit: cover; background: #000;
}
.room-tile .tile-label {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  padding: 2px 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.78rem;
  border-radius: 4px;
}
.room-tile.empty {
  color: rgba(255,255,255,0.55);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
  font-family: 'Poppins', sans-serif;
}
.tool-head {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tool-head h2, .tool-head h3 { color: #fff; margin: 0; font-size: 1.15rem; }
.tool-head .tool-sub { color: rgba(255,255,255,0.85); font-size: 0.9rem; }
.tool-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 1rem;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
.tool-toolbar label { font-size: 0.85rem; color: var(--text-muted); margin-right: 0.25rem; }
.tool-toolbar select,
.tool-toolbar input[type="color"],
.tool-toolbar input[type="text"],
.tool-toolbar input[type="url"] {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
}
.tool-toolbar input[type="color"] { padding: 2px; width: 36px; height: 32px; }
.tool-toolbar .btn-sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

/* === Pane expand / hide controls (molecules editor) === */
.mol-2d-pane, .mol-3d-pane { position: relative; }
.pane-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0.65rem;
  background: linear-gradient(180deg, #fafbfd 0%, #f0f3f8 100%);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-muted); font-weight: 600;
}
.pane-label { font-family: 'Poppins', sans-serif; }
.pane-actions { display: inline-flex; gap: 0.25rem; }
.pane-btn {
  border: 1px solid var(--border); background: #fff; color: var(--blue);
  padding: 0.15rem 0.55rem; border-radius: 4px; font: inherit; font-size: 0.95rem;
  cursor: pointer; line-height: 1; min-width: 1.8em;
}
.pane-btn:hover { background: var(--blue); color: #fff; }
.mol-pane-restore { padding: 0.5rem 1rem; text-align: center; background: var(--bg-light); border-top: 1px solid var(--border); }
.mol-editor.expand-2d { grid-template-columns: 1fr; }
.mol-editor.expand-2d .mol-elements,
.mol-editor.expand-2d .mol-3d-pane { display: none; }
.mol-editor.expand-3d { grid-template-columns: 1fr; }
.mol-editor.expand-3d .mol-2d-pane,
.mol-editor.expand-3d .mol-elements { display: none; }
.mol-editor.hide-2d { grid-template-columns: 56px 1fr; }
.mol-editor.hide-2d .mol-2d-pane { display: none; }
.mol-editor.hide-3d { grid-template-columns: 320px 56px; }
.mol-editor.hide-3d .mol-3d-pane { display: none; }
@media (max-width: 900px) {
  .mol-editor.expand-2d, .mol-editor.expand-3d, .mol-editor.hide-2d, .mol-editor.hide-3d {
    grid-template-columns: 1fr;
  }
}

/* === Collapsible page sections === */
.section-title { position: relative; }
.section-toggle {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border: 1px solid var(--border); background: #fff; color: var(--blue);
  padding: 0.2rem 0.7rem; border-radius: 4px; font: inherit; font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
}
.section-toggle:hover { background: var(--blue); color: #fff; }
section.collapsed > .container > *:not(.section-title) { display: none; }
section.collapsed { padding-bottom: 1rem !important; }

.tool-toolbar-pdb {
  background: linear-gradient(180deg, #f4f7fb 0%, #eef2f8 100%);
  border-top: 1px solid var(--border);
}
.tool-toolbar-pdb + .tool-toolbar-pdb {
  border-top: 1px dashed var(--border);
}
.tool-toolbar-pdb #mol-pdb-id {
  letter-spacing: 0.05em;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}
.tool-toolbar-pdb label.btn {
  display: inline-flex;
  align-items: center;
}
#mol-pdb-loaded {
  margin-left: auto;
  padding: 0 0.5rem;
}

/* Old .whiteboard-wrap / #whiteboard / mol-viewer / .tool-stage rules.
   The OLD #whiteboard rule (height: 480px; background: #fff) was overriding
   the new positional/transparent rules — removed. The drawing canvas uses the
   absolute-positioned rule defined earlier in this file. */
.tool-stage { background: #fff; padding: 0; }
#mol-viewer {
  width: 100%;
  height: 480px;
  background: #f8f9fa;
  position: relative;
}
.mol-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  background: var(--bg-light);
  border-top: 1px solid var(--border);
}
@media (max-width: 600px) { .mol-info { grid-template-columns: 1fr 1fr; } }
.mol-info dt { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.mol-info dd { margin: 0.1rem 0 0; font-family: 'Poppins', sans-serif; font-weight: 600; color: var(--blue); }
.mol-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  background: #fffbe6;
  border-top: 1px solid var(--border);
}
.slides-frame {
  width: 100%;
  height: 480px;
  border: 0;
  display: block;
  background: var(--bg-light);
}
.slides-empty {
  height: 220px;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.95rem;
}

/* ===== Slide presenter ===== */
.pres-tool {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.pres-tool.fs {
  position: fixed; inset: 0; z-index: 9999;
  margin: 0; border-radius: 0;
  display: flex; flex-direction: column;
}
.pres-stage {
  position: relative;
  background: #1a1f2a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  overflow: hidden;
}
.pres-tool.fs .pres-stage { flex: 1; min-height: 0; }
.pres-slide {
  max-width: 100%;
  max-height: 100%;
  display: block;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  background: #fff;
}
.pres-anno {
  position: absolute;
  pointer-events: none;
  touch-action: none;
}
.pres-tool[data-mode="annotate"] .pres-anno { pointer-events: auto; cursor: crosshair; }
.pres-empty {
  color: rgba(255,255,255,0.7);
  text-align: center;
  font-size: 0.95rem;
  padding: 2rem;
  font-family: 'Poppins', sans-serif;
}
.pres-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg-light);
  border-top: 1px solid var(--border);
}
.pres-mode-tabs {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px;
}
.pres-mode-tabs button {
  background: transparent;
  border: 0;
  padding: 0.4rem 0.85rem;
  font: 600 0.85rem 'Poppins', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 5px;
}
.pres-mode-tabs button.active { background: var(--blue); color: #fff; }
.pres-counter {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  color: var(--blue);
  margin: 0 0.5rem;
}
.pres-source-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}
.pres-curr-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.pres-curr-select:hover { background: var(--blue); color: #fff; }
.pres-curr-select option { background: #fff; color: var(--ink); font-weight: 400; }
.pres-anno-toolbar {
  display: none;
  align-items: center;
  gap: 0.4rem;
}
.pres-tool[data-mode="annotate"] .pres-anno-toolbar { display: inline-flex; }
.pres-tool[data-mode="annotate"] .pres-anno-toolbar input[type="color"] {
  padding: 2px; width: 32px; height: 30px; border: 1px solid var(--border); border-radius: 4px;
}

/* ---------- Sponsor cards ---------- */
.sponsor-school {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sponsor-school .school-name { font-family: 'Poppins', sans-serif; font-weight: 600; color: var(--blue); font-size: 1.05rem; }
.sponsor-school .school-meta { color: var(--text-muted); font-size: 0.88rem; }
.sponsor-school .school-need {
  background: var(--bg-light);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.sponsor-school .school-cta { margin-top: auto; padding-top: 0.75rem; }

.steps-num {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}
@media (max-width: 820px) { .steps-num { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .steps-num { grid-template-columns: 1fr; } }
.steps-num .step {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
}
.steps-num .step .n {
  position: absolute;
  top: -12px;
  left: 1rem;
  background: var(--yellow);
  color: var(--blue);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}

/* ---------- Misc ---------- */
.note {
  background: #fffbe6;
  border-left: 4px solid var(--yellow);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: #6b5614;
  margin: 1rem 0;
}
.kbd-list { padding-left: 1.25rem; }
.partner-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 700px) { .partner-row { grid-template-columns: repeat(2, 1fr); } }
.partner-placeholder {
  height: 90px;
  background: var(--bg-light);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--blue);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { top: 0; }
