:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #1e293b;
  --card2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --good: #34d399;
  --bad: #f87171;
  --gold: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

#app { max-width: 640px; margin: 0 auto; padding-bottom: 32px; }

.hidden { display: none !important; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #123 100%);
  padding: 40px 24px 28px;
  border-radius: 0 0 24px 24px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "☪";
  position: absolute; right: -20px; bottom: -40px;
  font-size: 160px; opacity: 0.07; transform: rotate(-15deg);
}
.hero-inner { position: relative; z-index: 1; }
.badge {
  display: inline-block; background: rgba(56,189,248,0.15); color: var(--accent);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px; margin-bottom: 10px;
}
.hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.sub { color: #b6c6da; margin-top: 8px; font-size: 15px; }
.learner-badge {
  margin-top: 12px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(129,140,248,0.15); color: #c7d2fe; border: 1px solid rgba(129,140,248,0.35);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.learner-badge:hover { background: rgba(129,140,248,0.28); }

/* ===== STATS ===== */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 18px 16px 0;
}
.stat {
  background: var(--card); border: 1px solid #26334d; border-radius: var(--radius-sm);
  padding: 12px 8px; text-align: center;
}
.stat-num { display: block; font-size: 22px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--muted); }

/* ===== PROGRESS ===== */
.progress-wrap { display: flex; align-items: center; gap: 12px; padding: 16px 16px 0; }
.progress-bar { flex: 1; height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px; transition: width 0.5s ease;
}
.progress-text { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 42px; text-align: right; }

/* ===== SEMESTER + COURSE CARDS (home) ===== */
.semester-list { padding: 16px; }
.sem-section { margin-bottom: 20px; }
.sem-title { font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 4px 0 10px; }
.course-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid #26334d;
  border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease;
  text-decoration: none; color: inherit; width: 100%; text-align: left;
  margin-bottom: 10px;
}
.course-card:active { transform: scale(0.98); }
.course-info { flex: 1; min-width: 0; }
.course-code { display: block; font-size: 11px; font-weight: 800; color: var(--accent); letter-spacing: 0.5px; margin-bottom: 2px; }
.course-title { display: block; font-weight: 800; font-size: 16px; }
.course-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.course-bar-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.course-bar { width: 64px; height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.course-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; }
.course-pct { font-size: 12px; font-weight: 800; color: var(--muted); min-width: 34px; text-align: right; }
.course-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== SESSION LIST ===== */
.session-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sess-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid #26334d;
  border-radius: var(--radius); padding: 14px 16px;
  cursor: pointer; transition: transform 0.12s ease, border-color 0.12s ease;
  text-decoration: none; color: inherit; width: 100%; text-align: left;
}
.sess-card:active { transform: scale(0.98); }
.sess-card.locked { opacity: 0.45; cursor: not-allowed; }
.sess-card.done { border-color: rgba(52,211,153,0.35); }
.sess-num {
  min-width: 42px; height: 42px; border-radius: 12px;
  background: var(--bg2); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: var(--accent);
}
.sess-card.done .sess-num { background: rgba(52,211,153,0.15); color: var(--good); }
.sess-info { flex: 1; min-width: 0; }
.sess-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sess-status { font-size: 18px; }

/* ===== SESSION HEAD ===== */
.session-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 16px 12px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, #0f172a 70%, rgba(15,23,42,0));
}
.back-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid #26334d;
  background: var(--card); color: var(--text); font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.session-head h2 { font-size: 18px; font-weight: 800; line-height: 1.25; }

/* ===== DRIP (chat) ===== */
.drip { padding: 8px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg {
  max-width: 92%; padding: 12px 14px; border-radius: 14px;
  background: var(--card2); font-size: 15px;
  animation: pop 0.25s ease;
  white-space: normal; word-break: break-word;
}
.msg b { color: #fff; font-weight: 700; }
.msg i { color: #cbd5e1; }
.msg a { color: var(--accent); text-decoration: underline; }
.md-list { margin: 6px 0 4px; padding-left: 20px; }
.md-list li { margin-bottom: 5px; line-height: 1.5; }
.md-list li::marker { color: var(--accent); }
.md-head { font-weight: 800; margin: 8px 0 4px; line-height: 1.3; }
.md-head.h1 { font-size: 17px; color: var(--accent); }
.md-head.h2 { font-size: 16px; color: #e0e7ff; }
.md-head.h3 { font-size: 15px; color: #c7d2fe; }
.md-spacer { height: 8px; }
.msg.ayat {
  background: linear-gradient(135deg, rgba(251,191,36,0.12), rgba(251,191,36,0.05));
  border: 1px solid rgba(251,191,36,0.25); border-radius: 4px 14px 14px 14px;
}
.msg.reflect {
  background: linear-gradient(135deg, rgba(129,140,248,0.15), rgba(129,140,248,0.05));
  border: 1px solid rgba(129,140,248,0.3);
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.drip-actions { padding: 12px 16px; position: sticky; bottom: 0; background: linear-gradient(0deg, #0f172a 65%, rgba(15,23,42,0)); }
.material-link { margin-top: 8px; }
.material-link .btn { display: inline-block; width: auto; padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn {
  border: none; border-radius: 12px; padding: 13px 20px; font-size: 15px; font-weight: 700;
  cursor: pointer; width: 100%; transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #06121f; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid #334155; }

/* ===== QUIZ ===== */
.quiz { padding: 12px 16px; }
.quiz-progress { display: flex; gap: 6px; margin-bottom: 14px; }
.qdot { flex: 1; height: 6px; border-radius: 99px; background: var(--bg2); }
.qdot.on { background: var(--accent); }
.qdot.right { background: var(--good); }
.qdot.wrong { background: var(--bad); }
.quiz-q { font-size: 17px; font-weight: 700; margin-bottom: 14px; line-height: 1.4; }
.quiz-opts { display: flex; flex-direction: column; gap: 9px; }
.qopt {
  text-align: left; padding: 13px 14px; border-radius: 12px;
  background: var(--card); border: 1.5px solid #2c3a52; color: var(--text);
  font-size: 15px; cursor: pointer; transition: border-color 0.1s ease;
}
.qopt:active { transform: scale(0.99); }
.qopt.correct { border-color: var(--good); background: rgba(52,211,153,0.12); }
.qopt.wrong { border-color: var(--bad); background: rgba(248,113,113,0.12); }
.qopt:disabled { cursor: default; }
.quiz-feedback {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5;
}
.quiz-feedback.ok { background: rgba(52,211,153,0.12); border: 1px solid rgba(52,211,153,0.35); }
.quiz-feedback.no { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); }
.quiz-feedback .ans { font-weight: 800; }
.quiz-feedback .exp { color: #cbd5e1; margin-top: 4px; }

/* ===== DONE ===== */
.done { padding: 24px 16px; }
.done-card {
  background: var(--card); border: 1px solid #26334d; border-radius: 20px;
  padding: 32px 20px; text-align: center;
}
.done-emoji { font-size: 56px; margin-bottom: 10px; }
.done-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.done-card p { color: var(--muted); margin-bottom: 18px; }

/* ===== FOOT ===== */
.foot { padding: 24px 20px 8px; text-align: center; color: var(--muted); font-size: 12px; }
