/* CMA MCQ Bank — student app styles. Author: Kalpesh Choudhary */
:root {
  --bg: #F3F5F9; --card: #FFFFFF; --ink: #101828; --ink2: #344054; --muted: #475467; --faint: #98A2B3;
  --line: #E4E7EC; --line2: #D0D5DD; --soft: #F2F4F7;
  --pri: #1F4FD1; --pri-ink: #102A7A; --pri-soft: #EAF0FF; --pri-dark: #173EA6;
  --ok: #0E7A3A; --ok-ink: #0B4A25; --ok-soft: #E6F4EC; --ok-line: #2E9D5B;
  --bad: #C0281C; --bad-ink: #7A1A12; --bad-soft: #FDECEC; --bad-line: #E0665C;
  --star: #B45309; --star-ink: #7A3E06; --star-soft: #FEF3E2; --star-line: #F5C98B;
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
a { color: var(--pri); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #8DA8F0; outline-offset: 2px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.page { flex: 1; padding: 20px 18px 28px; display: flex; flex-direction: column; gap: 16px; }
.page.tight { padding-top: 14px; }
.with-nav { padding-bottom: 96px; }

/* type */
h1 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sm { font-size: 13px; }
.b { font-weight: 700; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* brand */
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: var(--pri); display: grid; place-items: center; flex-shrink: 0; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.pad0 { padding: 0; gap: 0; overflow: hidden; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }

/* forms */
label.f { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.input { height: 46px; border: 1px solid var(--line2); border-radius: 10px; padding: 0 14px; font-size: 15px; background: #fff; width: 100%; }
textarea.input { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; }
.input.pin { letter-spacing: .3em; }
.prefix { display: flex; height: 46px; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background: #fff; }
.prefix span { padding: 0 12px; background: var(--soft); border-right: 1px solid var(--line2); display: flex; align-items: center; color: var(--muted); }
.prefix input { flex: 1; min-width: 0; border: 0; padding: 0 14px; font-size: 15px; }
.prefix input:focus { outline: none; }
.err { background: var(--bad-soft); color: var(--bad-ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; }
.note { background: var(--pri-soft); color: var(--pri-ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; }

/* buttons */
.btn { height: 48px; border-radius: 12px; border: 0; padding: 0 18px; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.pri { background: var(--pri); color: #fff; }
.btn.pri:hover { background: var(--pri-dark); }
.btn.out { background: #fff; border: 1px solid var(--line2); color: var(--ink2); }
.btn.dark { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.btn.danger { background: transparent; border: 1.5px solid var(--bad); color: #9B2016; }
.btn.star { background: var(--star-soft); border: 1px solid var(--star-line); color: var(--star-ink); }
.btn.big { height: 54px; font-size: 16px; font-weight: 800; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.sm { height: 38px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; flex-shrink: 0; }
.icon-btn.on { background: var(--star-soft); border-color: transparent; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--pri); font-weight: 600; font-size: 13px; }

/* chips / segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line2); background: #fff; color: var(--ink2); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.count { height: 44px; border-radius: 10px; border: 1px solid var(--line2); background: #fff; font-weight: 700; color: var(--ink2); }
.count.on { border: 2px solid var(--pri); background: var(--pri-soft); color: var(--pri); font-weight: 800; }

/* choice cards (mode, stage) */
.choice { text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.choice.on { background: var(--pri-soft); border: 2px solid var(--pri); padding: 13px; }
.choice .t { font-size: 15px; font-weight: 800; }
.choice .d { font-size: 12px; line-height: 1.4; color: var(--muted); }
.radio-row { text-align: left; min-height: 60px; border: 1px solid var(--line2); border-radius: 12px; background: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 12px; width: 100%; }
.radio-row .dot { width: 20px; height: 20px; border-radius: 10px; border: 2px solid var(--faint); flex-shrink: 0; }
.radio-row.on { border: 2px solid var(--pri); background: var(--pri-soft); padding: 9px 13px; }
.radio-row.on .dot { border: 6px solid var(--pri); background: #fff; }

/* toggle */
.toggle { width: 48px; height: 28px; border-radius: 14px; background: var(--line2); padding: 3px; border: 0; display: flex; flex-shrink: 0; }
.toggle::after { content: ''; width: 22px; height: 22px; border-radius: 11px; background: #fff; transition: transform .15s; }
.toggle.on { background: var(--pri); }
.toggle.on::after { transform: translateX(20px); }

/* home */
.stage-banner { background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.stage-banner .k { font-size: 12px; color: #D0D5DD; }
.announce { background: var(--star-soft); color: var(--star-ink); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; line-height: 1.45; }
.tile { border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; border: 1px solid var(--line); background: #fff; }
.tile.star { background: var(--star-soft); border-color: transparent; }
.paper { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.paper:hover { border-color: var(--line2); }
.badge { width: 42px; height: 42px; flex-shrink: 0; border-radius: 10px; background: var(--pri-soft); color: var(--pri); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.bar { height: 6px; background: #EEF1F5; border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--pri); border-radius: 3px; }

/* bottom nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
.nav > div { max-width: 560px; margin: 0 auto; height: 64px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.nav a.on { color: var(--pri); }

/* quiz */
.qbar { background: #fff; border-bottom: 1px solid var(--line); padding: 14px 18px 12px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 4; }
.timer { height: 36px; padding: 0 12px; border-radius: 18px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.timer.low { background: var(--bad); }
.palette { display: flex; flex-wrap: wrap; gap: 4px; max-height: 76px; overflow-y: auto; }
.palette button { width: 26px; height: 26px; border-radius: 6px; border: 0; font-size: 10px; font-weight: 700; background: var(--soft); color: var(--muted); padding: 0; }
.palette .ok { background: var(--ok); color: #fff; }
.palette .bad { background: var(--bad); color: #fff; }
.palette .cur { background: #fff; color: var(--pri); box-shadow: inset 0 0 0 2px var(--pri); }
.mode-pill { align-self: flex-start; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 6px 12px; }
.mode-pill.practice { color: #0E5C2E; background: var(--ok-soft); }
.mode-pill.test { color: var(--pri-dark); background: var(--pri-soft); }
.qtext { margin: 0; font-size: 17px; line-height: 1.55; font-weight: 600; white-space: pre-line; overflow-wrap: anywhere; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { min-height: 56px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.opt .k { width: 30px; height: 30px; flex-shrink: 0; border-radius: 15px; background: var(--soft); color: var(--muted); font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.opt .t { flex: 1; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.opt .tag { font-size: 11px; font-weight: 700; flex-shrink: 0; }
.opt.sel { border: 2px solid var(--pri); background: var(--pri-soft); padding: 9px 13px; }
.opt.sel .k { background: var(--pri); color: #fff; }
.opt.sel .t { font-weight: 700; color: var(--pri-ink); }
.opt.right { border: 2px solid var(--ok-line); background: var(--ok-soft); padding: 9px 13px; }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.right .t { font-weight: 700; color: var(--ok-ink); }
.opt.right .tag { color: #0E5C2E; }
.opt.wrong { border: 2px solid var(--bad-line); background: var(--bad-soft); padding: 9px 13px; }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt.wrong .t { font-weight: 700; color: var(--bad-ink); }
.opt.wrong .tag { color: #9B2016; }
.opt.dim { opacity: .7; }
.opt:disabled { opacity: 1; cursor: default; }
.opt.dim:disabled { opacity: .7; }
.verdict { border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.verdict.ok { background: var(--ok-soft); color: var(--ok-ink); border: 1px solid #9BD3B0; }
.verdict.bad { background: var(--bad-soft); color: var(--bad-ink); border: 1px solid #F4B4AE; }
.hist { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 12px; color: var(--muted); }
.qfoot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; z-index: 4; }
.qfoot.f3 { grid-template-columns: 1fr 1.3fr 1fr; }
.qfoot.f2 { grid-template-columns: 1fr 2fr; }

/* result */
.ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.ring .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.kpi4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kpi4 > div { border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; }
.kpi4 .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi4 .l { font-size: 11px; font-weight: 600; }
.rv { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.sq { width: 28px; height: 28px; flex-shrink: 0; border-radius: 7px; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.sq.ok { background: var(--ok); color: #fff; } .sq.bad { background: var(--bad); color: #fff; } .sq.skip { background: #EEF1F5; color: var(--muted); }

/* tables (progress) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { background: #F9FAFB; color: var(--muted); font-size: 11px; font-weight: 700; text-align: right; padding: 10px 8px; }
.tbl td { padding: 10px 8px; border-top: 1px solid var(--soft); text-align: right; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 14px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 14px; }
.good { color: #0E5C2E; } .mid { color: var(--star-ink); } .low { color: #9B2016; }

/* states */
.center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.big-ico { align-self: center; width: 80px; height: 80px; border-radius: 40px; display: grid; place-items: center; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 20; max-width: 90vw; }
.sheet-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }

/* "built by" credit + ICMAI disclaimer */
.credit { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.5; }
.credit a { color: var(--pri); font-weight: 600; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.credit .disc { font-size: 11px; color: var(--muted); }
.credit-card { background: #F5F9FF; border-color: #C9DAF8; }
.btn.li { gap: 6px; text-decoration: none; min-width: 0; }
