/* ========== Quiz Layout ========== */
.quiz-app { padding-bottom: 60px; }

/* Mode bar */
.mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  flex-wrap: wrap;
}

.mode-toggle {
  display: flex;
  gap: 0;
  border: 2px solid var(--primary);
  border-radius: 10px;
  overflow: hidden;
}

.mode-btn {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active {
  background: var(--primary);
  color: #fff;
}

.quiz-title-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-dark);
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}
.timer-icon { font-size: 24px; }

/* Main layout: sidebar + content */
.quiz-main {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

/* ========== Sidebar ========== */
.quiz-sidebar {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 84px;
}

.progress-info {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.progress-label {
  display: block;
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.progress-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}
.progress-count span:first-child { color: var(--primary); }

.question-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.qnav-item {
  aspect-ratio: 1;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f9f9f9;
  font-size: 16px;
  font-weight: 600;
  color: #999;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qnav-item:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}
.qnav-item.current {
  border-color: #1890ff;
  background: #e6f7ff;
  color: #1890ff;
}
.qnav-item.answered {
  background: #f0f5ff;
  border-color: #adc6ff;
  color: #2f54eb;
}
.qnav-item.correct {
  background: #f6ffed;
  border-color: #52c41a;
  color: #52c41a;
}
.qnav-item.wrong {
  background: #fff1f0;
  border-color: #f5222d;
  color: #f5222d;
}

.sidebar-legend {
  font-size: 12px;
  color: #888;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.legend-item .dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 2px solid;
  flex-shrink: 0;
}
.dot-correct { background: #f6ffed; border-color: #52c41a; }
.dot-wrong { background: #fff1f0; border-color: #f5222d; }
.dot-unanswered { background: #f9f9f9; border-color: #e0e0e0; }
.dot-current { background: #e6f7ff; border-color: #1890ff; }

/* ========== Question Content ========== */
.quiz-content { min-height: 400px; }

.q-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.q-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.q-category {
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.q-index {
  font-size: 14px;
  color: #999;
}
.result-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}
.result-badge.correct { background: #f6ffed; color: #52c41a; }
.result-badge.wrong { background: #fff1f0; color: #f5222d; }

/* anno-wrap */
.anno-wrap {
  position: relative;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
}
.anno-content {
  padding: 20px;
  font-size: 15px;
  line-height: 2;
  color: var(--text-dark);
}
.anno-canvas {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.anno-canvas.on {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}

/* Options */
.q-options {
  padding: 0 20px 16px;
  position: relative;
}
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 8px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
  line-height: 1.6;
  position: relative;
}
.q-option:hover {
  border-color: var(--primary);
  background: rgba(28,187,180,0.04);
}
.q-option.selected {
  border-color: var(--primary);
  background: rgba(28,187,180,0.08);
}
.q-option.struck .opt-text {
  text-decoration: line-through;
  text-decoration-color: #999;
  text-decoration-thickness: 1px;
  color: #bbb;
}
.q-option.opt-correct {
  border-color: #52c41a;
  background: rgba(82,196,26,0.08);
}
.q-option.opt-wrong {
  border-color: #f5222d;
  background: rgba(245,34,45,0.06);
}
.opt-label {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 2px solid #d9d9d9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #666;
}
.q-option.selected .opt-label {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.q-option.opt-correct .opt-label {
  background: #52c41a;
  color: #fff;
  border-color: #52c41a;
}
.q-option.opt-wrong .opt-label {
  background: #f5222d;
  color: #fff;
  border-color: #f5222d;
}
.opt-text { flex: 1; min-width: 0; }
/* 选项内图片（袋鼠几何题等纯图选项）：保持紧凑，避免撑高选项行 */
.opt-text .rich-img { max-height: 180px; margin: 4px 0; border: none; box-shadow: none; background: transparent; }

/* Strikethrough button */
.strike-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid #e0e0e0;
  border-radius: 50%;
  background: #fafafa;
  font-size: 14px;
  color: #bbb;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.strike-btn:hover {
  background: #fff1f0;
  border-color: #f5222d;
  color: #f5222d;
}
.q-option.struck .strike-btn {
  background: #fff1f0;
  border-color: #f5222d;
  color: #f5222d;
}

/* ========== Action Bar ========== */
.action-bar {
  display: flex;
  gap: 12px;
  padding: 12px 0 16px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 8px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}
.action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.action-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.action-icon { font-size: 20px; }
.action-label { font-weight: 500; }

/* ========== Marker Toolbar ========== */
.marker-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f5f7fa;
  border-radius: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.marker-color {
  width: 40px;
  height: 40px;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.marker-color:hover { transform: scale(1.1); }
.marker-color.active {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(28,187,180,0.25);
}

.marker-hint {
  margin-left: 8px;
  font-size: 12px;
  color: #b0b0b0;
}

.marker-action {
  padding: 8px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 40px;
}
.marker-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ========== Public Notes (题目卡片内，解析上方) ========== */
.public-notes-section {
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: box-shadow 0.3s;
}
.public-notes-section.highlight {
  box-shadow: 0 0 0 3px var(--primary);
}

.public-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
}
.public-notes-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

.public-notes-list {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* ========== Hints Section ========== */
.hints-section {
  margin-top: 16px;
}

.hints-toggle {
  width: 100%;
  padding: 14px 20px;
  border: 2px dashed var(--primary);
  border-radius: 10px;
  background: var(--primary-light);
  font-size: 15px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.hints-toggle:hover {
  background: rgba(28,187,180,0.15);
}

.hints-content {
  margin-top: 12px;
  padding: 20px;
  background: #f9fbfc;
  border-radius: 10px;
  border: 1px solid #e8e8e8;
}
.hints-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
  margin-top: 16px;
}
.hints-content h4:first-child { margin-top: 0; }
.hints-content p {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 8px;
}
.explanation {
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
}
.explanation p { color: var(--text-dark); }
.hint-only p { color: #999; }
.submit-hint {
  font-style: italic;
  color: #bbb !important;
  font-size: 13px !important;
}

.notes-in-hints {
  margin-top: 12px;
}
.notes-in-hints .note-item {
  padding: 10px 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  margin-bottom: 8px;
}

/* ========== Quiz Navigation ========== */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}
.quiz-nav .btn {
  min-height: 48px;
  padding: 12px 28px;
  font-size: 15px;
}
.quiz-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== Notes Panel ========== */
.notes-panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.3s;
}
.notes-panel.highlight {
  box-shadow: 0 0 0 3px var(--primary);
}

/* 笔记切换按钮（默认隐藏面板的入口） */
.notes-toggle-btn {
  margin-left: 12px;
  padding: 7px 14px;
  border: 1px solid var(--primary, #1cbbb4);
  background: #fff;
  color: var(--primary, #1cbbb4);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.notes-toggle-btn:hover {
  background: var(--primary, #1cbbb4);
  color: #fff;
}
.notes-toggle-btn.active {
  background: var(--primary, #1cbbb4);
  color: #fff;
}
@media (max-width: 768px) {
  .notes-toggle-btn { margin-left: 0; }
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
}
.notes-header h3 {
  font-size: 16px;
  font-weight: 600;
}
.notes-q-ref {
  padding: 2px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
}
.notes-empty {
  text-align: center;
  color: #ccc;
  font-size: 13px;
  padding: 20px;
}
.note-item {
  padding: 10px 12px;
  background: #f9fbfc;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid #f0f0f0;
}
.note-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.note-date {
  font-weight: 400;
  color: #bbb;
  font-size: 11px;
}
.note-text {
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}

.note-input-area {
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}
.note-input-area textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.note-input-area textarea:focus {
  border-color: var(--primary);
}
.note-post-btn {
  width: 100%;
  margin-top: 8px;
  min-height: 40px;
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .quiz-main {
    grid-template-columns: 180px 1fr;
  }
}

@media (max-width: 768px) {
  .quiz-main {
    grid-template-columns: 1fr;
  }
  .quiz-sidebar {
    position: static;
  }
  .question-nav {
    grid-template-columns: repeat(6, 1fr);
  }
  .mode-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .mode-toggle {
    align-self: stretch;
  }
  .mode-btn {
    flex: 1;
    text-align: center;
  }
  .action-bar {
    flex-wrap: wrap;
  }
  .action-btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
  .quiz-nav {
    flex-wrap: wrap;
  }
  .quiz-nav .btn {
    flex: 1;
  }
}

/* ========== 题目图片（image_path 导入） ========== */
.q-images {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0 4px;
}
.q-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  border: 1px solid #eef0f3;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  object-fit: contain;
}

/* 题干/选项/解析内嵌图片（{{img:NAME}} 占位符渲染） */
.rich-img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  margin: 6px 0;
  border-radius: 10px;
  border: 1px solid #eef0f3;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  object-fit: contain;
}
/* 填空题输入 */
.q-fill { margin: 14px 0 6px; }
.fill-input {
  width: 100%;
  max-width: 360px;
  padding: 12px 14px;
  font-size: 18px;
  border: 2px solid #d0d4da;
  border-radius: 10px;
  font-family: inherit;
  outline: none;
}
.fill-input:focus { border-color: var(--primary, #1cbbb4); }
.fill-answer {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(82,196,26,0.10);
  border: 1px solid #b7eb8f;
  border-radius: 10px;
  color: #237804;
  font-weight: 600;
}

/* ========== 判断题（简单题）选项 ========== */
.q-option.judge {
  font-size: 17px;
  font-weight: 600;
  padding: 16px 18px;
  border-width: 2px;
}
.q-option.judge .opt-label {
  font-size: 22px;
  font-weight: 800;
  width: 40px;
  height: 40px;
  line-height: 40px;
}
.q-option.judge.judge-yes .opt-label { color: #52c41a; }
.q-option.judge.judge-no .opt-label { color: #f5222d; }
.q-option.judge.judge-yes.selected { background: rgba(82,196,26,0.10); border-color: #52c41a; }
.q-option.judge.judge-no.selected { background: rgba(245,34,45,0.10); border-color: #f5222d; }

/* ========== Report Modal ========== */
.report-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.report-dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
}
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--primary, #1cbbb4);
  color: #fff;
}
.report-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.report-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.report-close:hover { background: rgba(255,255,255,0.35); }
.report-body {
  padding: 20px;
  overflow-y: auto;
}
.report-qid {
  margin: 0 0 12px;
  font-size: 13px;
  color: #888;
}
.report-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.report-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  color: var(--text-dark);
}
.report-option:hover {
  border-color: var(--primary);
  background: rgba(28,187,180,0.04);
}
.report-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary, #1cbbb4);
}
.report-option span { flex: 1; line-height: 1.5; }
.report-textarea,
.report-contact {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.report-textarea:focus,
.report-contact:focus { border-color: var(--primary); }
.report-textarea { resize: vertical; margin-bottom: 12px; }
.report-contact { margin-bottom: 0; }
.report-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
.report-footer .btn { min-height: 40px; padding: 10px 22px; }
.report-toggle-btn {
  border-color: #ff4d4f;
  color: #ff4d4f;
}
.report-toggle-btn:hover {
  background: #ff4d4f;
  color: #fff;
  border-color: #ff4d4f;
}
