/* ── STUDY PAGE LAYOUT ── */
.study-page {
  display: flex;
  min-height: calc(100vh - 61px);
}

/* ── STUDY MAIN ── */
.study-main {
  flex: 1;
  min-width: 0;
  min-height: calc(100vh - 61px);
}

/* ── DOMAIN HEADER ── */
.domain-hdr {
  padding: 40px 40px 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 256px;
}

.progress-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--muted);
}

/* ── DOMAIN STATS ROW ── */
.domain-stats {
  display: none;
}

.stat-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  line-height: 15px;
}

.stat-box.active .stat-lbl {
  color: var(--primary);
}

.stat-val {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-var);
  line-height: 28px;
}

.stat-box.active .stat-val {
  color: var(--ink);
}

/* ── CONTENT AREA ── */
.study-content-area {
  display: flex;
  gap: 48px;
  padding: 0 40px 80px;
  align-items: flex-start;
}

.ts-scroll-counter {
  position: sticky;
  top: 72px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 5px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 20px;
  pointer-events: none;
}
.ts-scroll-counter-current {
  color: var(--primary);
}
.ts-counter-sep {
  color: var(--muted);
}

/* ── ARTICLE ── */
.study-article {
  flex: 1;
  min-width: 0;
  overflow-x: clip;
}

.domain-content {
  display: flex;
  flex-direction: column;
  gap: 64px;
  padding-bottom: 96px;
}

.domain-content[hidden] {
  display: none;
}

/* ── TS SECTION ── */
.ts-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.ts-title-area {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ts-badge {
  display: none;
}

.ts-heading {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--ink);
}

/* ── KS CARDS GRID ── */
.ks-grid {
  display: flex;
  gap: 32px;
}

.ks-card {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border-width: 1px 1px 1px 4px;
  border-style: solid;
  border-color: var(--line);
  border-radius: 12px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ks-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 15px;
}

.ks-label.know {
  color: var(--primary);
}
.ks-label.skill {
  color: var(--cyan);
}

.ks-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ks-list li {
  position: relative;
  padding-left: 20px;
  font-size: 16px;
  line-height: 26px;
  color: var(--ink-var);
}

.ks-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 1px;
}

.ks-card:not(.skill) .ks-list li::before {
  background: var(--primary);
}
.ks-card.skill .ks-list li::before {
  background: var(--cyan);
}

/* ── ARTICLE FOOTER NAV — shared base via .domain-nav-footer in styles.css ── */

/* ── RIGHT SIDEBAR ── */
.study-aside {
  flex: 0 0 320px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 80px;
}

/* ── QUICK QUIZ ── */
.quiz-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.sidebar-hdr {
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-hdr-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}

.quiz-body {
  padding: 23px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quiz-question {
  font-size: 14px;
  font-weight: 400;
  line-height: 23px;
  color: var(--ink-var);
}

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

.quiz-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--panel-dark);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}

.quiz-option:hover {
  background: rgba(198, 191, 255, 0.05);
}

.quiz-option.selected {
  background: rgba(198, 191, 255, 0.1);
  border: 2px solid var(--primary);
}

.quiz-option.correct {
  background: rgba(78, 203, 160, 0.1);
  border-color: var(--green);
}
.quiz-option.wrong {
  background: rgba(245, 91, 91, 0.1);
  border-color: var(--red);
}

.quiz-opt-letter {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  flex: 0 0 auto;
}

.quiz-option.selected .quiz-opt-letter {
  font-weight: 700;
  color: var(--primary);
}
.quiz-option.correct .quiz-opt-letter {
  color: var(--green);
  font-weight: 700;
}
.quiz-option.wrong .quiz-opt-letter {
  color: var(--red);
  font-weight: 700;
}

.quiz-opt-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-var);
  line-height: 18px;
}

.quiz-option.selected .quiz-opt-text {
  font-weight: 700;
  color: var(--primary);
}
.quiz-option.correct .quiz-opt-text {
  color: var(--green);
  font-weight: 700;
}
.quiz-option.wrong .quiz-opt-text {
  color: var(--red);
  font-weight: 700;
}

.quiz-submit {
  width: 100%;
  padding: 16px 0;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--cta-ink);
  cursor: pointer;
  transition: opacity 0.15s;
}

.quiz-submit:hover {
  opacity: 0.9;
}
.quiz-submit[disabled] {
  opacity: 0.5;
  cursor: default;
}

.quiz-feedback {
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  padding: 8px 0;
}

.quiz-feedback.correct {
  color: var(--green);
}
.quiz-feedback.wrong {
  color: var(--red);
}

/* ── KEY TERMS ── */
.terms-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.terms-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.term-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.term-name {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  line-height: 15px;
}

.term-def {
  font-size: 14px;
  line-height: 23px;
  color: var(--ink-var);
}

.term-warning {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.warning-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.warning-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--salmon);
}

.warning-text {
  font-style: italic;
  font-size: 14px;
  line-height: 23px;
  color: rgba(200, 196, 213, 0.7);
}

/* ── CTA BANNER ── */
.cta-banner {
  background: linear-gradient(135deg, rgba(198, 191, 255, 0.2) 0%, rgba(198, 191, 255, 0) 100%);
  border: 1px solid rgba(198, 191, 255, 0.3);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cta-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--primary);
  line-height: 15px;
}

.cta-title {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--ink);
  padding-top: 5px;
}

.cta-body {
  font-size: 14px;
  line-height: 23px;
  color: var(--muted);
}

.cta-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 17px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.cta-link:hover {
  opacity: 0.8;
}

/* ── APPENDIX ── */
.app-section {
  margin-bottom: 48px;
}

.app-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 16px;
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.app-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}

.app-card h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-card ul {
  padding-left: 16px;
}

.app-card li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

.app-card li strong {
  color: var(--ink);
  font-weight: 600;
}

.oos-card {
  background: rgba(245, 91, 91, 0.06);
  border: 1px solid rgba(245, 91, 91, 0.25);
  border-radius: 12px;
  padding: 24px;
}

.oos-card h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  margin-bottom: 12px;
}

.oos-card ul {
  padding-left: 16px;
}
.oos-card li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

.prep-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prep-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
}

.prep-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(198, 191, 255, 0.1);
  border: 1px solid rgba(198, 191, 255, 0.25);
  border-radius: 9999px;
  padding: 1px 8px;
  flex: 0 0 auto;
  margin-top: 1px;
  height: 20px;
  display: flex;
  align-items: center;
}

.prep-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.prep-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .study-content-area {
    flex-direction: column;
  }
  .study-article {
    flex: none;
    width: 100%;
  }
  .study-aside {
    flex: none;
    width: 100%;
    position: static;
    top: auto;
  }
}

@media (max-width: 820px) {
  .study-main {
    margin-left: 0;
  }
  .study-page {
    flex-direction: column;
  }
  .domain-h1 {
    font-size: 32px;
    line-height: 38px;
  }
  .ks-grid {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .domain-hdr {
    padding: 24px 20px 0;
  }
  .domain-stats {
    padding: 0 20px 24px;
    flex-wrap: wrap;
  }
  .study-content-area {
    padding: 0 20px 60px;
    gap: 24px;
  }
  .domain-content {
    gap: 32px;
    padding-bottom: 40px;
  }
  .app-grid {
    grid-template-columns: 1fr;
  }
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  /* .article-footer mobile stacking now handled by shared .domain-nav-footer in styles.css */
}
