/* ===== 全局 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green: #477468;
  --green-light: #EDF4F0;
  --green-ring: #C8D9D1;
  --warm-bg: #F7F3EA;
  --card-bg: #FBFAF6;
  --white: #FFFFFF;
  --text: #1e1e1e;
  --text-muted: #8b8b8b;
  --text-sub: #5e5e5e;
  --red-bg: #FFF2EF;
  --red-text: #b45309;
  --orange-bg: #FFF7ED;
  --yellow-bg: #FEFCE8;
  --blue-bg: #EFF6FF;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--warm-bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 背景纹理 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(71,116,104,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(200,180,150,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255,255,255,0.5) 0%, transparent 70%);
}

/* ===== App 容器 ===== */
.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* ===== 输入区 & 结果区 ===== */
.input-top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: -8px;
}

.user-id-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-light);
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.input-section {
  padding: 20px 16px 0;
}

.result-section {
  padding: 0 16px 32px;
}

/* ===== 进度条 ===== */
.progress-bar {
  margin: 0 16px;
  height: 3px;
  background: #e5e5e5;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  width: 0%;
  animation: progressAnim 2s ease-in-out infinite;
}

@keyframes progressAnim {
  0% { width: 0%; }
  30% { width: 40%; }
  60% { width: 70%; }
  90% { width: 90%; }
  100% { width: 95%; }
}

/* ===== 密码门 ===== */
.gate-overlay {
  position: fixed;
  inset: 0;
  background: var(--warm-bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gate-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(71,116,104,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 80%, rgba(200,180,150,0.08) 0%, transparent 60%);
}

.gate-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  max-width: 320px;
  width: 100%;
  position: relative;
}

.gate-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 4px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.gate-input:focus {
  border-color: var(--green);
}

/* ===== 品牌标签 ===== */
.brand-tag {
  font-size: 13px;
  color: var(--green);
  background: var(--green-light);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* ===== 输入屏 ===== */
.input-hero {
  text-align: center;
  padding-top: 20px;
}

.input-hero h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 16px;
  letter-spacing: -0.5px;
}

/* 麦克风区域 */
.mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 28px 0;
}

.mic-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: none;
  background: var(--green-light);
  color: var(--green);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  position: relative;
  box-shadow: 0 0 0 0 rgba(71,116,104,0);
  -webkit-tap-highlight-color: transparent;
}

.mic-circle::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1.5px solid var(--green-ring);
  transition: all 0.3s;
}

.mic-circle::after {
  content: '';
  position: absolute;
  inset: -24px;
  border-radius: 50%;
  border: 1px solid rgba(200,217,209,0.6);
}

.mic-circle:active {
  transform: scale(0.96);
}

.mic-circle.recording {
  background: #ef4444;
  color: #fff;
  box-shadow: 0 0 0 12px rgba(239,68,68,0.15);
  animation: micPulse 1.8s ease-in-out infinite;
}

.mic-circle.recording::before {
  border-color: rgba(239,68,68,0.3);
}

.mic-circle.recording::after {
  border-color: rgba(239,68,68,0.15);
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 0 24px rgba(239,68,68,0); }
}

.mic-hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
  transition: color 0.2s;
}

.mic-hint.recording {
  color: #ef4444;
  font-weight: 500;
}

/* 输入卡片 */
.input-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.04);
}

textarea {
  width: 100%;
  height: 180px;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.9;
  resize: none;
  color: var(--text);
  background: transparent;
}

textarea::placeholder {
  color: #c5c5c5;
}

/* 主按钮 */
.btn-main {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(71,116,104,0.25);
}

.btn-main:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-main:disabled {
  background: #b0b0b0;
  box-shadow: none;
}

.btn-outline {
  flex: 1;
  padding: 14px;
  background: var(--white);
  color: var(--text);
  border: 1.5px solid #e5e5e5;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-outline:active {
  background: #f5f5f5;
}

/* 步骤指示器 */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 28px;
  padding: 0 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #ccc;
  font-weight: 500;
}

.step span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e5e5e5;
  color: #999;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.step.done { color: var(--green); }
.step.done span { background: var(--green-light); color: var(--green); }
.step.active { color: var(--text); }
.step.active span { background: var(--green); color: #fff; }

.step-line {
  flex: 1;
  height: 1.5px;
  background: #e5e5e5;
  min-width: 20px;
  max-width: 40px;
  margin: 0 6px;
}

/* ===== 结果屏 ===== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.top-title {
  font-size: 15px;
  font-weight: 600;
}

.top-spacer, .btn-back {
  width: 36px;
  height: 36px;
}

.btn-back {
  background: var(--white);
  border: 1px solid #e5e5e5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
}

/* 结果卡片 */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.03);
}

.card-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-result {
  border: 1.5px solid #D8E5DF;
}

.result-body {
  font-size: 15px;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
}

/* 标记高亮 */
.result-body mark {
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}

.result-body mark.hl-sound  { background: #fef3c7; border-bottom: 2px solid #eab308; }
.result-body mark.hl-meaning { background: #ffedd5; border-bottom: 2px solid #f97316; }
.result-body mark.hl-name   { background: #dbeafe; border-bottom: 2px solid #3b82f6; }
.result-body mark.hl-missing { background: #fee2e2; border-bottom: 2px solid #ef4444; color: #dc2626; }

/* ===== 标注版正文（修改标注卡） ===== */
.card-annotated {
  border: 1.5px solid #e5e7eb;
}

.annotated-body {
  font-size: 15px;
  line-height: 2.2;
  color: var(--text);
}

/* 标注版高亮颜色 */
.annotated-body .a-del {
  background: #fee2e2;
  color: #dc2626;
  text-decoration: line-through;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
}

.annotated-body .a-add {
  background: #d1fae5;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
}

.annotated-body .a-rephrase {
  background: #fef3c7;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  border-bottom: 2px solid #eab308;
}

.annotated-body .a-typo {
  background: #dbeafe;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  border-bottom: 2px solid #3b82f6;
}

.annotated-body .a-punct {
  background: #f3e8ff;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
  border-bottom: 2px solid #a855f7;
  font-weight: 600;
  color: #7c3aed;
}

.annotated-body .a-split {
  background: #e0f2fe;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
  border-bottom: 2px solid #0ea5e9;
}

/* 标注点击弹窗 */
.annotation-popup {
  position: fixed;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  z-index: 1000;
  max-width: 280px;
  font-size: 13px;
}

.annotation-popup .popup-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.annotation-popup .popup-orig {
  color: #dc2626;
  margin-bottom: 4px;
}

.annotation-popup .popup-new {
  color: #059669;
  margin-bottom: 10px;
}

.annotation-popup .popup-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.annotation-popup .popup-actions button {
  padding: 4px 12px;
  border-radius: 14px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.annotation-popup .popup-actions button.undo-btn {
  color: #dc2626;
  border-color: #fecaca;
}

/* 标签 chips */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag-chip {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.tag-chip.good { background: var(--green-light); color: var(--green); }
.tag-chip.warn { background: #FEF3C7; color: #92400e; }

/* ===== 修改详情卡片列表 ===== */
.changes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.change-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.03);
}

.change-card .change-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.change-card .change-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.change-card .change-num.warn {
  background: #FEF3C7;
  color: #92400e;
}

.change-card .change-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.change-card .change-reason {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.change-card .change-diff {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.change-card .diff-line {
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.change-card .diff-line.before {
  background: #FFF2EF;
  color: #8b5e54;
}

.change-card .diff-line.before::before {
  content: '原文  ';
  font-weight: 700;
  font-size: 11px;
  color: #b45309;
}

.change-card .diff-line.after {
  background: var(--green-light);
  color: #3d5a50;
}

.change-card .diff-line.after::before {
  content: '整理  ';
  font-weight: 700;
  font-size: 11px;
  color: var(--green);
}

.change-card .change-action {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.change-card .btn-sm {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
  color: var(--text-sub);
}

.change-card .btn-sm.danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff;
}

.change-card .btn-sm.danger:hover {
  background: #fef2f2;
}

/* ===== 待确认卡片 ===== */
.card-confirm {
  border: 1.5px solid #FDE68A;
}

.confirm-item {
  background: #FFFBEB;
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

.confirm-item .confirm-q {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
}

.confirm-item .confirm-text {
  font-size: 14px;
  color: var(--text);
  padding: 8px 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.confirm-item .confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.confirm-item .btn-confirm-opt {
  padding: 8px 0;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #ddd;
  text-align: center;
}

.confirm-item .btn-confirm-opt.locate {
  background: #f5f5f5;
  color: var(--text-sub);
}

.confirm-item .btn-confirm-opt.ok {
  background: #fff;
  color: var(--text-sub);
}

.confirm-item .btn-confirm-opt.edit {
  background: var(--green);
  color: #fff;
  border: none;
}

/* 定位闪烁 */
mark.locate-flash {
  background: #fbbf24;
  padding: 2px 4px;
  border-radius: 3px;
  animation: flashHighlight 0.6s ease-in-out 3;
}

@keyframes flashHighlight {
  0%, 100% { background: #fbbf24; }
  50% { background: #fde68a; }
}

/* ===== 底部操作栏 ===== */
.bottom-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}

/* ===== 编辑弹窗（固定定位） ===== */
.edit-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.edit-popup-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
}

.edit-popup-card h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.edit-popup-card .edit-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.edit-popup-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 14px;
}

.edit-popup-card input:focus {
  outline: none;
  border-color: var(--green);
}

.edit-popup-card .edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.edit-popup-card .edit-actions button {
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.edit-popup-card .edit-actions .btn-cancel {
  background: #f5f5f5;
  border: none;
  color: var(--text-sub);
}

.edit-popup-card .edit-actions .btn-save {
  background: var(--green);
  border: none;
  color: #fff;
}

.edit-popup-card .edit-actions .btn-undo {
  background: transparent;
  border: 1px solid #ddd;
  color: var(--text-sub);
}

/* ===== Spinner ===== */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ===== 桌面端居中 ===== */
@media (min-width: 480px) {
  .app {
    border-left: 1px solid rgba(0,0,0,0.04);
    border-right: 1px solid rgba(0,0,0,0.04);
  }
}

/* ===== 图例 ===== */
.legend {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #fafafa;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  color: #666;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.leg-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
}
