/* =========================================================
   IGCSE MATHEMATICS — SHARED THEME
   (extracted & extended from sample_chapter_5.html)
========================================================= */

:root {
  --teal: #00a6b2;
  --teal-dark: #007f8a;
  --magenta: #c50068;
  --yellow: #ffd51e;
  --navy: #152238;
  --navy-light: #213a5b;
  --ink: #202938;
  --muted: #667085;
  --bg: #f4f7fa;
  --card: #ffffff;
  --green: #20a464;
  --red: #d64545;
  --blue: #3977d5;
  --purple: #7357c7;
  --shadow: 0 12px 30px rgba(21,34,56,.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

button, input, select { font-family: inherit; }

/* ===================== HEADER ===================== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(21,34,56,.97);
  color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.navbar {
  max-width: 1250px;
  margin: auto;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  font-weight: 900;
  letter-spacing: .5px;
  text-decoration: none;
}
.logo-mark { width: 30px; height: 30px; flex: none; overflow: visible; }
.logo-word { font-size: 1.18rem; color: #fff; line-height: 1; }
.logo-word .lz { color: var(--teal); }
.logo:hover { opacity: .9; }
.logo-sub { font-weight: 800; font-size: .7rem; letter-spacing: .4px; color: var(--navy); background: var(--yellow); padding: 2px 8px; border-radius: 20px; }

.navlinks {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-left: auto;
  align-items: center;
}
.navlinks button {
  border: 0;
  color: white;
  background: transparent;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.navlinks button:hover,
.navlinks button.active { background: var(--teal); }

.userchip {
  background: var(--teal);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .85rem;
  white-space: nowrap;
}
.userchip.magenta { background: var(--magenta); }

.progress-wrap { height: 4px; background: #26344d; }
.progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--yellow));
  transition: width .25s;
}

/* ===================== HERO ===================== */
.hero {
  min-height: 460px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 80% 25%, rgba(255,213,30,.35), transparent 20%),
    radial-gradient(circle at 15% 75%, rgba(0,166,178,.35), transparent 25%),
    linear-gradient(135deg, #152238 0%, #213a5b 55%, #7b0750 100%);
}
.hero:before, .hero:after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 70px solid rgba(255,255,255,.04);
}
.hero:before { width: 360px; height: 360px; right: -150px; top: -150px; }
.hero:after { width: 300px; height: 300px; left: -140px; bottom: -160px; }

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1050px,92%);
  text-align: center;
}
.badge {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 900;
  padding: 7px 15px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.4rem,6vw,5rem);
  line-height: .98;
  margin: 0;
  letter-spacing: -3px;
}
.hero h1 span { color: var(--yellow); }
.hero p {
  font-size: 1.2rem;
  max-width: 760px;
  margin: 24px auto;
  color: #e5ebf5;
}

.start-btn {
  border: 0;
  background: var(--teal);
  color: white;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 15px 28px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,166,178,.3);
  transition: .2s;
}
.start-btn:hover { background: #08bcc8; transform: translateY(-2px); }

/* ===================== MAIN ===================== */
main { max-width: 1100px; margin: auto; padding: 50px 20px; }
.section { margin-bottom: 70px; scroll-margin-top: 90px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}
.section-number {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: white; font-weight: 900;
  background: var(--magenta);
  flex-shrink: 0;
}
h2 { font-size: clamp(1.8rem,4vw,2.8rem); margin: 0; color: var(--navy); }
h3 { color: var(--teal-dark); margin-top: 0; }
p { font-size: 1.02rem; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 28px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px,1fr));
  gap: 18px;
}
.small-card {
  background: white;
  border-radius: 15px;
  padding: 22px;
  box-shadow: 0 6px 20px rgba(21,34,56,.07);
}

/* ===================== SPECIAL BOXES ===================== */
.mathbox {
  background: #edf9fa;
  border-left: 6px solid var(--teal);
  padding: 22px;
  border-radius: 10px;
  margin: 18px 0;
  font-size: 1.12rem;
  overflow-x: auto;
}
.key {
  background: linear-gradient(135deg, #fff8cc, #fff);
  border-left: 6px solid var(--yellow);
  padding: 20px; border-radius: 10px; margin: 18px 0;
}
.warning {
  background: #fff0f3;
  border-left: 6px solid var(--magenta);
  padding: 20px; border-radius: 10px; margin: 18px 0;
}
.info {
  background: #eef5ff;
  border-left: 6px solid var(--blue);
  padding: 20px; border-radius: 10px; margin: 18px 0;
}
.extended {
  display: inline-block;
  background: var(--magenta);
  color: white;
  font-size: .75rem;
  font-weight: 900;
  padding: 5px 9px;
  border-radius: 7px;
  vertical-align: middle;
  margin-left: 5px;
}

/* ===================== STEPS ===================== */
.steps { counter-reset: step; }
.step {
  counter-increment: step;
  position: relative;
  margin: 12px 0;
  padding: 16px 18px 16px 58px;
  background: #f7f9fc;
  border-radius: 10px;
}
.step:before {
  content: counter(step);
  position: absolute;
  left: 16px; top: 15px;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--teal);
  color: white; font-weight: 900;
}

/* ===================== BUTTONS ===================== */
.btn {
  border: 0;
  padding: 11px 17px;
  border-radius: 9px;
  background: var(--navy);
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition: .2s;
}
.btn:hover { background: var(--teal-dark); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.magenta { background: var(--magenta); }
.btn.teal { background: var(--teal); }
.btn.ghost { background: transparent; border: 2px solid rgba(255,255,255,.6); }
.btn.small { padding: 7px 12px; font-size: .85rem; }

/* ===================== ANSWERS / REVEAL ===================== */
.answer {
  display: none;
  margin-top: 15px;
  padding: 17px;
  background: #eaf8f0;
  border-left: 5px solid var(--green);
  border-radius: 8px;
}
.answer.show { display: block; }

/* ===================== QUIZ ===================== */
.quiz-question {
  background: #f7f9fc;
  border-radius: 14px;
  padding: 22px;
  margin: 18px 0;
  border: 1px solid #e6ecf3;
}
.quiz-question strong { color: var(--navy); font-size: 1.05rem; }
.quiz-question input, .quiz-question select {
  margin-top: 12px;
  padding: 12px 14px;
  width: 100%;
  max-width: 260px;
  border: 2px solid #d3dbe6;
  border-radius: 9px;
  font-size: 1rem;
  display: block;
}
.quiz-question input:focus { outline: none; border-color: var(--teal); }
.feedback { margin-top: 12px; font-weight: 800; min-height: 1.2em; }
.feedback.correct { color: var(--green); }
.feedback.incorrect { color: var(--red); }
.feedback.pending { color: var(--muted); }
.qmeta {
  display: inline-block;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--teal-dark);
  background: #e4f6f7;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

/* ===================== WHITEBOARD ===================== */
.wb-wrap {
  position: relative;
  border-radius: 12px;
  border: 2px dashed #cfd9e6;
  background:
    linear-gradient(#eef3f9 1px, transparent 1px) 0 0 / 100% 32px,
    #ffffff;
  margin: 16px 0 8px;
  overflow: hidden;
}
.wb-wrap canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }

/* Graphing grid — graph-paper background that attaches behind the drawing on any board */
.wb-wrap.wb-grid canvas {
  background-color: #ffffff;
  background-image:
    linear-gradient(to right, rgba(21,34,56,.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(21,34,56,.10) 1px, transparent 1px),
    linear-gradient(to right, rgba(21,34,56,.24) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(21,34,56,.24) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  background-position: 0 0, 0 0, 0 0, 0 0;
}

/* Scrollable board (more drawing space via horizontal + vertical scroll) */
.wb-scroll { overflow: auto; background: #fff; border-radius: 8px; -webkit-overflow-scrolling: touch; }
.wb-scroll canvas { display: block; cursor: crosshair; touch-action: none; }
/* Pen / eraser size slider in the whiteboard toolbar */
.wb-toolbar .wb-size-wrap { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.wb-toolbar .wb-size-label { font-size: .78rem; color: #556; font-weight: 700; }
.wb-toolbar input.wb-size { width: 110px; accent-color: var(--teal); cursor: pointer; }
.wb-toolbar .btn.active-tool { background: var(--magenta); }
.wb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f2f6fb;
  border-top: 1px solid #e2e9f2;
}
.wb-toolbar .swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
}
.wb-toolbar .swatch.active { box-shadow: 0 0 0 3px var(--navy); }
.wb-toolbar .btn.active-tool { background: var(--magenta); }
.wb-label {
  font-size: .8rem;
  font-weight: 800;
  color: var(--muted);
  margin-right: auto;
}

/* ===================== LOGIN ===================== */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px 16px;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,213,30,.25), transparent 22%),
    radial-gradient(circle at 12% 80%, rgba(0,166,178,.30), transparent 25%),
    linear-gradient(135deg, #152238 0%, #213a5b 55%, #7b0750 100%);
}
.login-card {
  width: min(460px, 94%);
  background: #fff;
  border-radius: 20px;
  padding: 34px 30px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 4px; color: var(--navy); font-size: 1.7rem; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; }
.role-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.role-tabs button {
  flex: 1;
  border: 2px solid #e0e6ee;
  background: #f7f9fc;
  color: var(--navy);
  font-weight: 800;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}
.role-tabs button.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 800;
  font-size: .85rem;
  color: var(--navy);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 13px 14px;
  border: 2px solid #d3dbe6;
  border-radius: 11px;
  font-size: 1rem;
  text-transform: none;
}
.field input:focus { outline: none; border-color: var(--teal); }
.field input.code { letter-spacing: .35em; text-transform: uppercase; font-weight: 800; }
.login-btn {
  width: 100%;
  border: 0;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  font-size: 1.05rem;
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,166,178,.3);
}
.login-btn:hover { background: #08bcc8; }
.login-err { color: var(--red); font-weight: 700; min-height: 1.1em; margin: 4px 0 10px; }
.mode-note {
  margin-top: 18px;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.pill {
  display:inline-block;
  font-size:.72rem;
  font-weight:800;
  padding:3px 9px;
  border-radius:999px;
}
.pill.live { background:#e4f6f7; color: var(--teal-dark); }
.pill.demo { background:#fff3d6; color:#9a6b00; }

/* ===================== DASHBOARD ===================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 16px;
  margin: 6px 0 26px;
}
.stat {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat .num { font-size: 2.2rem; font-weight: 900; color: var(--navy); line-height: 1; }
.stat .lbl { color: var(--muted); font-weight: 700; font-size: .85rem; margin-top: 6px; }
.stat.green .num { color: var(--green); }
.stat.magenta .num { color: var(--magenta); }
.stat.teal .num { color: var(--teal-dark); }

.dash-table { width: 100%; border-collapse: collapse; background:#fff; }
.dash-table th, .dash-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f7;
  font-size: .95rem;
  vertical-align: top;
}
.dash-table th {
  background: var(--navy);
  color: #fff;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
}
.dash-table tr:hover td { background: #f7fafc; }
.tag { font-weight: 800; padding: 3px 9px; border-radius: 999px; font-size: .78rem; white-space: nowrap; }
.tag.ok { background: #e4f7ee; color: var(--green); }
.tag.no { background: #fdeaea; color: var(--red); }
.tag.wait { background: #eef2f7; color: var(--muted); }
.student-block {
  background:#fff;
  border-radius:16px;
  box-shadow: var(--shadow);
  overflow:hidden;
  margin-bottom:18px;
}
.student-head {
  display:flex; align-items:center; gap:12px;
  padding:14px 18px;
  background:#f7f9fc;
  border-bottom:1px solid #eef2f7;
}
.student-head .avatar {
  width:38px;height:38px;border-radius:50%;
  background:var(--teal); color:#fff;
  display:grid;place-items:center;font-weight:900;
}
.student-head .name { font-weight:900; color:var(--navy); }
.student-head .score { margin-left:auto; font-weight:900; }
.empty {
  text-align:center; color:var(--muted);
  padding:50px 20px; font-size:1.05rem;
}
.codebig {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: .3em;
  color: var(--teal-dark);
  background:#e4f6f7;
  padding: 8px 18px;
  border-radius: 12px;
  display:inline-block;
}

/* ===================== OVERLAY WHITEBOARD ===================== */
.wb-overlay {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1200;
  background: #fff;
  box-shadow: 0 -12px 40px rgba(21,34,56,.28);
  border-top: 3px solid var(--teal);
}
.wb-overlay-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--navy);
  color: #fff;
}
.wb-overlay-body { padding: 0 12px 8px; }
.wb-overlay .wb-wrap { margin: 10px 0; border-style: solid; }

/* ===================== BACK TO TOP ===================== */
#topButton {
  display:none;
  position:fixed;
  bottom:26px; right:26px;
  z-index:900;
  border:0;
  width:48px;height:48px;
  border-radius:50%;
  background:var(--navy);
  color:#fff;font-size:1.3rem;font-weight:900;
  cursor:pointer;
  box-shadow:0 8px 20px rgba(0,0,0,.25);
}

@media (max-width: 640px) {
  .navlinks { gap: 2px; }
  .navlinks button { padding: 7px 7px; font-size: .85rem; }
}

/* AEZIT card logo lockup (login / signup) */
.brand-lockup{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 0 6px}
.brand-icon{width:46px;height:46px;flex:none;overflow:visible}
.brand-word{font-weight:800;letter-spacing:1px;font-size:2.15rem;color:#22314a;line-height:1;position:relative;font-family:Inter,Arial,Helvetica,sans-serif}
.brand-word .z{color:var(--teal)}
.brand-word .i{position:relative}
.brand-word .i::after{content:"\2726";position:absolute;left:50%;top:-.95em;transform:translateX(-50%);font-size:.4em;color:var(--yellow)}
.brand-tag{text-align:center;color:var(--muted);font-size:.8rem;letter-spacing:.3px;margin:2px 0 10px}

/* compact lockup for form headers (signup) */
.brand-sm{gap:9px;margin-bottom:10px}
.brand-sm .brand-icon{width:34px;height:34px}
.brand-sm .brand-word{font-size:1.55rem;letter-spacing:.6px}
