:root {
  --primary: #1a73e8;
  --primary-deep: #1557b0;
  --accent: #34a853;
  --warning: #fbbc04;
  --danger: #ea4335;
  --bg: #f0f4f8;
  --bg-strong: #e5edf5;
  --card: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #e0e0e0;
  --sidebar-bg: #1e2a3a;
  --sidebar-text: #b0c4d8;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --reading-line-height: 1.65;
  --font-stack: "Segoe UI", system-ui, sans-serif;
}

body[data-theme="night"] {
  --bg: #0d1117;
  --bg-strong: #161b22;
  --card: #161b22;
  --text: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --primary: #71a7ff;
  --primary-deep: #96bcff;
  --accent: #7ee787;
  --warning: #e3b341;
  --danger: #ff7b72;
  --sidebar-bg: #010409;
  --sidebar-text: #8b949e;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body[data-theme="warm"] {
  --bg: #f5efe6;
  --bg-strong: #ece1d2;
  --card: #fdf6ee;
  --text: #3b2f20;
  --muted: #7a6352;
  --line: #ddd0bc;
  --primary: #8b4a1d;
  --primary-deep: #6e3815;
  --accent: #2f6a53;
  --warning: #b0750d;
  --danger: #9b2d2d;
  --sidebar-bg: #2e2417;
  --sidebar-text: #c4a882;
}

body[data-font-size="compact"] { font-size: 14px; }
body[data-font-size="base"] { font-size: 16px; }
body[data-font-size="large"] { font-size: 18px; }
body.contrast-mode {
  --bg: #ffffff;
  --bg-strong: #f2f2f2;
  --card: #ffffff;
  --text: #000000;
  --muted: #212121;
  --line: #000000;
  --primary: #0047ff;
  --primary-deep: #002b91;
  --accent: #0d7a33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  min-width: 270px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar__header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: fit-content;
  margin-bottom: 10px;
}

.sidebar__title {
  font-size: 17px;
  margin: 0;
  color: #fff;
}

.sidebar__subtitle {
  color: var(--sidebar-text);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.sidebar__section-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(237, 245, 252, 0.6);
  margin: 0.6rem 0 0.2rem;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-item,
.subnav-item,
.review-item,
.overview-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  border-radius: 0;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover,
.subnav-item:hover,
.overview-item:hover,
.review-item:hover,
.settings-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.is-active,
.subnav-item.is-active,
.review-item.is-active,
.overview-item.is-active {
  background: rgba(113, 167, 255, 0.24);
  color: #fff;
}

.nav-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-item__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item__label {
  font-weight: 700;
  font-size: 15px;
}

.nav-item__sub {
  font-size: 0.9rem;
  color: rgba(237, 245, 252, 0.72);
}

.nav-item__progress {
  font-size: 0.86rem;
  color: #dbe8fb;
}

.subnav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.2rem 0 0.3rem 1rem;
}

.subnav-item {
  font-size: 0.94rem;
  padding: 0.7rem 0.8rem;
  color: rgba(237, 245, 252, 0.78);
}

.overview-item,
.review-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 0;
  font-size: 14px;
}

.settings-button {
  margin-top: auto;
  border: 0;
  background: transparent;
  color: var(--sidebar-text);
  border-radius: 8px;
  padding: 9px 8px;
  cursor: pointer;
}

.content-shell {
  min-width: 0;
  flex: 1;
  margin-left: 270px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

body[data-theme="night"] .topbar {
  background: var(--card);
}

.topbar__title {
  margin: 0;
  font-size: 18px;
}

.topbar__sub {
  color: var(--muted);
  margin-top: 0.15rem;
}

.topbar__text {
  min-width: 0;
}

.icon-button {
  background: none;
  border: 1.5px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.page-wrap {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-card,
.card,
.panel,
.chapter-card,
.study-card,
.note-card,
.question-card,
.settings-panel,
.summary-card,
.review-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 1.6rem;
  background:
    linear-gradient(135deg, rgba(36, 87, 197, 0.96), rgba(25, 67, 144, 0.94)),
    var(--card);
  color: #f4f8fe;
}

.hero-card__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
}

.hero-card h2 {
  font-size: 2rem;
  margin: 0 0 0.45rem;
}

.hero-card p {
  margin: 0;
  line-height: 1.7;
  color: rgba(244, 248, 254, 0.86);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.metric {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 1rem;
}

.metric__value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
}

.metric__label {
  color: rgba(244, 248, 254, 0.76);
}

.chapter-grid,
.two-col,
.review-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.chapter-card,
.card,
.panel,
.study-card,
.summary-card,
.review-card {
  padding: 1.2rem;
}

.chapter-card__head,
.panel__head,
.study-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  margin: 0 0 0.85rem;
}

.icon {
  margin-right: 0.45rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 1rem 0 0.9rem;
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-list li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1rem;
  border-bottom: 1px solid var(--bg-strong);
  line-height: 1.55;
}

.topic-list li:last-child {
  border-bottom: none;
}

.topic-list li::before {
  content: "•";
  color: var(--primary);
  position: absolute;
  left: 0;
}

.topic-list.compact li {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: none;
}

.chapter-card__tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-strong);
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-strong);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.85rem 0 0.4rem;
}

.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.button,
.button-secondary,
.button-ghost {
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
  font-size: 13px;
  font-weight: 600;
}

.button:hover,
.button-secondary:hover,
.button-ghost:hover {
  transform: translateY(-1px);
}

.button {
  background: var(--primary);
  color: #fff;
}

.button-secondary {
  background: var(--card);
  color: var(--primary);
  border-color: var(--primary);
}

.button-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.step-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.6rem;
}

.step-tab {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 0.9rem 0.8rem;
  text-align: left;
  cursor: pointer;
}

.step-tab.is-active {
  background: linear-gradient(135deg, rgba(36, 87, 197, 0.1), rgba(29, 143, 109, 0.08));
  color: var(--text);
  border-color: rgba(36, 87, 197, 0.35);
}

.objective-card details {
  margin-top: 0.7rem;
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.source-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(36, 87, 197, 0.08);
  border: 1px solid rgba(36, 87, 197, 0.2);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.source-pill:hover {
  background: rgba(36, 87, 197, 0.14);
}

.objective-support {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  padding: 0.95rem 1rem;
}

.objective-support h4 {
  margin: 0 0 0.6rem;
  font-size: 0.98rem;
}

.objective-card summary {
  cursor: pointer;
  font-weight: 700;
}

.objective-lines {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  line-height: var(--reading-line-height);
}

.topic-viewer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.topic-card {
  padding: 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(36, 87, 197, 0.04), rgba(255, 255, 255, 0));
  border: 1px solid var(--line);
}

.reading-copy {
  line-height: var(--reading-line-height);
}

.reading-copy p {
  margin: 0 0 1rem;
}

.takeaway-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: var(--reading-line-height);
}

.scenario-list,
.lab-list,
.flashcard-view,
.quiz-shell,
.summary-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scenario-card,
.lab-card,
.flashcard-card,
.summary-card,
.review-card,
.question-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.flashcard-card {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.flashcard-face {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.6;
}

.flashcard-back {
  color: var(--muted);
  line-height: var(--reading-line-height);
  margin-top: 1rem;
}

.note-card {
  padding: 1rem;
}

.note-card textarea,
.notes-page textarea {
  width: 100%;
  min-height: 170px;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.question-options {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.question-option {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0.9rem 1rem;
  cursor: pointer;
}

.question-option.is-selected {
  border-color: rgba(36, 87, 197, 0.6);
  background: rgba(36, 87, 197, 0.08);
}

.question-option.is-correct {
  border-color: rgba(29, 143, 109, 0.6);
  background: rgba(29, 143, 109, 0.12);
}

.question-option.is-wrong {
  border-color: rgba(177, 65, 65, 0.55);
  background: rgba(177, 65, 65, 0.1);
}

.feedback-box {
  margin-top: 1rem;
  border-radius: 16px;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  line-height: var(--reading-line-height);
}

.feedback-box__wrong-list {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
}

.lab-decision-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.lab-decision-group legend {
  font-weight: 700;
  padding: 0 0.35rem;
}

.lab-decision-group .question-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  border-radius: 10px;
}

.lab-decision-group .question-option input {
  margin-top: 0.2rem;
}

.filter-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.filter-row select,
.filter-row input {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 0.75rem 0.85rem;
  min-width: 180px;
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  background: rgba(177, 65, 65, 0.12);
  color: var(--danger);
  padding: 0.45rem 0.8rem;
  font-weight: 700;
}

.settings-panel[hidden],
.drawer-backdrop[hidden] {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 45, 0.45);
  z-index: 40;
}

.settings-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100vw - 2rem));
  z-index: 50;
  padding: 1rem;
}

.settings-grid {
  display: grid;
  gap: 0.9rem;
}

.setting-group {
  display: grid;
  gap: 0.55rem;
}

.option-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.option-pills button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  padding: 0.45rem 0.8rem;
  color: var(--text);
  cursor: pointer;
}

.option-pills button.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.notes-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem;
}

.notes-toolbar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.notes-section-list {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.notes-meta {
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  padding: 1.4rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px dashed var(--line);
  color: var(--muted);
}

/* Data+ UI shell alignment */
.book-badge {
  background: var(--primary);
  color: #fff;
}

.nav-section {
  padding: 10px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(176, 196, 216, 0.5);
}

.nav-ch-group {
  padding: 0;
}

.nav-ch-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid transparent;
  padding: 12px 14px;
}

.nav-ch-group.open .nav-ch-link {
  background: transparent;
  border-left-color: transparent;
  color: #fff;
}

.nav-ch-group.open .nav-ch-title,
.nav-ch-group.open .ch-progress {
  color: #fff;
  font-weight: 700;
}

.nav-ch-arrow {
  font-size: 12px;
  color: rgba(176, 196, 216, 0.45);
  transition: transform 0.25s;
  margin-left: 2px;
}

.nav-ch-group.open .nav-ch-arrow {
  transform: rotate(90deg);
  color: rgba(176, 196, 216, 0.85);
}

.nav-ch-sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.18);
  border-left: 3px solid rgba(26, 115, 232, 0.25);
  padding: 0;
}

.nav-ch-group.open .nav-ch-sub {
  max-height: 340px;
}

.subnav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px 10px 42px;
  font-size: 12.5px;
  color: rgba(176, 196, 216, 0.7);
  border-left: 3px solid transparent;
}

.subnav-item.is-active {
  border-left-color: var(--primary);
  background: rgba(26, 115, 232, 0.2);
  color: #fff;
}

.subnav-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.ch-num,
.ch-badge {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-item.is-active .ch-num,
.nav-ch-group.open .ch-badge,
.chapter-card__tag.ch-badge {
  background: var(--primary);
  color: #fff;
}

.ch-progress {
  margin-left: auto;
  font-size: 12px;
  color: rgba(176, 196, 216, 0.7);
  white-space: nowrap;
}

.nav-ch-title {
  line-height: 1.35;
}

.nav-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.09);
  color: #dfeaf7;
  flex-shrink: 0;
  font-weight: 700;
}

.overview-item.is-active .nav-icon-circle,
.review-item.is-active .nav-icon-circle {
  background: var(--primary);
  color: #fff;
}

#sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
}

.settings-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
}

.cog-icon {
  font-size: 18px;
  transition: transform 0.5s;
}

.settings-button:hover .cog-icon {
  transform: rotate(60deg);
}

.dashboard-resume-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 20px rgba(26, 115, 232, 0.25);
}

.resume-card-icon {
  font-size: 40px;
  flex-shrink: 0;
}

.resume-card-body {
  flex: 1;
}

.resume-card-greeting {
  font-size: 13px;
  opacity: 0.82;
  margin-bottom: 2px;
}

.resume-card-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.resume-card-sub {
  font-size: 13px;
  opacity: 0.82;
}

.resume-card-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.attention-banner {
  background: #fff8e1;
  border: 1.5px solid #ffcc02;
  border-left: 5px solid #f9a825;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.attention-banner-icon {
  font-size: 20px;
}

.attention-banner-text {
  font-size: 14px;
  color: #5f4c00;
  font-weight: 600;
  flex: 1;
}

.attention-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attention-chip {
  background: #fff3cd;
  border: 1.5px solid #f9a825;
  color: #7a4f00;
  border-radius: 100px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  border-radius: var(--radius);
  padding: 36px 40px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.dashboard-hero h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.dashboard-hero p {
  font-size: 15px;
  opacity: 0.85;
  max-width: 640px;
}

.exam-meta {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.exam-meta div {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 18px;
}

.exam-meta .label {
  font-size: 11px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exam-meta .value {
  font-size: 20px;
  font-weight: 700;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.stat-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
}

.stat-label,
.progress-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.dashboard-section-header {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: -8px;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chapter-card {
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.chapter-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.chapter-card__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chapter-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.ch-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.tag {
  background: var(--bg);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.domain-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-strong);
}

.domain-row:last-child {
  border-bottom: none;
}

.domain-name {
  font-size: 14px;
  font-weight: 500;
  width: 220px;
  flex-shrink: 0;
}

.domain-bar-wrap {
  flex: 1;
  height: 10px;
  background: var(--bg-strong);
  border-radius: 5px;
  overflow: hidden;
}

.domain-bar {
  height: 100%;
  border-radius: 5px;
}

.domain-pct {
  font-size: 13px;
  font-weight: 700;
  width: 44px;
  text-align: right;
}

.accordion {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--card);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  background: var(--card);
  font-size: 14px;
  font-weight: 700;
  user-select: none;
  transition: background 0.15s ease;
  gap: 12px;
}

.accordion-header:hover {
  background: #f5f8ff;
}

.accordion-header .acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.accordion-header .acc-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}

.accordion-header .acc-pct {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.accordion-header .acc-arrow {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.25s;
  flex-shrink: 0;
}

.accordion-header.open .acc-arrow {
  transform: rotate(90deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  border-top: 0 solid var(--line);
  background: #fafcff;
}

.accordion-body.open {
  max-height: 10000px;
  border-top: 1.5px solid var(--line);
}

.accordion-body-inner {
  padding: 18px 22px 20px;
}

.obj-intro p {
  margin: 0 0 0.8rem;
}

.obj-block {
  margin-bottom: 18px;
}

.obj-block:last-child {
  margin-bottom: 0;
}

.obj-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.obj-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.obj-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0 24px;
}

.obj-cols ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.obj-cols ul li {
  font-size: 13px;
  color: var(--text);
  padding: 2px 0;
  display: flex;
  gap: 6px;
}

.obj-cols ul li::before {
  content: "•";
  color: var(--primary);
  flex-shrink: 0;
}

.obj-support {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(26, 115, 232, 0.05);
  border-left: 3px solid var(--primary);
}

.obj-support p {
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.domain-source-pills {
  margin-top: 1rem;
}

.domain-detail-stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.domain-detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.domain-detail-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
}

.domain-detail-summary::-webkit-details-marker {
  display: none;
}

.domain-detail-summary__copy {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.domain-summary-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.domain-summary-arrow {
  color: var(--muted);
  transition: transform 0.16s ease;
}

.domain-detail-card[open] .domain-summary-arrow {
  transform: rotate(90deg);
}

.domain-detail-body {
  border-top: 1px solid var(--line);
  padding: 1rem 1.1rem 1.15rem;
}

.domain-detail-grid {
  margin: 1rem 0;
}

.domain-objective-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.domain-objective-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(36, 87, 197, 0.04);
  padding: 1rem;
}

.objective-title {
  margin: 0.25rem 0 0;
  color: var(--text);
  font-weight: 700;
}

.domain-objective-details {
  margin-top: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.domain-objective-details summary {
  cursor: pointer;
  font-weight: 700;
}

.chapter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.chapter-link-chip {
  border: 1px solid rgba(36, 87, 197, 0.2);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.84rem;
}

.chapter-link-chip:hover {
  border-color: rgba(36, 87, 197, 0.4);
  color: var(--primary);
}

.chapter-hero {
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.94), rgba(21, 87, 176, 0.94));
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
}

.chapter-hero .ch-num-big {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.78;
  margin-bottom: 6px;
}

.chapter-hero h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.chapter-hero p {
  font-size: 14px;
  opacity: 0.84;
  line-height: 1.6;
  max-width: 700px;
}

.chapter-meta {
  margin-top: 16px;
}

.ch-tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
}

.ch-tab,
.step-tab {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
  white-space: nowrap;
}

.ch-tab:hover,
.step-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.ch-tab.active,
.step-tab.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.objective-card details,
.scenario-card,
.lab-card,
.review-card,
.summary-card,
.question-card {
  border-radius: 10px;
}

.flashcard-card {
  border-radius: 12px;
  min-height: 260px;
}

.question-option {
  border-radius: 8px;
  border-width: 2px;
}

.feedback-box {
  border-radius: 10px;
}

.notes-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px;
}

.notes-page-hero {
  background: linear-gradient(135deg, #1e2a3a 0%, #2d3f55 100%);
  border-radius: var(--radius);
  padding: 28px 36px;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.notes-page-hero h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}

.notes-page-hero p {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 4px;
}

.back-btn {
  white-space: nowrap;
}

.notes-toolbar select,
.notes-page textarea,
.filter-row select,
.filter-row input {
  font-size: 14px;
}

.settings-panel {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  padding: 18px;
  background: transparent;
  box-shadow: none;
  border: 0;
}

.settings-panel[hidden] {
  display: none;
}

#settings-modal {
  background: var(--card);
  border-radius: 16px;
  width: 480px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
}

#settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

#settings-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.settings-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-pill {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
}

.settings-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.settings-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.settings-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-slider-row label {
  font-size: 13px;
  color: var(--muted);
  min-width: 72px;
}

.settings-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
}

.settings-slider-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  min-width: 36px;
  text-align: right;
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-toggle .tog-track {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-toggle input:checked + .tog-track {
  background: var(--primary);
}

.settings-toggle .tog-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.settings-toggle input:checked + .tog-track::after {
  transform: translateX(18px);
}

#bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 300;
  align-items: stretch;
}

#bottom-nav .bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.15s;
  padding: 0;
}

#bottom-nav .bn-item .bn-icon {
  font-size: 20px;
  line-height: 1;
}

#bottom-nav .bn-item.active {
  color: var(--primary);
}

.content-shell {
  padding-bottom: 68px;
}

body.settings-open #bottom-nav {
  pointer-events: none;
  opacity: 0.35;
}

@media (max-width: 1080px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: min(92vw, 320px);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 60;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .content-shell {
    margin-left: 0;
  }

  .hero-card__grid,
  .two-col,
  .review-grid,
  .stats-grid,
  .stats-row,
  .chapters-grid {
    grid-template-columns: 1fr;
  }

  .step-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .domain-row {
    flex-wrap: wrap;
  }

  .domain-name {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .page-wrap,
  .notes-page {
    padding: 18px 18px 90px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .dashboard-hero,
  .chapter-hero,
  .notes-page-hero,
  .dashboard-resume-card {
    padding: 22px 20px;
  }

  .hero-card h2,
  .dashboard-hero h2 {
    font-size: 1.6rem;
  }

  .step-tabs {
    grid-template-columns: 1fr;
  }

  .notes-page-hero,
  .dashboard-resume-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar__sub {
    display: none;
  }
}
