:root {
  --bg: #f5f7fa;
  --white: #ffffff;
  --border: #dfe3e8;
  --text: #1a202c;
  --text-muted: #8892a0;
  --primary: #4a6cf7;
  --primary-hover: #3651d4;
  --success: #22c55e;
  --danger: #ef4444;
  --danger-bg: #fff5f5;
  --danger-border: #fecaca;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* 标题 */
.app-header h1 {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  color: var(--text);
}

/* 输入区 */
.input-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.input-section textarea {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.input-section textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.08);
}

.btn-primary {
  margin-top: 14px;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* 输出区 */
.output-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 0;
}

.status {
  font-size: 13px;
  color: var(--text-muted);
}

.result-box {
  padding: 16px 20px 20px;
  min-height: 160px;
  font-size: 14px;
  line-height: 1.75;
}

.placeholder-text { color: var(--text-muted); font-style: italic; }

/* 免责声明 */
.disclaimer {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 6px;
  font-size: 13px;
  color: #b91c1c;
  font-weight: 500;
}

/* 状态标签 */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #f4f5f7;
  color: var(--text-muted);
}

.tag.pass {
  background: #f0fdf4;
  color: var(--success);
  border-color: #bbf7d0;
}
.tag.fail {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.tag.warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

/* 摘要 */
.summary-text {
  margin-bottom: 14px;
  color: var(--text);
}

/* 违规 / 风险区块 */
.block-section {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fafbfc;
  border: 1px solid #eef1f4;
  border-radius: 6px;
}

.block-section .block-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.block-list { list-style: none; padding: 0; }

.block-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eef1f4;
  font-size: 13px;
  line-height: 1.7;
}
.block-list li:last-child { border-bottom: none; }
.block-list strong { color: var(--text); }

/* ——— 原文定位 ——— */
.original-preview {
  background: #fffbf0;
  border-color: #fde68a;
}

.original-text {
  font-size: 14px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.original-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.original-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.violation-dot { background: #fca5a5; }
.qualification-dot { background: #fcd34d; }

.violation-highlight {
  background: #fecaca;
  color: #991b1b;
  padding: 1px 2px;
  border-radius: 3px;
  font-weight: 600;
}

.violation-highlight a {
  color: #991b1b;
  text-decoration: none;
  cursor: pointer;
}

.violation-highlight a:hover {
  text-decoration: underline;
}

.qualification-highlight {
  background: #fde68a;
  color: #92400e;
  padding: 1px 2px;
  border-radius: 3px;
  font-weight: 600;
}

.qualification-highlight a {
  color: #92400e;
  text-decoration: none;
  cursor: pointer;
}

.qualification-highlight a:hover {
  text-decoration: underline;
}

/* ——— 违规明细列表 ——— */
.violation-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.violation-item {
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid #eef1f4;
  border-radius: 8px;
  scroll-margin-top: 20px;
}

.violation-item:target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.12);
  transition: box-shadow 0.3s;
}

/* 资质块 */
.qualification-block .block-title { color: #92400e; }
.qualification-item {
  border-color: #fde68a;
  background: #fffbeb;
}

.qualification-item .violation-index {
  background: #d97706;
}

.qualification-item .violation-word {
  color: #92400e;
}

.qualification-item:target {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217,119,6,0.16);
}

.violation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.violation-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.violation-word {
  font-size: 15px;
  font-weight: 600;
  color: var(--danger);
}

.violation-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.violation-field {
  font-size: 13px;
  line-height: 1.7;
}

.violation-field strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.rule-text {
  padding: 8px 12px;
  background: #f8fafc;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-size: 13px;
  color: #334155;
  line-height: 1.7;
}

.suggestion-text {
  padding: 6px 10px;
  background: #f0fdf4;
  border-radius: 4px;
  color: #166534;
  font-weight: 500;
}

.video-upload-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  background: #f5f7ff;
}

.video-upload-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.video-upload-copy strong {
  color: #1e293b;
  font-size: 15px;
  line-height: 1.45;
}

.video-upload-copy > span:last-child {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.video-upload-kicker {
  color: #4a6cf7;
  font-size: 11px;
  font-weight: 700;
}

.input-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 11px;
}

.input-divider::before,
.input-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-upload {
  min-width: 148px;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-upload:hover:not(:disabled) {
  border-color: #3658e6;
  background: #3658e6;
}

.btn-upload:disabled { opacity: 0.55; cursor: wait; }

.transcription-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.transcription-meta .success { color: #15803d; }
.transcription-meta .error { color: #b91c1c; }

@media (max-width: 520px) {
  .video-upload-panel { align-items: stretch; flex-direction: column; gap: 12px; }
  .btn-upload { width: 100%; }
  .transcription-meta { flex-direction: column; gap: 2px; }
}

/* 用户反馈入口 */
.feedback-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #eef1f4;
  color: var(--text-muted);
  font-size: 13px;
}

.feedback-entry-button {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: var(--white);
  color: #475569;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.feedback-entry-button:hover { border-color: var(--primary); color: var(--primary); }

.feedback-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.24);
}

.feedback-dialog::backdrop { background: rgba(15, 23, 42, 0.48); }
.feedback-form { padding: 22px; }
.feedback-heading { display: flex; justify-content: space-between; gap: 16px; }
.feedback-heading h2 { font-size: 19px; }
.feedback-heading p { margin-top: 3px; color: var(--text-muted); font-size: 13px; }
.icon-button { border: 0; background: transparent; color: #64748b; font-size: 28px; line-height: 1; cursor: pointer; }
.feedback-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 18px 0; }
.feedback-options label { cursor: pointer; }
.feedback-options input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-options span { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; color: #475569; font-size: 13px; text-align: center; }
.feedback-options input:checked + span { border-color: var(--primary); background: #eef2ff; color: #304fc6; font-weight: 600; box-shadow: 0 0 0 2px rgba(74,108,247,0.1); }
.feedback-note-label { display: block; margin-bottom: 6px; color: #475569; font-size: 13px; font-weight: 600; }
.feedback-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; resize: vertical; font: inherit; outline: none; }
.feedback-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,108,247,0.08); }
.feedback-privacy { margin-top: 9px; color: var(--text-muted); font-size: 11px; }
.feedback-message { min-height: 20px; margin-top: 7px; font-size: 12px; }
.feedback-message.success { color: #15803d; }
.feedback-message.error { color: #b91c1c; }

/* 动画 */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.25s ease both; }

/* 响应式 */
@media (max-width: 520px) {
  .container { padding: 24px 16px 40px; }
  .app-header h1 { font-size: 20px; margin-bottom: 24px; }
  .feedback-options { grid-template-columns: 1fr; }
  .feedback-entry { align-items: flex-start; flex-direction: column; }
}
