:root {
  --bg: #fbf8f2;
  --surface: #ffffff;
  --ink: #1b2430;
  --muted: #5d6673;
  --line: #e7e1d6;
  --brand: #1f6f5c;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ec;
  --accent: #f2b544;
  --coral: #e8664f;
  --board: #20352f;
  --board-2: #2a453d;
  --chalk: #f3f1e8;
  --chalk-yellow: #ffd772;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(27, 36, 48, .08);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
img { max-width: 100%; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 22px; font: 600 15px/1 var(--font); cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px rgba(31, 111, 92, .25); }
.btn-primary:hover { background: #185a4a; }
.btn-accent { background: var(--accent); color: #2b1d00; }
.btn-accent:hover { background: #e9a72c; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: rgba(251, 248, 242, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--board); display: grid; place-items: center; color: var(--chalk-yellow); font: 700 22px/1 var(--hand); }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a.link { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.nav-links a.link:hover { color: var(--ink); }
@media (max-width: 760px) { .nav-links a.link { display: none; } }

/* hero */
.hero { padding: 64px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; background: var(--brand-soft); color: var(--brand); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; }
h1 { font-size: clamp(34px, 5.4vw, 56px); line-height: 1.07; letter-spacing: -.035em; margin: 18px 0 16px; }
h1 .hand { font-family: var(--hand); color: var(--coral); font-weight: 700; font-size: 1.15em; letter-spacing: 0; }
.lead { font-size: 18px; color: var(--muted); max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding-top: 36px; } }

/* demo board */
.demo-board { background: var(--board); border-radius: 22px; padding: 22px; color: var(--chalk); box-shadow: 0 24px 60px rgba(32, 53, 47, .35), inset 0 0 0 10px #6b4a2f, inset 0 0 0 12px #3d2a1b; min-height: 360px; position: relative; overflow: hidden; }
.demo-board .q { font-family: var(--hand); font-size: 24px; color: var(--chalk-yellow); margin: 6px 6px 14px; }
.demo-step { font-family: var(--hand); font-size: 22px; line-height: 1.3; margin: 8px 6px; opacity: 0; transform: translateY(6px); animation: chalkIn .6s forwards; }
.demo-step b { color: var(--chalk-yellow); font-weight: 700; }
.demo-step:nth-child(2) { animation-delay: .6s; } .demo-step:nth-child(3) { animation-delay: 1.6s; } .demo-step:nth-child(4) { animation-delay: 2.6s; } .demo-step:nth-child(5) { animation-delay: 3.6s; }
.demo-board .ans { display: inline-block; border: 2px solid var(--chalk-yellow); border-radius: 10px; padding: 0 10px; }
@keyframes chalkIn { to { opacity: 1; transform: none; } }

/* sections */
section.block { padding: 64px 0; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-head h2 { font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.03em; margin: 8px 0; line-height: 1.15; }
.section-head p { color: var(--muted); margin: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card h3 { margin: 10px 0 6px; font-size: 18px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.step-num { font: 700 34px/1 var(--hand); color: var(--coral); }
.subjects { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; }

/* pricing */
.pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 820px; margin: 0 auto; }
@media (max-width: 700px) { .pricing { grid-template-columns: 1fr; } }
.price-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; }
.price-card.pro { border-color: var(--brand); box-shadow: 0 18px 40px rgba(31, 111, 92, .15); position: relative; }
.price-card .badge { position: absolute; top: -13px; right: 22px; background: var(--accent); color: #2b1d00; font-weight: 700; font-size: 12px; padding: 5px 12px; border-radius: 999px; }
.price { font-size: 44px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 2px; }
.price small { font-size: 16px; font-weight: 500; color: var(--muted); }
.price-card ul { list-style: none; padding: 0; margin: 18px 0 24px; flex: 1; }
.price-card li { padding: 7px 0 7px 28px; position: relative; font-size: 15px; }
.price-card li::before { content: "✓"; position: absolute; left: 0; top: 7px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 800; display: grid; place-items: center; }

/* faq */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { color: var(--muted); margin: 10px 0 0; }

.cta-band { background: var(--board); color: var(--chalk); border-radius: 26px; padding: 44px 24px; text-align: center; }
.cta-band h2 { font-family: var(--hand); font-size: clamp(34px, 5vw, 52px); color: var(--chalk-yellow); margin: 0 0 8px; font-weight: 700; }
.cta-band p { color: #c9d6cf; margin: 0 0 22px; }

footer.site { border-top: 1px solid var(--line); padding: 30px 0 40px; margin-top: 40px; color: var(--muted); font-size: 14px; }
footer.site .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.site a { color: var(--muted); margin-right: 16px; text-decoration: none; }
footer.site a:hover { color: var(--ink); }

/* auth */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 28px; margin: 0 0 6px; }
.field { display: block; margin: 14px 0; }
.field span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; font: 15px var(--font); background: #fff; color: var(--ink); outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.error { background: #fdecea; color: #a3341f; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; display: none; }
.error.show { display: block; }
.muted { color: var(--muted); }

/* legal pages */
.prose { max-width: 760px; margin: 40px auto; }
.prose h1 { font-size: 36px; }
.prose h2 { margin-top: 28px; font-size: 20px; }
.prose p, .prose li { color: #384250; }

/* ---------- tutor app ---------- */
.app { display: grid; grid-template-columns: 270px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-top { padding: 16px; border-bottom: 1px solid var(--line); }
.side-top .btn { width: 100%; margin-top: 14px; }
.history { flex: 1; overflow-y: auto; padding: 10px; }
.history h4 { margin: 8px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.h-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 10px; cursor: pointer; font: 14px var(--font); color: var(--ink); }
.h-item:hover, .h-item.active { background: var(--brand-soft); }
.h-item small { display: block; color: var(--muted); font-size: 12px; }
.side-bottom { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.plan-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.plan-box b { display: block; }
.meter { height: 6px; border-radius: 6px; background: var(--line); margin: 8px 0 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: 600 14px var(--font); cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.icon-btn.menu-btn { display: none; }

.stage { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.board { background: radial-gradient(ellipse at 30% 20%, var(--board-2), var(--board) 70%); border-radius: 20px; min-height: 100%; padding: 26px 28px 30px; color: var(--chalk); box-shadow: inset 0 0 0 9px #6b4a2f, inset 0 0 0 11px #3d2a1b, 0 12px 30px rgba(32, 53, 47, .25); position: relative; }
.board-empty { text-align: center; padding: 60px 10px; }
.board-empty h2 { font: 700 clamp(30px, 5vw, 44px)/1.1 var(--hand); color: var(--chalk-yellow); margin: 0 0 8px; }
.board-empty p { color: #c4d2cb; margin: 0 auto 22px; max-width: 460px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.examples button { background: rgba(255,255,255,.08); border: 1px dashed rgba(255,255,255,.35); color: var(--chalk); border-radius: 12px; padding: 9px 13px; font: 15px var(--font); cursor: pointer; }
.examples button:hover { background: rgba(255,255,255,.15); }

.b-question { font: 700 26px/1.25 var(--hand); color: var(--chalk-yellow); margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; }
.b-idea { font-size: 16px; color: #d6e2dc; border-left: 3px solid var(--chalk-yellow); padding: 4px 12px; margin: 12px 0 18px; }
.b-step { border-top: 1px dashed rgba(255,255,255,.18); padding: 14px 2px; animation: chalkIn .5s both; }
.b-step h3 { font: 700 24px/1.2 var(--hand); margin: 0 0 6px; color: #fff; display: flex; gap: 10px; align-items: baseline; }
.b-step h3 .n { color: var(--coral); }
.b-step.answer h3 { color: var(--chalk-yellow); }
.b-step.answer .b-body { border: 2px solid var(--chalk-yellow); border-radius: 12px; padding: 8px 14px; display: inline-block; }
.b-step.try h3 { color: #9fe3c9; }
.b-body { font-size: 16.5px; line-height: 1.65; color: var(--chalk); overflow-x: auto; }
.b-body p { margin: 6px 0; }
.b-body code { background: rgba(0,0,0,.25); padding: 1px 6px; border-radius: 6px; }
.b-body .katex { color: #fffbe6; font-size: 1.08em; }
.b-body .katex-display { margin: 10px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.b-body ul, .b-body ol { padding-left: 22px; margin: 6px 0; }
.b-body table { border-collapse: collapse; } .b-body td, .b-body th { border: 1px solid rgba(255,255,255,.25); padding: 4px 8px; }
.b-photo { max-height: 160px; border-radius: 10px; border: 2px solid rgba(255,255,255,.3); margin: 6px 0 4px; }

.board-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,.2); }
.chalk-btn { background: rgba(255,255,255,.1); color: var(--chalk); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 8px 14px; font: 600 14px var(--font); cursor: pointer; }
.chalk-btn:hover { background: rgba(255,255,255,.2); }
.chalk-btn.primary { background: var(--chalk-yellow); color: #2b1d00; border-color: transparent; }
.thinking { font: 700 26px var(--hand); color: var(--chalk-yellow); padding: 40px 0; text-align: center; }
.thinking .dots::after { content: ""; animation: dots 1.2s infinite steps(4); }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.composer { padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.composer-opts { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.composer-opts select { width: auto; padding: 7px 10px; font-size: 13px; border-radius: 10px; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { resize: none; min-height: 48px; max-height: 160px; }
.icon-btn { width: 48px; height: 48px; flex: none; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); }
.attach-preview { display: none; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.attach-preview.show { display: flex; }
.attach-preview img { height: 44px; border-radius: 8px; border: 1px solid var(--line); }

/* scratchpad */
.pad-wrap { display: flex; flex-direction: column; height: 100%; gap: 10px; }
.pad-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); }
#pad { flex: 1; width: 100%; min-height: 320px; background: var(--board); border-radius: 16px; touch-action: none; cursor: crosshair; box-shadow: inset 0 0 0 8px #6b4a2f; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgba(20, 26, 34, .55); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal.show { display: flex; }
.modal .sheet { background: var(--surface); border-radius: 22px; max-width: 440px; width: 100%; padding: 28px; position: relative; }
.modal .close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .icon-btn.menu-btn { display: grid; }
  .stage { padding: 10px; }
  .board { padding: 20px 18px 22px; }
  .b-question { font-size: 22px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171d; --surface: #1a2129; --ink: #eef1f4; --muted: #9aa4b0; --line: #2b343e; --brand: #3fae8f; --brand-soft: #1d3a32; --shadow: 0 10px 30px rgba(0,0,0,.35);
  }
  :root:not([data-theme="light"]) .input, :root:not([data-theme="light"]) .icon-btn { background: #141a20; }
  :root:not([data-theme="light"]) .nav { background: rgba(18, 23, 29, .88); }
}
@media (max-width: 520px) { .hide-sm { display: none; } }

/* plan picker + UPI payment */
.plan-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.plan-opt { position: relative; cursor: pointer; }
.plan-opt input { position: absolute; opacity: 0; pointer-events: none; }
.plan-opt > span { display: flex; flex-direction: column; gap: 2px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; transition: border-color .15s, box-shadow .15s; }
.plan-opt em { font-style: normal; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plan-opt small { color: var(--muted); font-size: 12px; }
.plan-opt input:checked + span { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.pay-amt { font-size: 22px; }
.pay-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px auto; }
.pay-qr svg { width: 200px; height: 200px; background: #fff; border-radius: 12px; }
.pay-qr small { color: var(--muted); font-size: 12px; }
.pay-vpa { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; font-size: 14px; }
.pay-vpa code { background: var(--brand-soft); color: var(--brand); padding: 4px 8px; border-radius: 8px; word-break: break-all; }
.pay-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0; font-size: 14px; color: var(--muted); text-align: center; flex-wrap: wrap; }
.pay-wait #payTimer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-utr { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.pay-utr summary { cursor: pointer; font-weight: 600; }
.modal .sheet { max-height: calc(100vh - 32px); overflow-y: auto; }
.pricing.three { grid-template-columns: repeat(3, 1fr); max-width: 1080px; }
@media (max-width: 900px) { .pricing.three { grid-template-columns: 1fr; max-width: 460px; } }
