:root {
  --bg: #0d0f16;
  --top: #171b27;
  --panel: #181d2a;
  --panel-2: #1e2435;
  --panel-3: #141925;
  --panel2: #1e2435;
  --text: #f2f4fb;
  --muted: #969db2;
  --blue: #5596ff;
  --purple: #8f67ff;
  --accent: #64a0ff;
  --accent-2: #8e65ff;
  --accent2: #5596ff;
  --good: #47d79b;
  --bad: #ff6882;
  --warn: #f4bd4f;
  --line: #293146;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 70% -20%, rgba(84, 77, 190, .14), transparent 42%), var(--bg);
  color: var(--text);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: #88b6ff; }
button, input, select { font: inherit; }

.wrap { max-width: 1240px; margin: auto; padding: 22px; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 58px;
  margin: -22px -22px 24px;
  padding: 10px 22px;
  background: rgba(23, 27, 39, .96);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--blue);
}
.brand span {
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
nav a {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #c7ccda;
  background: var(--panel-2);
  font-size: 13px;
}

.card {
  background: rgba(24, 29, 42, .96);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h1, .card h2, .card h3 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.error { color: var(--bad); }
.success { color: var(--good); }
.pill { font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--blue), #6d7dff);
  color: white;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(73, 130, 255, .18);
}
.btn:hover { color: white; filter: brightness(1.08); transform: translateY(-1px); }
.btn.secondary { background: var(--panel-2); color: #d9ddea; border: 1px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.auth { max-width: 460px; margin: 10vh auto; }
.auth .card { padding: 34px; border-radius: 14px; }
.auth .brand { text-align: center; font-size: clamp(27px, 6vw, 34px); margin-bottom: 5px; }
.auth .auth-intro { text-align: center; margin: 0 0 24px; }
.auth form { display: grid; gap: 15px; }
.auth label, .search-label {
  display: grid;
  gap: 7px;
  color: #9ca4ba;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.auth input, .search-input, .jump-select, .quiz select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111621;
  color: var(--text);
  outline: none;
}
.auth input:focus, .search-input:focus, .jump-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(85, 150, 255, .12); }
.auth .btn { width: 100%; margin-top: 4px; }
.auth-help { margin: 22px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 26px;
  background: linear-gradient(145deg, rgba(30, 36, 53, .98), rgba(22, 26, 39, .98));
}
.hero h1 {
  margin: 2px 0 7px;
  font: 800 clamp(30px, 5vw, 45px)/1.05 Georgia, "Times New Roman", serif;
  background: linear-gradient(90deg, #67a5ff, #986aff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0; max-width: 700px; }
.eyebrow { color: #9ea7bf; font-size: 10px; font-weight: 850; letter-spacing: .17em; }
.hero-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-tile { min-height: 105px; display: grid; place-content: center; text-align: center; background: linear-gradient(180deg, #1c2232, #181d2a); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--blue), var(--purple)); }
.stat-tile strong { display: block; font: 800 34px/1 Georgia, "Times New Roman", serif; color: var(--blue); }
.stat-tile span { margin-top: 9px; color: #858da3; font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }

.progress-panel { margin-bottom: 16px; scroll-margin-top: 78px; }
.progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.progress-heading h2 { margin: 0 0 3px; font: 750 24px/1.2 Georgia, "Times New Roman", serif; color: #dce1ff; }
.progress-heading p { margin: 0; }
.progress-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.progress-summary-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-3); }
.progress-summary-card p { margin: 9px 0 0; }
.progress-summary-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: #b9c0d3; font-weight: 700; }
.progress-summary-top strong { color: var(--blue); font: 800 25px/1 Georgia, "Times New Roman", serif; }
.progress-bar { height: 8px; overflow: hidden; border-radius: 999px; background: #10141f; }
.progress-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--purple)); transition: width .35s ease; }
.progress-bar.accuracy i { background: linear-gradient(90deg, var(--good), #63a8ff); }
.chapter-progress-title { margin: 20px 0 11px; font-size: 15px; color: #cbd1e4; }
.chapter-progress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chapter-progress-item { padding: 12px 13px; border: 1px solid rgba(41, 49, 70, .85); border-radius: 9px; background: rgba(20, 25, 37, .72); }
.chapter-progress-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 9px; font-size: 12px; font-weight: 720; }
.chapter-progress-head > span { min-width: 0; }
.chapter-progress-head strong { flex: 0 0 auto; color: var(--blue); }
.chapter-progress-icon { margin-right: 7px; }
.chapter-progress-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 10px; }
.progress-placeholder { grid-column: 1/-1; padding: 12px 0; }

.dashboard-tools {
  display: grid;
  grid-template-columns: auto minmax(220px, 420px) 1fr;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
}
.course-summary { text-align: right; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 16px; }
.chapter-card { scroll-margin-top: 78px; padding: 0; overflow: hidden; }
.chapter-heading { display: flex; align-items: center; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.chapter-heading h2 { margin: 0; font: 750 18px/1.25 Georgia, "Times New Roman", serif; color: #d7dcff; }
.chapter-icon { font-size: 24px; }
.lecture-row { display: flex; align-items: center; gap: 13px; padding: 13px 18px; border-bottom: 1px solid rgba(41, 49, 70, .78); }
.lecture-row:last-child { border-bottom: 0; }
.lecture-row:hover { background: rgba(90, 102, 160, .07); }
.lecture-main { min-width: 0; flex: 1; }
.lecture-title { font-weight: 720; line-height: 1.35; }
.lecture-meta { color: var(--muted); font-size: 11px; margin-top: 4px; }
.lecture-open { min-height: 35px; padding: 7px 13px; }
.bar { height: 5px; background: #10141f; border-radius: 4px; overflow: hidden; margin: 9px 0 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--purple)); border-radius: inherit; }
.empty-state { text-align: center; color: var(--muted); grid-column: 1/-1; }
.skeleton-card { height: 210px; position: relative; overflow: hidden; }
.skeleton-card::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: skeleton 1.25s infinite; }
@keyframes skeleton { to { transform: translateX(100%); } }

.quiz-shell { max-width: 1450px; }
.quiz-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; min-height: calc(100vh - 82px); margin: -24px -22px -22px; }
.question-rail { background: #151a26; border-right: 1px solid var(--line); min-height: calc(100vh - 58px); display: flex; flex-direction: column; }
.rail-head { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.rail-title { display: flex; justify-content: space-between; color: #8f97ac; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.rail-search { margin-top: 10px; padding: 9px 10px; width: 100%; border: 1px solid var(--line); border-radius: 7px; background: #10141e; color: white; }
.rail-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.rail-chip { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: #8e96ab; font-size: 10px; cursor: pointer; }
.rail-chip.active { background: var(--blue); color: white; border-color: transparent; }
.rail-list { flex: 1; overflow: auto; max-height: calc(100vh - 205px); }
.rail-item { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 11px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: #9fa6b8; text-align: left; width: 100%; cursor: pointer; font-size: 11px; }
.rail-item:hover, .rail-item.active { background: #223457; color: white; }
.rail-item.done::before { color: var(--good); }
.rail-q { color: #737d96; font-weight: 750; }
.rail-stem { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.rail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 12px 8px; border-top: 1px solid var(--line); text-align: center; background: #121722; }
.rail-stat strong { display: block; font-size: 16px; }
.rail-stat span { color: #747d92; font-size: 9px; letter-spacing: .08em; }
.rail-stat.good strong { color: var(--good); }.rail-stat.bad strong { color: var(--bad); }
.quiz-main { padding: 18px 22px 40px; min-width: 0; }
.quiz-card { max-width: 900px; margin: 0 auto; }
.question-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: #9299ac; font-size: 11px; margin-bottom: 12px; }
.difficulty { padding: 4px 9px; border-radius: 999px; background: rgba(244, 189, 79, .13); color: var(--warn); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stem { font-size: 18px; font-weight: 650; line-height: 1.55; white-space: pre-wrap; margin: 6px 0 22px; }
.choice { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; margin: 9px 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 8px; background: #141925; color: #eef0f7; cursor: pointer; }
.choice b { display: inline-grid; place-items: center; flex: 0 0 25px; height: 25px; border-radius: 50%; background: #292f46; color: #a8b2d1; }
.choice:hover, .choice.selected { border-color: var(--blue); background: #1c2a43; }
.choice.correct { border-color: var(--good); background: rgba(71, 215, 155, .12); }
.choice.wrong { border-color: var(--bad); background: rgba(255, 104, 130, .12); }
.quiz-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.explain { white-space: pre-wrap; background: #111721; border-left: 3px solid var(--blue); padding: 15px; margin-top: 17px; border-radius: 0 8px 8px 0; color: #d7dbea; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
.table th { color: #9ba4bb; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.dashboard-jump { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 22px; }
.chapter-jump { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.chapter-jump h2 { margin: 0; }

@media (max-width: 780px) {
  .wrap { padding: 14px; }
  .top { margin: -14px -14px 18px; padding: 9px 13px; }
  .top .small { display: none; }
  nav { justify-content: flex-end; gap: 6px; }
  nav a { padding: 6px 8px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 20px; }
  .hero-actions { justify-content: flex-start; }
  .dashboard-tools { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-heading { align-items: flex-start; flex-direction: column; }
  .progress-overview, .chapter-progress-grid { grid-template-columns: 1fr; }
  .chapter-progress-meta { flex-wrap: wrap; }
  .course-summary { text-align: left; }
  .lecture-row { align-items: flex-start; }
  .lecture-open { padding: 8px 11px; }
  .quiz-layout { grid-template-columns: 1fr; margin: -18px -14px -14px; }
  .question-rail { display: none; }
  .quiz-main { padding: 16px 14px 32px; }
  .auth { margin: 6vh auto; }
  .auth .card { padding: 25px 20px; }
}
