/* StepWise theme — indigo/blue on cream, matching logo */
:root {
  --bg: #f7f4ec;
  --bg-2: #fbf9f2;
  --card: #ffffff;
  --ink: #1a1f3d;
  --ink-2: #4a5075;
  --muted: #8a90ad;
  --line: #ece6d3;
  --brand: #4a5cf0;         /* logo blue */
  --brand-2: #6a7bff;
  --brand-dark: #2f3fbf;
  --brand-soft: #eef0ff;
  --accent: #ffcc4d;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad:  #ef4444;
  --shadow: 0 6px 24px rgba(74, 92, 240, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Auth pages ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.auth-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at -10% 20%, #6f7dff 0%, transparent 55%),
    radial-gradient(900px 700px at 110% 90%, #a4aeff 0%, transparent 55%),
    linear-gradient(135deg, #4a5cf0 0%, #2f3fbf 100%);
  color: #fff;
  padding: 56px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero .logo-row { display: flex; align-items: center; gap: 12px; }
.auth-hero .logo-row img { width: 56px; height: 56px; border-radius: 14px; background: #fff; padding: 4px; object-fit: contain; }
.auth-hero h1 { font-size: 42px; line-height: 1.1; margin: 40px 0 16px; font-weight: 800; letter-spacing: -0.5px; }
.auth-hero p { font-size: 17px; opacity: .9; max-width: 460px; }
.auth-hero .blobs { position: absolute; inset: 0; pointer-events: none; }
.auth-hero .blob { position: absolute; border-radius: 50%; filter: blur(30px); opacity: .35; }
.auth-hero .b1 { width: 260px; height: 260px; background: #ffcc4d; top: -60px; right: -60px; }
.auth-hero .b2 { width: 320px; height: 320px; background: #6a7bff; bottom: -80px; left: -80px; }
.auth-hero .tagline { display: inline-flex; gap: 8px; align-items: center; background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.auth-hero .stats { display: flex; gap: 24px; margin-top: 40px; }
.auth-hero .stat b { font-size: 24px; display: block; }
.auth-hero .stat span { font-size: 13px; opacity: .85; }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--card); padding: 36px 32px; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card h2 { margin: 0 0 6px; font-size: 26px; }
.auth-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.form-field input {
  padding: 12px 14px; border: 1.5px solid var(--line); background: #fff;
  border-radius: var(--radius-sm); font-size: 15px; outline: none;
  transition: border .15s, box-shadow .15s;
}
.form-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(74,92,240,.15); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; border: none; }
.btn-primary { background: var(--brand); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-google { background: #fff; color: var(--ink); width: 100%; border: 1.5px solid var(--line); }
.btn-google:hover { border-color: var(--brand); }
.btn-google img { width: 18px; height: 18px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-2); }
.err { color: var(--bad); font-size: 13px; margin-top: 8px; min-height: 18px; }

.demo-note { font-size: 12px; color: var(--muted); background: #f4f2ea; padding: 10px 12px; border-radius: 10px; margin-top: 16px; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px; min-height: 260px; }
  .auth-hero h1 { font-size: 30px; }
}

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #faf6ea 100%);
  border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y:auto;
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; }
.brand-row img { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #eef0ff; padding: 2px; }
.brand-row .brand-name { font-weight: 800; font-size: 18px; line-height: 1; }
.brand-row .brand-sub { font-size: 11px; color: var(--muted); }

.search-box { position: relative; margin: 8px 6px 14px; }
.search-box input { width: 100%; padding: 10px 12px 10px 34px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; outline: none; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--brand-soft); color: var(--brand); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(74,92,240,.35); }
.ugat-nav-item { position:relative; background:linear-gradient(100deg,#fff8df 0%,#fff 72%); border:1px solid rgba(245,158,11,.22); }
.ugat-nav-item:hover { background:linear-gradient(100deg,#fff1b9,#eef0ff); }
.ugat-nav-item.active { color:#fff; border-color:transparent; background:linear-gradient(100deg,#15214f,#4a5cf0); box-shadow:0 8px 22px rgba(47,63,191,.28); }
.ugat-nav-badge { padding:3px 7px; border-radius:999px; background:linear-gradient(120deg,#ffd76a,#f59e0b); color:#332000; font-size:9px; font-weight:800; letter-spacing:.35px; text-transform:uppercase; box-shadow:0 3px 9px rgba(245,158,11,.25); }
.nav-item .chev { margin-left: auto; opacity: .5; font-size: 12px; }
.nav-section-label { padding: 12px 12px 6px; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--muted); text-transform: uppercase; }

.wa-community-cta {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  margin: auto 6px 2px;
  padding: 10px 9px;
  overflow: hidden;
  border: 1px solid rgba(18, 140, 126, .24);
  border-radius: 13px;
  color: #17203e;
  background: linear-gradient(115deg, #ecfff4 0%, #f8fffb 58%, #eef0ff 100%);
  box-shadow: 0 8px 22px rgba(19, 98, 78, .10);
  text-decoration: none;
  isolation: isolate;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.wa-community-cta::after {
  content: '';
  position: absolute;
  width: 70px;
  height: 70px;
  right: -35px;
  top: -42px;
  border-radius: 50%;
  background: rgba(74, 92, 240, .09);
  z-index: -1;
}
.wa-community-cta:hover {
  color: #101936;
  border-color: rgba(18, 140, 126, .46);
  box-shadow: 0 10px 26px rgba(19, 98, 78, .16);
  transform: translateY(-2px);
}
.wa-community-cta:focus-visible { outline: 3px solid rgba(74, 92, 240, .28); outline-offset: 2px; }
.wa-community-cta img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 3px 5px rgba(18, 140, 126, .18)); }
.wa-community-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.wa-community-copy strong { font-size: 11.5px; font-weight: 800; letter-spacing: -.12px; white-space: nowrap; }
.wa-community-copy small { overflow: hidden; color: #61716f; font-size: 8.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wa-community-arrow { color: #128c7e; font-size: 15px; font-weight: 800; text-align: center; transition: transform .18s ease; }
.wa-community-cta:hover .wa-community-arrow { transform: translate(2px, -2px); }
.wa-community-cta + .sidebar-footer { margin-top: 0; }

.sidebar-footer { flex: 0 0 auto; margin-top: auto; padding: 12px 6px 4px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.user-chip .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-chip .name { font-weight: 700; font-size: 13px; }
.user-chip .role { font-size: 11px; color: var(--muted); }
.logout-btn { margin-left: auto; background: transparent; border: none; color: var(--muted); }
.logout-btn:hover { color: var(--bad); }

/* ---------- Main ---------- */
.main { padding: 24px 32px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }
.topbar .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }

/* ---------- XP Hero ---------- */
.xp-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #4a5cf0 0%, #6a7bff 55%, #8b98ff 100%);
  color: #fff; padding: 26px 28px; border-radius: 20px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.xp-hero::after { content: ''; position: absolute; right: -60px; bottom: -60px; width: 260px; height: 260px; background: radial-gradient(circle, rgba(255,204,77,.5), transparent 60%); }
.xp-hero .row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; position: relative; z-index: 1; }
.xp-hero .greeting { font-size: 14px; opacity: .85; }
.xp-hero .rank-line { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.xp-hero .rank-badge { background: rgba(255,255,255,.16); padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; }
.xp-hero h2 { margin: 0; font-size: 28px; letter-spacing: -.5px; }
.xp-hero .caption { font-size: 14px; opacity: .9; margin-top: 6px; }
.xp-bar { margin-top: 18px; background: rgba(255,255,255,.18); height: 10px; border-radius: 999px; overflow: hidden; }
.xp-bar .fill { background: linear-gradient(90deg, #ffcc4d 0%, #ffe27a 100%); height: 100%; border-radius: 999px; }
.xp-meta { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; opacity: .9; }

.xp-side { background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 16px; }
.xp-side .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; opacity: .8; }
.xp-side .unlock-title { font-weight: 800; font-size: 18px; margin: 4px 0 6px; }
.xp-side .unlock-caption { font-size: 13px; opacity: .9; }
.tier-track { display: flex; gap: 4px; margin-top: 14px; }
.tier-track .pip { flex: 1; height: 6px; border-radius: 4px; background: rgba(255,255,255,.2); }
.tier-track .pip.active { background: #ffcc4d; }

/* ---------- Dash Header: XP hero + exam countdown stack ---------- */
.dash-header {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 22px;
  align-items: stretch;
}
.dash-header .xp-hero { margin-bottom: 0; height: 100%; }
.dash-header .xp-hero .row { grid-template-columns: 1fr; gap: 16px; }
.dash-header .xp-hero h2 { font-size: 26px; }

.exam-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  min-width: 0;
}
.exam-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px 20px;
  color: #fff;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(20,26,60,.18);
  transition: transform .18s ease, box-shadow .18s ease;
  isolation: isolate;
}
.exam-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(20,26,60,.24); }
.exam-card.ugat {
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255,204,77,.35), transparent 55%),
    linear-gradient(135deg, #1a2255 0%, #3a2c8f 55%, #6a3ecb 100%);
}
.exam-card.ipmat {
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(120,255,196,.32), transparent 55%),
    linear-gradient(135deg, #063d2f 0%, #0e6b4c 55%, #14a26a 100%);
}
.exam-card::after {
  content: '';
  position: absolute;
  left: -30px; bottom: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  z-index: -1;
}
.exam-card .exam-glyph {
  width: 46px; height: 46px; border-radius: 13px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  backdrop-filter: blur(4px);
}
.exam-card .exam-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.exam-card .exam-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .16em;
  opacity: .82;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-card .exam-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-card .days-wrap {
  text-align: right;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding-left: 8px;
  border-left: 1px solid rgba(255,255,255,.18);
}
.exam-card .days-num {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: .9;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.exam-card .days-label {
  font-size: 9.5px;
  opacity: .82;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 700;
}
@media (max-width: 1150px) {
  .exam-card .days-num { font-size: 34px; }
  .exam-card { padding: 16px 16px; grid-template-columns: 40px 1fr auto; gap: 12px; }
  .exam-card .exam-glyph { width: 40px; height: 40px; }
  .exam-card .exam-name { font-size: 15px; }
}
@media (max-width: 980px) {
  .dash-header { grid-template-columns: 1fr; }
  .exam-stack { grid-template-rows: auto; grid-template-columns: 1fr 1fr; }
  .exam-card .days-num { font-size: 38px; }
}
@media (max-width: 640px) {
  .exam-stack { grid-template-columns: 1fr; }
}

/* ---------- Grid & Cards ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 780px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } .xp-hero .row { grid-template-columns: 1fr; } .app { grid-template-columns: 1fr; } .sidebar { position: relative; height: auto; } }

.card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.card-head .pill { font-size: 11px; padding: 4px 10px; border-radius: 999px; font-weight: 700; letter-spacing: .5px; }
.pill-blue { background: var(--brand-soft); color: var(--brand); }
.pill-green { background: #e8f8ee; color: #199f4a; }
.pill-red { background: #fdecec; color: #d33; }
.pill-yellow { background: #fff5d6; color: #a97a00; }

.card .card-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }

.small-muted { color: var(--muted); font-size: 12px; }
.link-arrow { color: var(--brand); font-weight: 600; font-size: 13px; }

/* Daily RC */
.rc-card { border-left: 4px solid var(--brand); }
.rc-title { font-size: 16px; font-weight: 700; margin-top: 2px; }
.rc-passage { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.rc-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); }

/* Daily RC — mini leaderboard (top 5, sits below RC card) */
.rc-lb-card { border-left: 4px solid #eab308; }
.rc-lb { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 6px; }
.rc-lb-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fbfaf3;
  border: 1px solid var(--line);
  font-size: 13px;
}
.rc-lb-row.me { background: #eef6ff; border-color: #b7d6ff; }
.rc-lb-rank { font-weight: 800; color: var(--brand); text-align: center; }
.rc-lb-name { color: var(--ink); font-weight: 600; }
.rc-lb-name em { color: var(--brand); font-style: normal; font-weight: 700; }
.rc-lb-score { font-weight: 700; color: var(--ink); }
.rc-lb-acc { color: var(--muted); font-size: 12px; }

/* SWOT */
.swot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swot-quad { border-radius: 12px; padding: 12px; border: 1px solid var(--line); background: #fbfaf3; min-height: 110px; }
.swot-quad h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.swot-quad ul { margin: 0; padding-left: 16px; }
.swot-quad li { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.q-s h4 { color: #199f4a; } .q-s { background: #f0faf3; }
.q-w h4 { color: #d33; }    .q-w { background: #fdf0f0; }
.q-o h4 { color: var(--brand); } .q-o { background: #eef0ff; }
.q-t h4 { color: #a97a00; } .q-t { background: #fff8de; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: #fbfaf3; border: 1px solid var(--line); }
.list .badge { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.b-qa { background: #eef0ff; color: var(--brand); }
.b-varc { background: #fff5d6; color: #a97a00; }
.b-lrdi { background: #e8f8ee; color: #199f4a; }
.b-other { background: #f4f2ea; color: var(--ink-2); }
.list .q-title { font-size: 13px; font-weight: 600; }
.list .q-meta { font-size: 11px; color: var(--muted); }
.list .status { margin-left: auto; font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.status-open { background: #fdecec; color: #d33; }
.status-resolved { background: #e8f8ee; color: #199f4a; }
.status-unresolved { background: #fff5d6; color: #a97a00; }

.stat-row { display: flex; gap: 12px; }
.stat-box { flex: 1; background: #fbfaf3; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat-box b { font-size: 20px; display: block; }
.stat-box span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* Graph */
.graph-card { grid-column: 1 / -1; }
.graph-wrap { position: relative; height: 320px; }

/* Rich-text tables (questions, explanations, passages) */
.rt-table {
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13.5px;
  min-width: 260px;
  max-width: 100%;
  border: 1px solid #d6d8e5;
  background: #fff;
}
.rt-table th, .rt-table td {
  border: 1px solid #d6d8e5;
  padding: 6px 10px;
  vertical-align: top;
  line-height: 1.45;
}
.rt-table th {
  background: #eef0ff;
  font-weight: 700;
  color: #1e2340;
  text-align: center;
}
.rt-table caption {
  caption-side: top;
  font-weight: 700;
  padding: 4px 0 6px;
  color: #31384f;
  font-size: 12.5px;
}

/* Matrices — bracketed 2D array, no visible borders except tall side rules */
.rt-matrix {
  border-collapse: collapse;
  display: inline-table;
  margin: 6px 6px 6px 4px;
  padding: 4px 10px;
  border-left: 2.5px solid #1e2340;
  border-right: 2.5px solid #1e2340;
  background: transparent;
  font-family: 'IBM Plex Mono', 'Consolas', monospace;
  font-size: 14px;
}
.rt-matrix td {
  border: none;
  padding: 3px 12px;
  text-align: center;
  color: #1e2340;
}
.rt-matrix th { border: none; padding: 3px 12px; text-align: center; }

/* ============================================================
   QuestionRenderer (shared across attempt / analysis / preview)
   ============================================================ */
.qr-body { font-size: 15.5px; line-height: 1.6; color: #1e2340; word-break: break-word; }
.qr-body p { margin: 0 0 10px 0; }
.qr-body p:last-child { margin-bottom: 0; }
.qr-body strong { color: #10163a; }
.qr-body em { color: #1e2340; }
.qr-body ul, .qr-body ol { margin: 6px 0 10px 22px; padding: 0; }
.qr-body li { margin: 2px 0; }
.qr-body pre { background: #f4f6fb; border: 1px solid #dee3f0; border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 14px; }
.qr-body code { background: #f4f6fb; border-radius: 4px; padding: 1px 5px; font-size: 0.92em; }
.qr-body pre code { background: transparent; padding: 0; }
.qr-body blockquote { border-left: 3px solid #cfd6ea; padding: 4px 12px; margin: 6px 0; color: #4a5170; }
.qr-body hr { border: 0; border-top: 1px solid #e2e6f2; margin: 12px 0; }
.qr-body a { color: #3b7cf5; text-decoration: none; }
.qr-body a:hover { text-decoration: underline; }

.qr-body .qr-img { max-width: 100%; height: auto; display: block; margin: 10px auto; border-radius: 6px; cursor: zoom-in; }
.qr-image-lightbox { position:fixed; inset:0; z-index:10000; display:flex; align-items:center; justify-content:center; padding:24px; background:rgba(10,14,28,.88); cursor:zoom-out; }
.qr-image-lightbox img { display:block; max-width:96vw; max-height:92vh; object-fit:contain; border-radius:8px; background:#fff; }

.qr-body .qr-table-scroll { overflow-x: auto; margin: 10px 0; border: 1px solid #e2e6f2; border-radius: 8px; }
.qr-body table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
.qr-body th, .qr-body td { border: 1px solid #e2e6f2; padding: 6px 10px; text-align: left; vertical-align: top; }
.qr-body thead th { background: #eef2fa; color: #10163a; font-weight: 700; }

.qr-body .qr-math-scroll { overflow-x: auto; padding: 4px 0; }
.qr-body .qr-math-error { color: #c62828; background: #fdecea; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* KaTeX inline sits on the line; give display math a bit of vertical air */
.qr-body .katex { font-size: 1.03em; }
.qr-body .katex-display { margin: 8px 0; }

/* Option rows: (a) (b) (c) (d) — flex, one baseline-aligned line */
.qr-opts { display: flex; flex-direction: column; gap: 6px; }
.qr-opt-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  line-height: 1.5;
  transition: background .1s ease, border-color .1s ease;
}
.qr-opt-row:hover { background: #f4f7fd; }
.qr-opt-row.is-selected { background: #e6efff; border-color: #a9c2f4; }
.qr-opt-row:focus-visible { outline: 2px solid #3b7cf5; outline-offset: 1px; }

.qr-opt-row .qr-opt-dot {
  flex: 0 0 auto;
  width: 14px; height: 14px;
  border: 2px solid #8894b3;
  border-radius: 50%;
  display: inline-block;
  background: #fff;
  position: relative;
  transform: translateY(2px);
  transition: border-color .1s ease;
}
.qr-opt-row.is-selected .qr-opt-dot,
.qr-opt-row .qr-opt-dot.is-on { border-color: #3b7cf5; }
.qr-opt-row.is-selected .qr-opt-dot::after,
.qr-opt-row .qr-opt-dot.is-on::after {
  content: ''; position: absolute; inset: 2px;
  background: #3b7cf5; border-radius: 50%;
}

.qr-opt-row .qr-opt-label {
  flex: 0 0 auto;
  color: #1e2340; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qr-opt-row .qr-opt-body { flex: 1 1 auto; min-width: 0; display: inline; }
.qr-opt-row .qr-opt-body .qr-img { max-height:240px; }
.qr-opt-row .qr-opt-body p,
.qr-opt-row .qr-opt-body p:first-child,
.qr-opt-row .qr-opt-body p:last-child { display: inline; margin: 0; }
.qr-opt-row .qr-opt-body .katex { line-height: 1.4; }
