* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f8fc;
  color: #1a202c;
  min-height: 100vh;
}

/* ── Progress Bar ── */
#progress-bar-wrap {
  position: fixed; top: 0; left: 0; right: 0;
  height: 4px; background: #e2e8f0; z-index: 100;
}
#progress-bar {
  height: 100%; background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.4s ease;
}

/* ── Container ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 32px 80px;
}

/* ── Welcome / Submit pages ── */
.page { display: none; }
.page.active { display: block; }

.welcome-card, .submit-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}
.welcome-card h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.welcome-card p { color: #718096; font-size: 16px; line-height: 1.7; margin-bottom: 32px; }

.form-group { text-align: left; margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: #4a5568; }
.form-group input {
  width: 100%; padding: 12px 16px;
  border: 2px solid #e2e8f0; border-radius: 10px;
  font-size: 15px; transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus { border-color: #667eea; }

/* ── Question Card ── */
.question-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-badge {
  display: inline-block;
  background: #ebf4ff; color: #3182ce;
  font-size: 12px; font-weight: 600;
  padding: 4px 12px; border-radius: 20px;
  margin-bottom: 16px;
}

.question-text {
  font-size: 20px; font-weight: 700;
  line-height: 1.5; margin-bottom: 8px;
}
.question-hint {
  font-size: 13px; color: #a0aec0;
  margin-bottom: 20px;
}

textarea {
  width: 100%; min-height: 200px;
  padding: 14px 16px;
  border: 2px solid #e2e8f0; border-radius: 10px;
  font-size: 15px; line-height: 1.7;
  resize: vertical; outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
textarea:focus { border-color: #667eea; }
textarea::placeholder { color: #cbd5e0; }

/* ── Input Wrapper（语音 + AI按钮） ── */
.input-wrapper {
  position: relative;
}
.input-wrapper textarea {
  width: 100%;
  padding-bottom: 52px; /* 给底部按钮留空间 */
}
.input-actions {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 语音按钮 */
.voice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.voice-btn:hover { background: #f7fafc; border-color: #667eea; }
.voice-btn.recording {
  background: #fed7d7;
  border-color: #fc8181;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* AI协助按钮 */
.ai-assist-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid #667eea;
  background: #fff;
  color: #667eea;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ai-assist-btn:hover {
  background: #667eea;
  color: #fff;
}
.ai-assist-btn.loading {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 语音状态提示 */
.voice-status {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  background: #fed7d7;
  border-radius: 8px;
  font-size: 13px;
  color: #c53030;
  text-align: center;
}
.voice-status.active { display: block; }

/* ── Character Counter ── */
.char-counter {
  margin-top: 8px;
  font-size: 14px;
  color: #718096;
  text-align: right;
}

.char-counter.ok {
  color: #f59e0b;
}

.char-counter.good {
  color: #10b981;
}

.char-counter #char-count {
  font-weight: 600;
}

/* ── AI Guide Box ── */
.ai-box {
  margin-top: 16px;
  background: linear-gradient(135deg, #f0f4ff, #faf5ff);
  border: 1px solid #c3dafe;
  border-radius: 12px;
  padding: 16px 20px;
  display: none;
  animation: fadeUp 0.3s ease;
}
.ai-box.show { display: block; }
.ai-label {
  font-size: 12px; font-weight: 600;
  color: #667eea; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.ai-suggestion {
  font-size: 14px;
  color: #4a5568;
  line-height: 1.6;
  user-select: text; /* 允许选中文字 */
  cursor: text; /* 鼠标变成文字选择光标 */
  padding: 8px 0;
}

.ai-example-wrap {
  margin-top: 10px;
  padding: 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  border-left: 3px solid #667eea;
}
.ai-example-label {
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 6px;
}
.ai-example {
  font-size: 14px;
  color: #2d3748;
  line-height: 1.7;
  user-select: text;
  cursor: text;
  margin-bottom: 10px;
}

.ai-actions { margin-top: 10px; display: flex; gap: 8px; }
.ai-btn {
  font-size: 13px; padding: 6px 14px;
  border-radius: 8px; border: none; cursor: pointer;
  font-weight: 500; transition: all 0.2s;
}
.ai-btn-copy {
  background: #48bb78;
  color: #fff;
}
.ai-btn-copy:hover {
  background: #38a169;
}
.ai-btn-ok { background: #667eea; color: #fff; }
.ai-btn-ok:hover { background: #5a67d8; }

/* ── Buttons ── */
.btn {
  display: inline-block; padding: 14px 32px;
  border-radius: 12px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 600;
  transition: all 0.2s; text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; width: 100%;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: #edf2f7; color: #4a5568; width: 100%;
}
.btn-secondary:hover { background: #e2e8f0; }

.nav-btns {
  display: flex; gap: 12px; margin-top: 24px;
  align-items: center;
}
.btn-next {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; flex: 1; padding: 14px;
  border-radius: 12px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 600;
  transition: all 0.2s;
}
.btn-next:hover { opacity: 0.9; }
.btn-prev {
  background: #edf2f7; color: #718096;
  padding: 14px 20px; border-radius: 12px;
  border: none; cursor: pointer; font-size: 16px;
  transition: all 0.2s;
}
.btn-prev:hover { background: #e2e8f0; }
.btn-skip {
  background: none; border: none;
  color: #a0aec0; font-size: 14px;
  cursor: pointer; padding: 8px;
  text-decoration: underline;
}

.keyboard-hint {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: #a0aec0;
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-family: monospace;
  font-size: 11px;
  color: #4a5568;
}

/* ── Counter ── */
.q-counter {
  font-size: 13px; color: #a0aec0;
  margin-bottom: 24px;
}

/* ── Submit page (ChatGPT 风格) ── */
.submit-card {
  padding: 64px 48px !important;
}

.success-icon {
  margin-bottom: 32px;
  display: inline-block;
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-title {
  font-size: 36px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 16px;
}

.success-text {
  font-size: 16px;
  color: #718096;
  margin-bottom: 40px;
  line-height: 1.6;
}

.btn-restart {
  background: #f7fafc;
  color: #4a5568;
  border: 1px solid #e2e8f0;
  padding: 12px 32px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-restart:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  transform: translateY(-1px);
}


/* ── Loading spinner ── */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid #c3dafe;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Admin ── */
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-header h1 { font-size: 22px; font-weight: 700; }

.stats { display: flex; gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: #fff; border-radius: 12px;
  padding: 20px 24px; flex: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-card .num { font-size: 28px; font-weight: 700; color: #667eea; }
.stat-card .label { font-size: 13px; color: #718096; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
th { background: #2d3748; color: #fff; padding: 14px 16px; text-align: left; font-size: 13px; font-weight: 600; }
td { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7f8fc; }

.badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-submitted { background: #c6f6d5; color: #276749; }
.badge-progress  { background: #bee3f8; color: #2b6cb0; }

.action-btn {
  padding: 6px 14px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 13px; font-weight: 500;
  margin-right: 6px; transition: all 0.2s;
}
.btn-detail { background: #ebf4ff; color: #3182ce; }
.btn-word   { background: #e9d8fd; color: #6b46c1; }
.btn-excel  { background: #c6f6d5; color: #276749; }
.btn-pdf    { background: #fed7d7; color: #c53030; }
.action-btn:hover { opacity: 0.8; }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  width: 90%; max-width: 760px; max-height: 85vh;
  overflow-y: auto; padding: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal h2 { font-size: 20px; margin-bottom: 20px; }
.modal-close {
  float: right; background: none; border: none;
  font-size: 22px; cursor: pointer; color: #718096;
}
.qa-item { margin-bottom: 20px; }
.qa-q { font-weight: 600; font-size: 14px; color: #4a5568; margin-bottom: 4px; }
.qa-a { font-size: 14px; line-height: 1.7; color: #1a202c; white-space: pre-wrap; }
.section-title { font-size: 16px; font-weight: 700; color: #667eea; margin: 24px 0 12px; border-bottom: 2px solid #ebf4ff; padding-bottom: 6px; }

/* ── Question Layout (左右布局) ── */
.question-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ── Left Navigation ── */
.question-nav {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  padding: 16px 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: #4a5568;
  margin-bottom: 4px;
}

.nav-item:hover {
  background: #f7fafc;
}

.nav-item.active {
  background: #ebf4ff;
  color: #3182ce;
  font-weight: 600;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-dot.status-excellent { background: #48bb78; }
.nav-dot.status-good { background: #ed8936; }
.nav-dot.status-poor { background: #f56565; }
.nav-dot.status-empty { background: #cbd5e0; }

.nav-section {
  margin-bottom: 16px;
}

.nav-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: #f7fafc;
  border-radius: 6px;
}

.nav-section .nav-item {
  padding-left: 20px;
}

.question-main {
  flex: 1;
  min-width: 0;
}

/* 响应式：小屏幕隐藏导航 */
@media (max-width: 768px) {
  .question-nav { display: none; }
}

/* ── Review Page ── */
.review-container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}

.review-title {
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 32px;
  color: #1a202c;
}

.review-layout {
  display: flex;
  gap: 32px;
  margin-bottom: 32px;
}

.review-nav {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  max-height: 600px;
  overflow-y: auto;
}

.review-nav h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1a202c;
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.review-item:hover {
  background: #f7fafc;
}

.review-num {
  font-size: 14px;
  color: #4a5568;
}

.review-status {
  font-size: 14px;
  font-weight: 500;
}

.review-stats {
  flex: 1;
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-circle {
  position: relative;
  margin-bottom: 32px;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-percent {
  font-size: 48px;
  font-weight: 700;
  color: #10b981;
}

.score-label {
  font-size: 16px;
  color: #718096;
  margin-top: 4px;
}

#score-progress {
  transition: stroke-dashoffset 1s ease;
}

.stats-detail {
  width: 100%;
}

.stat-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 12px;
}

.stat-dot.excellent { background: #10b981; }
.stat-dot.good { background: #f59e0b; }
.stat-dot.poor { background: #ef4444; }
.stat-dot.empty { background: #6b7280; }

.stat-label {
  flex: 1;
  font-size: 14px;
  color: #4a5568;
}

.stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
}

.review-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.btn-secondary {
  background: white;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

.btn-secondary:hover {
  background: #f7fafc;
}

@media (max-width: 768px) {
  .review-layout {
    flex-direction: column;
  }

  /* 移动端适配 */
  .container {
    padding: 40px 16px 60px;
  }

  .welcome-card {
    padding: 32px 24px;
  }

  .welcome-card h1 {
    font-size: 24px;
  }

  .welcome-card p {
    font-size: 15px;
  }

  .question-card {
    padding: 24px 20px;
  }

  .question-text {
    font-size: 18px;
  }

  textarea {
    min-height: 120px;
    font-size: 14px;
  }

  .nav-btns {
    flex-direction: column;
    gap: 8px;
  }

  .btn-prev {
    width: 100%;
  }

  .review-container {
    padding: 0 16px;
  }

  .review-title {
    font-size: 22px;
  }

  .review-nav {
    max-height: 400px;
  }

  .score-circle svg {
    width: 160px;
    height: 160px;
  }

  .score-percent {
    font-size: 36px;
  }

  .review-actions {
    flex-direction: column;
    width: 100%;
  }

  .review-actions .btn {
    width: 100%;
  }
}
