/* happ-mcq — dark+violet design language (aligned with qbank/eb2026qa).
 * Base: dark slate (#05070f), indigo accent (#6366f1), ivory paper (#f6f1e7).
 * Tiers: easy→green, standard→amber, hard→oxblood. */

:root {
  --bg: #05070f;
  --bg-soft: #0a0f1c;
  --bg-card: #0d1220;
  --line: #1a2132;
  --line-strong: #2a3350;
  --ink: #e7eaf3;
  --muted: #96a0b5;
  --indigo: #6366f1;
  --indigo-soft: #a5b4fc;
  --indigo-glow: rgba(99, 102, 241, 0.35);
  --paper: #f6f1e7;
  --paper-ink: #201c16;
  --paper-muted: #6d6457;
  --paper-line: #ddd4c4;
  --oxblood: #8b1e2d;
  --easy: #2f6b45;
  --standard: #8a6a1f;
  --hard: #8b1e2d;
  --header-h: 58px;
  --side-w: 276px;
  --curve: 16px;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Sinhala", "Noto Sans Tamil", "Noto Sans Arabic", sans-serif;
  background:
    radial-gradient(1100px 560px at 84% -8%, rgba(99, 102, 241, 0.16), transparent 62%),
    radial-gradient(820px 460px at 6% 4%, rgba(56, 189, 248, 0.06), transparent 58%),
    var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layered background: subtle indigo + grain ---------- */

.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(800px 520px at 105% 110%, rgba(5, 7, 15, 0.4), transparent 60%),
    radial-gradient(600px 400px at 85% -10%, rgba(99, 102, 241, 0.08), transparent 60%),
    var(--bg);
}
.bg .blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35;
}
.bg .b1 {
  width: 480px; height: 480px; left: -140px; top: -120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 70%);
  animation: drift1 46s ease-in-out infinite alternate;
}
.bg .b2 {
  width: 420px; height: 420px; right: -120px; bottom: -140px;
  background: radial-gradient(circle, rgba(5, 7, 15, 0.3), transparent 70%);
  animation: drift2 58s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(90px, 60px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-70px, -50px) scale(1.08); } }
.bg .grain {
  position: absolute; inset: 0; opacity: 0.04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ---------- custom scrollbars ---------- */

.chat::-webkit-scrollbar, .side-list::-webkit-scrollbar { width: 9px; }
.chat::-webkit-scrollbar-track, .side-list::-webkit-scrollbar-track { background: var(--bg); }
.chat::-webkit-scrollbar-thumb, .side-list::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg);
}
.chat::-webkit-scrollbar-thumb:hover, .side-list::-webkit-scrollbar-thumb:hover { background: var(--indigo); }
.chat, .side-list { scrollbar-width: thin; scrollbar-color: var(--line-strong) var(--bg); }

/* ---------- header ---------- */

header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(5, 7, 15, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.home {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-soft));
  color: #fff; font-weight: 800; font-size: 14px; text-decoration: none;
  box-shadow: 0 2px 12px var(--indigo-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.home:hover { transform: translateY(-1px); box-shadow: 0 4px 18px var(--indigo-glow); }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand h1 {
  font-size: 15px; letter-spacing: 0.2px; font-weight: 700;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-soft));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.brand span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hspace { flex: 1; }
.meter {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.meter .chip {
  padding: 3px 10px; border-radius: 999px;
  background: rgba(99, 102, 241, 0.10); border: 1px solid var(--line);
  color: var(--indigo-soft); font-variant-numeric: tabular-nums;
}
.meter .chip.lab { color: var(--indigo-soft); border-color: rgba(99, 102, 241, 0.4); background: rgba(99, 102, 241, 0.12); }
.meter .chip.score { color: var(--paper); border-color: rgba(246, 241, 231, 0.3); background: rgba(246, 241, 231, 0.15); }
.meter .chip.cov { color: var(--indigo); border-color: rgba(99, 102, 241, 0.3); background: rgba(99, 102, 241, 0.08); }
.meter .chip.cov.full { color: var(--easy); border-color: rgba(47, 107, 69, 0.45); background: rgba(47, 107, 69, 0.10); }
.meter .chip.pulse { animation: chippulse 0.5s ease; }
@keyframes chippulse { 30% { transform: scale(1.14); } }
#drawerBtn {
  display: none; width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: rgba(99, 102, 241, 0.10); border: 1px solid var(--line);
  color: var(--indigo-soft); font-size: 17px; cursor: pointer;
}

/* ---------- sidebar ---------- */

aside {
  position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column;
  background: rgba(10, 15, 28, 0.9); backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.side-head { padding: 16px 16px 10px; }
.side-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); font-weight: 700; }
.side-head p { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.side-list { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.pitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 14px; text-align: left; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--line); color: var(--ink);
  font: inherit; transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.pitem:hover { border-color: var(--line-strong); transform: translateX(2px); }
.pitem.active { border-color: var(--indigo); background: rgba(99, 102, 241, 0.12); box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35); }
.pitem .pnum { font-size: 13px; font-weight: 700; flex: 1; min-width: 0; }
.pitem .pmeta { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.pright { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.pscore {
  flex: none; min-width: 44px; text-align: center; padding: 3px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.pscore.hi { color: var(--easy); background: rgba(47, 107, 69, 0.10); border-color: rgba(47, 107, 69, 0.3); }
.pscore.mid { color: var(--standard); background: rgba(138, 106, 31, 0.08); border-color: rgba(138, 106, 31, 0.3); }
.pscore.lo { color: var(--hard); background: rgba(139, 30, 45, 0.08); border-color: rgba(139, 30, 45, 0.3); }
.pscore.none { color: var(--muted); background: rgba(150, 160, 181, 0.10); border-color: rgba(150, 160, 181, 0.25); }
.pitem.empty { border-style: dashed; background: transparent; cursor: default; opacity: 0.55; }
.pitem.empty:hover { transform: none; border-color: var(--line); }
.pitem.empty .pnum { color: var(--muted); font-weight: 500; }
.pdel {
  flex: none; width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(139, 30, 45, 0.18); color: var(--hard);
  font-size: 18px; font-weight: 800; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  opacity: 0.85;
}
.pdel:hover { background: rgba(139, 30, 45, 0.35); color: var(--oxblood); border-color: var(--hard); opacity: 1; }
.pdel:focus-visible { outline: 2px solid var(--hard); outline-offset: 2px; }
.pitem:hover .pdel { opacity: 1; }
.side-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.scrim {
  position: fixed; inset: 0; z-index: 25; background: rgba(5, 7, 15, 0.7);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- chat column ---------- */

main {
  position: fixed; top: var(--header-h); left: var(--side-w); right: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column;
}
.chat { flex: 1; overflow-y: auto; padding: 22px 18px 120px; }
.thread { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

.replaybar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; margin-bottom: 4px; border-radius: 14px;
  background: rgba(138, 106, 31, 0.08); border: 1px solid rgba(138, 106, 31, 0.35);
  color: var(--standard); font-size: 12.5px;
  backdrop-filter: blur(8px);
}
.replaybar button {
  margin-left: auto; padding: 4px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(138, 106, 31, 0.14); border: 1px solid rgba(138, 106, 31, 0.4);
  color: var(--standard); font: inherit; font-size: 12px; font-weight: 600;
}
.replaybar button:hover { background: rgba(138, 106, 31, 0.24); }

/* ---------- bubbles ---------- */

.qcard, .welcome, .done {
  background: var(--paper); color: var(--paper-ink);
  border: 1px solid var(--paper-line); border-radius: var(--curve);
  padding: 18px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--d, 0s);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.qhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.qnum {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; color: var(--indigo-soft);
  background: rgba(99, 102, 241, 0.12); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px;
}
.tier {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid; font-variant-numeric: tabular-nums;
}
.tier.easy { color: var(--easy); border-color: rgba(47, 107, 69, 0.4); background: rgba(47, 107, 69, 0.09); }
.tier.standard { color: var(--standard); border-color: rgba(138, 106, 31, 0.4); background: rgba(138, 106, 31, 0.07); }
.tier.hard { color: var(--hard); border-color: rgba(139, 30, 45, 0.4); background: rgba(139, 30, 45, 0.07); }
.qtopic { font-size: 11px; color: var(--muted); margin-left: auto; }

.qstem { font-size: 15.5px; line-height: 1.55; font-weight: 600; color: var(--paper-ink); margin-bottom: 14px; }

.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: left;
  padding: 11px 13px; border-radius: 13px; cursor: pointer;
  background: rgba(246, 241, 231, 0.65); border: 1px solid var(--paper-line);
  color: var(--paper-ink); font: inherit; font-size: 13.5px; line-height: 1.5;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, opacity 0.2s ease;
}
.opt:hover:not(:disabled) { border-color: var(--indigo); background: rgba(99, 102, 241, 0.08); transform: translateX(3px); }
.opt:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.opt .key {
  flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 12px; font-weight: 800;
  background: rgba(99, 102, 241, 0.14); border: 1px solid var(--line); color: var(--indigo-soft);
  transition: inherit;
}
.opt:disabled { cursor: default; }
.opts.locked .opt { opacity: 0.5; }
.opts.locked .opt.picked-correct, .opts.locked .opt.picked-wrong, .opts.locked .opt.reveal-correct { opacity: 1; }
.opt.picked-correct, .opt.reveal-correct {
  color: var(--easy); border-color: rgba(47, 107, 69, 0.55);
  background: rgba(47, 107, 69, 0.09); box-shadow: 0 0 16px rgba(47, 107, 69, 0.12);
}
.opt.picked-correct .key, .opt.reveal-correct .key { color: var(--easy); border-color: rgba(47, 107, 69, 0.5); background: rgba(47, 107, 69, 0.14); }
.opt.picked-wrong {
  color: var(--hard); border-color: rgba(139, 30, 45, 0.55);
  background: rgba(139, 30, 45, 0.08); animation: shake 0.35s ease;
}
.opt.picked-wrong .key { color: var(--hard); border-color: rgba(139, 30, 45, 0.5); background: rgba(139, 30, 45, 0.12); }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

.qexplain {
  display: none; margin-top: 13px; padding: 11px 14px;
  border-left: 3px solid var(--standard); border-radius: 0 12px 12px 0;
  background: rgba(138, 106, 31, 0.06);
  font-size: 13px; line-height: 1.55; color: #8a6a1f;
}
.qexplain.show { display: block; animation: rise 0.4s ease both; }
.qexplain .why { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--standard); font-weight: 700; display: block; margin-bottom: 4px; }
.qexplain .src { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.verdict { font-weight: 700; margin-right: 6px; }
.verdict.ok { color: var(--easy); }
.verdict.no { color: var(--hard); }

/* ---------- welcome & completion ---------- */

.welcome { text-align: left; }
.welcome .wk { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--standard); font-weight: 700; }
.welcome h2 {
  font-size: 26px; line-height: 1.2; margin: 8px 0 10px; font-weight: 800;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-soft) 45%, var(--standard));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.welcome p { font-size: 13.5px; line-height: 1.65; color: var(--muted); max-width: 56ch; }
.wfeatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.wfeat {
  padding: 12px; border-radius: 13px; background: rgba(246, 241, 231, 0.1);
  border: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted);
}
.wfeat b { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 3px; }
.wfeat .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.bigbtn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 14px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-soft));
  color: #fff; font: inherit; font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 24px var(--indigo-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bigbtn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px var(--indigo-glow); }
.bigbtn img { width: 18px; height: 18px; }

.done { text-align: center; }
.done .ringwrap { position: relative; width: 132px; height: 132px; margin: 4px auto 10px; }
.done svg.ring { transform: rotate(-90deg); }
.done .ringbg { stroke: var(--paper-line); }
.done .ringfg { stroke: url(#scoregrad); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1); }
.done .ringtxt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.done .ringtxt b { font-size: 30px; font-variant-numeric: tabular-nums; color: var(--paper-ink); }
.done .ringtxt span { font-size: 11px; color: var(--paper-muted); }
.done h2 { font-size: 18px; margin-bottom: 4px; color: var(--paper-ink); }
.done .dmsg { font-size: 13px; color: var(--paper-muted); margin-bottom: 14px; }
.done .dcov { font-size: 12px; color: var(--indigo); margin: -6px 0 14px; }
.tbars { display: flex; flex-direction: column; gap: 7px; max-width: 420px; margin: 0 auto 16px; text-align: left; }
.tbar { display: grid; grid-template-columns: 118px 1fr 40px; align-items: center; gap: 9px; font-size: 11.5px; color: var(--muted); }
.tbar .track { height: 7px; border-radius: 6px; background: rgba(150, 160, 181, 0.15); overflow: hidden; }
.tbar .fill { height: 100%; border-radius: 6px; animation: grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes grow { from { width: 0; } }
.tbar .val { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- FAB ---------- */

.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 35;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-soft));
  color: #fff; font: inherit; font-size: 14px; font-weight: 700;
  box-shadow: 0 10px 34px var(--indigo-glow), 0 0 0 1px rgba(99, 102, 241, 0.25) inset;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.fab:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 16px 44px var(--indigo-glow), 0 0 0 1px rgba(99, 102, 241, 0.35) inset; }
.fab:active { transform: scale(0.97); }
.fab img { width: 20px; height: 20px; }
.fab.spin img { animation: spin 0.6s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px); z-index: 50;
  padding: 9px 18px; border-radius: 999px; font-size: 12.5px;
  background: rgba(5, 7, 15, 0.95); border: 1px solid var(--line-strong); color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- mobile ---------- */

@media (max-width: 900px) {
  :root { --side-w: 0px; }
  #drawerBtn { display: inline-flex; align-items: center; justify-content: center; }
  aside { width: 280px; transform: translateX(-102%); box-shadow: 20px 0 60px rgba(5, 7, 15, 0.5); }
  aside.open { transform: translateX(0); }
  main { left: 0; }
  .brand span { display: none; }
  .chat { padding: 16px 12px 110px; }
  .qcard, .welcome, .done { padding: 15px; }
  .qstem { font-size: 14.5px; }
  .opt { font-size: 13px; padding: 12px; }
  .wfeatures { grid-template-columns: 1fr; }
  .welcome h2 { font-size: 22px; }
  .fab { right: 16px; bottom: 18px; padding: 13px 18px; }
  .qtopic { display: none; }
  .meter .chip.lab { display: none; }
  .meter { gap: 6px; font-size: 11px; }
  .meter .chip { padding: 3px 8px; }
}

@media (max-width: 620px) {
  header { gap: 8px; padding: 0 10px; }
  .home { display: none; }
  .brand h1 { font-size: 13px; }
  .meter { font-size: 10.5px; gap: 5px; }
  .meter .chip { padding: 2px 7px; }
  .covcycle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- language bar ---------- */

.langbar {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 28, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.langbar button {
  padding: 5px 16px; border-radius: 999px; cursor: pointer;
  background: rgba(99, 102, 241, 0.08); border: 1px solid var(--line);
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.8px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.langbar button:hover { border-color: var(--line-strong); color: var(--indigo-soft); }
.langbar button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.langbar button.on {
  background: linear-gradient(135deg, var(--indigo), var(--indigo-soft));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 14px var(--indigo-glow);
}
.plang {
  flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: 0.6px;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(99, 102, 241, 0.12); border: 1px solid var(--line); color: var(--indigo-soft);
}

/* ---------- model lane: loading + error cards ---------- */

.loadcard, .errcard {
  background: var(--paper); color: var(--paper-ink);
  border: 1px solid var(--paper-line); border-radius: var(--curve);
  padding: 26px 18px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  text-align: center; animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.loadspin img { width: 34px; height: 34px; animation: spin 1.1s linear infinite; }
.loadcard h2 { font-size: 18px; margin: 10px 0 6px; }
.loadcard p { font-size: 13px; color: var(--paper-muted); line-height: 1.6; max-width: 52ch; margin: 0 auto; }
.loadtick { margin: 12px auto 4px; font-size: 22px; font-weight: 800; color: var(--standard); font-variant-numeric: tabular-nums; }
.loadcard .loadnote { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.errcard h2 { font-size: 18px; color: var(--hard); margin-bottom: 6px; }
.errcard p { font-size: 13px; color: var(--paper-muted); line-height: 1.6; max-width: 56ch; margin: 0 auto; }
.errbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.ghostbtn {
  padding: 12px 20px; border-radius: 14px; cursor: pointer;
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--indigo-soft); font: inherit; font-size: 13.5px; font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ghostbtn:hover { background: rgba(99, 102, 241, 0.10); border-color: var(--indigo); }
a.bigbtn { text-decoration: none; }
.langbar button.locked, .langbar button:disabled { opacity: 0.45; cursor: not-allowed; }
.langbar button.locked:hover { border-color: var(--line); color: var(--muted); }
.lockcard h2 { color: var(--indigo); }
.welcome .wlangnote { margin-top: 8px; font-size: 12.5px; color: var(--indigo); }
.welcome .wnote { margin-top: 12px; font-size: 11.5px; }

@media (max-width: 620px) {
  .langbar { gap: 5px; padding: 7px 10px; }
  .langbar button { padding: 4px 13px; font-size: 11.5px; }
}

/* ---------- Arabic RTL ---------- */

[dir="rtl"] aside { left: auto; right: 0; border-right: none; border-left: 1px solid var(--line); }
[dir="rtl"] main { left: 0; right: var(--side-w); }
[dir="rtl"] .pitem, [dir="rtl"] .opt, [dir="rtl"] .welcome, [dir="rtl"] .tbars { text-align: right; }
[dir="rtl"] .pitem:hover { transform: translateX(-2px); }
[dir="rtl"] .opt:hover:not(:disabled) { transform: translateX(-3px); }
[dir="rtl"] .qtopic { margin-left: 0; margin-right: auto; }
[dir="rtl"] .qexplain { border-left: none; border-right: 3px solid var(--standard); border-radius: 12px 0 0 12px; }
[dir="rtl"] .verdict { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .replaybar button { margin-left: 0; margin-right: auto; }
[dir="rtl"] .wfeat .dot { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .tbar .val { text-align: left; }
[dir="rtl"] .fab { right: auto; left: 26px; }

@media (max-width: 900px) {
  [dir="rtl"] aside { transform: translateX(102%); box-shadow: -20px 0 60px rgba(5, 7, 15, 0.5); }
  [dir="rtl"] aside.open { transform: translateX(0); }
  [dir="rtl"] .fab { left: 16px; }
}

/* Hide language bar on MCQ pages - language selection via apex site */
header .langbar { display: none; }