/* ============ Math Made Fun — shared styles ============ */
:root {
  --ink: #1d2545;
  --ink-soft: #4a5275;
  --muted: #7a809b;
  --bg: #fffaf2;
  --surface: #ffffff;
  --line: #ece5d8;
  --coral: #ff6b4a;
  --coral-dark: #e9512f;
  --sun: #ffc23d;
  --mint: #21a99a;
  --sky: #4f7cff;
  --grape: #8b5cf6;
  --ok: #1f9d6b;
  --warn: #d98a00;
  --bad: #d64545;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(29, 37, 69, 0.08);
  --font-head: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--sky); }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.eyebrow {
  display: inline-block; font-weight: 800; font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--coral); margin-bottom: .8rem;
}
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 700 1rem var(--font-body); padding: .8rem 1.4rem; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 16px rgba(255, 107, 74, .35); }
.btn-primary:hover { background: var(--coral-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-soft { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }
.btn-block { width: 100%; }

label { display: block; font-weight: 700; font-size: .92rem; margin: .9rem 0 .35rem; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .7rem .9rem;
  border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); }
textarea { min-height: 90px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1rem; }
.form-msg { margin-top: 1rem; padding: .7rem 1rem; border-radius: 12px; font-weight: 600; }
.form-msg.error { background: #fdecec; color: var(--bad); }
.form-msg.success { background: #e7f7ef; color: var(--ok); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255, 250, 242, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; gap: 1rem; }
.logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink);
        font: 600 1.35rem var(--font-head); }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--coral); color: #fff;
  display: grid; place-items: center; font-size: 1.2rem; transform: rotate(-6deg);
}
.nav-links { display: flex; gap: 1.6rem; align-items: center; }
.nav-links a { color: var(--ink); text-decoration: none; font-weight: 700; }
.nav-links a:hover { color: var(--coral); }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.hero h1 span { color: var(--coral); }
.hero-ctas { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 440px; margin-left: auto; width: 100%; }
.tile {
  position: absolute; display: grid; place-items: center; border-radius: 24px;
  font: 600 2.4rem var(--font-head); color: #fff; box-shadow: var(--shadow);
}
.tile.t1 { inset: 4% 46% 52% 4%; background: var(--sky); transform: rotate(-8deg); }
.tile.t2 { inset: 0 4% 58% 58%; background: var(--sun); color: var(--ink); transform: rotate(6deg); }
.tile.t3 { inset: 44% 50% 6% 10%; background: var(--mint); transform: rotate(5deg); }
.tile.t4 { inset: 48% 6% 12% 54%; background: var(--coral); transform: rotate(-5deg); font-size: 2rem; }
.tile.t5 { inset: 36% 36% 38% 38%; background: var(--grape); border-radius: 50%; font-size: 1.6rem; z-index: 2; }

.pill-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.4rem; }
.pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem;
        font-size: .88rem; font-weight: 700; color: var(--ink-soft); }

/* ---------- Sections ---------- */
section.block { padding: 84px 0; }
.block.alt { background: #fff; border-block: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 2.6rem; }
.section-head.center { margin-inline: auto; }

.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 1.6rem; box-shadow: var(--shadow); }
.card .icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
              font-size: 1.5rem; margin-bottom: 1rem; }

/* Course journey */
.journey { position: relative; display: grid; gap: 1.2rem; }
.journey::before { content: ""; position: absolute; left: 27px; top: 10px; bottom: 10px; width: 4px;
                   background: repeating-linear-gradient(var(--line) 0 10px, transparent 10px 18px); }
.stage { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 1.2rem; align-items: start; }
.stage-dot { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
             font: 600 1.2rem var(--font-head); color: #fff; z-index: 1; border: 4px solid var(--bg); }
.stage-body { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; }
.stage-body header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.grade-tag { font-weight: 800; font-size: .82rem; color: var(--ink-soft); background: var(--bg);
             padding: .2rem .7rem; border-radius: 999px; }
.why { margin-top: .6rem; padding: .7rem 1rem; border-left: 4px solid var(--sun); background: #fffbef;
       border-radius: 0 10px 10px 0; font-size: .95rem; }
.why strong { color: var(--ink); }
.topics { color: var(--muted); font-size: .92rem; margin: .5rem 0 0; }
.stage.sat .stage-body { border: 2px dashed var(--grape); }

/* CSR */
.csr { background: var(--ink); color: #fff; }
.csr .lead { color: #c9cde0; }
.csr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.csr-points { display: grid; gap: 1rem; }
.csr-point { display: flex; gap: 1rem; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
             padding: 1.1rem 1.2rem; border-radius: 16px; }
.csr-point .icon { font-size: 1.6rem; }
.csr-point h4 { margin: 0 0 .2rem; font-size: 1.1rem; }
.csr-point p { margin: 0; color: #c9cde0; font-size: .95rem; }
.csr .eyebrow { color: var(--sun); }

/* Portals */
.portal { display: flex; flex-direction: column; }
.portal ul { padding-left: 1.1rem; color: var(--ink-soft); flex: 1; }
.portal .btn { align-self: flex-start; margin-top: .6rem; }

/* Contact */
.contact-box { background: linear-gradient(135deg, var(--coral), #ff9a5a); color: #fff; border-radius: 28px;
               padding: 3rem; display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
.contact-box h2 { margin: 0 0 .3rem; }
.contact-box p { margin: 0; opacity: .95; }
.btn-white { background: #fff; color: var(--coral-dark); }

.site-footer { padding: 2.4rem 0; color: var(--muted); font-size: .92rem; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px;
             padding: 2.2rem; box-shadow: var(--shadow); }
.tabs { display: flex; background: var(--bg); border-radius: 999px; padding: 4px; margin: 1rem 0 .4rem; }
.tabs button { flex: 1; border: 0; background: none; padding: .6rem; border-radius: 999px; font: 700 .95rem var(--font-body);
               cursor: pointer; color: var(--ink-soft); }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.hint { font-size: .85rem; color: var(--muted); margin-top: .35rem; }

/* ---------- Dashboards ---------- */
.dash { padding: 32px 0 80px; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.dash-head h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: 0; }
.dash-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.4rem; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.4rem; }
.panel h3 { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.child-list { display: grid; gap: .6rem; }
.child-btn { text-align: left; width: 100%; border: 2px solid var(--line); background: #fff; border-radius: 14px;
             padding: .8rem 1rem; cursor: pointer; font: inherit; }
.child-btn.active { border-color: var(--coral); background: #fff5f1; }
.child-btn strong { display: block; }
.code-chip { display: inline-block; font: 700 .95rem ui-monospace, monospace; background: var(--sun);
             padding: .15rem .55rem; border-radius: 8px; letter-spacing: .1em; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.2rem; }
.stat .num { font: 600 2rem var(--font-head); }
.stat .lbl { color: var(--muted); font-size: .88rem; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 800; text-transform: capitalize; }
.b-present, .b-graded { background: #e3f6ee; color: var(--ok); }
.b-late, .b-submitted { background: #fff3d9; color: var(--warn); }
.b-absent { background: #fde8e8; color: var(--bad); }
.b-excused { background: #eceefa; color: var(--sky); }

.feedback-item { border-left: 4px solid var(--mint); background: #f4fbfa; padding: .9rem 1.1rem; border-radius: 0 12px 12px 0; margin-bottom: .8rem; }
.feedback-item .meta { font-size: .82rem; color: var(--muted); font-weight: 700; }
.chart { width: 100%; height: 200px; }
.empty { color: var(--muted); font-style: italic; padding: .6rem 0; }

.question { border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.question .choices label { font-weight: 600; display: flex; gap: .6rem; align-items: center; margin: .4rem 0; cursor: pointer; }
.question .choices input { width: auto; }
.score-burst { text-align: center; padding: 2rem 1rem; }
.score-burst .big { font: 600 4rem var(--font-head); color: var(--coral); }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: .9rem 1.2rem;
         border-radius: 14px; box-shadow: var(--shadow); z-index: 100; max-width: 340px; animation: pop .25s ease; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

.q-builder .q-item { border: 1px dashed var(--line); padding: .8rem 1rem; border-radius: 12px; margin-bottom: .8rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid, .csr-grid, .dash-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 320px; margin: 0 auto; }
  .cards-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 70px; left: 0; right: 0; flex-direction: column;
               background: var(--bg); padding: 1rem 16px 1.4rem; border-bottom: 1px solid var(--line); align-items: flex-start; }
  .nav-links.open { display: flex; }
  section.block { padding: 60px 0; }
  .contact-box { padding: 2rem; }
}

/* ============ v2 additions ============ */
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .4rem .8rem; }
.check-grid label, .inline-check { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin: .2rem 0; cursor: pointer; }
.check-grid input, .inline-check input { width: auto; }
.check-grid .grp { grid-column: 1 / -1; font: 800 .75rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: .5rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend.section { font: 600 1.05rem var(--font-head); margin: 1.4rem 0 .2rem; padding: 0; }
.wide-card { width: min(760px, 100%); }
.course-group-head { display: flex; align-items: baseline; gap: .8rem; margin: 2.4rem 0 1rem; }
.course-group-head h3 { margin: 0; font-size: 1.5rem; }
.hs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.hs-card { background: #fff; border: 1px solid var(--line); border-top: 5px solid var(--grape); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.hs-card .why { font-size: .9rem; }
.star { display: flex; gap: 1rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.star .medal { font-size: 1.8rem; }
.star .bars { font-size: .82rem; color: var(--muted); }
.tabs.wrap { flex-wrap: wrap; border-radius: 18px; }
.tabs.wrap button { flex: 0 1 auto; padding: .55rem 1rem; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.toolbar > * { flex: 0 1 auto; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.wa-btn { background: #25d366; color: #fff; }
.wa-btn:hover { background: #1eb457; }
.video-frame { position: relative; aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.modal-back { position: fixed; inset: 0; background: rgba(29,37,69,.45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal { background: #fff; border-radius: 20px; padding: 1.6rem; width: min(720px, 100%); max-height: 90vh; overflow: auto; }
.area-list li { margin-bottom: .4rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
