:root {
  --bg: #0c1116; --surface: #141b22; --surface-2: #1d2630; --border: #2a3540;
  --text: #e9eef4; --muted: #8d9aa8;
  --brand: #f5b942; --brand-2: #22c55e; --accent: #34d399;
  --ok: #22c55e; --warn: #f59e0b; --danger: #ef4444; --info: #6366f1;
  --radius: 14px; --shadow: 0 8px 30px rgba(0,0,0,.32); --sidebar-w: 234px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
[data-theme="light"] {
  --bg: #f6f3ec; --surface: #ffffff; --surface-2: #f1efe7; --border: #e2ddd0;
  --text: #1a1d22; --muted: #5f6770; --shadow: 0 8px 30px rgba(80,70,40,.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: Inter, "Noto Sans Devanagari", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; transition: background .25s, color .25s; }
body.hi { font-family: "Noto Sans Devanagari", Inter, system-ui, sans-serif; }
button, input, select { font-family: inherit; color: inherit; }
.muted-text { color: var(--muted); font-size: 13.5px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--brand); color: #1a1209; padding: 8px 14px; border-radius: 8px; z-index: 99; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 900; font-size: 20px; padding: 6px 8px 18px; display: flex; align-items: center; gap: 9px; }
.brand-mark { font-size: 22px; }
.brand-accent { color: var(--brand); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { width: 100%; text-align: left; background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 600; padding: 11px 13px; border-radius: 10px; cursor: pointer; transition: .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #14210b; box-shadow: 0 6px 16px rgba(245,185,66,.28); }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.priv { font-size: 12px; color: var(--brand); font-weight: 600; }
.ghost-link { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.ghost-link:hover { color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 13px clamp(16px,3vw,30px); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); z-index: 20; }
.topbar-title { font-size: 18px; font-weight: 800; flex: 1; }
.menu-btn { display: none; }
.lang-toggle { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.lang-btn { background: none; border: none; padding: 6px 12px; border-radius: 7px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.lang-btn.on { background: var(--brand); color: #1a1209; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 15px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { border-color: var(--brand); }

.view { padding: clamp(16px,3vw,28px); flex: 1; display: flex; flex-direction: column; gap: 14px; max-width: 1140px; width: 100%; }
.lead h1 { font-size: clamp(22px,3.5vw,30px); font-weight: 900; letter-spacing: -.01em; }

/* controls */
.toolbar { display: flex; gap: 10px; }
.search { flex: 1; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.search:focus { outline: none; border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 20px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #1a1209; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { font-size: 16px; font-weight: 800; }
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.books { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.calcs { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* badges */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.high, .badge.beginner { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.badge.medium, .badge.intermediate { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.badge.low { background: var(--surface-2); color: var(--muted); }
.badge.advanced { background: color-mix(in srgb, var(--info) 24%, transparent); color: var(--info); }

/* ideas */
.idea { display: flex; flex-direction: column; gap: 8px; }
.idea-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.idea-top h3 { font-size: 15.5px; font-weight: 800; line-height: 1.35; }
.idea p { color: var(--muted); font-size: 13.5px; }

/* books */
.book { display: flex; flex-direction: column; gap: 8px; }
.book-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.book-head h3 { font-size: 16px; font-weight: 800; line-height: 1.3; }
.book-author { color: var(--brand); font-size: 12.5px; font-weight: 600; }
.book p { color: var(--muted); font-size: 13.5px; }
.lessons { font-size: 13px; }
.lessons b { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lessons ul { margin: 5px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 2px 9px; border-radius: 12px; }

/* calculators */
.calc h3 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 9px 11px; font-size: 14px; font-weight: 600; }
.field input:focus { outline: none; border-color: var(--brand); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field.inline input { width: 120px; }
.outs { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.out-row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; }
.out-row span { color: var(--muted); }
.out-row b { font-family: var(--mono); font-size: 15px; }
.calc-note { font-size: 11px; color: var(--muted); margin-top: 10px; }
.donut-row { display: flex; justify-content: center; margin: 6px 0; }
.chart-donut { width: 88px; height: 88px; }
.chart-wrap { margin: 6px 0; }
.chart-bars { width: 100%; height: 90px; }

/* challenges / tracker */
.tracker-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; flex-wrap: wrap; }
.week-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 5px; }
.week { aspect-ratio: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; font-size: 11px; font-weight: 700; color: var(--muted); cursor: pointer; }
.week:hover { border-color: var(--brand); }
.week.done { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #14210b; border-color: transparent; }
.tracker-stats { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.tracker-stats > div:first-child { font-size: 13px; color: var(--muted); }
.tracker-stats b { font-family: var(--mono); font-size: 18px; color: var(--text); margin: 0 6px; }
.tracker-stats small { color: var(--muted); }
.progress { flex: 1; min-width: 140px; height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .4s; }
.progress-num { font-family: var(--mono); font-weight: 700; }
.btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 15px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--brand); }

/* glossary */
.glossary { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.term { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 11px; padding: 14px 16px; box-shadow: var(--shadow); }
.term b { font-size: 14.5px; }
.term p { color: var(--muted); font-size: 13.5px; margin-top: 5px; }

/* toast */
.toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; padding: 11px 15px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); animation: slidein .25s ease; }
.toast.hide { opacity: 0; transform: translateX(20px); transition: .3s; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* footer */
.footer { border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px clamp(16px,3vw,30px); color: var(--muted); font-size: 13px; }
.foot-socials { display: flex; gap: 10px; }
.foot-socials a { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); transition: .2s; }
.foot-socials a:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 11px; color: var(--muted); font-size: 12px; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .menu-btn { display: inline-grid; }
  .week-grid { grid-template-columns: repeat(8, 1fr); }
}
