:root {
  --bg: #0d0f14;
  --surface: #13161e;
  --card: #191d28;
  --border: #252a38;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-dim: #7a6130;
  --bull: #26a65b;
  --bear: #e84040;
  --text: #e2e8f0;
  --muted: #8892a4;
  --accent: #3b82f6;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button {
  font: inherit;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.icon-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.brand-title,
.eyebrow,
.chart-label,
.progress-label,
.module-tag,
.quiz-label,
.concept-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-title {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.25em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.progress-area {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.progress-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.progress-track {
  width: 120px;
  height: 4px;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.progress-pill {
  min-width: 48px;
  padding: 4px 12px;
  color: var(--gold);
  font-size: 12px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 61px;
  width: 260px;
  height: calc(100vh - 61px);
  flex: 0 0 260px;
  padding: 20px 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 4px;
}

.module-link {
  width: 100%;
  padding: 10px 12px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.module-link.is-active {
  background: var(--card);
  border-color: var(--module-color);
}

.module-link-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 10px;
  font-weight: 800;
  background: var(--border);
  border-radius: 4px;
}

.module-link.is-active .module-number {
  color: var(--bg);
  background: var(--module-color);
}

.module-link.is-complete:not(.is-active) .module-number {
  color: var(--bull);
  background: #1a2f1a;
}

.module-name {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.module-link.is-active .module-name {
  color: var(--text);
  font-weight: 700;
}

.module-tag {
  margin-top: 3px;
  color: var(--gold-dim);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.module-link.is-active .module-tag {
  color: var(--module-color);
}

.content {
  width: min(100%, 800px);
  flex: 1 1 auto;
  padding: 28px 32px;
}

.module-header {
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  padding: 4px 10px;
  color: var(--bg);
  font-size: 10px;
  font-weight: 800;
  background: var(--module-color);
  border-radius: 4px;
}

h1 {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 26px;
  line-height: 1.3;
}

.title-rule {
  width: 48px;
  height: 2px;
  margin-top: 12px;
  background: var(--module-color);
  border-radius: 1px;
}

.copy {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}

.concept {
  margin-bottom: 20px;
}

.concept-title,
.quiz-label {
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.concept-points {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.concept-point {
  display: grid;
  grid-template-columns: minmax(110px, 140px) 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.point-label {
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

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

.chart-block {
  margin-bottom: 20px;
}

.chart-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.chart-panel,
.quiz {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chart-panel {
  padding: 16px 12px;
}

.chart-panel svg {
  display: block;
  width: 100%;
  max-width: 400px;
}

.chart-note {
  margin: 10px 0 0;
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  line-height: 1.6;
  border-top: 1px solid var(--border);
}

.quiz {
  margin-top: 16px;
  padding: 18px 20px;
}

.quiz-question {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-option {
  width: 100%;
  padding: 10px 14px;
  color: var(--muted);
  text-align: left;
  line-height: 1.5;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quiz-option.is-selected {
  color: var(--text);
  background: #1a1d28;
  border-color: var(--gold);
}

.quiz-option.is-correct {
  color: var(--bull);
  background: #0d2818;
  border-color: var(--bull);
}

.quiz-option.is-wrong {
  color: var(--bear);
  background: #2a0808;
  border-color: var(--bear);
}

.option-letter {
  margin-right: 8px;
  color: var(--gold-dim);
}

.check-button {
  margin-top: 12px;
  padding: 8px 18px;
  color: var(--bg);
  font-size: 12px;
  font-weight: 800;
  background: var(--gold);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.explanation {
  margin-top: 12px;
  padding: 12px 14px;
  background: #0d1f12;
  border: 1px solid var(--bull);
  border-radius: 6px;
}

.explanation-title {
  margin-bottom: 4px;
  color: var(--bull);
  font-size: 11px;
  font-weight: 800;
}

.explanation p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.nav-button,
.course-complete {
  max-width: min(50%, 320px);
  padding: 10px 18px;
  border-radius: 8px;
}

.nav-button {
  display: flex;
  min-height: 57px;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
}

.nav-button.next {
  align-items: flex-end;
  color: var(--bg);
  font-weight: 800;
  background: var(--module-color);
  border: 0;
}

.nav-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.next .nav-kicker {
  color: rgba(13, 15, 20, 0.75);
}

.nav-title {
  font-size: 13px;
  line-height: 1.35;
}

.course-complete {
  color: var(--bg);
  font-size: 14px;
  font-weight: 800;
  background: var(--bull);
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .brand-subtitle {
    display: none;
  }

  .progress-area {
    gap: 8px;
  }

  .progress-track {
    width: 82px;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 57px 0 auto 0;
    z-index: 90;
    width: 100%;
    height: min(70vh, 520px);
    padding: 10px;
    background: var(--bg);
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  }

  .content {
    width: 100%;
    padding: 24px 16px 36px;
  }

  h1 {
    font-size: 22px;
  }

  .concept-point {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .nav-row {
    flex-direction: column;
  }

  .nav-button,
  .course-complete {
    width: 100%;
    max-width: none;
  }
}
