/* AI Shikkha — course site.
   Green palette lifted from HisabCalc so the two sites read as one family:
   brand #062b1c, accent #12a06f, accent-2 #5fd6a4, ground #f4f7f4.
   Mobile-first, because the lessons are read on a phone. */

:root {
  /* brand */
  --brand: #062b1c;
  --brand-2: #0c4c34;
  --accent: #12a06f;
  --accent-2: #5fd6a4;
  --accent-3: #7fe0b4;

  /* surfaces */
  --bg: #f4f7f4;
  --bg-2: #e9f1ec;
  --card: #ffffff;
  --card-2: #fbfdfc;

  /* ink */
  --ink: #08170f;
  --ink-2: #0f2a1e;
  --body: #33453c;
  --dim: #5c6e64;

  /* lines */
  --line: #e1e8e3;
  --line-2: #eef3f0;
  --hair: rgba(8, 23, 15, .06);

  /* state */
  --ok: #12a06f;
  --ok-bg: #e6f7f0;
  --warn: #8f5504;
  --warn-bg: #fdf4e6;
  --err: #b21f1f;
  --err-bg: #fceef1;

  --r: 22px;
  --r-2: 16px;
  --r-3: 12px;
  --pill: 999px;

  --ring: 0 0 0 4px rgba(18, 160, 111, .16);
  --sh-1: 0 1px 2px rgba(8, 23, 15, .05), 0 8px 24px rgba(8, 23, 15, .05);
  --sh-2: 0 2px 6px rgba(8, 23, 15, .07), 0 18px 44px rgba(8, 23, 15, .09);
  --ease: cubic-bezier(.22, .61, .36, 1);

  --font-display: "Hind Siliguri", "Noto Sans Bengali", Georgia, serif;
  --font-body: "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system,
               "Segoe UI", Roboto, sans-serif;
  --maxw: 780px;
}

html[data-theme="dark"] {
  --brand: #7fe0b4;
  --brand-2: #4cc394;
  --accent: #3fc894;
  --accent-2: #7fe0b4;
  --accent-3: #a5ecc9;

  --bg: #0b1512;
  --bg-2: #152520;
  --card: #101d18;
  --card-2: #14231d;

  --ink: #eaf3ee;
  --ink-2: #d3e4da;
  --body: #c0d2c8;
  --dim: #8aa295;

  --line: #22382e;
  --line-2: #1b2c25;
  --hair: rgba(255, 255, 255, .06);

  --ok: #3fc894;
  --ok-bg: #10301f;
  --warn: #e0a952;
  --warn-bg: #241d10;
  --err: #f08a8a;
  --err-bg: #33191c;

  --ring: 0 0 0 4px rgba(63, 200, 148, .2);
  --sh-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .35), 0 20px 48px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

/* The hidden attribute is a UA-stylesheet display:none, so ANY author display
   rule silently beats it. .why sets display:flex, which made every explanation
   visible before the question was answered. This restores the intent. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.42;
  letter-spacing: -.011em;
  font-weight: 700;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 84px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 11px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 18px; color: var(--ink);
  display: flex; align-items: center; gap: 9px;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  box-shadow: 0 3px 10px rgba(18, 160, 111, .35);
}
.spacer { flex: 1; }
.iconbtn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: var(--r-3); width: 40px; height: 40px; font-size: 17px;
  cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; transition: all .18s var(--ease);
}
.iconbtn:hover { background: var(--bg-2); transform: translateY(-1px); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------------- hero ---------------- */
.hero {
  position: relative; margin: 20px 0 8px; padding: 30px 22px 26px;
  border-radius: var(--r); overflow: hidden;
  background:
    radial-gradient(120% 90% at 88% -12%, rgba(95, 214, 164, .34), transparent 60%),
    linear-gradient(150deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #eafaf2; box-shadow: var(--sh-2);
}
html[data-theme="dark"] .hero {
  background:
    radial-gradient(120% 90% at 88% -12%, rgba(63, 200, 148, .28), transparent 60%),
    linear-gradient(150deg, #0e2a20 0%, #123a2b 100%);
}
.hero .eyebrow {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-3);
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  padding: 5px 12px; border-radius: var(--pill); margin-bottom: 14px;
}
.hero h1 {
  color: #ffffff; font-size: 29px; margin: 0 0 12px; line-height: 1.34;
}
html[data-theme="dark"] .hero h1 { color: #f2fbf7; }
.hero p { color: rgba(234, 250, 242, .82); margin: 0; font-size: 16.5px; }

.stats { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.stat {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--pill); padding: 7px 14px; font-size: 14.5px;
  color: rgba(234, 250, 242, .9); backdrop-filter: blur(4px);
}
.stat b { color: #fff; font-weight: 700; }

/* ---------------- progress ---------------- */
.progresscard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 17px 18px; margin-top: 18px;
  box-shadow: var(--sh-1);
}
.progresscard .row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 10px;
}
.progresscard .row b { color: var(--ink); font-family: var(--font-display); }
.progresscard .row span { color: var(--dim); font-size: 15px; }
.bar {
  height: 11px; background: var(--bg-2); border-radius: var(--pill);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(8, 23, 15, .06);
}
.bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--pill); transition: width .8s var(--ease);
}

/* ---------------- modules ---------------- */
.module { margin-top: 40px; }
.module > h2 {
  font-size: 21px; margin: 0 0 3px; display: flex; align-items: center; gap: 9px;
}
.module > .sub { color: var(--dim); font-size: 15px; margin: 0 0 16px; }

.lessons { display: grid; gap: 11px; }

.card {
  display: flex; align-items: flex-start; gap: 14px; position: relative;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-2); padding: 15px 16px; overflow: hidden;
  box-shadow: var(--sh-1); color: var(--body);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              border-color .2s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-3) 100%);
  transform: scaleY(0); transform-origin: top; transition: transform .25s var(--ease);
}
.card:hover {
  text-decoration: none; transform: translateY(-3px);
  box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}
.card:hover::before { transform: scaleY(1); }
.card .num {
  flex: none; width: 44px; height: 44px; border-radius: var(--r-3);
  background: var(--bg-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; font-family: var(--font-display);
  transition: all .2s var(--ease);
}
.card.done .num {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
}
.card .body { min-width: 0; }
.card h3 { margin: 0 0 3px; font-size: 17px; }
.card p { margin: 0; color: var(--dim); font-size: 14.5px; line-height: 1.65; }
.card .tag {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 8px;
  font-size: 12.5px; font-weight: 600; border-radius: var(--pill); padding: 3px 11px;
  background: var(--ok-bg); color: var(--ok);
}
.card .tag.soon { background: var(--warn-bg); color: var(--warn); }

/* ---------------- lesson head ---------------- */
.lesson-head { padding: 22px 0 4px; }
.crumb { color: var(--dim); font-size: 14.5px; margin-bottom: 10px; }
.crumb a { font-weight: 600; }
.lesson-head h1 { font-size: 28px; margin: 0 0 10px; }
.goal {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-2); padding: 13px 15px; margin: 0;
  color: var(--body); font-size: 16px; box-shadow: var(--sh-1);
}

/* ---------------- article ---------------- */
.article {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 22px 19px; margin-top: 18px;
  box-shadow: var(--sh-1);
}
.article h2 {
  font-size: 21px; margin: 30px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line-2);
}
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 18px; margin: 22px 0 7px; color: var(--ink-2); }
.article p { margin: 0 0 13px; }
.article strong { color: var(--ink-2); font-weight: 700; }
.article ul, .article ol { margin: 0 0 15px; padding-left: 4px; list-style: none; }
.article li { margin-bottom: 8px; padding-left: 24px; position: relative; }
.article ul > li::before {
  content: ""; position: absolute; left: 4px; top: 11px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-2);
}
.article ol { counter-reset: li; }
.article ol > li { counter-increment: li; }
.article ol > li::before {
  content: counter(li); position: absolute; left: 0; top: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--bg-2); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 19px; text-align: center;
}
.article code {
  background: var(--bg-2); color: var(--brand-2); padding: 2px 7px;
  border-radius: 7px; font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
html[data-theme="dark"] .article code { color: var(--accent-2); }
.article pre {
  background: var(--bg-2); padding: 14px; border-radius: var(--r-3);
  overflow-x: auto; font-size: 14.5px; border: 1px solid var(--line-2);
}
.article table {
  width: 100%; border-collapse: collapse; margin: 0 0 17px;
  font-size: 15.5px; border-radius: var(--r-3); overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}
.article th, .article td {
  border-bottom: 1px solid var(--line-2); padding: 10px 12px; text-align: left;
}
.article th { background: var(--bg-2); color: var(--ink); font-weight: 700; }
.article tr:last-child td { border-bottom: 0; }
.article blockquote {
  margin: 0 0 15px; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--ok-bg); border-radius: 0 var(--r-3) var(--r-3) 0;
  color: var(--ink-2);
}
.article img { max-width: 100%; height: auto; border-radius: var(--r-3); }

.diagram {
  background: linear-gradient(160deg, var(--bg-2) 0%, var(--card-2) 100%);
  border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 18px 14px; margin: 0 0 18px; text-align: center; overflow-x: auto;
}
.diagram svg { max-width: 100%; height: auto; }

/* ---------------- section shell ---------------- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 22px 19px; margin-top: 18px;
  box-shadow: var(--sh-1);
}
.panel > h2 { margin: 0 0 5px; font-size: 21px; }
.panel > .sub { color: var(--dim); font-size: 15px; margin: 0 0 18px; }

/* ---------------- quiz ---------------- */
.q { padding: 18px 0; border-top: 1px solid var(--line-2); }
.q:first-of-type { border-top: 0; padding-top: 4px; }
.q .qhead {
  display: flex; gap: 11px; align-items: flex-start; margin-bottom: 12px;
}
.q .qno {
  flex: none; width: 27px; height: 27px; border-radius: 50%;
  background: var(--bg-2); color: var(--accent);
  font-size: 13px; font-weight: 700; display: flex;
  align-items: center; justify-content: center;
}
.q .qtext { font-weight: 600; color: var(--ink); margin: 0; flex: 1; }

.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  text-align: left; cursor: pointer; font: inherit; font-size: 16px;
  background: var(--card-2); color: var(--body);
  border: 1px solid var(--line); border-radius: var(--r-3);
  padding: 12px 14px; margin-bottom: 9px;
  transition: all .16s var(--ease);
}
.opt:hover:not([disabled]) {
  border-color: var(--accent); background: var(--bg-2); transform: translateX(3px);
}
.opt .mark {
  flex: none; width: 25px; height: 25px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: var(--dim);
  transition: all .16s var(--ease);
}
.opt.correct {
  background: var(--ok-bg); border-color: var(--ok); color: var(--ok);
  font-weight: 600;
}
.opt.correct .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong {
  background: var(--err-bg); border-color: var(--err); color: var(--err);
}
.opt.wrong .mark { background: var(--err); border-color: var(--err); color: #fff; }
.opt[disabled] { cursor: default; }
.opt[disabled]:not(.correct):not(.wrong) { opacity: .55; }

.why {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--ok-bg); border-radius: var(--r-3);
  padding: 11px 14px; margin-top: 4px; font-size: 15.5px;
  color: var(--ink-2); animation: fadeUp .3s var(--ease);
}
.why .ic { flex: none; }
.why.wrongbox { background: var(--err-bg); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- results ---------------- */
.results {
  margin-top: 20px; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--sh-2);
  animation: fadeUp .4s var(--ease);
}
.results .top {
  padding: 24px 20px; text-align: center;
  background:
    radial-gradient(120% 100% at 80% 0%, rgba(95, 214, 164, .3), transparent 62%),
    linear-gradient(150deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
}
html[data-theme="dark"] .results .top {
  background:
    radial-gradient(120% 100% at 80% 0%, rgba(63, 200, 148, .26), transparent 62%),
    linear-gradient(150deg, #0e2a20 0%, #123a2b 100%);
}
.results .big {
  font-family: var(--font-display); font-size: 44px; font-weight: 700;
  line-height: 1.1; color: #fff;
}
.results .of { font-size: 17px; color: rgba(255, 255, 255, .78); margin-top: 4px; }
.results .verdict {
  margin-top: 12px; font-size: 16.5px; color: rgba(255, 255, 255, .94);
}
.results .ring {
  width: 108px; height: 108px; margin: 0 auto 14px; position: relative;
}
.results .ring svg { transform: rotate(-90deg); }
.results .ring .val {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-display);
  font-size: 26px; font-weight: 700; color: #fff;
}
.results .bottom { background: var(--card); padding: 18px 20px; }
.results .bottom h3 { margin: 0 0 10px; font-size: 17px; }
.rlist { list-style: none; padding: 0; margin: 0; }
.rlist li {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 0;
  font-size: 15px; border-bottom: 1px solid var(--line-2);
}
.rlist li:last-child { border-bottom: 0; }
.rlist .ric { flex: none; font-size: 15px; }
.rlist .rq { color: var(--dim); }

/* ---------------- practice ---------------- */
.practice { margin-top: 18px; }
.p-item {
  border: 1px solid var(--line); border-radius: var(--r-2);
  padding: 16px; margin-bottom: 14px; background: var(--card-2);
}
.p-item > .ptitle {
  font-weight: 700; color: var(--ink); margin: 0 0 4px;
  display: flex; gap: 9px; align-items: flex-start;
}
.p-item > .pinst { color: var(--dim); font-size: 15px; margin: 0 0 14px; }

/* sort: item rows with bucket buttons */
.sitem {
  border: 1px solid var(--line); border-radius: var(--r-3);
  padding: 12px 13px; margin-bottom: 10px; background: var(--card);
}
.sitem .stext { font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.buckets { display: flex; flex-wrap: wrap; gap: 8px; }
.bucket {
  border: 1px solid var(--line); background: var(--card-2); color: var(--body);
  border-radius: var(--pill); padding: 7px 15px; font: inherit; font-size: 14.5px;
  cursor: pointer; transition: all .16s var(--ease);
}
.bucket:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-1px); }
.bucket[disabled] { cursor: default; }
.bucket.correct { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.bucket.wrong { background: var(--err-bg); border-color: var(--err); color: var(--err); }

/* fill in the blank */
.blank {
  border: 0; border-bottom: 2px dashed var(--accent); background: transparent;
  color: var(--ink); font: inherit; font-size: 16px; padding: 2px 4px;
  min-width: 110px; text-align: center;
}
.blank:focus { outline: none; border-bottom-style: solid; box-shadow: var(--ring); border-radius: 6px; }
.blank.ok { border-color: var(--ok); color: var(--ok); font-weight: 700; }
.blank.no { border-color: var(--err); color: var(--err); }
.fillrow { margin-bottom: 13px; }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: var(--pill); padding: 9px 20px; font: inherit; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: all .16s var(--ease);
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(18, 160, 111, .32);
}
.btn.primary:hover { box-shadow: 0 6px 20px rgba(18, 160, 111, .42); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* order steps */
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.step {
  border: 1px solid var(--line); background: var(--card); color: var(--body);
  border-radius: var(--r-3); padding: 9px 14px; font: inherit; font-size: 15px;
  cursor: pointer; transition: all .16s var(--ease); text-align: left;
}
.step:hover:not([disabled]) { border-color: var(--accent); }
.step.picked {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; border-color: transparent; font-weight: 600;
}
.step.correct { background: var(--ok); color: #fff; border-color: var(--ok); }
.step.wrong { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.picked-list { font-size: 15px; color: var(--dim); margin: 0 0 10px; }

/* match pairs */
.mrow {
  display: flex; gap: 10px; align-items: center; margin-bottom: 9px;
  flex-wrap: wrap;
}
.mcol { flex: 1 1 42%; min-width: 130px; }
.mitem {
  width: 100%; border: 1px solid var(--line); background: var(--card);
  color: var(--body); border-radius: var(--r-3); padding: 10px 13px;
  font: inherit; font-size: 15px; cursor: pointer; text-align: left;
  transition: all .16s var(--ease);
}
.mitem:hover:not([disabled]) { border-color: var(--accent); }
.mitem.sel { border-color: var(--accent); box-shadow: var(--ring); }
.mitem.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.mitem.bad { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.mitem[disabled] { cursor: default; }

/* ---------------- pager + footer ---------------- */
.pager { display: flex; gap: 11px; margin-top: 30px; }
.pager a {
  flex: 1; text-align: center; padding: 15px; font-weight: 600;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-2); color: var(--ink); box-shadow: var(--sh-1);
  transition: all .18s var(--ease);
}
.pager a:hover {
  text-decoration: none; transform: translateY(-2px); border-color: var(--accent);
  box-shadow: var(--sh-2);
}
.pager a.next {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 5px 18px rgba(18, 160, 111, .3);
}

.notice {
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--r-2); padding: 14px 16px; font-size: 15.5px; margin-top: 16px;
}

footer {
  margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--dim); font-size: 14.5px; text-align: center;
}

@media (min-width: 640px) {
  .hero h1 { font-size: 36px; }
  .lesson-head h1 { font-size: 32px; }
  .article, .panel { padding: 28px 26px; }
  .results .big { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
