:root {} /* reserved */

.b4a-branches{position:relative; /* defaults overridden by theme classes */ 
  --bg:#f7f8fc; --card:#ffffff; --ink:#1f2937; --muted:#6b7280; 
  --brand:#2563eb; --brand-2:#10b981; --accent:#f59e0b; 
  --good:#16a34a; --bad:#dc2626; --shadow:0 10px 30px rgba(2,6,23,.08); --radius:22px; 
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial,sans-serif; color:var(--ink);
  background:var(--bg);
}
.b4a-branches *{box-sizing:border-box}

/* Palettes */
.b4a-branches.theme-b4a{ --brand:#2563eb; --brand-2:#10b981; --accent:#f59e0b; --bg:#f7f8fc; }
.b4a-branches.theme-ocean{ --brand:#0ea5e9; --brand-2:#06b6d4; --accent:#22d3ee; --bg:#f0f9ff; }
.b4a-branches.theme-plum{ --brand:#7c3aed; --brand-2:#a855f7; --accent:#f472b6; --bg:#faf5ff; }
.b4a-branches.theme-gray{ --brand:#334155; --brand-2:#64748b; --accent:#94a3b8; --bg:#f8fafc; }

/* Fonts */
.b4a-branches.font-system{ font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial,sans-serif; }
.b4a-branches.font-quicksand{ font-family: "Quicksand", system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial,sans-serif; }
.b4a-branches.font-nunito{ font-family: "Nunito", system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial,sans-serif; }

.b4a-branches .wrap{max-width:1100px;margin:auto;padding:20px}
.b4a-branches header{display:flex;gap:16px;align-items:center;justify-content:space-between;margin:10px 0 16px;flex-wrap:wrap}
.b4a-branches h1{font-size:clamp(22px,2.6vw,34px);margin:0;font-weight:800;letter-spacing:.2px}
.b4a-branches .subtitle{color:var(--muted);margin-top:6px}
.b4a-branches .card{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px}
.b4a-branches .tabs{display:flex;gap:10px;flex-wrap:wrap}
.b4a-branches .tab{border:none;background:var(--card);padding:12px 16px;border-radius:999px;box-shadow:var(--shadow);cursor:pointer;font-weight:700}
.b4a-branches .tab[aria-selected="true"]{background:var(--brand);color:white}
.b4a-branches .grid{display:grid;gap:16px}
@media(min-width:900px){.b4a-branches .grid-3{grid-template-columns:repeat(3,1fr)}}
.b4a-branches .branch{display:flex;flex-direction:column;gap:10px}
.b4a-branches .badge{display:inline-flex;align-items:center;gap:8px;background:#eef2ff;color:#312e81;border-radius:999px;padding:6px 10px;font-weight:700}
.b4a-branches .pill{display:inline-flex;align-items:center;gap:8px;background:#ecfeff;color:#155e75;border-radius:999px;padding:6px 10px;font-weight:700}
.b4a-branches .hint{color:var(--muted);font-size:14px}
.b4a-branches .sr{position:absolute;left:-9999px}
.b4a-branches .footer{margin-top:26px;color:var(--muted);font-size:13px}

/* Top controls */
.b4a-branches .controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.b4a-branches .input{display:flex;gap:8px;align-items:center;background:var(--card);border:1px solid #e5e7eb;border-radius:999px;padding:6px 10px;box-shadow:var(--shadow)}
.b4a-branches .input input{border:none;outline:none;min-width:90px}
.b4a-branches .toggle{display:inline-flex;align-items:center;gap:8px;background:var(--card);border-radius:999px;padding:6px 10px;box-shadow:var(--shadow);cursor:pointer;border:1px solid #e5e7eb}
.b4a-branches .toggle[aria-pressed="true"]{background:var(--brand);color:#fff}

/* Drag & Drop */
.b4a-branches .dropzone{min-height:190px;border:2px dashed #c7d2fe;border-radius:18px;padding:12px;background:#fbfdff;display:flex;flex-direction:column;gap:8px}
.b4a-branches .token{background:#ffffff;border:1px solid #e5e7eb;border-radius:14px;padding:10px 12px;box-shadow:var(--shadow);cursor:grab;line-height:1.35}
.b4a-branches .token:focus{outline:3px solid #a7f3d0}
.b4a-branches .dz-title{font-weight:900;margin-bottom:6px}
.b4a-branches .dz-hint{color:var(--muted);font-size:12px;margin-bottom:8px}
.b4a-branches .pool{display:grid;gap:10px}

/* Quiz */
.b4a-branches .quiz-q{font-weight:800;margin:0 0 10px}
.b4a-branches .choices{display:grid;gap:10px}
.b4a-branches .choice{border:1px solid #e5e7eb;border-radius:12px;padding:12px;text-align:left;background:white;cursor:pointer}
.b4a-branches .choice.correct{border-color:var(--good)}
.b4a-branches .choice.wrong{border-color:var(--bad)}
.b4a-branches .progress{height:10px;background:#e5e7eb;border-radius:999px;overflow:hidden}
.b4a-branches .bar{height:10px;background:var(--brand);width:0%}

/* Toast & Confetti */
.b4a-branches .toast{position:absolute;right:16px;bottom:16px;background:var(--ink);color:white;border-radius:12px;padding:12px 14px;box-shadow:var(--shadow);opacity:0;transform:translateY(10px);transition:.25s;z-index:5}
.b4a-branches .toast.show{opacity:1;transform:none}
.b4a-branches canvas.b4a-confetti{position:absolute;inset:0;pointer-events:none;z-index:4}

/* Bunny helper bubble */
.b4a-branches .bunny{position:fixed;right:18px;bottom:78px;max-width:260px;background:#fff;border:1px solid #e5e7eb;border-radius:16px;box-shadow:var(--shadow);padding:10px 12px;display:none}
.b4a-branches .bunny.show{display:block}
.b4a-branches .bunny h4{margin:.2rem 0;font-size:14px}
.b4a-branches .bunny p{margin:0;font-size:13px;color:var(--ink)}

/* Certificate */
.b4a-branches .certificate{background:white;border:8px double #111;border-radius:20px;padding:24px;text-align:center;box-shadow:var(--shadow)}
.b4a-branches .certificate h2{margin:0 0 6px;font-size:28px}
.b4a-branches .certificate .subtitle{font-size:14px}
.b4a-branches .certificate .name{font-size:26px;font-weight:800;margin:10px 0}
.b4a-branches .certificate .meta{display:flex;justify-content:center;gap:20px;margin-top:8px;color:#374151}
.b4a-branches .btn{border:none;background:var(--brand);color:white;padding:10px 14px;border-radius:10px;cursor:pointer;box-shadow:var(--shadow);font-weight:700}

/* Print */
@media print{
  body *{ visibility:hidden !important; }
  .b4a-branches .certificate, .b4a-branches .certificate *{ visibility:visible !important; }
  .b4a-branches .certificate{ position:absolute; top:0; left:0; right:0; margin:0 auto; width:90%; }
}
