:root{
  --bg:#070A12;
  --panel: rgba(15, 23, 42, .78);
  --panelSolid:#0b1324;
  --panel2: rgba(17, 28, 55, .85);
  --stroke: rgba(255,255,255,.10);

  --text:#EAF1FF;
  --muted:#AAB7D6;

  --accent:#38BDF8;
  --accent2:#A78BFA;
  --good:#34D399;

  --shadow: 0 22px 60px rgba(0,0,0,.55);
  --radius:18px;
  --radius2:14px;

  --sans: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

html[data-theme="light"]{
  --bg:#F6F8FF;
  --panel: rgba(255,255,255,.78);
  --panelSolid:#ffffff;
  --panel2: rgba(239, 244, 255, .9);
  --stroke: rgba(9, 18, 40, .12);

  --text:#0B1224;
  --muted:#546186;

  --accent:#2563EB;
  --accent2:#7C3AED;

  --shadow: 0 18px 45px rgba(10,18,40,.14);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 55%),
    radial-gradient(900px 650px at 90% 10%, color-mix(in srgb, var(--accent2) 22%, transparent), transparent 60%),
    var(--bg);
}

.muted{color:var(--muted)}
.mono{font-family:var(--mono)}

/* ===== Header (FIXED) ===== */
.topbar{
  position:sticky; top:0; z-index:50;
  padding: 12px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;                 /* ✅ allows wrap on small width */
  border-bottom:1px solid var(--stroke);
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
}

/* Brand row */
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;                    /* ✅ allows text to shrink instead of overlap */
  flex: 1 1 auto;
}

/* Mumbai Traders badge */
.brand__mark{
  flex: 0 0 auto;
  height: 36px;                    /* ✅ shorter so it doesn't collide with title */
  padding: 0 12px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 1000;
  color:#fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: var(--shadow);

  white-space: nowrap;             /* ✅ never breaks into 2 lines */
  line-height: 1;
  font-size: 13px;
}

/* On very small screens, shrink badge font a bit */
@media (max-width: 420px){
  .brand__mark{font-size: 12px; padding: 0 10px;}
}

/* Right side */
.brand__meta{
  min-width: 0;                    /* ✅ critical for overflow handling */
  display:flex;
  flex-direction:column;
}

.brand__title{
  font-weight: 900;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;         /* ✅ prevents overlap; trims if needed */
}

.brand__sub{
  font-size: 12px;
  margin-top: 2px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex: 0 0 auto;
}

/* chips / buttons */
.iconBtn{
  width: 40px; height: 40px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panelSolid) 88%, transparent);
  color: var(--text);
  cursor:pointer;
}
.iconBtn:hover{transform: translateY(-1px); transition:.15s ease}

.chip{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panelSolid) 88%, transparent);
  color: var(--text);
  cursor:pointer;
}
.chip:hover{transform: translateY(-1px); transition:.15s ease}
.chip__label{font-size:12px; color: var(--muted)}
.chip__value{font-weight:900; font-family: var(--mono)}
.chip__icon{opacity:.8}

/* ===== Layout ===== */
.shell{
  max-width: 1250px;
  margin: 0 auto;
  padding: 18px;
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}
@media (max-width: 980px){
  .shell{grid-template-columns: 1fr}
}

.sidebar{display:flex; flex-direction:column; gap:16px}

.panel{
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 14px;
}
.panel__head{margin-bottom: 10px}
.panel__title{font-weight: 900}
.panel__sub{font-size:12px; color: var(--muted); margin-top:4px}

.panel--cta{padding: 14px}
.cta__title{font-weight:900}
.cta__links{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.link{color: var(--accent); text-decoration:none; font-weight: 800}
.link:hover{text-decoration:underline}

.nav{display:flex; flex-direction:column; gap:10px}
.nav__item{
  text-decoration:none;
  color: var(--text);
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
  padding: 12px;
  display:flex; gap:12px; justify-content:space-between;
}
.nav__item:hover{transform: translateY(-1px); transition:.15s ease}
.nav__item[aria-current="page"]{
  border-color: color-mix(in srgb, var(--accent) 55%, var(--stroke));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.nav__meta{font-size:12px; color: var(--muted)}

.ladder{margin:0; padding-left:18px; color:var(--muted); font-size:13px}
.ladder li{margin: 8px 0}
.ladder b{color: var(--text)}

/* ===== Content ===== */
.content{
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero{
  display:flex; justify-content:space-between; gap:14px; align-items:flex-start;
  padding: 10px 6px 14px;
  border-bottom: 1px solid var(--stroke);
}
.hero h1{margin:0; font-size: 30px; letter-spacing:.2px}
.hero__right{display:flex; gap:10px; flex-wrap:wrap}

.btn{
  border:none;
  cursor:pointer;
  padding: 10px 14px;
  border-radius: 16px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.btn:hover{transform: translateY(-1px); transition:.15s ease}
.btn:disabled{opacity:.5; cursor:not-allowed; transform:none}

.btn--ghost{
  color: var(--text);
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  border: 1px solid var(--stroke);
}

.progress{margin-top: 12px; max-width: 520px}
.progress__meta{display:flex; justify-content:space-between; align-items:center; font-size:12px}
.progress__bar{
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  overflow:hidden;
}
.progress__fill{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--good), var(--accent));
}

/* ===== Module strip readable ===== */
.moduleStrip{
  margin-top: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  padding: 14px;
}
.moduleStrip__head{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px}
.moduleStrip__title{
  font-weight: 1000;
  letter-spacing: .12em;
  font-size: 12px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 86%, var(--muted));
}
.modulePills{display:flex; flex-wrap:wrap; gap:10px}
.modulePill{
  border:1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--panelSolid) 86%, transparent);
  color: var(--text);
  cursor:pointer;
  font-weight: 900;
  display:flex; align-items:center; gap:10px;
}
.modulePill:hover{transform: translateY(-1px); transition:.15s ease; border-color: color-mix(in srgb, var(--accent) 45%, var(--stroke))}
.modulePill__idx{font-family: var(--mono); font-size: 12px; color: color-mix(in srgb, var(--text) 78%, var(--muted))}
.modulePill__done{width: 10px; height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 60%, transparent); border: 1px solid var(--stroke)}
.modulePill.is-active{
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 35%, var(--panelSolid)),
    color-mix(in srgb, var(--accent2) 25%, var(--panelSolid))
  );
  border-color: color-mix(in srgb, var(--accent) 55%, var(--stroke));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.modulePill.is-done .modulePill__done{background: var(--good); border-color: color-mix(in srgb, var(--good) 60%, var(--stroke))}

/* ===== Lesson cards, accordion, quiz ===== */
.card{
  margin-top: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
  padding: 14px;
}
.kicker{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
  font-family: var(--mono);
}
h2{margin: 10px 0 8px}
h3{margin: 14px 0 8px}
.hr{border:none; border-top:1px solid var(--stroke); margin:14px 0}

.accordion{display:flex; flex-direction:column; gap:10px; margin-top:10px}
.accItem{border-radius: var(--radius2); border:1px solid var(--stroke); background: color-mix(in srgb, var(--panelSolid) 82%, transparent); overflow:hidden}
.accBtn{
  width:100%;
  padding: 12px;
  background: transparent;
  color: var(--text);
  border:none;
  cursor:pointer;
  display:flex; justify-content:space-between; align-items:center;
  font-weight: 1000;
}
.accBtn:hover{background: color-mix(in srgb, var(--accent) 10%, transparent)}
.accBody{padding: 0 12px 12px; color: color-mix(in srgb, var(--text) 92%, var(--muted))}
.accBody p{margin: 8px 0}
.accBody ul{margin: 8px 0 0; padding-left: 18px}
.accBody li{margin: 6px 0}

.tip{
  margin-top: 12px;
  border-radius: var(--radius2);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--stroke));
  background: color-mix(in srgb, var(--accent) 10%, var(--panelSolid));
  padding: 12px;
}
.tip__title{font-weight: 1000}
.tip__text{margin-top: 6px; color: color-mix(in srgb, var(--text) 92%, var(--muted))}

.quizHead{display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-top:12px}
.tags{display:flex; gap:8px; flex-wrap:wrap}
.tag{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panelSolid) 85%, transparent);
  color: var(--text);
  font-family: var(--mono);
}
.q{
  margin-top: 10px;
  border-radius: var(--radius2);
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panelSolid) 85%, transparent);
  padding: 12px;
}
.q__title{font-weight: 1000}
.q__diff{font-size: 12px; color: var(--muted); margin-top: 4px}
.opts{display:grid; gap:8px; margin-top:10px}
.opt{
  display:flex; gap:10px; align-items:flex-start;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--panel2) 78%, transparent);
  cursor:pointer;
}
.opt:hover{transform: translateY(-1px); transition:.15s ease; border-color: color-mix(in srgb, var(--accent) 45%, var(--stroke))}
.opt input{margin-top: 3px}

.result{
  margin-top: 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--stroke);
  padding: 12px;
  background: color-mix(in srgb, var(--good) 10%, var(--panelSolid));
}

.footer{margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--stroke)}