/* ================= PUC Quest – clean light UI (dark optional) ================= */
:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-2: #ffffff;
  --glass: #ffffff;
  --glass-2: #f3f4f9;
  --glass-hover: #ffffff;
  --border: #e9eaf2;
  --border-2: #d9dbe8;
  --text: #171a2e;
  --text-2: #4b5068;
  --muted: #6b7088;
  --a1: #6d5efc;
  --a2: #4f9cff;
  --a3: #ff7eb3;
  --good: #16a34a;
  --warn: #d97706;
  --bad: #e11d48;
  --grad: linear-gradient(135deg, #6d5efc, #4f9cff);
  --grad-3: linear-gradient(120deg, #6d5efc, #a86bff 45%, #4f9cff);
  --soft: #f0eeff;
  --shadow: 0 1px 2px rgba(23, 26, 46, .04), 0 6px 20px rgba(23, 26, 46, .05);
  --grid: rgba(23, 26, 46, .05);
  --r: 20px;
  --blob-o: .16;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c14;
  --bg-2: #13141f;
  --glass: #151724;
  --glass-2: #1c1e2e;
  --glass-hover: #1a1c2b;
  --border: #25283a;
  --border-2: #33374d;
  --text: #eef0ff;
  --text-2: #b4b8d4;
  --muted: #7d82a6;
  --a1: #8b7dff;
  --a2: #5aa8ff;
  --a3: #ff8cc0;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --grad: linear-gradient(135deg, #7c6dff, #4f9cff);
  --grad-3: linear-gradient(120deg, #7c6dff, #b07bff 45%, #4f9cff);
  --soft: #1f1d3a;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --grid: rgba(255, 255, 255, .04);
  --blob-o: .35;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Noto Sans Kannada", sans-serif;
  overflow-x: clip; -webkit-font-smoothing: antialiased;
}
a { color: var(--a1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--a1) 30%, transparent); }

/* ---------- Background layers (very subtle) ---------- */
#bg, #confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bg { z-index: 0; opacity: .7; }
#confetti { z-index: 200; }
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blobs i { position: absolute; width: 40vw; height: 40vw; border-radius: 50%; filter: blur(100px); opacity: var(--blob-o); animation: drift 30s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { background: #8f7dff; top: -16vw; right: 10vw; }
.blobs i:nth-child(2) { background: #7cc4ff; bottom: -20vw; right: -10vw; animation-duration: 36s; }
.blobs i:nth-child(3) { background: #ffb3d1; top: 40%; left: 20%; width: 24vw; height: 24vw; animation-duration: 42s; }
@keyframes drift { to { transform: translate(5vw, 3vw) scale(1.1); } }
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(var(--grid) 1.2px, transparent 1.2px); background-size: 26px 26px;
  mask-image: linear-gradient(180deg, #000, transparent 75%);
}
.no-motion .blobs i { animation: none; }
.no-motion * { transition: none !important; animation-duration: 0s !important; }

/* ---------- Sidebar (laptop): fixed on the left ---------- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 20; padding: 24px 14px; display: flex; flex-direction: column; gap: 22px;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent); border-right: 1px solid var(--border); backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 800; font-size: .95rem; color: #fff; background: var(--grad-3); }
.brand-name { font-weight: 750; font-size: 1.05rem; }
.brand-sub { font-size: .72rem; color: var(--muted); }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-size: .9rem; font-weight: 550;
  transition: background .2s, color .2s; position: relative;
}
#nav a svg { width: 19px; height: 19px; flex: none; }
#nav a:hover { background: var(--glass-2); color: var(--text); text-decoration: none; }
#nav a.active { background: var(--soft); color: var(--a1); }
#nav .nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--a3); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; color: inherit; }
.side-user:hover { background: var(--glass-2); text-decoration: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--grad-3); flex: none; }

/* ---------- Phone: top bar + bottom tab bar (hidden on laptop) ---------- */
.m-top, #tabbar { display: none; }

/* ---------- Main ---------- */
#app { position: relative; z-index: 1; padding: 32px 40px 80px; margin-left: 240px; max-width: 1240px; }
.view { animation: viewIn .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.85rem; font-weight: 780; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.grad-text { background: var(--grad-3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mt { margin-top: 18px; }

.glass {
  background: var(--glass); border: 1px solid var(--border); border-radius: var(--r);
  backdrop-filter: blur(16px) saturate(140%); box-shadow: var(--shadow);
}
.card { padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 1.05rem; font-weight: 680; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2 .sub { margin-left: auto; font-size: .78rem; color: var(--muted); font-weight: 500; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.g-hero { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.lift { transition: transform .25s cubic-bezier(.2, .8, .2, 1), border-color .25s, background .25s; }
.lift:hover { transform: translateY(-3px); border-color: var(--border-2); background: var(--glass-hover); }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; border-radius: 12px; padding: 10px 18px;
  font-weight: 650; font-size: .9rem; color: #fff; background: var(--grad); box-shadow: 0 6px 22px color-mix(in srgb, var(--a1) 35%, transparent);
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.ghost { background: var(--glass-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.sm { padding: 6px 12px; font-size: .8rem; border-radius: 10px; }
.btn.danger { background: linear-gradient(135deg, #e11d48, #f97316); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 550; cursor: pointer;
  background: var(--glass); border: 1px solid var(--border); color: var(--text-2); transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--border-2); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--glass-2); color: var(--text-2); border: 1px solid var(--border); }
.tag.hot { background: color-mix(in srgb, var(--a3) 18%, transparent); color: var(--a3); border-color: color-mix(in srgb, var(--a3) 35%, transparent); }
.tag.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
input, select, textarea {
  font: inherit; font-size: .9rem; color: var(--text); background: var(--glass); border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--a1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 25%, transparent); }
select option { background: var(--bg-2); color: var(--text); }
textarea { width: 100%; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: .76rem; color: var(--muted); font-weight: 600; }
input[type=range] { accent-color: var(--a1); padding: 0; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--glass-2); border: 1px solid var(--border-2); cursor: pointer; transition: .25s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: var(--text-2); transition: .25s; }
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--glass-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); width: 0; transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--glass-2); }
.ring .val { transition: stroke-dashoffset 1.3s cubic-bezier(.2, .8, .2, 1); stroke-linecap: round; }
.ring .lbl { position: absolute; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.ring .lbl small { display: block; font-size: .62rem; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- Hero / countdown ---------- */
.hero { padding: 26px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--grad-3); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: .55; pointer-events: none; }
.hero h1 { font-size: 1.9rem; font-weight: 800; margin: 6px 0 2px; }
.cd { display: flex; gap: 12px; margin-top: 18px; }
.cd div { flex: 1; text-align: center; padding: 14px 6px; border-radius: 16px; background: var(--glass); border: 1px solid var(--border); }
.cd b { display: block; font-size: 2.5rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; background: var(--grad-3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cd span { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.level-card { display: flex; flex-direction: column; gap: 14px; }
.lvl-row { display: flex; align-items: center; gap: 14px; }
.lvl-badge { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-weight: 850; font-size: 1.4rem; color: #fff; background: var(--grad-3); box-shadow: 0 8px 26px color-mix(in srgb, var(--a3) 35%, transparent); }
.streak { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.streak .flame { display: inline-block; animation: flicker 1.8s ease-in-out infinite; }
@keyframes flicker { 50% { transform: scale(1.12) rotate(-4deg); filter: brightness(1.2); } }

/* ---------- Board timeline ---------- */
.timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6%; right: 6%; top: 38px; height: 2px; background: linear-gradient(90deg, transparent, var(--border-2), transparent); }
.tl-item { position: relative; text-align: center; padding: 14px 10px 16px; border-radius: 16px; cursor: pointer; }
.tl-date { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tl-item .ring { margin: 8px auto; }
.tl-name { font-weight: 680; font-size: .92rem; }
.tl-days { font-size: .76rem; color: var(--text-2); }
.tl-item.next { background: var(--glass-2); border: 1px solid var(--border-2); }
.tl-item.next::after { content: "NEXT"; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: .6rem; font-weight: 800; letter-spacing: .12em; padding: 2px 8px; border-radius: 99px; background: var(--grad); color: #fff; }

/* ---------- Missions ---------- */
.mission { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); }
.mission + .mission { margin-top: 10px; }
.m-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: var(--glass-2); flex: none; }
.mission.done .m-icon { background: color-mix(in srgb, var(--good) 22%, transparent); }
.mission .grow { flex: 1; min-width: 0; }
.mission .xp { font-size: .78rem; font-weight: 750; color: var(--a2); white-space: nowrap; }
.mission.done .xp { color: var(--good); }

/* ---------- Subjects ---------- */
.subj-card { padding: 20px; cursor: pointer; position: relative; overflow: hidden; }
.subj-card .glow { position: absolute; width: 180px; height: 180px; right: -60px; top: -60px; border-radius: 50%; filter: blur(40px); opacity: .45; transition: opacity .3s, transform .5s; }
.subj-card:hover .glow { opacity: .75; transform: scale(1.2); }
.subj-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.subj-icon .ic { width: 62%; height: 62%; }
.subj-card h3 { font-size: 1.1rem; margin-top: 12px; }
.chapter-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.ch-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.ch-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: .85rem; background: var(--glass-2); flex: none; }
.ch-row .grow { flex: 1; min-width: 0; }
.ch-row .ch-title { font-weight: 620; }
.ch-row .ch-about { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--glass-2); border: 1px solid var(--border-2); }
.dots i.on { background: var(--grad); border-color: transparent; box-shadow: 0 0 8px color-mix(in srgb, var(--a2) 60%, transparent); }

/* Chapter detail */
.ch-hero { padding: 24px; position: relative; overflow: hidden; }
.ch-hero .glow { position: absolute; width: 320px; height: 320px; right: -100px; top: -140px; border-radius: 50%; filter: blur(60px); opacity: .45; }
.stage-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stage-btn { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 14px; cursor: pointer; font-weight: 650; font-size: .88rem; background: var(--glass-2); border: 1px solid var(--border); transition: all .25s; }
.stage-btn:hover { border-color: var(--border-2); transform: translateY(-1px); }
.stage-btn.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 22px color-mix(in srgb, var(--a1) 35%, transparent); }
.stage-btn .xp { font-size: .7rem; opacity: .8; }
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); width: fit-content; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .86rem; color: var(--text-2); }
.tabs button.on { background: var(--glass-2); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.key-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.key-list li { padding: 12px 14px 12px 42px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); position: relative; font-size: .92rem; }
.key-list li::before { content: ""; position: absolute; left: 16px; top: 15px; width: 15px; height: 15px; background: var(--grad); -webkit-mask: var(--spark) center / contain no-repeat; mask: var(--spark) center / contain no-repeat; }
.q-group h4 { font-size: .85rem; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.q-item { padding: 12px 14px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); margin-bottom: 8px; font-size: .92rem; }
.q-item .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.callout { padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--a1) 12%, transparent); border: 1px solid color-mix(in srgb, var(--a1) 30%, transparent); font-size: .9rem; }
.callout.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* ---------- Quiz ---------- */
.quiz-card { padding: 28px; max-width: 760px; margin: 0 auto; }
.quiz-progress { display: flex; gap: 6px; margin-bottom: 20px; }
.quiz-progress i { flex: 1; height: 5px; border-radius: 9px; background: var(--glass-2); }
.quiz-progress i.done { background: var(--grad); }
.quiz-progress i.cur { background: color-mix(in srgb, var(--a2) 50%, transparent); }
.quiz-q { font-size: 1.25rem; font-weight: 680; margin: 8px 0 20px; line-height: 1.45; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 14px; cursor: pointer; background: var(--glass); border: 1px solid var(--border); font-size: .95rem; display: flex; gap: 12px; align-items: center; transition: all .2s; }
.opt:hover:not([disabled]) { border-color: var(--a1); background: var(--glass-2); transform: translateX(3px); }
.opt .k { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 750; font-size: .8rem; background: var(--glass-2); flex: none; }
.opt.picked { border-color: var(--a1); background: color-mix(in srgb, var(--a1) 16%, transparent); }
.opt.picked .k { background: var(--a1); color: #fff; }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.opt.right .k { background: var(--good); color: #04130c; }
.opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); animation: shake .35s; }
.opt.wrong .k { background: var(--bad); color: #fff; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.explain { margin-top: 16px; }
.big-score { font-size: 3.4rem; font-weight: 850; line-height: 1; }

/* ---------- Plan ---------- */
.journey { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; position: relative; }
.phase { padding: 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--border); position: relative; }
.phase.now { background: var(--glass-2); border-color: transparent; box-shadow: 0 0 0 1px var(--a1), 0 10px 30px color-mix(in srgb, var(--a1) 25%, transparent); }
.phase.now::before { content: "YOU ARE HERE"; position: absolute; top: -10px; left: 14px; font-size: .6rem; font-weight: 800; letter-spacing: .12em; padding: 2px 8px; border-radius: 99px; background: var(--grad); color: #fff; }
.phase.past { opacity: .5; }
.phase .p-icon { font-size: 1.5rem; }
.phase h3 { font-size: .98rem; margin: 6px 0 2px; }
.phase .p-date { font-size: .74rem; color: var(--muted); font-weight: 600; }
.phase p { font-size: .82rem; color: var(--text-2); margin: 8px 0 0; }
.slots { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.slot { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); position: relative; }
.slot::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--slot-c, var(--a1)); }
.slot.done { opacity: .55; }
.slot.done .s-title { text-decoration: line-through; }
.slot.light::before { background: var(--muted); }
.s-time { font-size: .8rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.s-title { font-weight: 640; }
.s-sub { font-size: .8rem; color: var(--muted); }
.check { width: 26px; height: 26px; border-radius: 9px; border: 1.5px solid var(--border-2); background: transparent; cursor: pointer; display: grid; place-items: center; font-size: .8rem; transition: .2s; }
.check.on { background: var(--grad); border-color: transparent; color: #fff; }
.focus-ring { display: grid; place-items: center; margin: 8px auto 16px; }
.focus-time { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.exam-mode { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.em-row { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); }
.em-row.paper { border-color: color-mix(in srgb, var(--a3) 45%, transparent); background: color-mix(in srgb, var(--a3) 10%, transparent); }

/* ---------- Mock test ---------- */
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.palette button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--glass); cursor: pointer; font-weight: 650; font-size: .8rem; }
.palette button.ans { background: color-mix(in srgb, var(--a1) 30%, transparent); border-color: var(--a1); }
.palette button.cur { outline: 2px solid var(--a2); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.2rem; }
.timer.low { color: var(--bad); animation: flicker 1s infinite; }

/* ---------- Paper ---------- */
.paper { padding: 34px 40px; font-family: Georgia, "Times New Roman", "Noto Serif Kannada", serif; }
.paper-head { text-align: center; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 2px solid var(--border-2); }
.paper-head h2 { font-size: 1.4rem; display: block; }
.paper .part { margin-top: 22px; }
.paper .part h3 { font-family: "Inter", system-ui, sans-serif; font-size: .95rem; letter-spacing: .06em; }
.paper ol { padding-left: 26px; }
.paper li { margin-bottom: 8px; }
.paper .opts-inline { display: flex; gap: 18px; flex-wrap: wrap; font-size: .9rem; color: var(--text-2); margin-top: 3px; }
.paper .ans-key { font-family: "Inter", sans-serif; font-size: .75rem; color: var(--good); margin-left: 6px; }

/* ---------- Entrance ---------- */
.goal-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-col h4 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.plan-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; }
.ex-card { padding: 22px; }
.ex-head { display: flex; gap: 14px; align-items: center; }
.ex-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: var(--glass-2); flex: none; }
.ex-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.ex-box { padding: 14px; border-radius: 14px; background: var(--glass); border: 1px solid var(--border); font-size: .88rem; }
.ex-box h5 { margin: 0 0 6px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ex-box ul { margin: 0; padding-left: 18px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.step { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; font-size: .8rem; cursor: pointer; background: var(--glass); border: 1px solid var(--border); font-weight: 600; transition: .2s; }
.step.on { background: color-mix(in srgb, var(--good) 18%, transparent); border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }

/* ---------- Badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border-radius: 16px; background: var(--glass); border: 1px solid var(--border); }
.badge .b-icon { width: 54px; height: 60px; margin: 0 auto; display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, color-mix(in srgb, var(--h) 72%, #fff), var(--h)); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); filter: grayscale(1) opacity(.35); transition: .3s; }
.badge .b-icon .ic { width: 30px; height: 30px; }
.badge.got .b-icon { filter: none; animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
.badge.got { border-color: color-mix(in srgb, var(--a1) 40%, transparent); background: color-mix(in srgb, var(--a1) 10%, transparent); }
.badge .b-name { font-weight: 680; font-size: .86rem; margin-top: 6px; }
.badge .b-desc { font-size: .72rem; color: var(--muted); }
@keyframes pop { from { transform: scale(.4); } }

/* ---------- Charts ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .gl { stroke: var(--grid); }
.chart .tgt { stroke: var(--text-2); stroke-dasharray: 5 5; stroke-width: 1.3; }
.chart .mark { fill: url(#barGrad); transition: opacity .2s; }
.chart .mark.dim { opacity: .4; }
.chart .hit { fill: transparent; cursor: pointer; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th, .data-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 26px; color: var(--muted); }

/* ---------- Modal, toast, tooltip ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(3, 4, 10, .6); backdrop-filter: blur(6px); animation: fade .25s; }
.modal[hidden] { display: none; }
.modal-card { width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 28px; position: relative; background: color-mix(in srgb, var(--bg-2) 92%, transparent); animation: rise .4s cubic-bezier(.2, 1.3, .4, 1); }
.modal-x { position: absolute; top: 14px; right: 14px; border: 0; background: var(--glass-2); width: 32px; height: 32px; border-radius: 10px; cursor: pointer; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.96); } }
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 150; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { padding: 12px 16px; border-radius: 14px; font-size: .88rem; font-weight: 600; background: color-mix(in srgb, var(--bg-2) 90%, transparent); border: 1px solid var(--border-2); backdrop-filter: blur(14px); box-shadow: var(--shadow); animation: toastIn .45s cubic-bezier(.2, 1.4, .4, 1); display: flex; gap: 10px; align-items: center; }
.toast .xp-amt { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 850; }
.toast.out { animation: toastOut .4s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.tooltip { position: fixed; z-index: 160; pointer-events: none; padding: 8px 12px; border-radius: 10px; font-size: .8rem; background: color-mix(in srgb, var(--bg-2) 95%, transparent); border: 1px solid var(--border-2); box-shadow: var(--shadow); max-width: 260px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g-hero, .g3 { grid-template-columns: minmax(0, 1fr); }
  .timeline { grid-template-columns: repeat(3, 1fr); }
  .timeline::before { display: none; }
  .journey { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  #app { margin-left: 0; padding: 78px 16px calc(100px + env(safe-area-inset-bottom)); }
  .m-top { display: flex; align-items: center; justify-content: space-between; position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
  .m-top .brand { padding: 0; }
  .m-top .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: .82rem; }
  #tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
    padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--bg-2) 94%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(23, 26, 46, .12); }
  #tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0; border-radius: 16px; font-size: .66rem; font-weight: 650; color: var(--muted); position: relative; cursor: pointer; }
  #tabbar a svg { width: 22px; height: 22px; }
  #tabbar a.active { color: var(--a1); background: var(--soft); }
  #tabbar a:hover { text-decoration: none; }
  #tabbar .nav-dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--a3); }
  .page-head h1, .hello h1 { font-size: 1.5rem; }
  .g2, .ex-grid, .plan-cols, .g3 { grid-template-columns: minmax(0, 1fr) !important; }
  .slot { grid-template-columns: 1fr auto; }
  .slot .s-time { grid-column: 1 / -1; }
  .card, .hero { padding: 16px; }
  .journey { grid-template-columns: 1fr; }
  .count-big { font-size: 3.2rem; }
  .ex-row { grid-template-columns: 54px 1fr auto; }
  .ex-row .ex-pct { display: none; }
  #toasts { bottom: 100px; right: 12px; left: 12px; align-items: stretch; }
  .stage-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stage-btn { flex-direction: column; gap: 2px; padding: 10px 4px; font-size: .8rem; justify-content: center; text-align: center; }
  .ch-hero h1 { font-size: 1.4rem !important; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 8px 6px; font-size: .78rem; }
  .more-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Clean home ---------- */
.hello h1 { font-size: 2rem; font-weight: 800; }
.hero-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
.count-hero { padding: 26px; background: var(--grad-3); color: #fff; border: 0; border-radius: var(--r); position: relative; overflow: hidden; box-shadow: 0 14px 34px color-mix(in srgb, var(--a1) 28%, transparent); }
.count-hero::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -70px; top: -90px; background: rgba(255, 255, 255, .14); }
.count-hero::before { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; right: 60px; bottom: -90px; background: rgba(255, 255, 255, .08); }
.count-hero .eyebrow { color: rgba(255, 255, 255, .82); }
.count-big { font-size: 4.4rem; font-weight: 850; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.count-sub { font-variant-numeric: tabular-nums; opacity: .92; font-weight: 600; }
.stat-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-mini > a { padding: 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--border); box-shadow: var(--shadow); color: inherit; }
.stat-mini > a:hover { text-decoration: none; border-color: var(--border-2); }
.stat-mini .s-ic { line-height: 0; }
.stat-mini .s-ic.flame .ic { animation: flicker 1.8s ease-in-out infinite; transform-origin: 50% 80%; }
.stat-mini b { display: block; font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.stat-mini span { font-size: .76rem; color: var(--muted); font-weight: 600; }
.exam-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ex-row { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 16px; cursor: pointer; transition: background .2s; }
.ex-row:hover { background: var(--glass-2); }
.ex-row.next { background: var(--soft); }
.ex-row .ex-pct { font-size: .8rem; color: var(--muted); font-weight: 600; }
.date-pill { text-align: center; border-radius: 14px; padding: 7px 0; background: var(--glass-2); line-height: 1.1; }
.date-pill b { display: block; font-size: 1.25rem; }
.date-pill span { font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ex-row.next .date-pill { background: var(--grad); color: #fff; }
.ex-row.next .date-pill span { color: rgba(255, 255, 255, .85); }
.task { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); color: inherit; }
.task:last-child { border-bottom: 0; }
.task:hover { text-decoration: none; }
.task .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; font-size: .75rem; flex: none; }
.task.done .tick { background: var(--good); border-color: var(--good); color: #fff; }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border-radius: 18px; background: var(--glass-2); color: var(--text); font-weight: 600; font-size: .85rem; text-align: center; }
.more-grid a svg { width: 26px; height: 26px; color: var(--a1); }
.more-grid a:hover { text-decoration: none; background: var(--soft); }
@media (max-width: 1100px) { .hero-row { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Password screen ---------- */
.locked .sidebar, .locked .m-top, .locked #tabbar, .locked #app, .locked #toasts { display: none; }
.lock-screen { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; }
.lock-card { width: min(380px, 100%); padding: 32px 26px; text-align: center; }
.lock-card h1 { font-size: 1.5rem; font-weight: 800; margin-top: 14px; }
.lock-card p { margin: 6px 0 18px; }
.lock-mark { width: 60px; height: 60px; border-radius: 18px; font-size: 1.3rem; margin: 0 auto; }
.lock-field { position: relative; margin-bottom: 12px; }
.lock-field .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.lock-field input { width: 100%; padding: 13px 14px 13px 44px; font-size: 16px; }
.lock-card .lock-err { color: var(--bad); font-size: .85rem; font-weight: 600; margin: 0 0 12px; }
.lock-card.shake { animation: shake .35s; }

/* ---------- Layout safety and phone polish ---------- */
input, select, textarea { max-width: 100%; min-width: 0; }
label.field input, label.field select { width: 100%; }
label.field { min-width: 0; }
.stat3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }
@media (hover: none) { .lift:hover { transform: none; } }
@media (prefers-reduced-motion: reduce) { .blobs i, .ic { animation: none !important; } .view { animation: none; } }
@media (max-width: 820px) {
  input, select, textarea { font-size: 16px; } /* stops iPhones zooming in when a field is tapped */
  input[type=range] { min-height: 32px; }
  .glass, .sidebar, #tabbar, .m-top, .toast { backdrop-filter: none; } /* blur is costly on phones */
  .blobs i { animation: none; }
  .card h2 { flex-wrap: wrap; }
  .card h2 .sub { margin-left: 0; flex-basis: 100%; }
  .btn.sm { min-height: 38px; }
  .check { width: 36px; height: 36px; border-radius: 11px; }
  .ch-row { padding: 12px; gap: 10px; }
  .ch-row .tag { display: none; }
  .em-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .stat-mini > a { padding: 12px; }
  .stat-mini b { font-size: 1.25rem; }
  .stat3 { gap: 10px; }
  .stat3 .card { padding: 12px; }
  .hero .row > label.field { flex: 1 1 120px; }
  .hero .row > .btn { flex: 1 1 100%; }
  .paper { padding: 20px 16px; }
}

/* ---------- Custom icons (see js/icons.js) ---------- */
:root, [data-theme="light"] {
  --spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3c.8 5 3.9 8.2 9 9-5.1.8-8.2 4-9 9-.8-5-3.9-8.2-9-9 5.1-.8 8.2-4 9-9z'/%3E%3C/svg%3E");
  --h-violet: #6d5efc; --h-blue: #2f7df6; --h-cyan: #0891b2; --h-teal: #0d9488; --h-green: #16a34a;
  --h-gold: #ca8a04; --h-orange: #ea580c; --h-rose: #e11d48; --h-pink: #db2777; --h-slate: #64748b;
}
[data-theme="dark"] {
  --h-violet: #a496ff; --h-blue: #6db0ff; --h-cyan: #38cfe8; --h-teal: #2dd4bf; --h-green: #4ade80;
  --h-gold: #fbbf24; --h-orange: #fb923c; --h-rose: #fb7185; --h-pink: #f472b6; --h-slate: #a3aec2;
}
.hue-violet { --h: var(--h-violet); } .hue-blue { --h: var(--h-blue); } .hue-cyan { --h: var(--h-cyan); } .hue-teal { --h: var(--h-teal); } .hue-green { --h: var(--h-green); }
.hue-gold { --h: var(--h-gold); } .hue-orange { --h: var(--h-orange); } .hue-rose { --h: var(--h-rose); } .hue-pink { --h: var(--h-pink); } .hue-slate { --h: var(--h-slate); }
.ic { width: 1.2em; height: 1.2em; flex: none; vertical-align: -.24em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic .f { fill: currentColor; fill-opacity: .2; }
.ic .t { fill: currentColor; fill-opacity: .2; stroke: none; }
.ic .s { fill: currentColor; stroke: none; }
.ic.c { color: var(--h); }
.ic-tile { display: inline-grid; place-items: center; width: var(--s, 30px); height: var(--s, 30px); border-radius: 30%; flex: none; vertical-align: middle; font-style: normal; color: var(--h); background: color-mix(in srgb, var(--h) 14%, transparent); }
.ic-tile .ic { width: 62%; height: 62%; }
.card h2 { gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; }
.quiz-card > .ic-tile, #fr > .ic-tile { display: grid; margin: 0 auto 12px; }
.modal-x { display: grid; place-items: center; color: var(--text-2); }
.m-icon .ic { width: 22px; height: 22px; }
.check .ic, .task .tick .ic, .ch-num .ic { width: 62%; height: 62%; }
.timer .ic { color: var(--a1); }
.timer.low .ic { color: var(--bad); }

@media print {
  body { display: block; background: #fff; color: #000; }
  .sidebar, .m-top, #tabbar, #modal, #bg, .blobs, #confetti, body::before, .no-print, #toasts { display: none !important; }
  .glass { box-shadow: none; border: 0; background: #fff; backdrop-filter: none; }
  #app { padding: 0; margin: 0; max-width: none; }
  .paper { color: #000; }
}
