/* =========================================================
   Wormhole of ICT — styles
   Tokens → base → shell → home → chapter → blocks → sim kit → quiz → misc
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg: #F4F2FC;
  --bg-2: #EAE6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F5FF;
  --line: #D8D2F2;
  --ink: #1A1546;
  --muted: #5D5791;
  --amber: #B86E00;
  --amber-soft: #FFE7BF;
  --cyan: #0A7F8A;
  --cyan-soft: #D3F4F6;
  --magenta: #B8296A;
  --magenta-soft: #FADCE9;
  --green: #18804A;
  --green-soft: #D7F3E3;
  --red: #C4283B;
  --red-soft: #FBDDE1;
  --violet: #5B45D6;
  --violet-soft: #E4DEFF;
  --shadow: 0 1px 0 rgba(26, 21, 70, .06), 0 8px 24px -12px rgba(26, 21, 70, .22);
  --code-bg: #1A1546;
  --code-ink: #EDEAFF;
  --ch: var(--violet);

  --f-display: 'Unbounded', 'Baloo Da 2', system-ui, sans-serif;
  --f-bn-display: 'Baloo Da 2', 'Hind Siliguri', system-ui, sans-serif;
  --f-body: 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 22px;
  --topbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #100D2E; --bg-2: #161245; --surface: #1D1850; --surface-2: #231D5C; --line: #383078;
    --ink: #EEEBFF; --muted: #A9A3DB;
    --amber: #FFB547; --amber-soft: rgba(255, 181, 71, .14);
    --cyan: #5CE1E6; --cyan-soft: rgba(92, 225, 230, .13);
    --magenta: #F2609E; --magenta-soft: rgba(242, 96, 158, .14);
    --green: #6BE39B; --green-soft: rgba(107, 227, 155, .13);
    --red: #FF7A88; --red-soft: rgba(255, 122, 136, .14);
    --violet: #A897FF; --violet-soft: rgba(168, 151, 255, .15);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 12px 30px -14px rgba(0, 0, 0, .7);
    --code-bg: #0A0824; --code-ink: #E6E2FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #100D2E; --bg-2: #161245; --surface: #1D1850; --surface-2: #231D5C; --line: #383078;
  --ink: #EEEBFF; --muted: #A9A3DB;
  --amber: #FFB547; --amber-soft: rgba(255, 181, 71, .14);
  --cyan: #5CE1E6; --cyan-soft: rgba(92, 225, 230, .13);
  --magenta: #F2609E; --magenta-soft: rgba(242, 96, 158, .14);
  --green: #6BE39B; --green-soft: rgba(107, 227, 155, .13);
  --red: #FF7A88; --red-soft: rgba(255, 122, 136, .14);
  --violet: #A897FF; --violet-soft: rgba(168, 151, 255, .15);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 12px 30px -14px rgba(0, 0, 0, .7);
  --code-bg: #0A0824; --code-ink: #E6E2FF;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.7;
  min-height: 100vh; overflow-x: hidden;
}
html[lang="bn"] body { font-size: 17.5px; line-height: 1.8; }
img, svg, canvas { max-width: 100%; }
a { color: var(--cyan); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 1.4em 0 .5em; }
h1, h2 { font-family: var(--f-display); font-weight: 600; letter-spacing: -.01em; }
html[lang="bn"] h1, html[lang="bn"] h2, html[lang="bn"] h3 { font-family: var(--f-bn-display); letter-spacing: 0; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, kbd, .mono { font-family: var(--f-mono); font-size: .9em; }
:not(pre) > code { background: var(--violet-soft); padding: .1em .38em; border-radius: 5px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35em; background: var(--surface); font-size: .8em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--amber); color: #1A1546; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--f-display); font-weight: 700; font-size: 15px; line-height: 1.05; white-space: nowrap; }
.brand-name small { display: block; font-family: var(--f-body); font-weight: 500; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }
.topbar .spacer { flex: 1; }
.top-nav { display: flex; gap: 4px; }
.top-nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.top-nav a:hover { color: var(--ink); background: var(--bg-2); }
.top-nav a.active { color: var(--ink); background: var(--violet-soft); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
}
.icon-btn:hover { border-color: var(--violet); }
.icon-btn svg { width: 18px; height: 18px; }
.search-btn { min-width: 170px; justify-content: flex-start; color: var(--muted); font-weight: 500; }
.search-btn kbd { margin-left: auto; }
.lang-toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.lang-toggle span { position: relative; z-index: 1; display: grid; place-items: center; padding: 0 10px; font-weight: 700; font-size: 13.5px; color: var(--muted); transition: color .25s; }
.lang-toggle::before { content: ''; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--amber); transition: transform .3s cubic-bezier(.5, 1.6, .4, 1); }
html[lang="en"] .lang-toggle::before { transform: translateX(100%); }
html[lang="bn"] .lang-toggle .l-bn, html[lang="en"] .lang-toggle .l-en { color: #1A1546; }
.xp-pill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 999px; background: var(--amber-soft); color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none; }
.xp-pill svg { width: 16px; height: 16px; color: var(--amber); }
.menu-btn { display: none; }

/* ---------- Layout ---------- */
main { min-height: calc(100vh - var(--topbar)); }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 14.5px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }

/* ---------- Home: hero ---------- */
.hero { position: relative; height: min(88vh, 760px); min-height: 520px; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--line); background: #0B0926; color: #EEEBFF; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero-inner { height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 0 20px; }
.hero h1 { margin: 0; font-size: clamp(2.3rem, 7.6vw, 6.4rem); line-height: .95; font-weight: 800; letter-spacing: -.035em; text-wrap: balance; }
.hero h1 .of { display: block; font-size: .32em; font-weight: 400; letter-spacing: .3em; margin: .55em 0 .35em; opacity: .75; }
.hero .by { margin-top: 18px; font-family: var(--f-bn-display); font-size: clamp(1rem, 2.2vw, 1.3rem); color: #FFB547; }
.hero p.lede { max-width: 34em; margin: 18px auto 30px; color: #C9C3F2; font-size: clamp(1rem, 2vw, 1.15rem); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-warp {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px; border: 0; cursor: pointer;
  background: #FFB547; color: #1A1546; font-weight: 700; font-size: 17px; text-decoration: none;
  box-shadow: 0 0 0 0 rgba(255, 181, 71, .6); animation: pulse 2.6s infinite;
}
.btn-ghost { display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px; border-radius: 999px; border: 1px solid rgba(238, 235, 255, .35); color: #EEEBFF; text-decoration: none; font-weight: 600; background: rgba(255, 255, 255, .04); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 181, 71, .55); } 70% { box-shadow: 0 0 0 18px rgba(255, 181, 71, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 181, 71, 0); } }
.hero-hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 13px; color: #8F88C9; }

/* ---------- Home: journey ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 64px 0 24px; }
.section-head h2 { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2.2rem); }
.section-head p { margin: 0; color: var(--muted); max-width: 36em; }
.journey { position: relative; display: grid; gap: 18px; padding-left: 56px; }
.journey::before { content: ''; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: linear-gradient(var(--cyan), var(--violet), var(--magenta), var(--amber)); opacity: .55; }
.portal {
  --c: var(--violet);
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: center;
  padding: 22px 26px; border-radius: var(--r-lg); text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .25s, border-color .25s;
}
.portal:hover { transform: translateX(6px); border-color: var(--c); }
.portal .node {
  position: absolute; left: -56px; top: 50%; translate: 0 -50%; width: 45px; height: 45px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 17px;
  background: var(--bg); border: 3px solid var(--c); color: var(--c);
}
.portal.complete .node { background: var(--c); color: var(--bg); }
.portal h3 { margin: 0; font-size: clamp(1.15rem, 2.4vw, 1.45rem); font-family: var(--f-display); font-weight: 600; }
html[lang="bn"] .portal h3 { font-family: var(--f-bn-display); font-weight: 700; }
.portal .tag { color: var(--muted); grid-column: 1; }
.portal .chips { grid-column: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.portal .chips span { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--ink); }
.portal .ring { grid-row: 1 / span 3; grid-column: 2; }
.ring { width: 64px; height: 64px; }
.ring circle { fill: none; stroke-width: 6; }
.ring .bgc { stroke: var(--line); }
.ring .fgc { stroke: var(--c, var(--violet)); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .8s; }
.ring text { font-family: var(--f-body); font-weight: 700; font-size: 15px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }

.feature-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0; margin: 56px 0 30px; border-block: 1px solid var(--line); }
.feature-strip > div { padding: 22px 22px 22px 0; }
.feature-strip > div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.feature-strip b { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.feature-strip span { color: var(--muted); font-size: 15px; }
@media (max-width: 760px) { .feature-strip > div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); } }

/* ---------- Chapter layout ---------- */
.chapter-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 40px; width: min(1280px, 100% - 32px); margin-inline: auto; padding: 28px 0 60px; }
.sidebar { position: sticky; top: calc(var(--topbar) + 20px); align-self: start; max-height: calc(100vh - var(--topbar) - 40px); overflow: auto; padding-right: 6px; scrollbar-width: thin; }
.side-ch { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.side-ch .ring { width: 52px; height: 52px; flex: none; }
.side-ch b { display: block; font-size: 1rem; line-height: 1.3; }
.side-ch small { color: var(--muted); }
.side-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.side-tabs a { text-align: center; padding: 8px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); background: var(--bg-2); font-weight: 600; font-size: 14.5px; }
.side-tabs a.active { background: var(--ch); color: var(--bg); }
.topic-list { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.topic-list li { counter-increment: t; }
.topic-list a { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--muted); font-size: 15px; line-height: 1.4; }
.topic-list a::before { content: counter(t); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 1.5px solid var(--line); }
html[lang="bn"] .topic-list a::before { content: counter(t, bengali); }
.topic-list a:hover { background: var(--bg-2); color: var(--ink); }
.topic-list a.active { background: color-mix(in srgb, var(--ch) 14%, transparent); color: var(--ink); font-weight: 600; }
.topic-list a.active::before { border-color: var(--ch); color: var(--ch); }
.topic-list a.done::before { content: '✓'; background: var(--green); border-color: var(--green); color: var(--bg); }

.content { min-width: 0; }
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--muted); }
.topic-head h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 10px 0 8px; }
.topic-head .summary { color: var(--muted); font-size: 1.08rem; max-width: 46em; }
.prose { max-width: 50em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose table, table.t { border-collapse: collapse; width: 100%; margin: 1em 0 1.4em; font-size: .95em; display: block; overflow-x: auto; }
.prose th, .prose td, table.t th, table.t td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th, table.t th { background: var(--bg-2); font-weight: 700; }
.prose h3 { margin-top: 1.6em; }
.prose strong { color: var(--ink); }
.prose .hl { background: linear-gradient(transparent 55%, var(--amber-soft) 55%); }

.block { margin: 22px 0; }
.callout { max-width: 50em; border-radius: var(--r-md); padding: 14px 18px 14px 52px; position: relative; background: var(--violet-soft); }
.callout::before { position: absolute; left: 16px; top: 13px; font-size: 20px; line-height: 1; }
.callout.tip { background: var(--cyan-soft); } .callout.tip::before { content: '💡'; }
.callout.exam { background: var(--amber-soft); } .callout.exam::before { content: '🎯'; }
.callout.remember { background: var(--magenta-soft); } .callout.remember::before { content: '🧠'; }
.callout.warn { background: var(--red-soft); } .callout.warn::before { content: '⚠️'; }
.callout.fun { background: var(--green-soft); } .callout.fun::before { content: '🚀'; }
.callout > :last-child { margin-bottom: 0; }
.callout .ttl { font-weight: 700; display: block; margin-bottom: 2px; }
.formula { max-width: 50em; border: 1.5px dashed var(--ch); border-radius: var(--r-md); padding: 16px 20px; background: var(--surface); }
.formula .f-expr { font-family: var(--f-mono); font-size: 1.12rem; font-weight: 600; text-align: center; padding: 6px 0 10px; overflow-x: auto; }
.formula .f-note { color: var(--muted); font-size: .95em; }
.formula .f-note > :last-child { margin-bottom: 0; }
.codeblock { max-width: 50em; position: relative; border-radius: var(--r-md); background: var(--code-bg); color: var(--code-ink); overflow: hidden; }
.codeblock .cb-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 16px; font-size: 13px; color: #9C95D6; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.codeblock .cb-bar button { background: rgba(255, 255, 255, .08); border: 0; color: #E6E2FF; border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 13px; }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-family: var(--f-mono); font-size: 14px; line-height: 1.6; }
.tok-k { color: #FF8FC5; } .tok-s { color: #FFD08A; } .tok-c { color: #7E78B8; font-style: italic; } .tok-n { color: #8EF0D0; } .tok-t { color: #8FC8FF; } .tok-p { color: #C7B8FF; }
.keyterms { max-width: 50em; display: flex; flex-wrap: wrap; gap: 8px; }
.keyterms button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 14px; cursor: pointer; font-size: 15px; }
.keyterms button[aria-expanded="true"] { background: var(--ch); color: var(--bg); border-color: var(--ch); }
.keyterm-def { max-width: 50em; margin-top: 10px; padding: 12px 16px; border-left: 3px solid var(--ch); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.reveal-q { max-width: 50em; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.reveal-q summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; gap: 10px; }
.reveal-q summary::before { content: '?'; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ch); color: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.reveal-q[open] summary::before { content: '✓'; }
.reveal-q > div { padding: 0 16px 14px 50px; }

.topic-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 46px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 50em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: var(--ch); }
.btn.primary { background: var(--ch); border-color: var(--ch); color: var(--bg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #1A1546; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.done-btn.is-done { background: var(--green-soft); border-color: var(--green); }

/* ---------- Simulator kit (shared by every sim) ---------- */
.sim {
  max-width: 56em; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); overflow: hidden;
}
.sim-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, color-mix(in srgb, var(--ch) 16%, transparent), transparent 70%); }
.sim-head .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ch); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ch) 25%, transparent); animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.sim-head b { font-size: 15.5px; }
.sim-head small { color: var(--muted); margin-left: auto; font-size: 13px; }
.sim-body { padding: 18px; }
.sim-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.sim-controls label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.sim-stage { position: relative; border-radius: var(--r-md); background: var(--bg-2); min-height: 120px; overflow: hidden; }
.sim-stage canvas, .sim-stage svg { display: block; width: 100%; }
.sim-out { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 15.5px; }
.sim-out:empty { display: none; }
.sim-note { color: var(--muted); font-size: 14px; margin-top: 10px; }
.sim input[type="text"], .sim input[type="number"], .sim select, .sim textarea {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 6px 10px; min-width: 0;
}
.sim input:focus, .sim select:focus, .sim textarea:focus { border-color: var(--ch); outline: none; }
.sim input[type="range"] { accent-color: var(--ch); width: 160px; }
.sim textarea { font-family: var(--f-mono); font-size: 14px; width: 100%; resize: vertical; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 13px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.bits { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.bit {
  width: 36px; height: 42px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; user-select: none;
  font-family: var(--f-mono); font-weight: 700; font-size: 18px; border: 2px solid var(--line); background: var(--surface); color: var(--muted);
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.bit.on, .bit[data-v="1"] { background: var(--ch); border-color: var(--ch); color: var(--bg); }
.bit:active { transform: scale(.92); }
.bit-label { font-size: 11px; color: var(--muted); text-align: center; font-family: var(--f-mono); }
.led { width: 26px; height: 26px; border-radius: 50%; display: inline-block; background: var(--line); border: 2px solid var(--muted); transition: all .2s; vertical-align: middle; }
.led.on { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 16px 4px color-mix(in srgb, var(--amber) 60%, transparent); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 600; background: var(--bg-2); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.bad { background: var(--red-soft); color: var(--red); }
.pill.ch { background: color-mix(in srgb, var(--ch) 18%, transparent); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; animation: stepIn .35s both; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--ch); color: var(--bg); display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; }
@keyframes stepIn { from { opacity: 0; transform: translateY(6px); } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.truth { border-collapse: collapse; font-family: var(--f-mono); font-size: 14.5px; }
.truth th, .truth td { border: 1px solid var(--line); padding: 4px 12px; text-align: center; }
.truth th { background: var(--bg-2); }
.truth tr.hit td { background: color-mix(in srgb, var(--ch) 20%, transparent); font-weight: 700; }
.code-edit { width: 100%; min-height: 220px; font-family: var(--f-mono); font-size: 14px; line-height: 1.55; background: var(--code-bg); color: var(--code-ink); border: 0; border-radius: var(--r-md); padding: 12px 14px; resize: vertical; tab-size: 2; }
.preview-frame { width: 100%; min-height: 240px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.trace-line { display: block; padding: 0 8px; border-left: 3px solid transparent; white-space: pre; }
.trace-line.cur { background: rgba(255, 181, 71, .2); border-left-color: #FFB547; }
.var-table { border-collapse: collapse; font-family: var(--f-mono); font-size: 14px; width: 100%; }
.var-table td, .var-table th { border: 1px solid var(--line); padding: 4px 10px; text-align: left; }
.var-table tr.changed td { background: var(--amber-soft); }
.console { font-family: var(--f-mono); font-size: 14px; background: var(--code-bg); color: #9AF5C6; border-radius: var(--r-md); padding: 10px 14px; min-height: 60px; white-space: pre-wrap; }

/* ---------- Quiz ---------- */
.quiz-wrap { max-width: 50em; }
.quiz-setup { display: grid; gap: 18px; }
.quiz-card { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 24px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; color: var(--muted); font-size: 15px; }
.quiz-bar { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; margin-bottom: 20px; }
.quiz-bar i { display: block; height: 100%; background: var(--ch); transition: width .35s; }
.quiz-q { font-size: 1.2rem; font-weight: 600; margin: 0 0 18px; line-height: 1.55; }
.quiz-q pre { font-size: 14px; background: var(--code-bg); color: var(--code-ink); padding: 10px 14px; border-radius: 8px; overflow-x: auto; font-weight: 400; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1.5; transition: border-color .15s, background .15s; }
.opt:hover:not(:disabled) { border-color: var(--ch); }
.opt .k { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--bg-2); }
.opt.correct { border-color: var(--green); background: var(--green-soft); }
.opt.correct .k { background: var(--green); color: var(--bg); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .35s; }
.opt.wrong .k { background: var(--red); color: var(--bg); }
.opt:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.explain { margin-top: 16px; padding: 12px 16px; border-radius: var(--r-md); background: var(--violet-soft); animation: stepIn .3s both; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.score-big { font-family: var(--f-display); font-size: clamp(3rem, 9vw, 5rem); font-weight: 800; line-height: 1; color: var(--ch); }
.timer { font-family: var(--f-mono); font-weight: 700; color: var(--ink); }
.timer.low { color: var(--red); }
.review-item { padding: 14px 0; border-top: 1px solid var(--line); }
.review-item .ri-q { font-weight: 600; }
.review-item .ri-a { font-size: 15px; color: var(--muted); }
.review-item .ri-a b.ok { color: var(--green); } .review-item .ri-a b.bad { color: var(--red); }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-grid button { border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); padding: 6px 14px; cursor: pointer; font-size: 15px; }
.choice-grid button[aria-pressed="true"] { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 15%, transparent); font-weight: 600; }

/* ---------- Search ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(10, 8, 36, .55); backdrop-filter: blur(4px); display: grid; place-items: start center; padding: 10vh 16px 0; animation: fadeIn .15s; }
@keyframes fadeIn { from { opacity: 0; } }
.search-box { width: min(640px, 100%); background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5); overflow: hidden; }
.search-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; font-size: 18px; background: transparent; outline: none; }
.search-results { max-height: 55vh; overflow: auto; padding: 6px; }
.search-results a { display: block; padding: 10px 14px; border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.search-results a small { display: block; color: var(--muted); font-size: 13.5px; }
.search-results a.sel, .search-results a:hover { background: var(--violet-soft); }
.search-results .empty { padding: 20px; color: var(--muted); text-align: center; }
.search-results mark { background: var(--amber-soft); color: inherit; border-radius: 3px; }

/* ---------- Progress page ---------- */
.stat-row { display: flex; flex-wrap: wrap; gap: 36px; margin: 20px 0 30px; }
.stat-row div b { display: block; font-family: var(--f-display); font-size: 2.2rem; line-height: 1.1; }
.stat-row div span { color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border-radius: var(--r-md); border: 1px dashed var(--line); color: var(--muted); }
.badge .b-ico { font-size: 34px; display: block; filter: grayscale(1); opacity: .45; }
.badge.got { border-style: solid; border-color: var(--amber); color: var(--ink); background: var(--amber-soft); }
.badge.got .b-ico { filter: none; opacity: 1; }
.badge b { display: block; font-size: 14.5px; }
.badge small { font-size: 12.5px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; translate: -50% 0; z-index: 200; display: grid; gap: 8px; justify-items: center; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: stepIn .25s both; }
.toast.xp { background: var(--amber); color: #1A1546; }
.toast.out { opacity: 0; transition: opacity .4s; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .chapter-layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: fixed; z-index: 60; top: var(--topbar); left: 0; bottom: 0; width: min(320px, 86vw); max-height: none; background: var(--bg); padding: 20px 16px; border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .3s; }
  body.side-open .sidebar { transform: none; box-shadow: 30px 0 60px -20px rgba(0, 0, 0, .4); }
  .menu-btn.show { display: inline-flex; }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .top-nav { display: none; }
  .brand-name small { display: none; }
  .brand-name { font-size: 13px; }
  .xp-pill .lbl { display: none; }
  .journey { padding-left: 44px; }
  .journey::before { left: 16px; }
  .portal { grid-template-columns: 1fr; padding: 18px; }
  .portal .node { left: -44px; width: 36px; height: 36px; font-size: 14px; }
  .portal .ring { display: none; }
  .sim-body { padding: 12px; }
  .quiz-card { padding: 18px; }
  .bit { width: 30px; height: 36px; font-size: 16px; }
}
@media (max-width: 420px) { .brand-name { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.bottom-nav { display: none; }
@media print { .topbar, .sidebar, .footer, .sim { display: none !important; } }

/* =========================================================
   Shell additions (home stats, chapter overview, labs, progress)
   ========================================================= */
.hero-kicker { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: #5CE1E6; margin-bottom: 18px; font-weight: 600; }
html[lang="bn"] .hero-kicker { letter-spacing: .04em; font-size: 15px; }
.hero h1 { background: linear-gradient(100deg, #EEEBFF 10%, #A897FF 45%, #5CE1E6 70%, #FFB547 95%); -webkit-background-clip: text; background-clip: text; color: transparent; font-family: var(--f-display) !important; text-shadow: 0 0 40px rgba(168, 151, 255, .25); }
.hero-resume { margin-top: 14px; font-size: 14px; color: #A9A3DB; }
.hero-stats { display: flex; gap: clamp(18px, 4vw, 46px); margin-top: 34px; flex-wrap: wrap; justify-content: center; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-family: var(--f-display); font-size: clamp(1.4rem, 3.4vw, 2rem); color: #fff; line-height: 1.1; }
.hero-stats span { font-size: 13.5px; color: #A9A3DB; }
.hero-inner > * { animation: heroIn .9s cubic-bezier(.2, .8, .2, 1) both; }
.hero-inner > :nth-child(2) { animation-delay: .08s; } .hero-inner > :nth-child(3) { animation-delay: .16s; }
.hero-inner > :nth-child(4) { animation-delay: .24s; } .hero-inner > :nth-child(5) { animation-delay: .32s; }
.hero-inner > :nth-child(6) { animation-delay: .4s; } .hero-inner > :nth-child(7) { animation-delay: .48s; }
@keyframes heroIn { from { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(6px); } }
.hero.warping .hero-inner { transition: transform .6s cubic-bezier(.6, 0, .9, .4), opacity .6s, filter .6s; transform: scale(2.6); opacity: 0; filter: blur(10px); }
.portal-k { grid-column: 1; font-size: 13px; font-weight: 700; color: var(--c); letter-spacing: .02em; }

.page-pad { padding: 30px 0 40px; }
.mini-h { font-size: 1.35rem; margin: 40px 0 16px; }
.ch-hero { display: flex; gap: 20px; align-items: center; margin: 14px 0 10px; }
.ch-hero h1 { margin: 2px 0 6px; font-size: clamp(1.7rem, 4vw, 2.6rem); }
.ch-hero .summary { color: var(--muted); margin: 0; font-size: 1.08rem; }
.ch-icon { flex: none; width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; font-size: 44px; background: color-mix(in srgb, var(--ch) 16%, transparent); border: 1.5px solid color-mix(in srgb, var(--ch) 45%, transparent); box-shadow: 0 0 40px -10px var(--ch); animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px) rotate(-3deg); } }
.ch-kicker { color: var(--ch); font-weight: 700; font-size: 14px; letter-spacing: .03em; }
.ch-intro { margin-top: 10px; }
.topic-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.topic-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px 60px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s, box-shadow .2s; }
.topic-card:hover { transform: translateY(-3px); border-color: var(--ch); box-shadow: var(--shadow); }
.topic-card .tc-n { position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: color-mix(in srgb, var(--ch) 15%, transparent); color: var(--ch); }
.topic-card.done .tc-n { background: var(--green); color: var(--bg); }
.topic-card b { line-height: 1.35; }
.topic-card .tc-s { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.topic-card .tc-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.side-jump { display: flex; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.side-jump a { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; font-weight: 700; font-size: 14px; color: var(--c); border: 2px solid color-mix(in srgb, var(--c) 50%, transparent); }
.side-jump a.on, .side-jump a:hover { background: var(--c); color: var(--bg); }

.read-bar { position: fixed; top: var(--topbar); left: 0; right: 0; height: 3px; z-index: 49; pointer-events: none; }
.read-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ch), var(--amber)); box-shadow: 0 0 10px var(--ch); }
.topic-quiz { max-width: 50em; margin-top: 40px; border-top: 4px solid var(--ch); }
.sim.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--ch), var(--shadow); } }
.xp-pill.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.18); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

.progress-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pg-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.pg-card:hover { border-color: var(--c); }
.pg-card .ring { flex: none; }
.pg-card small { color: var(--c); font-weight: 700; display: block; }
.pg-card b { display: block; line-height: 1.35; }
.pg-card span { font-size: 14px; color: var(--muted); }

.labs-sec .mini-h { color: var(--ink); border-left: 4px solid var(--c); padding-left: 12px; }
.labs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.lab-card { position: relative; display: block; padding: 14px 14px 14px 36px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); transition: transform .2s, border-color .2s; }
.lab-card:hover { transform: translateY(-2px); border-color: var(--c); }
.lab-card b { display: block; font-size: 15px; line-height: 1.4; }
.lab-card small { color: var(--muted); font-size: 13px; }
.lab-dot { position: absolute; left: 14px; top: 20px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent); }
@media (max-width: 760px) {
  .ch-hero { align-items: flex-start; }
  .ch-icon { width: 60px; height: 60px; font-size: 32px; border-radius: 18px; }
  .stat-row { gap: 20px; }
  .stat-row div b { font-size: 1.6rem; }
}
.hero h1 .of { -webkit-text-fill-color: #C9C3F2; color: #C9C3F2; font-family: var(--f-body); font-weight: 600; }
.hero p.lede, .hero-stats, .hero-resume, .hero-kicker { text-shadow: 0 1px 12px rgba(11, 9, 38, .95), 0 0 2px rgba(11, 9, 38, .9); }
.hero-inner { background: radial-gradient(ellipse 46% 52% at 50% 52%, rgba(11, 9, 38, .55), transparent 75%); }
.quiz-wrap, .quiz-card { scroll-margin-top: calc(var(--topbar) + 16px); }

/* =========================================================
   Accounts, locking & payments
   ========================================================= */
.acct-btn { gap: 8px; padding: 0 12px 0 4px; text-decoration: none; color: var(--ink); }
.acct-btn svg { margin-left: 6px; }
.acct-btn .lbl { font-size: 14px; }
.acct-btn.active { border-color: var(--violet); background: var(--violet-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: 14px; color: #1A1546; background: linear-gradient(135deg, #5CE1E6, #A897FF 55%, #FFB547); flex: none; }
.avatar.xl { width: 64px; height: 64px; font-size: 28px; }
@media (max-width: 760px) { .acct-btn .lbl { display: none; } .acct-btn { padding: 0 4px; } .acct-btn svg { margin: 0 4px; } }

.lock-tag, .free-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; vertical-align: 1px; }
.lock-tag { background: var(--amber-soft); color: var(--ink); }
.free-tag { background: var(--green-soft); color: var(--green); }
.portal.locked .node { font-size: 18px; }
.topic-card.is-locked { opacity: .82; }
.topic-card.is-locked .tc-n { font-size: 15px; }
.lab-card.is-locked { opacity: .7; }
.btn-ghost.unlock-ghost { border-color: rgba(255, 181, 71, .6); color: #FFB547; }

.lock-card { max-width: 50em; margin: 22px 0 28px; padding: 26px 26px 22px; border-radius: var(--r-lg); border: 1.5px solid color-mix(in srgb, var(--amber) 55%, var(--line)); background: radial-gradient(120% 140% at 100% 0, color-mix(in srgb, var(--amber) 14%, transparent), transparent 55%), var(--surface); box-shadow: var(--shadow); }
.lock-card h2 { margin: 6px 0 8px; font-size: 1.5rem; }
.lock-card .lock-ico { font-size: 40px; line-height: 1; }
.lock-card.success { border-color: var(--green); background: radial-gradient(120% 140% at 100% 0, var(--green-soft), transparent 60%), var(--surface); }
.lock-card.pending { border-color: var(--cyan); background: radial-gradient(120% 140% at 100% 0, var(--cyan-soft), transparent 60%), var(--surface); }
.lock-card > b { display: block; text-align: center; }
.spinner { width: 34px; height: 34px; margin: 6px auto 12px; border-radius: 50%; border: 3.5px solid var(--line); border-top-color: var(--violet); animation: spin .8s linear infinite; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; margin: 0; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.field { display: grid; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, .field select, .row-form input { width: 100%; padding: 10px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.row-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.row-form .field { flex: 1 1 200px; }
.row-form .btn { margin-bottom: 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; border: 0; background: none; cursor: pointer; font-size: 18px; opacity: .7; }
.btn.wide { width: 100%; padding: 12px 18px; font-size: 16px; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.ok-btn { border-color: var(--green); background: var(--green-soft); }
.form-msg:empty { display: none; }
.form-msg { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--bg-2); font-size: 15px; }
.form-msg.ok { background: var(--green-soft); }
.form-msg.bad { background: var(--red-soft); color: var(--ink); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 15px; cursor: pointer; }
.check input { width: 19px; height: 19px; margin-top: 3px; accent-color: var(--violet); flex: none; }
.linkish { border: 0; background: none; color: var(--cyan); cursor: pointer; padding: 8px 0 0; font-size: 14.5px; text-decoration: underline; text-underline-offset: 3px; }

/* login */
.auth-wrap { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 40px; align-items: start; padding: 20px 0 50px; }
.auth-card { width: 100%; max-width: 460px; padding: 28px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-card h1 { margin: 6px 0 10px; font-size: 1.65rem; }
.auth-brand { font-size: 38px; line-height: 1; }
.auth-seg { display: flex; margin: 8px 0 16px; }
.auth-seg button { flex: 1; }
.google-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 15.5px; cursor: pointer; }
.google-btn:hover { border-color: var(--violet); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13.5px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-side { padding-top: 10px; }
.auth-side h2 { margin-top: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.perks { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 8px; }
.perks li { padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.price-chip { display: inline-block; padding: 8px 16px; border-radius: 999px; background: var(--amber); color: #1A1546; font-weight: 800; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; gap: 24px; } .auth-card { max-width: none; padding: 22px 18px; } }

/* unlock / pay */
.unlock-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; align-items: start; padding: 10px 0 50px; }
.unlock-grid .lock-card { margin-top: 0; }
.price-card { position: sticky; top: calc(var(--topbar) + 20px); padding: 24px; border-radius: var(--r-lg); color: #EEEBFF; background: radial-gradient(130% 90% at 0 0, rgba(168, 151, 255, .45), transparent 60%), radial-gradient(120% 90% at 100% 100%, rgba(92, 225, 230, .3), transparent 55%), #0F0B33; border: 1px solid rgba(168, 151, 255, .4); box-shadow: 0 20px 50px -20px rgba(91, 69, 214, .6); }
.price-card .pc-k { font-size: 13px; font-weight: 700; letter-spacing: .03em; color: #5CE1E6; }
.price-card .pc-price { font-family: var(--f-display); font-size: 3.2rem; font-weight: 800; line-height: 1.1; margin: 8px 0 4px; color: #FFB547; }
.price-card .pc-price small { font-family: var(--f-body); font-size: 1rem; font-weight: 600; color: #C9C3F2; }
.price-card .pc-until { color: #C9C3F2; font-size: 15px; }
.price-card .perks li { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #EEEBFF; font-size: 15px; }
.price-card .sim-note { color: #A9A3DB; }
.panel { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.panel h2 { font-size: 1.3rem; }
.pay-steps { padding-left: 1.3em; margin: 0 0 18px; display: grid; gap: 10px; }
.pay-num { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--bg-2); }
.pay-num span { font-weight: 700; min-width: 56px; }
.pay-num b { font-size: 1.15rem; letter-spacing: .04em; }
.pm { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800; }
.pm.bkash { background: #E2136E; color: #fff; }
.st-pending { background: var(--cyan-soft); color: var(--cyan); }
.faq { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 8px 0; font-size: 15px; }
@media (max-width: 900px) { .unlock-grid { grid-template-columns: minmax(0, 1fr); } .price-card { position: static; } .price-card .pc-price { font-size: 2.5rem; } }

/* account */
.acct-head { display: flex; gap: 16px; align-items: center; margin: 10px 0 18px; }
.acct-head h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.2rem); }
.acc-status { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 16px 18px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); margin-bottom: 20px; }
.acc-status > span { color: var(--muted); flex: 1 1 220px; }
.acc-status.premium { border-color: var(--amber); background: var(--amber-soft); }
.acc-status.pending { border-color: var(--cyan); background: var(--cyan-soft); }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.acct-grid h2 { margin-top: 0; }
.acct-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 50px; }
.tbl-wrap { overflow-x: auto; }
table.t { display: table; font-size: 14.5px; }
.pw-change { margin-top: 18px; }
.pw-change summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }

/* admin */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.admin-tabs a { padding: 7px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14.5px; background: var(--bg-2); }
.admin-tabs a.on { background: var(--violet); color: var(--bg); }
.admin-tabs .cnt:not(:empty) { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--amber); color: #1A1546; font-size: 12px; }
.pay-list { display: grid; gap: 10px; }
.pay-item { display: grid; grid-template-columns: minmax(160px, 1.4fr) minmax(140px, 1fr) minmax(150px, 1fr) 90px 90px minmax(170px, auto); gap: 8px 14px; align-items: center; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: opacity .3s, transform .3s; }
.pay-item.gone { opacity: 0; transform: translateX(20px); }
.pay-item .pi-who small { display: block; color: var(--muted); font-size: 13px; word-break: break-all; }
.pay-item .pi-amt { font-weight: 800; }
.pay-item .pi-amt.warn { color: var(--red); }
.pay-item .pi-time { color: var(--muted); font-size: 13.5px; }
.pay-item .pi-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pay-item .pi-rej { grid-column: 1 / -1; display: flex; gap: 8px; }
.pay-item .pi-rej input { flex: 1; padding: 8px 10px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
@media (max-width: 1000px) { .pay-item { grid-template-columns: 1fr 1fr; } .pay-item .pi-act { justify-content: flex-start; } }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.file-chip { padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); font-size: 14px; }
.file-chip.ok { background: var(--green-soft); }
.file-chip.miss { background: var(--red-soft); }
.file-chip small { display: block; color: var(--muted); }
.upload-drop { display: block; padding: 22px; border-radius: var(--r-md); border: 2px dashed var(--line); text-align: center; cursor: pointer; font-weight: 600; }
.upload-drop:hover { border-color: var(--violet); }
.upload-drop input { display: block; margin: 0 auto 8px; }
.pay-item .pi-rej[hidden], .form-msg[hidden], [hidden] { display: none !important; }
@media (max-width: 900px) { .unlock-grid > section { order: -1; } }

/* ---------- MCQ Bank ---------- */
.bank-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 18px 0; }
.bank-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.bank-tab:hover { border-color: var(--ch); transform: translateY(-2px); }
.bank-tab.on { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 14%, var(--surface)); }
.bank-tab span { font-size: 1.3rem; } .bank-tab small { color: var(--muted); font-size: 12px; }
.bank-tools { display: grid; min-width: 0; overflow: hidden; gap: 14px; padding: 18px; margin-bottom: 18px; }
.bank-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.bank-field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); min-width: 0; }
.bank-field.grow { flex: 1 1 220px; }
.bank-field select, .bank-field input { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; max-width: 100%; }
.bank-field select { max-width: min(100%, 360px); }
.bank-field select:focus, .bank-field input:focus { outline: none; border-color: var(--ch); }
.bank-switch { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 15px; }
.bank-switch input { width: 18px; height: 18px; accent-color: var(--ch); }
.bank-list { display: grid; gap: 14px; }
.bq { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); padding: 16px 18px; }
.bq-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 13px; }
.bq-n { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; background: var(--ch); color: var(--bg); }
.bq-tag { color: var(--muted); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.bq-tag:hover { color: var(--ch); border-color: var(--ch); }
.bq-type { border-radius: 999px; padding: 2px 10px; background: color-mix(in srgb, var(--ch) 15%, transparent); font-weight: 600; }
.bq-q { font-weight: 600; line-height: 1.6; margin-bottom: 12px; }
.bq-q pre { font-size: 14px; font-weight: 400; background: var(--code-bg); color: var(--code-ink); padding: 10px 14px; border-radius: 8px; overflow-x: auto; margin: 8px 0 0; line-height: 1.5; }
.bq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bq-opts .opt { padding: 8px 12px; font-size: 15px; grid-template-columns: 28px 1fr; }
.bq-opts .opt .k { width: 26px; height: 26px; font-size: 14px; }
.bq-exp .explain { margin-top: 12px; font-size: 15px; }
.bank-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 22px 0 8px; }
.bank-locked { text-align: center; }
@media (max-width: 640px) {
  .bank-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bq-opts { grid-template-columns: 1fr; }
  .bq { padding: 14px; }
  .bank-row { flex-direction: column; align-items: stretch; }
  .bank-row > * { min-width: 0; max-width: 100%; }
  .bank-row .seg { display: flex; width: 100%; border-radius: 16px; }
  .bank-field.grow { flex: 0 0 auto; }
  .bank-field select, .bank-field input { width: 100%; box-sizing: border-box; }
  .bank-field select { max-width: 100%; }
  .bank-actions .btn { width: 100%; justify-content: center; }
}
/* tables inside MCQ questions (e.g. SQL sample data) */
.bq-q table, .quiz-q table { border-collapse: collapse; margin: 8px 0; font-weight: 400; font-size: 14px; max-width: 100%; display: block; overflow-x: auto; }
.bq-q th, .bq-q td, .quiz-q th, .quiz-q td { border: 1px solid var(--line); padding: 4px 10px; text-align: left; white-space: nowrap; }
.bq-q th, .quiz-q th { background: var(--bg-2); font-weight: 600; }
.quiz-q pre { margin: 8px 0; }
/* keep wide code / tables inside the card on small screens */
.bank-list { grid-template-columns: minmax(0, 1fr); }
.bq, .bq-q, .quiz-card, .quiz-q { min-width: 0; }
.bq-q pre, .quiz-q pre { max-width: 100%; overflow-x: auto; }
.bq-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bq-opts .opt > span:last-child, .opts .opt > span:last-child { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .bq-opts { grid-template-columns: minmax(0, 1fr); } }
.quiz-wrap { min-width: 0; max-width: 100%; }

/* ---------- Leaderboard ---------- */
.lb-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.lb-tabs a { display: inline-flex; gap: 6px; align-items: center; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; }
.lb-tabs a:hover { color: var(--ink); border-color: var(--violet); }
.lb-tabs a.on { color: var(--ink); border-color: var(--violet); background: var(--violet-soft); }
.lb-hint { margin: 6px 0 18px; }
.lb-loading, .lb-empty { text-align: center; color: var(--muted); padding: 30px 18px; }
.lb-me { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r-lg); border: 1px dashed var(--line); background: var(--surface); margin-bottom: 22px; }
.lb-me.mine { border: 1.5px solid var(--violet); background: var(--violet-soft); justify-content: flex-start; }
.lb-me small { display: block; color: var(--muted); }
.lb-me small small { display: inline; }
.lb-rank-big { font-family: var(--f-display); font-size: 2rem; font-weight: 800; color: var(--violet); line-height: 1; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 8px 0 24px; }
.pod { position: relative; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 10px 0; box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.pod.me { border-color: var(--violet); }
.pod-medal { font-size: 2rem; line-height: 1; }
.pod-av { width: 54px; height: 54px; margin: 8px auto 6px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; color: #1b1340; background: linear-gradient(135deg, #FFD36E, #FF9F43); }
.pod.p2 .pod-av { background: linear-gradient(135deg, #E9EEF5, #AEB8C7); }
.pod.p3 .pod-av { background: linear-gradient(135deg, #F6C9A0, #C9824B); }
.pod-name { display: block; font-size: 15px; overflow-wrap: anywhere; }
.pod-col { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pod-val { font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; margin: 6px 0 10px; }
.pod-val small, .lb-val small { font-family: inherit; font-weight: 600; font-size: 12px; color: var(--muted); margin-left: 4px; }
.pod-step { margin: 0 -10px; padding: 8px 0; font-family: var(--f-display); font-weight: 800; font-size: 1.4rem; color: #1b1340; background: linear-gradient(180deg, #FFD36E, #F5B83F); }
.pod.p1 .pod-step { padding: 26px 0; }
.pod.p2 .pod-step { padding: 16px 0; background: linear-gradient(180deg, #E9EEF5, #C3CBD8); }
.pod.p3 .pod-step { padding: 10px 0; background: linear-gradient(180deg, #F6C9A0, #DDA06C); }
.you { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--violet); color: #fff; vertical-align: middle; }
.lb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.lb-list li { display: grid; grid-template-columns: 40px 40px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.lb-list li.me { border-color: var(--violet); background: var(--violet-soft); }
.lb-list li.gap { margin-top: 14px; }
.lb-rank { font-weight: 800; color: var(--muted); text-align: center; }
.lb-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--bg-2); }
.lb-who { min-width: 0; }
.lb-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-who small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-val { font-weight: 800; white-space: nowrap; text-align: right; }
.lb-reset { border: 1px solid var(--line); background: transparent; border-radius: 8px; cursor: pointer; font-size: 12px; padding: 3px 6px; color: var(--muted); }
.pod .lb-reset { position: absolute; top: 8px; right: 8px; }
.lb-foot { margin: 20px 0 50px; }
.lb-toggle { display: flex; gap: 10px; align-items: center; margin-top: 16px; cursor: pointer; font-size: 15px; }
.lb-toggle input { width: 18px; height: 18px; accent-color: var(--violet); }
.lb-cta { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 14px; align-items: center; margin: 30px 0 0; padding: 16px 20px; border-radius: var(--r-lg); background: var(--violet-soft); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.lb-cta span { grid-row: 1 / 3; font-size: 2rem; }
.lb-cta small { color: var(--muted); }
.lb-cta i { grid-row: 1 / 3; grid-column: 3; font-style: normal; font-size: 1.4rem; }
@media (max-width: 640px) {
  .podium { gap: 6px; }
  .pod { padding: 12px 4px 0; }
  .pod-av { width: 42px; height: 42px; font-size: 1.05rem; }
  .pod-val { font-size: 1rem; }
  .pod-val small { display: block; margin: 0; }
  .lb-list li { grid-template-columns: 30px 32px minmax(0, 1fr) auto auto; gap: 8px; padding: 10px; }
  .lb-av { width: 30px; height: 30px; }
  .lb-tabs a { padding: 6px 11px; font-size: 14px; }
}
.lb-me small small { margin-left: 3px; }

/* ---------- Admin: students progress ---------- */
.st-sum { margin: 10px 0 16px; }
.st-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.st-tools .field { margin: 0; min-width: 0; }
.st-tools .st-grow { flex: 1 1 240px; }
.st-tools select { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink); }
.st-f { flex-wrap: wrap; }
.st-tbl td, .st-tbl th { white-space: nowrap; vertical-align: middle; }
.st-tbl td small { color: var(--muted); }
.st-who { white-space: normal !important; min-width: 200px; }
.st-who small { display: block; font-size: 12.5px; }
.st-prem { background: color-mix(in srgb, var(--amber) 22%, transparent); }
tr.st-detail > td { background: var(--bg-2); white-space: normal !important; }
.st-dbox { padding: 6px 2px; }
.st-chs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.st-ch { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.st-ch small { color: var(--muted); font-size: 12.5px; }
.st-bar { height: 6px; border-radius: 6px; background: var(--bg-2); margin: 6px 0; overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--c); }
.st-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .st-tools { flex-direction: column; align-items: stretch; } .st-tools .st-grow { flex: 0 0 auto; } .st-tools select { width: 100%; } }
.st-f { border-radius: 16px; }

/* =========================================================
   Navigation: desktop "More ▾" menu + mobile bottom bar
   ========================================================= */
.nav-more { position: relative; }
.nav-more > button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer; }
.nav-more > button:hover, .nav-more > button[aria-expanded="true"] { color: var(--ink); background: var(--bg-2); }
.nav-more-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 2px; z-index: 70; }
.nav-more-menu[hidden] { display: none; }
.nav-more-menu a, .nav-more-menu button { display: block; text-align: left; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; border: 0; background: none; cursor: pointer; }
.nav-more-menu a:hover, .nav-more-menu button:hover, .nav-more-menu a.active { background: var(--violet-soft); }
.nav-more-menu .install-btn { color: var(--violet); }
.nav-more-menu .install-btn[hidden] { display: none; }
.top-nav { align-items: center; flex-shrink: 0; }
.top-nav a, .nav-more > button, .acct-btn .lbl, .xp-pill, .search-btn .lbl { white-space: nowrap; }
@media (min-width: 1400px) { .nav-more-menu .nav-dup { display: none; } }
@media (max-width: 1399px) {
  .top-nav .nav-x { display: none; }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
}
@media (max-width: 1100px) and (min-width: 761px) {
  .top-nav { gap: 0; }
  .top-nav a, .nav-more > button { padding: 6px 9px; font-size: 14.5px; }
  .xp-pill .lbl, .acct-btn .lbl, .brand-name small { display: none; }
  .acct-btn { padding: 0 4px; }
  .acct-btn svg { margin: 0 4px; }
}
@media (max-width: 900px) and (min-width: 761px) { .brand-name { display: none; } }

.bnav, .more-sheet, .more-back { display: none; }
@media (max-width: 760px) {
  :root { --bnav: 62px; }
  body { padding-bottom: calc(var(--bnav) + env(safe-area-inset-bottom, 0px)); }
  .bnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bnav) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
    border-top: 1px solid var(--line); transition: transform .2s;
  }
  body.typing .bnav { transform: translateY(110%); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); text-decoration: none; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; position: relative; min-width: 0; }
  .bnav svg { width: 23px; height: 23px; }
  .bnav span { line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bnav .active { color: var(--violet); }
  .bnav .active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 4px 4px; background: var(--violet); }
  .more-back { display: block; position: fixed; inset: 0; z-index: 56; background: rgba(8, 6, 28, .45); }
  .more-back[hidden], .more-sheet[hidden] { display: none; }
  .more-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 57; max-height: 80vh; overflow: auto;
    padding: 8px 14px calc(var(--bnav) + 14px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0;
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .45);
    animation: sheetUp .22s ease-out;
  }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .ms-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
  .ms-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .ms-grid a, .ms-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font: inherit; cursor: pointer; min-height: 84px; justify-content: center; }
  .ms-grid a[hidden], .ms-grid button[hidden] { display: none; }
  .ms-grid span { font-size: 26px; line-height: 1; }
  .ms-grid b { font-size: 13px; text-align: center; line-height: 1.3; }
  .ms-ios { margin: 14px 2px 0; font-size: 14px; color: var(--muted); }
  .ms-ios[hidden] { display: none; }
  body.more-open { overflow: hidden; }
  .toast-box, #toasts { bottom: calc(var(--bnav) + 14px + env(safe-area-inset-bottom, 0px)) !important; }
  .footer { padding-bottom: 24px; }
  .footer .wrap > span:last-child { display: none; }
  /* nothing that slides in from the left may hide under the bottom bar */
  .sidebar { bottom: calc(var(--bnav) + env(safe-area-inset-bottom, 0px)) !important; }
}

/* =========================================================
   Mobile polish (whole site)
   ========================================================= */
@media (max-width: 760px) {
  /* iOS zooms into inputs smaller than 16px — keep every field at 16px */
  input, select, textarea, .bank-field select, .bank-field input, .field input, .field select { font-size: 16px !important; }
  .btn { min-height: 42px; }
  .btn.small { min-height: 36px; }
  .opt { padding: 12px; min-height: 48px; }
  .icon-btn, .xp-pill, .lang-toggle { height: 40px; }
  .wrap { width: calc(100% - 28px); }
  .page-pad { padding-top: 18px; }
  .topic-head h1 { font-size: 1.55rem; }
  .hero-cta { gap: 8px; }
  .lb-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding: 2px 14px 6px; scroll-snap-type: x proximity; }
  .lb-tabs::-webkit-scrollbar { display: none; }
  .lb-tabs a { flex: none; scroll-snap-align: start; }
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  table.t { font-size: 14px; }
  pre { font-size: 13px; }
  .stat-row { gap: 14px 22px; }
}
@media (hover: none) { .portal:hover, .lab-card:hover, .topic-card:hover { transform: none; } }

/* =========================================================
   Home: study strip · practice hub tiles
   ========================================================= */
.study-strip { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 12px; margin: 34px 0 6px; }
.study-strip a { text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); transition: transform .2s, border-color .2s; }
.study-strip a:hover { transform: translateY(-2px); border-color: var(--violet); }
.ss-daily { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; background: linear-gradient(135deg, var(--amber-soft), var(--surface) 70%) !important; }
.ss-daily.done { background: linear-gradient(135deg, var(--green-soft), var(--surface) 70%) !important; }
.ss-daily .ss-ico { font-size: 34px; line-height: 1; }
.ss-daily b { display: block; font-size: 16.5px; line-height: 1.35; }
.ss-daily small { color: var(--muted); font-size: 14px; }
.ss-daily i { font-style: normal; font-weight: 800; color: var(--amber); font-size: 20px; }
.ss-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.ss-tile span { font-size: 24px; line-height: 1.1; }
.ss-tile b { font-size: 15px; line-height: 1.3; }
.ss-tile small { color: var(--muted); font-size: 13px; line-height: 1.35; }
@media (max-width: 1000px) { .study-strip { grid-template-columns: repeat(4, 1fr); } .ss-daily { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .study-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
  .ss-tile { padding: 12px 14px; }
}
.hub-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 6px 0 10px; }
.hub-tiles a { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .2s, transform .2s; }
.hub-tiles a:hover { border-color: var(--violet); transform: translateY(-2px); }
.hub-tiles span { font-size: 24px; line-height: 1.2; }
.hub-tiles b { font-size: 15px; line-height: 1.3; }
.hub-tiles small { font-size: 13px; color: var(--muted); line-height: 1.35; }
@media (max-width: 900px) { .hub-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .hub-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .hub-tiles a:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.study-stats a { text-decoration: none; color: inherit; }
.study-stats a b { display: block; }

/* =========================================================
   CQ bank
   ========================================================= */
.cq-how { margin: 8px 0 0; font-size: 14.5px; }
.cq-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.cq-best { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--green); background: var(--green-soft); padding: 2px 10px; border-radius: 999px; }
.cq-stem { background: var(--bg-2); border-left: 4px solid var(--ch); padding: 12px 14px; border-radius: 0 var(--r-md) var(--r-md) 0; margin: 10px 0 12px; line-height: 1.75; }
.cq-stem pre, .cq-a pre { overflow-x: auto; max-width: 100%; background: var(--code-bg); color: var(--code-ink); padding: 12px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.cq-stem table, .cq-a table { margin: 8px 0; }
.cq-qs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cq-qs > li { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.cq-qs > li.open { border-color: color-mix(in srgb, var(--ch) 50%, var(--line)); }
.cq-q { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.cq-k { font-weight: 800; color: var(--ch); }
.cq-m { font-size: 12.5px; font-weight: 800; background: var(--violet-soft); color: var(--violet); border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.cq-show { margin-top: 8px; }
.cq-a { margin-top: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px dashed var(--line); line-height: 1.75; min-width: 0; overflow-x: auto; }
.cq-tag { display: inline-block; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; width: 100%; }
.cq-self { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--muted); }
.cq-self[hidden] { display: none; }
.cq-marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cq-marks button { min-width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; color: var(--ink); }
.cq-marks button:hover { border-color: var(--violet); }
.cq-marks button.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.cq-peek { position: relative; }
.cq-blur { filter: blur(5px); user-select: none; color: var(--muted); padding: 6px 2px; }
@media (max-width: 640px) { .cq-card { padding: 14px; } .cq-marks button { min-width: 34px; } }

/* =========================================================
   Model tests
   ========================================================= */
.test-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 10px 0 8px; }
.test-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.test-card h2 { margin: 6px 0 6px; font-size: 1.25rem; }
.test-card p { color: var(--muted); font-size: 15px; }
.test-card.week { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); background: linear-gradient(160deg, var(--amber-soft), var(--surface) 60%); }
.tc-ico { font-size: 30px; line-height: 1; }
.test-chs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tch { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.tch:hover { border-color: var(--c, var(--violet)); background: color-mix(in srgb, var(--c, var(--violet)) 12%, var(--surface)); }
.tch.locked { color: var(--muted); }
.test-done { padding: 10px 12px; border-radius: 12px; background: var(--green-soft); margin: 0 0 12px; }
.test-resume { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; padding: 14px 18px; margin: 0 0 16px; border-radius: var(--r-lg); background: var(--violet-soft); border: 1.5px solid var(--violet); color: var(--ink); text-decoration: none; }
.test-resume span { grid-row: span 2; font-size: 28px; }
.test-resume small { color: var(--muted); }
.test-hist td small { color: var(--muted); }
@media (max-width: 900px) { .test-grid { grid-template-columns: 1fr; } }

.exam { padding-bottom: 40px; }
.exam-bar { position: sticky; top: calc(var(--topbar) + 8px); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1.5px solid var(--line); box-shadow: var(--shadow); margin-bottom: 12px; }
.exam-t { font-family: var(--f-mono); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.exam-t.low { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.exam-n { color: var(--muted); font-weight: 600; }
.exam-bar .btn { margin-left: auto; }
.exam-head h1 { margin: 8px 0 4px; font-size: 1.5rem; }
.exam-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: none; }
.exam-q { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; scroll-margin-top: calc(var(--topbar) + 80px); min-width: 0; overflow-wrap: anywhere; }
.exam-q.done { border-left-color: var(--ch); }
.exam-qh { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.exam-qh small { color: var(--muted); font-weight: 600; }
.exam-q .quiz-q { font-size: 16.5px; margin-bottom: 10px; }
.exam-q .quiz-q pre { overflow-x: auto; max-width: 100%; }
.exam-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.exam-opts .opt { padding: 9px 12px; font-size: 15.5px; grid-template-columns: 28px 1fr; }
.exam-opts .opt.picked { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 14%, var(--surface)); }
.exam-opts .opt.picked .k { background: var(--ch); color: #fff; border-color: var(--ch); }
.exam-omr { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin: 22px 0 14px; padding: 14px; border: 1px dashed var(--line); border-radius: var(--r-md); }
.exam-omr a { display: grid; place-items: center; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); color: var(--muted); text-decoration: none; font-weight: 700; font-size: 14px; }
.exam-omr a.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.exam-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.exam-foot .wide { width: min(420px, 100%); }
@media (max-width: 640px) {
  .exam-opts { grid-template-columns: minmax(0, 1fr); }
  .exam-bar { top: calc(var(--topbar) + 4px); gap: 10px; padding: 8px 8px 8px 14px; }
  .exam-t { font-size: 16px; }
  .exam-q { padding: 12px; }
}
.exam-result { text-align: center; }
.exam-result .score-big small { font-size: .45em; color: var(--muted); }
.er-k { font-weight: 700; color: var(--muted); }
.er-line { font-size: 1.05rem; margin: 8px 0; }
.er-rank { font-weight: 700; color: var(--green); }
.er-review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bq.is-bad { border-left: 4px solid var(--red); }
.bq.is-ok { border-left: 4px solid var(--green); }
.bq-opts div.opt { cursor: default; }
.topic-report { display: grid; gap: 8px; margin: 8px 0 12px; }
.tr-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
a.tr-row:hover { border-color: var(--violet); }
.tr-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: inherit; text-decoration: none; }
.tr-bar { height: 10px; border-radius: 6px; background: var(--bg-2); overflow: hidden; }
.tr-bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.tr-row.mid .tr-bar i { background: var(--amber); }
.tr-row.bad .tr-bar i { background: var(--red); }
.tr-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-v small { color: var(--muted); font-weight: 500; }
.tr-go { padding: 4px 10px !important; min-height: 32px !important; }
@media (max-width: 560px) { .tr-row { grid-template-columns: minmax(0, 1fr) auto auto; } .tr-bar { grid-column: 1 / -1; grid-row: 2; } }

/* =========================================================
   Weak spots · daily challenge
   ========================================================= */
.weak-sec { margin: 18px 0; }
.weak-sec h2 { margin-top: 0; }
.wk-empty { color: var(--muted); margin: 0; }
.wk-list { display: grid; gap: 8px; }
.wk-item { border: 1px solid var(--line); border-left: 4px solid var(--ch); border-radius: 12px; background: var(--surface); transition: opacity .25s, transform .25s; }
.wk-item.gone { opacity: 0; transform: translateX(30px); }
.wk-item summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; list-style: none; }
.wk-item summary::-webkit-details-marker { display: none; }
.wk-ch { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.wk-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.wk-w { font-size: 12.5px; font-weight: 800; color: var(--red); background: var(--red-soft); border-radius: 999px; padding: 0 8px; }
.wk-body { padding: 0 14px 14px; min-width: 0; overflow-wrap: anywhere; }
.wk-body pre { overflow-x: auto; }
.wk-body .btn { margin-top: 10px; }
.daily-hero { text-align: center; max-width: 640px; margin: 0 auto 60px; }
.dh-streak { display: flex; flex-direction: column; align-items: center; }
.dh-fire { font-size: 46px; line-height: 1; }
.dh-streak b { font-family: var(--f-display); font-size: 3rem; line-height: 1.1; }
.dh-streak small { color: var(--muted); font-weight: 600; }
.dh-week { display: flex; justify-content: center; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.dh-week span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dh-week i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 2px dashed var(--line); font-style: normal; font-weight: 800; color: #fff; }
.dh-week .on i { background: var(--green); border: 2px solid var(--green); }
.dh-week .today i { border-color: var(--amber); border-style: solid; }
.dh-week small { font-size: 12px; color: var(--muted); }
.dh-done { padding: 12px; border-radius: 12px; background: var(--green-soft); }

/* =========================================================
   Unlock: promo code · account: referral · admin bits
   ========================================================= */
.pc-old { color: var(--muted); font-size: .55em; font-weight: 600; margin-right: 4px; }
.promo { margin: 0 0 16px; padding: 10px 14px; border: 1.5px dashed var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.promo summary { cursor: pointer; font-weight: 700; }
.promo-row { display: flex; gap: 8px; margin-top: 10px; }
.promo-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-family: var(--f-mono); text-transform: uppercase; font-size: 16px; }
.promo .form-msg { margin: 8px 0 0; }
.promo .ok { color: var(--green); font-weight: 700; }
.promo .bad { color: var(--red); font-weight: 700; }
.pay-amt { font-size: 1.1em; }
.ref-panel { margin-top: 20px; }
.ref-panel[hidden] { display: none; }
.ref-panel h2 { margin-top: 0; }
.ref-code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ref-code code { font-size: 1.35rem; font-weight: 800; letter-spacing: .08em; padding: 6px 14px; border-radius: 10px; background: var(--amber-soft); }
.pi-promo { display: block; color: var(--violet); font-weight: 600; }
.st-xp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--amber-soft); }
.st-xp input { padding: 7px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); }
.st-xp input[name="amt"] { width: 150px; }
.st-xp input[name="note"] { flex: 1 1 220px; min-width: 0; }
.st-grants { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.st-grants small { color: var(--muted); }
.cp-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; align-items: end; }
.cp-form .btn { margin-bottom: 12px; }
.cp-acts { white-space: nowrap; }
.cp-acts .btn + .btn { margin-left: 6px; }
@media (max-width: 760px) { .cp-form { grid-template-columns: 1fr; } .st-xp input[name="amt"] { width: 100%; } }
.toast { max-width: min(92vw, 560px); text-align: center; border-radius: 18px; line-height: 1.45; }
.price-card .pc-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.price-card .pc-old { color: #A9A3DB; }
.cq-qs { grid-template-columns: minmax(0, 1fr); }
.cq-qs > li { min-width: 0; }
.cq-q { grid-template-columns: auto minmax(0, 1fr) auto; }
.cq-stem { overflow-x: auto; min-width: 0; }
.cq-stem table, .cq-a table { min-width: max-content; }
.upload-drop input { max-width: 100%; }
.reveal-q summary > span { min-width: 0; overflow-wrap: anywhere; }
.reveal-q > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 760px) { .reveal-q > div { padding-left: 16px; } }
@media (max-width: 370px) {
  .topbar { gap: 5px; padding: 0 8px; }
  .icon-btn { min-width: 36px; padding: 0 8px; }
  .xp-pill { padding: 0 9px; }
  .lang-toggle span { padding: 0 7px; }
  .brand svg { width: 30px; height: 30px; }
}
/* admin: content files */
.file-sum { padding: 10px 14px; border-radius: 12px; font-weight: 600; margin: 4px 0 10px; }
.file-sum.ok { background: var(--green-soft); } .file-sum.bad { background: var(--red-soft); }
.file-chip { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.upload-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px; transition: border-color .2s, background .2s; }
.upload-drop.over, .upload-drop:focus-within { border-color: var(--violet); background: var(--violet-soft); }
.upload-drop .ud-ico { font-size: 30px; line-height: 1; }
.upload-drop small { color: var(--muted); font-weight: 500; }
.up-list { display: grid; gap: 6px; margin: 12px 0 0; }
.up-list:empty { display: none; }
.up-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); font-size: 14px; }
.up-row .ok { color: var(--green); font-weight: 700; } .up-row .bad { color: var(--red); font-weight: 700; }
@media (max-width: 560px) { .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .file-chip { font-size: 12.5px; padding: 8px; } }
/* "More ▾" must never look like a grey system button */
.topbar .nav-more > button { -webkit-appearance: none; appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px; }
.topbar .nav-more > button:hover, .topbar .nav-more > button[aria-expanded="true"] { color: var(--ink); background: var(--bg-2); }
.topbar .nav-more > button.active { color: var(--ink); background: var(--violet-soft); }
