/* ============================================================
   BrainManual Law Portal — style.css
   Colour psychology: parchment canvas (low glare), indigo = focus/navigation,
   amber = story/emotion, emerald = rule/example, crimson = cases/exceptions.
   Edit only the variables below to re-theme the whole site.
   ============================================================ */
:root {
  --bg: #f6f1e6;
  --bg2: #efe8d8;
  --surface: #fffdf7;
  --text: #1d2433;
  --muted: #5a6475;
  --line: #e2d9c3;
  --brand: #060a3a;          /* logo navy */
  --indigo: #2336a0;
  --indigo-soft: #e8ebfb;
  --cyan: #0e9fb3;
  --amber: #b45309;  --amber-bg: #fff4d6;  --amber-line: #f3b43f;
  --green: #047857;  --green-bg: #e3f6ec;  --green-line: #34b27b;
  --red: #b4173f;    --red-bg: #fde9ee;    --red-line: #e8577a;
  --violet: #6d28d9; --violet-bg: #efe8fd;
  --shadow: 0 6px 22px rgba(30, 36, 70, .08);
  --radius: 16px;
  --fs: 16.5px;
  --sans: "Plus Jakarta Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Merriweather", "Noto Sans Devanagari", Georgia, serif;
}
:root[data-theme="dark"] {
  --bg: #0b1020; --bg2: #121a33; --surface: #151d38; --text: #e8ecf8; --muted: #9aa6c4; --line: #26325a;
  --indigo: #8fa2ff; --indigo-soft: #1b2650; --cyan: #3cd4e8;
  --amber: #ffd27a; --amber-bg: #2d2410; --amber-line: #b9821c;
  --green: #7be0b2; --green-bg: #0f2a22; --green-line: #1f9d6c;
  --red: #ff9bb3;   --red-bg: #33121d;   --red-line: #c43a5e;
  --violet: #c4a8ff; --violet-bg: #231a40;
  --shadow: 0 6px 22px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: var(--fs); scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.75; min-height: 100vh;
  transition: background .25s, color .25s; padding-bottom: 84px; }
a { color: var(--indigo); }
button { font-family: inherit; cursor: pointer; color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.notranslate { translate: no; }

/* ---------- Header ---------- */
.hdr { background: linear-gradient(100deg, var(--brand), #14246e 70%, #0b4b73); color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25); }
.hdr-in { display: flex; align-items: center; gap: 10px; padding: 8px 16px; max-width: 1100px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; min-width: 0; flex: 1; }
.brand img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid #22d3ee; box-shadow: 0 0 14px rgba(34, 211, 238, .5); flex: none; }
.brand b { display: block; font-size: 1.02rem; line-height: 1.15; font-weight: 800; letter-spacing: .01em; }
.brand small { display: block; font-size: .66rem; letter-spacing: .09em; color: #9ee7f3; font-weight: 700; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: 6px; align-items: center; flex: none; }
.ibtn { background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .22); color: #fff; border-radius: 10px;
  min-width: 38px; height: 38px; font-size: .95rem; font-weight: 700; padding: 0 8px; }
.ibtn:hover, .ibtn:focus-visible { background: rgba(34, 211, 238, .35); outline: none; }
#langSel { background: rgba(255, 255, 255, .13); color: #fff; border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; height: 38px;
  font-family: inherit; font-weight: 700; padding: 0 6px; max-width: 118px; }
#langSel option { color: #111; }
#google_translate_element { position: absolute; left: -9999px; top: 0; height: 0; overflow: hidden; }
body { top: 0 !important; }
.skiptranslate iframe, .goog-te-banner-frame { display: none !important; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }
#installBtn { background: #22d3ee; color: #05213a; border: 0; }

/* ---------- Crumbs / titles ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .8rem; margin: 14px 0 4px; color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 700; }
h1.page { font-size: 1.65rem; line-height: 1.25; margin: 6px 0 4px; font-weight: 800; }
.lead { color: var(--muted); margin-bottom: 14px; }

/* ---------- Home ---------- */
.hero { margin: 18px 0 10px; padding: 20px; border-radius: 20px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, rgba(34, 211, 238, .35), transparent 45%), linear-gradient(135deg, #0a1250, #2336a0); box-shadow: var(--shadow); }
.hero h1 { font-size: 1.5rem; line-height: 1.3; font-weight: 800; }
.hero p { color: #d7defd; font-size: .93rem; margin-top: 6px; }
.hero .method { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: .74rem; font-weight: 800; }
.pill.a { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); }
.pill.g { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.pill.r { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }
.pill.i { background: var(--indigo-soft); color: var(--indigo); border: 1px solid var(--indigo); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 12px 0 24px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow); display: block; transition: transform .15s, border-color .15s; position: relative; }
.tile:hover { transform: translateY(-2px); border-color: var(--cyan); }
.tile h3 { font-size: 1.05rem; line-height: 1.35; }
.tile p { font-size: .84rem; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.tile .code { font-size: .72rem; font-weight: 800; color: var(--cyan); letter-spacing: .08em; text-transform: uppercase; }
.badge { position: absolute; top: 12px; right: 12px; font-size: .64rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.badge.live { background: var(--green); color: #fff; }
.badge.soon { background: var(--bg2); color: var(--muted); }
.tile.soon { opacity: .72; }
.bar { height: 7px; border-radius: 9px; background: var(--bg2); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green-line)); }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 10px; position: sticky; top: 54px; z-index: 30; background: var(--bg);
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 7px 14px; border-radius: 99px; font-weight: 700; font-size: .85rem; text-decoration: none; color: var(--text); }
.tab.on { background: var(--indigo); color: #fff; border-color: var(--indigo); }
:root[data-theme="dark"] .tab.on { color: #0b1020; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: thin; }
.chip { flex: none; text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 12px; padding: 6px 12px;
  font-size: .8rem; font-weight: 700; max-width: 210px; line-height: 1.35; position: relative; }
.chip small { display: block; font-size: .66rem; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.chip.on { border-color: var(--cyan); background: var(--indigo-soft); box-shadow: inset 0 -3px 0 var(--cyan); }
.chip.done::after { content: "✓"; position: absolute; top: 3px; right: 7px; color: var(--green); font-weight: 900; }

/* ---------- Cards and boxes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 16px; box-shadow: var(--shadow); margin-bottom: 18px; }
.unit-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; border-bottom: 2px dashed var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.unit-top h2 { font-size: 1.28rem; line-height: 1.35; font-weight: 800; }
.tag { font-size: .7rem; font-weight: 800; color: var(--cyan); letter-spacing: .1em; text-transform: uppercase; }
.objective { background: var(--indigo-soft); border-left: 5px solid var(--indigo); border-radius: 12px; padding: 11px 14px; margin-bottom: 14px; font-size: .95rem; }
.objective b { color: var(--indigo); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: .85rem; }
.btn:hover { border-color: var(--cyan); }
.btn.pri { background: var(--indigo); color: #fff; border-color: var(--indigo); }
:root[data-theme="dark"] .btn.pri { color: #0b1020; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.sm { padding: 4px 10px; font-size: .76rem; border-radius: 9px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 8px; }
.sec-h h3 { font-size: .8rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.box { border-radius: 14px; padding: 13px 15px; margin: 10px 0; border: 1px solid; border-left-width: 6px; }
.box p { margin: 6px 0; }
.box.story { background: var(--amber-bg); border-color: var(--amber-line); color: var(--text); }
.box.story .lbl { color: var(--amber); }
.box.rule { background: var(--green-bg); border-color: var(--green-line); }
.box.rule .lbl { color: var(--green); }
.box.case { background: var(--red-bg); border-color: var(--red-line); }
.box.case .lbl { color: var(--red); }
.box.tip { background: var(--violet-bg); border-color: var(--violet); }
.box.tip .lbl { color: var(--violet); }
.box.gap { background: var(--bg2); border-color: var(--cyan); border-style: dashed; border-left-style: solid; }
.lbl { font-size: .72rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.story-ch { margin: 12px 0; padding-left: 12px; border-left: 3px solid var(--amber-line); }
.story-ch h4 { font-size: .98rem; color: var(--amber); margin-bottom: 2px; }
.story-ch p { margin: 7px 0; }
.glance { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 8px 0; }
.glance div { background: var(--bg2); border-radius: 12px; padding: 9px 12px; font-size: .88rem; line-height: 1.5; border: 1px solid var(--line); }
.glance div b { display: block; font-size: .72rem; letter-spacing: .08em; color: var(--cyan); text-transform: uppercase; }
details.chap { background: var(--surface); border: 1px solid var(--amber-line); border-radius: 12px; margin: 8px 0; overflow: hidden; }
details.chap > summary { cursor: pointer; padding: 10px 12px; font-weight: 800; color: var(--amber); list-style: none; display: flex; gap: 10px; align-items: center; line-height: 1.4; }
details.chap > summary::-webkit-details-marker { display: none; }
details.chap > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
details.chap[open] > summary::after { content: "▴"; }
details.chap[open] > summary { border-bottom: 1px dashed var(--amber-line); }
.chno { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--amber-line); color: #3b2300; display: grid; place-items: center; font-size: .75rem; }
.chb { padding: 4px 14px 10px; }
ul.pts { margin: 6px 0 6px 20px; } ul.pts li { margin: 5px 0; }
ol.pts { margin: 6px 0 6px 22px; } ol.pts li { margin: 5px 0; }
strong, b { font-weight: 800; }
mark.sec { background: var(--indigo-soft); color: var(--indigo); font-weight: 800; padding: 0 6px; border-radius: 6px; }

/* diagram */
.diagram { background: var(--bg2); border: 1px dashed var(--cyan); border-radius: 14px; padding: 12px; overflow-x: auto; min-height: 80px; display: block; text-align: center; }
.diagram svg { height: auto; max-width: 100%; display: inline-block; }
.zoom { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; }
.zoom-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.zoom-body { flex: 1; overflow: auto; padding: 14px; text-align: center; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.swipe-hint { font-size: .72rem; color: var(--muted); margin-top: 6px; text-align: center; font-weight: 700; }
.diagram .fallback { text-align: left; font-size: .85rem; color: var(--muted); white-space: pre-wrap; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 10px 0; border-radius: 12px; border: 1px solid var(--line); }
table.tbl { border-collapse: collapse; width: 100%; min-width: 520px; font-size: .88rem; background: var(--surface); }
table.tbl caption { text-align: left; padding: 9px 12px; font-weight: 800; background: var(--bg2); font-size: .85rem; }
table.tbl th { background: var(--indigo); color: #fff; padding: 9px 12px; text-align: left; font-size: .82rem; }
:root[data-theme="dark"] table.tbl th { color: #0b1020; }
table.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; line-height: 1.55; }
table.tbl tr:nth-child(even) td { background: var(--bg2); }

/* case cards */
details.cs { background: var(--surface); border: 1px solid var(--red-line); border-radius: 14px; margin: 9px 0; overflow: hidden; }
details.cs > summary { cursor: pointer; padding: 11px 14px; font-weight: 800; list-style: none; display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--red-bg); color: var(--text); }
details.cs > summary::-webkit-details-marker { display: none; }
details.cs > summary::after { content: "＋"; color: var(--red); font-weight: 900; }
details.cs[open] > summary::after { content: "－"; }
details.cs .cs-b { padding: 4px 14px 12px; }
.cs-b dl { margin: 6px 0; } .cs-b dt { font-size: .7rem; font-weight: 900; letter-spacing: .09em; color: var(--red); text-transform: uppercase; margin-top: 9px; }
.cs-b dd { margin-left: 0; }
.cs-sum small { display: block; font-weight: 600; color: var(--muted); font-size: .76rem; }

/* deep drawer */
details.deep { border: 1px solid var(--line); border-radius: 14px; margin: 16px 0 4px; overflow: hidden; }
details.deep > summary { cursor: pointer; padding: 13px 16px; font-weight: 800; background: var(--bg2); list-style: none; display: flex; justify-content: space-between; }
details.deep > summary::-webkit-details-marker { display: none; }
details.deep > summary::after { content: "▾"; }
details.deep[open] > summary::after { content: "▴"; }
.deep-b { padding: 6px 16px 14px; font-family: var(--serif); font-size: .93rem; line-height: 1.85; }
.deep-b h4 { font-family: var(--sans); font-size: .95rem; margin: 22px 0 6px; padding-top: 14px; border-top: 2px solid var(--line); color: var(--indigo); }
.deep-b h4:first-child { border-top: 0; padding-top: 0; margin-top: 8px; }
.deep-b p { margin: 0 0 .8em; }

/* nav bottom of unit */
.pager { display: flex; justify-content: space-between; gap: 10px; margin: 14px 0; }
.pager.top { margin: 0 0 10px; }

/* ---------- Quiz ---------- */
.q-setup { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
select.sel, input.inp { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-family: inherit; font-size: .9rem; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-weight: 800; }
.q-prog { height: 8px; background: var(--bg2); border-radius: 9px; overflow: hidden; margin-bottom: 14px; }
.q-prog i { display: block; height: 100%; background: var(--cyan); transition: width .3s; }
.q-text { font-size: 1.06rem; font-weight: 700; margin-bottom: 8px; line-height: 1.6; }
.opt { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 13px; margin: 8px 0; border-radius: 13px; border: 2px solid var(--line); background: var(--surface); font-size: .95rem; font-weight: 600; align-items: flex-start; }
.opt b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-size: .8rem; }
.opt:hover:not([disabled]) { border-color: var(--cyan); }
.opt.right { border-color: var(--green-line); background: var(--green-bg); }
.opt.right b { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red-line); background: var(--red-bg); }
.opt.wrong b { background: var(--red); color: #fff; }
.why { margin-top: 10px; }
.score-ring { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; margin: 8px auto; font-size: 1.9rem; font-weight: 900;
  background: conic-gradient(var(--green-line) calc(var(--p) * 1%), var(--bg2) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 11px; background: var(--surface); border-radius: 50%; }
.score-ring span { position: relative; }

/* ---------- Flashcards ---------- */
.flash-wrap { perspective: 1200px; }
.flash { position: relative; min-height: 270px; cursor: pointer; transform-style: preserve-3d; transition: transform .55s; }
.flash.flip { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; justify-content: center; overflow: auto; border: 2px solid; }
.face.f { background: var(--amber-bg); border-color: var(--amber-line); }
.face.b { background: var(--green-bg); border-color: var(--green-line); transform: rotateY(180deg); }
.face .q { font-size: 1.12rem; font-weight: 700; }
.face .hint { margin-top: 12px; font-size: .75rem; color: var(--muted); font-weight: 700; }
.flash-ctl { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }

/* ---------- Q&A list ---------- */
details.qa { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin: 8px 0; }
details.qa > summary { padding: 11px 14px; cursor: pointer; font-weight: 700; }
details.qa > div { padding: 2px 14px 12px; }

/* ---------- Audio player ---------- */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: linear-gradient(90deg, #0a1250, #1e3a8a); color: #fff; padding: 8px 14px;
  display: flex; gap: 10px; align-items: center; transform: translateY(110%); visibility: hidden; transition: transform .25s, visibility .25s; box-shadow: 0 -4px 20px rgba(0, 0, 0, .3); }
.player.on { transform: none; visibility: visible; }
.player .t { flex: 1; min-width: 0; font-size: .8rem; line-height: 1.3; }
.player .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player select { background: rgba(255, 255, 255, .15); color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; padding: 4px; font-family: inherit; }
.player select option { color: #111; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #111a3a; color: #fff; padding: 9px 16px; border-radius: 12px; font-size: .85rem; z-index: 80; box-shadow: var(--shadow); max-width: 90vw; }
.foot { margin-top: 36px; padding: 22px 16px; background: var(--brand); color: #cbd5f5; font-size: .84rem; text-align: center; }
.foot a { color: #7fe3f2; }
.search { margin: 8px 0 12px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row .inp { flex: 1; min-width: 160px; }
.filter-row select.sel { flex: 1 1 150px; min-width: 0; }

@media (min-width: 760px) {
  :root { --fs: 17.5px; }
  .card { padding: 24px 26px; }
  .hero { padding: 30px; } .hero h1 { font-size: 2rem; }
  .brand b { font-size: 1.15rem; }
}
#fontCycle { display: none; }
@media (max-width: 560px) {
  #fontUp, #fontDn { display: none; } #fontCycle { display: inline-block; }
  .brand img { width: 36px; height: 36px; } .brand b { font-size: .92rem; }
  .brand small { display: none; }
  #langSel { max-width: 96px; font-size: .78rem; }
  .hdr-in { gap: 8px; padding: 7px 12px; } .ibtn { min-width: 36px; height: 36px; padding: 0 6px; }
}
@media print {
  .hdr, .tabs, .chips, .pager, .player, .foot, .btn { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  details > * { display: block !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* syllabus tab */
.syl { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 8px; }
.syl-i { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.syl-i:last-child { border-bottom: 0; }
.syl-i:nth-child(even) { background: var(--bg2); }
.syl-t { font-size: .95rem; line-height: 1.5; }
.syl-u { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.syl-u .chip { padding: 4px 10px; }
