/* 评论画像 — 全站样式
   规范：SPEC.md 第 5 节（深墨底、金线、衬线字；色彩写死，不另选）
   注意：CSP 禁止内联样式，所有样式只能写在本文件；动态样式用 class 切换或 SVG 属性 */

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

:root {
  --bg: #10131c;          /* 页面背景（深墨） */
  --card: #171b28;        /* 卡片背景 */
  --line: #c9a45c;        /* 卡片描边/金线 */
  --text: #ece5d3;        /* 主文字 */
  --text-dim: #9a937f;    /* 次要文字 */
  --badge-wrong: #c65b4e; /* 徽章（站错边） */
  --badge-correct: #7fae7a; /* 徽章（站对边） */
  --badge-neutral: #8b93a7; /* 徽章（求知/主观/证据不足） */
  --error: #e08a7d;       /* 错误提示 */
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 页面容器 ---------- */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px calc(40px + env(safe-area-inset-bottom));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 头部 ---------- */
.site-header {
  text-align: center;
  padding: 12px 0 20px;
}

.site-title {
  font-size: 28px;
  letter-spacing: 0.35em;
  margin-right: -0.35em; /* 抵消末字间距，保持视觉居中 */
  font-weight: 600;
}

.site-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.15em;
}

.site-header::after {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  background: var(--line);
  opacity: 0.7;
  margin: 14px auto 0;
}

/* ---------- 视图切换 ---------- */
.view[hidden] {
  display: none;
}

/* ---------- 错误条 ---------- */
.error-bar {
  background: rgba(198, 91, 78, 0.12);
  border: 1px solid rgba(198, 91, 78, 0.5);
  border-radius: 8px;
  color: var(--error);
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

/* 中性信息提示（分享解锁成功等） */
.error-bar.info {
  background: rgba(127, 174, 122, 0.1);
  border-color: rgba(127, 174, 122, 0.5);
  color: var(--badge-correct);
}

/* ---------- 页签 ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid rgba(201, 164, 92, 0.35);
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  min-height: 44px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  padding: 10px 8px;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--line);
}

.tab:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: -2px;
}

/* ---------- 输入面板 ---------- */
.panel[hidden] {
  display: none;
}

.panel {
  margin-bottom: 12px;
}

#comment-input {
  width: 100%;
  min-height: 128px;
  background: var(--card);
  border: 1px solid rgba(201, 164, 92, 0.4);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  padding: 12px;
  resize: vertical;
}

#comment-input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

#comment-input:focus {
  outline: none;
  border-color: var(--line);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  min-height: 20px;
}

.char-count {
  font-size: 13px;
  color: var(--text-dim);
  margin-left: auto;
}

.field-error {
  font-size: 13px;
  color: var(--error);
}

/* ---------- 截图面板 ---------- */
.drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 1px dashed rgba(201, 164, 92, 0.5);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  text-align: center;
}

.drop-hint {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
}

.drop-zone.dragover {
  border-color: var(--line);
  border-style: solid;
}

#image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.image-preview-box {
  text-align: center;
}

#image-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 8px;
  border: 1px solid rgba(201, 164, 92, 0.4);
  display: block;
  margin: 0 auto 8px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--line);
  font-family: inherit;
  font-size: 13px;
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.normal-disabled-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ---------- 话题 ---------- */
.topic-row {
  margin: 14px 0;
}

#topic-input {
  width: 100%;
  min-height: 44px;
  background: var(--card);
  border: 1px solid rgba(201, 164, 92, 0.4);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
}

#topic-input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

#topic-input:focus {
  outline: none;
  border-color: var(--line);
}

/* ---------- 双通道按钮 ---------- */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn-ai,
.btn-normal {
  position: relative;
  width: 100%;
  min-height: 64px;
  border-radius: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
}

.btn-ai {
  background: var(--line);
  border: 1px solid var(--line);
  color: #1a1508;
}

.btn-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.btn-sub {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

.btn-normal {
  background: transparent;
  border: 1px solid rgba(201, 164, 92, 0.55);
  color: var(--line);
}

.btn-normal .btn-sub {
  opacity: 0.7;
}

.btn-ai:disabled,
.btn-normal:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ai:focus-visible,
.btn-normal:focus-visible,
.tab:focus-visible,
button:focus-visible,
#topic-input:focus-visible,
#comment-input:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

.quota-badge {
  position: absolute;
  top: -9px;
  right: -6px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- 示例评论 ---------- */
.examples {
  margin-top: 20px;
}

.examples-title {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

.example-item {
  width: 100%;
  min-height: 44px;
  background: var(--card);
  border: 1px solid rgba(201, 164, 92, 0.3);
  border-radius: 10px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  line-height: 1.5;
}

.example-item:hover {
  border-color: var(--line);
  color: var(--text);
}

/* ---------- 显影状态 ---------- */
.reveal-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 0 40px;
}

.reveal-ring {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 2.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reveal-step {
  margin-top: 28px;
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.1em;
}

.reveal-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
}

.btn-cancel {
  margin-top: 28px;
  min-height: 44px;
  background: none;
  border: 1px solid rgba(201, 164, 92, 0.55);
  border-radius: 999px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  padding: 0 28px;
  cursor: pointer;
}

/* ---------- 结果区（区块样式） ---------- */
.result-section {
  background: var(--card);
  border: 1px solid rgba(201, 164, 92, 0.4);
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 17px;
  color: var(--line);
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 164, 92, 0.35);
}

.section-body {
  font-size: 15px;
}

/* 人格卡 */
.persona-card {
  text-align: center;
  padding: 26px 16px 22px;
}

.channel-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid rgba(154, 147, 127, 0.5);
  border-radius: 999px;
  padding: 2px 12px;
  margin-bottom: 10px;
  letter-spacing: 0.1em;
}

.type-name {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.persona-code {
  font-size: 17px;
  color: var(--line);
  letter-spacing: 0.4em;
  margin-top: 6px;
}

.persona-topic {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
}

.stance-badge {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  border-radius: 999px;
  padding: 4px 16px;
  border: 1px solid;
}

.stance-badge.correct { color: var(--badge-correct); border-color: var(--badge-correct); }
.stance-badge.wrong { color: var(--badge-wrong); border-color: var(--badge-wrong); }
.stance-badge.mixed,
.stance-badge.subjective,
.stance-badge.insufficient { color: var(--badge-neutral); border-color: var(--badge-neutral); }

/* 降级标注 */
.degraded-note {
  background: rgba(139, 147, 167, 0.12);
  border: 1px solid rgba(139, 147, 167, 0.5);
  border-radius: 10px;
  color: var(--badge-neutral);
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.6;
}

/* 分数条（SVG 实现，规避 CSP 内联样式限制） */
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.score-label {
  width: 68px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.score-track {
  flex: 1;
  height: 8px;
}

.score-value {
  width: 62px;
  flex-shrink: 0;
  text-align: right;
  font-size: 14px;
  color: var(--text);
}

.score-note {
  font-size: 13px;
  color: var(--text-dim);
  margin: 2px 0 12px 78px;
}

.confidence-line {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

/* 主张概括 */
.claim-summary {
  font-size: 15px;
  line-height: 1.7;
}

/* 论证体检 */
.check-item {
  border-left: 2px solid rgba(201, 164, 92, 0.5);
  padding: 2px 0 2px 12px;
  margin-bottom: 14px;
}

.check-quote {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 4px;
}

.check-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.check-issue {
  font-size: 12px;
  color: var(--badge-wrong);
  border: 1px solid rgba(198, 91, 78, 0.6);
  border-radius: 999px;
  padding: 1px 10px;
}

.check-severity {
  font-size: 12px;
  color: var(--badge-neutral);
  border: 1px solid rgba(139, 147, 167, 0.6);
  border-radius: 999px;
  padding: 1px 10px;
}

.check-comment {
  font-size: 14px;
}

.no-issues {
  font-size: 14px;
  color: var(--text-dim);
}

/* 锁定区块（普通版） */
.locked-section {
  text-align: center;
  padding: 22px 14px;
  opacity: 0.75;
}

.locked-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.locked-text {
  font-size: 14px;
  color: var(--text-dim);
}

/* 六维 */
.radar-box {
  display: flex;
  justify-content: center;
}

.dimension-list {
  margin-top: 12px;
}

.dimension-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  justify-content: center;
}

.dimension-name {
  width: 52px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.dimension-score {
  width: 30px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text);
}

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

/* 判词 */
.verdict-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.verdict-item {
  font-size: 19px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  padding-left: 14px;
  border-left: 2px solid var(--line);
}

/* 锋芒与软肋 */
.duo-list {
  display: flex;
  gap: 12px;
}

.duo-col {
  flex: 1;
}

.duo-title {
  font-size: 13px;
  color: var(--line);
  margin-bottom: 6px;
  letter-spacing: 0.1em;
}

.duo-item {
  font-size: 14px;
  margin-bottom: 4px;
}

/* 识别到的文字（截图模式） */
details.extracted-box {
  background: rgba(23, 27, 40, 0.6);
  border: 1px solid rgba(201, 164, 92, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

details.extracted-box summary {
  font-size: 14px;
  color: var(--line);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.extracted-text {
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 8px;
}

/* 操作区 */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.action-main-btn {
  width: 100%;
  min-height: 48px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #1a1508;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.action-ghost-btn {
  width: 100%;
  min-height: 48px;
  background: transparent;
  border: 1px solid rgba(201, 164, 92, 0.55);
  border-radius: 12px;
  color: var(--line);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.action-row {
  display: flex;
  gap: 10px;
}

.action-row .action-ghost-btn {
  flex: 1;
}

/* ---------- 解锁面板 ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
}

.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid rgba(201, 164, 92, 0.5);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  z-index: 50;
}

.sheet-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 0.06em;
}

.sheet-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(154, 147, 127, 0.15);
}

.sheet-row span:last-child {
  color: var(--text-dim);
}

.sheet-disabled {
  opacity: 0.45;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.sheet-btn {
  min-height: 46px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.sheet-btn.primary {
  background: var(--line);
  border: 1px solid var(--line);
  color: #1a1508;
  font-weight: 600;
}

.sheet-btn:not(.primary) {
  background: transparent;
  border: 1px solid rgba(201, 164, 92, 0.55);
  color: var(--line);
}

.sheet-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: auto;
  padding-top: 30px;
  text-align: center;
}

.site-footer p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.8;
}

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

/* ---------- 动效减弱 ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal-ring {
    animation: none;
    border-top-color: var(--line);
  }
}

/* ---------- 宽屏 ---------- */
@media (min-width: 560px) {
  .action-buttons {
    flex-direction: row;
  }
  .btn-ai,
  .btn-normal {
    flex: 1;
  }
}
