/* ============================================================
   HSC Islam · Grade 11 — Mu'āmalāt
   UI restyled to match designer spec: soft lavender canvas,
   white rounded cards, indigo accent, pastel resource icons.
   Mobile-first, zero dependencies.
   ============================================================ */

/* ---------- Plus Jakarta Sans (self-hosted, variable) ---------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Rasmee — Dhivehi (Thaana) typeface by Akuru Type */
@font-face {
  font-family: "AK Rasmee";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/akrasmee.woff2") format("woff2");
  unicode-range: U+0780-07BF, U+FDF2, U+FDFD;
}

:root {
  --bg: #eef0f7;
  --bg-2: #f5f6fb;
  --card: #ffffff;
  --ink: #20243a;          /* primary dark navy text */
  --ink-soft: #4a5070;
  --muted: #9aa1b9;        /* secondary gray text */
  --line: #edeef5;
  --line-2: #e3e5ef;

  --indigo: #5566f6;       /* primary accent */
  --indigo-deep: #4250e0;
  --indigo-soft: #eef0fe;
  --navy: #0b1437;         /* dark CTA */

  --ok: #16a34a;
  --ok-soft: #e7f6ee;
  --warn: #d99a25;
  --warn-soft: #fff5e0;
  --bad: #ef5350;
  --bad-soft: #fdecec;

  /* pastel icon tints  (bg / glyph) */
  --c-pink-bg: #fbe1ec;   --c-pink: #e35e98;
  --c-blue-bg: #e3ecff;   --c-blue: #4f7cf5;
  --c-purple-bg: #efe6ff; --c-purple: #8b5cf6;
  --c-orange-bg: #ffe9d4; --c-orange: #f0913c;
  --c-tan-bg: #efe6da;    --c-tan: #b08968;
  --c-coral-bg: #fee1de;  --c-coral: #ef6a5c;
  --c-green-bg: #e3f5ea;  --c-green: #16a34a;

  --radius: 18px;
  --radius-lg: 22px;
  --shadow: 0 6px 22px rgba(28, 38, 92, 0.06);
  --shadow-sm: 0 2px 10px rgba(28, 38, 92, 0.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-2: #181b24;
  --card: #1a1d27;
  --ink: #e8eaf2;
  --ink-soft: #b3b9cd;
  --muted: #7d839b;
  --line: #262a36;
  --line-2: #333849;

  --indigo: #7c8bff;
  --indigo-deep: #aab3ff;
  --indigo-soft: #242843;
  --navy: #272c54;

  --ok: #35d27c;
  --ok-soft: #15301f;
  --warn: #e6b34a;
  --warn-soft: #2f2613;
  --bad: #ff6b6b;
  --bad-soft: #341d1f;

  --c-pink-bg: #3a2330;   --c-pink: #ff8ab8;
  --c-blue-bg: #1f2a45;   --c-blue: #7ba2ff;
  --c-purple-bg: #2a2342; --c-purple: #b79bff;
  --c-orange-bg: #3a2a1a; --c-orange: #ffae66;
  --c-tan-bg: #322a20;    --c-tan: #d6b48f;
  --c-coral-bg: #3a2422;  --c-coral: #ff8c7d;
  --c-green-bg: #16301f;  --c-green: #4cd585;

  --shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}
/* lift the brand logo square so it reads on the dark canvas */
[data-theme="dark"] .brand__logo svg rect { fill: #2a3060; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { min-height: 100%; background: var(--bg); overflow-x: hidden; }

body {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(86px + var(--safe-bot));
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); margin: 0; }
p { margin: 0 0 12px; }
a { color: var(--indigo); text-decoration: none; }
ul, ol { margin: 0 0 12px; padding-left: 22px; }
li { margin-bottom: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px;
  padding: calc(8px + var(--safe-top)) 16px 8px;
  background: var(--bg);
}
.topbar__back {
  background: transparent; border: 0; color: var(--indigo);
  width: 36px; height: 36px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; margin-left: -8px;
}
.topbar__back:active { background: var(--indigo-soft); }
.topbar__title { flex: 1; font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.topbar.is-flat { background: var(--bg); }

/* branded header (top-level tabs) */
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand__logo { display: grid; place-items: center; }
.brand__logo svg { display: block; border-radius: 14px; }
.brand__name { font-weight: 800; font-size: 1.35rem; letter-spacing: -.01em; color: var(--ink); }
.topbar__menu {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); border: 0; color: var(--ink); cursor: pointer;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.topbar__menu:active { background: var(--bg-2); }

/* header dropdown menu */
.menu-pop {
  position: fixed; top: calc(58px + var(--safe-top)); right: 14px; z-index: 120;
  background: var(--card); border-radius: 16px; box-shadow: 0 12px 34px rgba(28,38,92,.16);
  padding: 6px; min-width: 210px; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.menu-pop a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
  font-weight: 600; font-size: .95rem; color: var(--ink); cursor: pointer;
}
.menu-pop a:active { background: var(--bg-2); }
.menu-pop a svg { width: 18px; height: 18px; color: var(--muted); }
.menu-pop__danger { color: var(--bad); }
.menu-pop__danger svg { color: var(--bad); }

/* ---------- Home: hero carousel ---------- */
.hero { margin: 4px 0 2px; }
.hero__track {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px;
}
.hero__track::-webkit-scrollbar { display: none; }
.hero__slide {
  flex: 0 0 100%; scroll-snap-align: center;
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 20px; min-height: 96px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.hero__slide--cta { cursor: pointer; }
.hero__txt { min-width: 0; }
.hero__hi { font-size: 1.32rem; font-weight: 800; color: var(--ink); }
.hero__hi span { color: var(--warn); }
.hero__sub { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.streak {
  flex: none; display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line-2); border-radius: 14px; padding: 12px 16px;
}
.streak__fire { font-size: 1.3rem; }
.streak b { font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.hero__ring { flex: none; width: 56px; height: 56px; }
.hero__ring .ring__label { font-size: .82rem; }
.hero__go {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: var(--indigo-soft); color: var(--indigo);
}
.hero__go svg { width: 20px; height: 20px; }
.dots { display: flex; justify-content: center; gap: 7px; margin: 12px 0 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); transition: all .2s; }
.dot.active { background: var(--warn); width: 20px; border-radius: 4px; }

/* ---------- Home: continue studying ---------- */
.study {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 0; margin-bottom: 14px; overflow: hidden; cursor: pointer;
}
.study__row { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; }
.study__icon {
  flex: none; width: 52px; height: 52px; border-radius: 16px; background: var(--indigo-soft);
  display: grid; place-items: center; font-size: 1.7rem;
}
.study__body { flex: 1; min-width: 0; }
.study__title { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.study__meta { color: var(--muted); font-weight: 600; font-size: .9rem; margin-top: 3px; }
.study__bar { height: 5px; background: var(--line); border-radius: 5px 5px 0 0; overflow: hidden; }
.study__bar i { display: block; height: 100%; background: linear-gradient(90deg, #3dd7c0, #16a34a); border-radius: 5px; transition: width .4s; }

/* ---------- Home: wide bookmark card ---------- */
.wide-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer;
}
.wide-card__icon {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  background: var(--c-orange-bg); color: var(--c-orange); display: grid; place-items: center;
}
.wide-card__icon svg { width: 22px; height: 22px; }
.wide-card__title { flex: 1; font-weight: 700; color: var(--ink); }
.wide-card__go { color: #16a34a; display: grid; place-items: center; }
.wide-card__go svg { width: 22px; height: 22px; }

/* ---------- Home: articles ---------- */
.row-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 12px; }
.row-head__more { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); font-weight: 700; font-size: .9rem; cursor: pointer; }
.row-head__more svg { width: 15px; height: 15px; }
.art-scroll {
  display: flex; gap: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px;
}
.art-scroll::-webkit-scrollbar { display: none; }
.art {
  flex: 0 0 66%; max-width: 260px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
}
.art__cover { height: 120px; display: block; }
.art__cover svg, .art__hero svg, .art__thumb svg { width: 100%; height: 100%; display: block; }
.art__title { font-weight: 700; color: var(--ink); padding: 12px 14px 2px; line-height: 1.3; }
.art__meta { color: var(--muted); font-weight: 600; font-size: .85rem; padding: 0 14px 14px; }
.art__thumb { flex: none; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; }
.art__hero { height: 150px; border-radius: var(--radius-lg); overflow: hidden; margin: 4px 0 6px; }
.cover-tan    { background: linear-gradient(135deg, #fbe3b3, #f6d28a); }
.cover-teal   { background: linear-gradient(135deg, #7fe9d8, #3dd7c0); }
.cover-purple { background: linear-gradient(135deg, #c9b8ff, #9b87f5); }

/* ---------- View / layout ---------- */
.view { max-width: 640px; margin: 0 auto; padding: 4px 16px 28px; outline: none; }
.view:focus { outline: none; }

.section-label {
  font-size: 1.02rem; font-weight: 800; color: var(--ink);
  margin: 22px 2px 12px;
}
.muted { color: var(--muted); }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* ---------- Subject header card ---------- */
.subject {
  background: var(--card); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); margin-top: 6px;
}
.subject__top { display: flex; gap: 16px; align-items: center; }
.subject__icon { flex: none; width: 72px; height: 72px; display: grid; place-items: center; }
.subject__icon svg { width: 72px; height: 72px; filter: drop-shadow(0 8px 14px rgba(85,102,246,.32)); }
.subject__info { min-width: 0; }
.subject__title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.2px; }
.subject__desc { color: var(--ink-soft); font-size: .92rem; margin: 4px 0 0; }
.subject__stats {
  display: flex; flex-wrap: wrap; gap: 18px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.stat { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.stat svg { width: 18px; height: 18px; color: var(--muted); }
.stat b { color: var(--ink); font-weight: 700; }

/* ---------- Segmented tabs (Lessons / Resources) ---------- */
.segment { display: flex; gap: 10px; margin: 20px 0 4px; }
.segment a {
  flex: 0 0 auto; padding: 11px 22px; border-radius: 12px;
  font-weight: 700; font-size: .95rem; color: var(--ink);
  background: var(--card); border: 1.5px solid transparent; box-shadow: var(--shadow-sm);
}
.segment a.active { color: var(--indigo); border-color: var(--indigo); background: var(--card); }

/* ---------- Generic list card (resources) ---------- */
.list { display: grid; gap: 14px; margin-top: 6px; }
.row {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); color: inherit; transition: transform .12s ease;
}
.row:active { transform: scale(.99); }
.row__icon {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
}
.row__icon svg { width: 22px; height: 22px; }
.row__body { flex: 1; min-width: 0; }
.row__title { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.row__desc { font-size: .9rem; color: var(--ink-soft); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__count { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.row__go {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--line-2); display: grid; place-items: center; color: var(--ink-soft);
}
.row__go svg { width: 17px; height: 17px; }
.row:active .row__go { border-color: var(--indigo); color: var(--indigo); }

/* pastel tints */
.t-pink   { background: var(--c-pink-bg);   color: var(--c-pink); }
.t-blue   { background: var(--c-blue-bg);   color: var(--c-blue); }
.t-purple { background: var(--c-purple-bg); color: var(--c-purple); }
.t-orange { background: var(--c-orange-bg); color: var(--c-orange); }
.t-tan    { background: var(--c-tan-bg);    color: var(--c-tan); }
.t-coral  { background: var(--c-coral-bg);  color: var(--c-coral); }
.t-green  { background: var(--c-green-bg);  color: var(--c-green); }

/* ---------- Lesson accordion (Lessons tab) ---------- */
.unit { display: grid; gap: 14px; }
.acc {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.acc__head {
  display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer;
}
.acc__icon {
  flex: none; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.4rem;
  background: var(--indigo-soft);
}
.acc__info { flex: 1; min-width: 0; }
.acc__title { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.acc__sub { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.acc__meta { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.acc__meta span { display: inline-flex; align-items: center; gap: 5px; }
.acc__meta svg { width: 14px; height: 14px; }
.acc__chev { flex: none; color: var(--muted); transition: transform .25s ease; }
.acc__chev svg { width: 20px; height: 20px; display: block; }
.acc.open .acc__chev { transform: rotate(180deg); }

.acc__body { display: none; padding: 0 16px 8px; }
.acc.open .acc__body { display: block; }
.acc__item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px; border-radius: 12px; cursor: pointer; color: var(--ink-soft);
  font-size: .92rem; line-height: 1.4;
}
.acc__item:active { background: var(--bg-2); }
.acc__item.current { background: var(--warn-soft); color: var(--ink); }
.acc__check {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; border: 1.6px solid var(--line-2); color: transparent;
}
.acc__check svg { width: 13px; height: 13px; }
.acc__item.done .acc__check { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.acc__item.current .acc__check { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.acc__dot {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.15rem;
}
.acc__dot svg { width: 18px; height: 18px; }
.acc__itxt { flex: 1; min-width: 0; }
.acc__ititle { font-weight: 600; color: var(--ink); font-size: .95rem; }
.acc__idesc { font-size: .82rem; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.acc__item.done .acc__ititle { color: var(--ink-soft); }

/* ---------- Lesson detail ---------- */
.lhead { margin: 6px 2px 8px; }
.pill {
  display: inline-block; background: var(--indigo-soft); color: var(--indigo);
  font-size: .74rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.lhead h1 { font-size: 1.5rem; margin: 10px 0 4px; letter-spacing: -.3px; }
.lhead .sub { color: var(--ink-soft); margin: 0; }

.objectives {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  margin: 16px 0; box-shadow: var(--shadow);
}
.objectives h3 { margin: 0 0 8px; font-size: .98rem; color: var(--indigo); }
.objectives ul { margin: 0; padding-left: 20px; }
.objectives li { font-size: .92rem; color: var(--ink-soft); }

.block {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  margin: 14px 0; box-shadow: var(--shadow);
}
.block h2 { font-size: 1.12rem; margin: 0 0 10px; }
.block p { color: var(--ink-soft); }
.block strong { color: var(--ink); }
.block blockquote {
  margin: 12px 0; padding: 12px 16px; background: var(--indigo-soft);
  border-left: 4px solid var(--indigo); border-radius: 10px; font-style: italic; color: var(--ink-soft);
}
.block blockquote .ref { display: block; font-style: normal; font-size: .8rem; color: var(--muted); margin-top: 4px; }

table.compare { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .86rem; margin: 8px 0; }
table.compare th, table.compare td { border: 1px solid var(--line-2); padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; word-break: break-word; }
table.compare th { background: var(--indigo-soft); color: var(--indigo-deep); }
table.compare td:first-child, table.compare th:first-child { font-weight: 700; background: var(--bg-2); }

/* ---------- Case study ---------- */
.casestudy {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  margin: 16px 0; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.casestudy__hd { background: var(--navy); color: #fff; padding: 14px 18px; font-weight: 800; }
.casestudy__hd small { display: block; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .6px; font-size: .68rem; margin-bottom: 2px; }
.casestudy__body { padding: 18px; }
.scenario { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; color: var(--ink-soft); }
.scenario b { color: var(--ink); }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li {
  position: relative; padding: 12px 14px 12px 46px; margin-bottom: 10px;
  background: var(--bg-2); border-radius: 12px; color: var(--ink-soft);
  opacity: 0; transform: translateY(8px); animation: rise .4s forwards;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 12px; top: 12px; width: 24px; height: 24px;
  background: var(--indigo); color: #fff; border-radius: 50%; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700;
}
.steps li b { color: var(--ink); }
.casestudy__lesson { margin-top: 14px; padding: 14px; background: var(--indigo-soft);
  border-radius: 12px; font-size: .92rem; color: var(--ink-soft); }
.casestudy__lesson b { color: var(--indigo-deep); }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Key terms inline ---------- */
.keyterms { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.keyterm {
  background: var(--card); color: var(--indigo-deep); border: 1.5px solid var(--line-2);
  padding: 7px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.keyterm:active { border-color: var(--indigo); background: var(--indigo-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--indigo); color: #fff; border: 0; border-radius: 14px;
  padding: 15px 18px; font-size: 1rem; font-weight: 700; cursor: pointer;
  width: 100%; box-shadow: 0 8px 20px rgba(85,102,246,.28);
}
.btn:active { background: var(--indigo-deep); }
.btn--navy { background: var(--navy); box-shadow: 0 8px 20px rgba(11,20,55,.25); }
.btn--ghost { background: var(--card); color: var(--ink); border: 1.5px solid var(--line-2); box-shadow: var(--shadow-sm); }
.btn--ghost:active { background: var(--bg-2); }
.btn-row { display: flex; gap: 12px; margin-top: 16px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---------- Quiz home ---------- */
.qhome-hero {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; text-align: center; cursor: pointer; margin-top: 6px;
}
.qhome-hero .ico3d { width: 64px; height: 64px; margin: 0 auto 10px; filter: drop-shadow(0 8px 14px rgba(85,102,246,.3)); }
.qhome-hero h3 { font-size: 1.05rem; }
.qhome-hero p { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.qtile {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px; text-align: center; cursor: pointer;
}
.qtile:active { transform: scale(.99); }
.qtile .ico3d { width: 48px; height: 48px; margin: 0 auto 10px; }
.qtile h4 { font-size: .98rem; }
.qtile p { color: var(--muted); font-size: .8rem; margin: 4px 0 0; }

/* ---------- Quiz runner ---------- */
.quiz-progress { font-size: .85rem; color: var(--ink-soft); margin: 6px 2px; font-weight: 600; }
.qbar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.qbar > i { display: block; height: 100%; background: var(--indigo); width: 0; transition: width .4s ease; }
.question { font-size: 1.2rem; font-weight: 700; color: var(--ink); margin: 4px 2px 18px; }
.options { display: grid; gap: 12px; }
.option {
  text-align: left; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 14px;
  padding: 15px; font-size: .98rem; cursor: pointer; display: flex; align-items: center; gap: 12px;
  color: var(--ink); transition: border-color .15s, background .15s; box-shadow: var(--shadow-sm);
}
.option__key { flex: none; width: 28px; height: 28px; border-radius: 9px; background: var(--indigo-soft);
  color: var(--indigo-deep); font-weight: 700; display: grid; place-items: center; font-size: .85rem; }
.option:active { border-color: var(--indigo); }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.correct .option__key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .option__key { background: var(--bad); color: #fff; }
.option[disabled] { cursor: default; }
.explain {
  margin-top: 16px; padding: 14px; border-radius: 12px; font-size: .92rem; color: var(--ink-soft);
  background: var(--ok-soft); border-left: 4px solid var(--ok); display: none;
}
.explain b { color: var(--ink); }
.explain.show { display: block; animation: rise .3s; }
.explain.show.bad { background: var(--bad-soft); border-left-color: var(--bad); }

/* ---------- Quiz result ---------- */
.result { text-align: center; padding: 20px 0 8px; }
.result__emoji { font-size: 3.4rem; }
.result__score { font-size: 3rem; font-weight: 800; color: var(--ink); }
.result__msg { color: var(--ink-soft); margin: 6px 0 4px; }

/* ---------- Glossary ---------- */
.glossary-list { display: grid; gap: 12px; }
.term-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.term-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.term-card__name { font-weight: 800; color: var(--ink); font-size: 1.04rem; }
.term-card__dhivehi {
  font-family: "AK Rasmee", "MV Faseyha", sans-serif;
  color: var(--indigo); font-weight: 400; font-size: 1.5rem; line-height: 1.2;
  direction: rtl;
}
.term-card__def { margin: 8px 0 0; color: var(--ink-soft); font-size: .92rem; }

/* ---------- Progress ring (Home / You) ---------- */
.progress-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); margin-top: 14px;
}
.ring { --val: 0; width: 68px; height: 68px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--line-2); stroke-width: 8; }
.ring__bar { fill: none; stroke: var(--indigo); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 176; stroke-dashoffset: calc(176 - 176 * var(--val)); transition: stroke-dashoffset .6s ease; }
.ring__label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: var(--ink); font-size: .95rem; }
.progress-meta { flex: 1; }
.progress-meta h3 { margin: 0 0 3px; font-size: 1.02rem; }
.progress-meta p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- You / profile ---------- */
.you-head { display: flex; align-items: center; gap: 16px; background: var(--card);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); margin-top: 6px; }
.you-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; background: var(--indigo-soft);
  color: var(--indigo); display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; }
.you-head h2 { font-size: 1.2rem; }
.you-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bot)); transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 14px;
  font-size: .9rem; opacity: 0; transition: .25s; z-index: 80; pointer-events: none;
  max-width: 88vw; text-align: center; box-shadow: 0 10px 30px rgba(11,20,55,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bot);
  box-shadow: 0 -4px 20px rgba(28,38,92,.05);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 11px 0 9px; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--indigo); }

/* ---------- Toggle switch ---------- */
.switch {
  flex: none; width: 46px; height: 28px; border-radius: 999px;
  background: var(--line-2); position: relative; transition: background .2s;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .2s;
}
.switch.on { background: var(--indigo); }
.switch.on i { transform: translateX(18px); }

/* ---------- Prevent long words / terms from overflowing ---------- */
.block, .block p, .block li, .objectives li, .scenario, .steps li,
.row__title, .row__desc, .row__count,
.acc__title, .acc__sub, .acc__ititle, .acc__idesc,
.term-card__def, .hero__hi, .hero__sub, .question, .option,
.subject__title, .subject__desc, .study__title, .study__meta,
.lhead h1, .lhead .sub, .art__title { overflow-wrap: break-word; word-break: break-word; }

.block blockquote { overflow-wrap: break-word; }
.casestudy { max-width: 100%; }

/* The comparison table is the one element that can get tight on phones */
@media (max-width: 430px) {
  table.compare { font-size: .8rem; }
  table.compare th, table.compare td { padding: 7px 8px; }
  .menu-pop { min-width: 0; width: calc(100vw - 28px); max-width: 300px; }
}

/* Only genuinely small phones (≤ 340px) need gentle tightening */
@media (max-width: 340px) {
  .view { padding-left: 13px; padding-right: 13px; }
  .hero__hi { font-size: 1.18rem; }
  .subject__title { font-size: 1.14rem; }
  .lhead h1 { font-size: 1.34rem; }
  .qgrid { gap: 10px; }
  table.compare { font-size: .74rem; }
  table.compare th, table.compare td { padding: 6px 6px; }
}

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 44px 20px 30px; max-width: 360px; margin: 0 auto; }
.empty__art {
  position: relative; width: 108px; height: 108px; margin: 0 auto 24px;
  border-radius: 34px; display: grid; place-items: center;
  animation: floaty 4s ease-in-out infinite;
}
.empty__art > span:first-child, .empty__art svg { width: 48px; height: 48px; }
.empty__art > span:first-child { display: grid; place-items: center; }
.empty__dot { position: absolute; border-radius: 50%; background: currentColor; opacity: .5; }
.empty__dot--a { width: 14px; height: 14px; top: -6px; right: 8px; opacity: .35; }
.empty__dot--b { width: 9px; height: 9px; bottom: 2px; left: -8px; opacity: .55; }
.empty__dot--c { width: 6px; height: 6px; top: 18px; left: -14px; opacity: .4; }
.empty__title { font-size: 1.2rem; font-weight: 800; }
.empty__text { color: var(--muted); margin: 8px auto 0; line-height: 1.5; }
.empty__cta { width: auto; display: inline-flex; padding-left: 30px; padding-right: 30px; margin-top: 24px; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* ---------- Wider screens ---------- */
@media (min-width: 600px) {
  .view { padding-top: 8px; }
}
