/* ============================================================
   Helpme 章节知识笔记 / 计算题专项页样式
   ============================================================ */
:root {
  --green: #22c55e;
  --red: #ef4444;
}

.note-page {
  min-height: 60vh;
  padding: 42px 0 90px;
}

.note-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.note-breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}

.note-breadcrumb b {
  color: var(--text-secondary);
  font-weight: 600;
}

.note-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.note-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 18px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  max-height: calc(100vh - var(--nav-height) - 42px);
  overflow-y: auto;
}

.note-sidebar-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.note-sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.18s ease;
  line-height: 1.4;
}

.note-sidebar a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.note-sidebar a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
}

.note-article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  min-height: 420px;
}

.note-body {
  font-size: 15px;
  line-height: 1.85;
}

.note-body h1 {
  font-size: 26px;
  margin: 4px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.note-body h2 {
  font-size: 21px;
  margin: 34px 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--accent-1);
}

.note-body h3 {
  font-size: 17px;
  margin: 24px 0 10px;
  color: var(--text-primary);
}

.note-body h4 {
  font-size: 15px;
  margin: 20px 0 8px;
}

.note-body p {
  margin: 10px 0;
}

.note-body .md-opt {
  margin: 2px 0;
  padding-left: 0;
}

.note-body strong {
  color: #fff;
}

.note-body code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 5px;
  padding: 1px 6px;
  color: #c7d2fe;
}

.note-body pre {
  background: #0a0a10;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 16px 0;
}

.note-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #e2e8f0;
}

.note-body blockquote {
  border-left: 3px solid rgba(251, 191, 36, 0.65);
  background: rgba(251, 191, 36, 0.06);
  border-radius: 0 10px 10px 0;
  padding: 10px 16px;
  margin: 14px 0;
  color: var(--text-secondary);
}

.note-body ul,
.note-body ol {
  margin: 8px 0 12px;
  padding-left: 26px;
}

.note-body li {
  margin: 5px 0;
}

.note-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 26px 0;
}

#quizArea .md-table,
.q-explain .md-table,
.note-body .md-table {
  overflow-x: auto;
  margin: 16px 0;
}

#quizArea table,
#quizArea .q-explain table,
.q-explain table,
.note-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#quizArea th,
#quizArea td,
.q-explain th,
.q-explain td,
.note-body th,
.note-body td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

#quizArea th,
.note-body th {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
  font-weight: 600;
}

#quizArea tr:nth-child(even) td,
.q-explain tr:nth-child(even) td,
.note-body tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.q-stem .md-table {
  margin: 12px 0;
}

#quizArea pre {
  background: #0a0a10;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0;
}

.note-body details {
  margin: 14px 0;
  border: 1px dashed rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.05);
  border-radius: 12px;
  padding: 12px 16px;
}

.note-body summary {
  cursor: pointer;
  color: var(--accent-1);
  font-weight: 700;
  user-select: none;
  outline: none;
}

.note-body details[open] summary {
  margin-bottom: 8px;
}

.note-pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.note-pager .btn {
  max-width: 48%;
}

/* ---------- 母题答题区 ---------- */
.quiz-area {
  margin-top: 44px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.quiz-head h2 {
  font-size: 22px;
}

.quiz-summary {
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
}

.quiz-summary b {
  color: var(--text-primary);
}

.q-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.q-card.done {
  border-color: rgba(99, 102, 241, 0.35);
}

.q-tag-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.q-tag {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
}

.q-tag.key {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

.q-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.q-fav {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.q-fav:hover {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.5);
}

.q-fav.on {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.55);
}

.fav-chapter-btn.on {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.1);
}

.q-stem {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.q-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.q-opt:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.08);
}

.q-opt:disabled {
  cursor: default;
  opacity: 0.85;
}

.q-opt .q-key {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--accent-1);
}

.q-opt.correct {
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.12);
}

.q-opt.correct .q-key {
  color: var(--green);
}

.q-opt.wrong-opt {
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(239, 68, 68, 0.12);
}

.q-opt.wrong-opt .q-key {
  color: var(--red);
}

.q-opt.excluded {
  opacity: 0.45;
  text-decoration: line-through;
}

.quiz-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.q-feedback {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  display: none;
}

.q-feedback.show {
  display: block;
}

.q-feedback.ok {
  color: var(--green);
}

.q-feedback.bad {
  color: var(--red);
}

.q-explain {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.06);
  border-left: 3px solid rgba(251, 191, 36, 0.55);
  font-size: 13.5px;
  color: var(--text-secondary);
  display: none;
  line-height: 1.8;
}

.q-explain.show {
  display: block;
}

.q-explain p {
  margin: 6px 0;
}

/* 主观题：查看参考答案 */
.q-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.1);
  color: #fde68a;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.q-open:hover {
  background: rgba(251, 191, 36, 0.2);
}

.q-open:disabled {
  opacity: 0.75;
  cursor: default;
}

/* 章节名前的重点星号 */
.ch-star {
  color: #fbbf24;
  margin-right: 4px;
}

.ch-card.key {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.07), rgba(168, 85, 247, 0.06));
}

.note-loading,
.note-error {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-muted);
}

.note-error {
  color: #f87171;
}

/* ---------- 计算题专项入口页 ---------- */
.calc-hero {
  padding: 52px 0 12px;
  text-align: center;
}

.calc-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.calc-hero p {
  color: var(--text-secondary);
  margin-top: 10px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 36px 0 90px;
}

.calc-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.22s ease;
}

.calc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(168, 85, 247, 0.65);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.calc-card .num {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.calc-card b {
  font-size: 17px;
}

.calc-card span:last-child {
  color: var(--text-muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .note-layout {
    grid-template-columns: 1fr;
  }
  .note-sidebar {
    position: static;
    max-height: 280px;
  }
  .note-article {
    padding: 26px 20px;
  }
}
