/* AI 视觉评测（作文点评 / AI 阅卷）—— 移动优先，桌面自适应 */
.ai-vision-screen {
  --av-theme: var(--accent);
  --av-theme-strong: var(--accent-strong);
  --av-theme-soft: var(--accent-soft);
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  padding: 0;
  font-size: 15px;
  line-height: 1.65;
}
.ai-vision-screen[data-theme="exam"] {
  --av-theme: #0d9488;
  --av-theme-strong: #0f766e;
  --av-theme-soft: #d8f2ee;
}

.av-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 60px 16px 96px;
}

/* 顶部标题区 */
.av-hero {
  background: linear-gradient(135deg, var(--av-theme), var(--av-theme-strong));
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.av-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.av-hero h1 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .01em;
}
.av-hero p { margin: 0; font-size: 13.5px; opacity: .92; line-height: 1.6; }

.av-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.av-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 14px;
}
.av-card-title .av-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--av-theme);
}

/* 上传区 */
.av-dropzone {
  border: 1.8px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface-sunken);
}
.av-dropzone:hover, .av-dropzone.dragging {
  border-color: var(--av-theme);
  background: var(--av-theme-soft);
}
.av-dropzone svg { width: 38px; height: 38px; color: var(--av-theme); margin-bottom: 8px; }
.av-dropzone strong { display: block; font-size: 15px; font-weight: 700; }
.av-dropzone small { display: block; color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.av-file-input { display: none; }

.av-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.av-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-sunken);
}
.av-thumb img { width: 100%; height: 100%; object-fit: cover; }
.av-thumb-remove {
  position: absolute; top: 5px; right: 5px;
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: rgba(13, 16, 32, .62);
  color: #fff;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.av-thumb-page {
  position: absolute; left: 5px; bottom: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(13, 16, 32, .62);
  color: #fff; font-size: 11px;
}

/* 年级选择 */
.av-grade-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}
.av-grade-scroll::-webkit-scrollbar { display: none; }
.av-grade {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
}
.av-grade.active {
  background: var(--av-theme);
  border-color: var(--av-theme);
  color: #fff;
  box-shadow: 0 4px 10px -3px var(--av-theme);
}

/* 按钮 */
.av-submit {
  width: 100%;
  margin-top: 18px;
  border: none;
  border-radius: 13px;
  background: var(--av-theme);
  color: #fff;
  padding: 14px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform .12s, background .2s, box-shadow .2s;
  box-shadow: 0 8px 18px -8px var(--av-theme);
}
.av-submit:hover { background: var(--av-theme-strong); }
.av-submit:active { transform: scale(.985); }
.av-submit:disabled { background: var(--faint); box-shadow: none; cursor: not-allowed; }
.av-spinner {
  width: 17px; height: 17px;
  border: 2.4px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: av-spin .8s linear infinite;
}
@keyframes av-spin { to { transform: rotate(360deg); } }

.av-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 4px;
  margin-top: 18px;
}
.av-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.av-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* 历史 */
.av-history { display: flex; flex-direction: column; gap: 10px; }
.av-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 13px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .18s, transform .12s;
}
.av-history-item:hover { border-color: var(--av-theme); }
.av-history-item:active { transform: scale(.99); }
.av-history-thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-sunken);
}
.av-history-meta { flex: 1; min-width: 0; }
.av-history-meta strong { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-history-meta small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.av-badge {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.av-badge.completed { background: var(--success-soft); color: var(--success); }
.av-badge.processing { background: var(--av-theme-soft); color: var(--av-theme); }
.av-badge.failed { background: var(--danger-soft); color: var(--danger); }

.av-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--faint);
}
.av-empty svg { width: 54px; height: 54px; margin-bottom: 10px; opacity: .7; }
.av-empty p { margin: 0; font-size: 14px; }

/* 结果详情 */
.av-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
}
.av-originals { display: grid; grid-template-columns: 1fr; gap: 10px; }
.av-original {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
}
.av-result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-top: 14px;
}
.av-md > :first-child { margin-top: 0; }
.av-md h1, .av-md h2, .av-md h3, .av-md h4 {
  line-height: 1.4;
  margin: 18px 0 8px;
  font-weight: 800;
  color: var(--ink);
}
.av-md h1 { font-size: 18px; }
.av-md h2 { font-size: 16.5px; }
.av-md h3 {
  font-size: 15px;
  padding-left: 10px;
  border-left: 3px solid var(--av-theme);
}
.av-md p { margin: 8px 0; color: var(--ink-soft); }
.av-md ul, .av-md ol { padding-left: 22px; margin: 8px 0; color: var(--ink-soft); }
.av-md li { margin: 4px 0; }
.av-md strong { color: var(--ink); }
.av-md blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--av-theme);
  background: var(--av-theme-soft);
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
}
.av-md code {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 13px;
}
.av-md table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.av-md th, .av-md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.av-md th { background: var(--surface-sunken); font-weight: 700; }
.av-md hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.av-error-box {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 12px;
}

/* 处理中骨架 */
.av-processing {
  text-align: center;
  padding: 30px 16px;
}
.av-processing .av-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--av-theme-soft);
  border-top-color: var(--av-theme);
  margin: 0 auto 14px;
  animation: av-spin .8s linear infinite;
  border-radius: 50%;
}
.av-processing strong { display: block; font-size: 15px; }
.av-processing small { display: block; color: var(--muted); margin-top: 6px; font-size: 12.5px; }

@media (min-width: 640px) {
  .av-wrap { padding: 68px 24px 80px; }
  .av-thumbs { grid-template-columns: repeat(4, 1fr); }
  .av-originals { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 结构化阅卷 / 作文增强 ========== */
/* 富文本标记 */
.rt-strong { font-weight: 800; color: #111827; }
.rt-mark { background: linear-gradient(180deg, transparent 55%, #fde68a 55%); padding: 0 2px; font-weight: 700; }
.rt-warn { color: #dc2626; font-weight: 800; }
.rt-term { color: #2563eb; font-weight: 700; }
.rt-code { background: #f1f5f9; color: #be123c; padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.rt-p { margin: 6px 0; }

/* 分数总览 */
.gx-hero { display: flex; flex-direction: column; gap: 16px; }
.gx-total { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.gx-total-num { font-size: 40px; font-weight: 900; color: #4f46e5; line-height: 1; }
.gx-total-num small { font-size: 16px; color: var(--muted); font-weight: 600; }
.gx-total-pct { font-size: 14px; font-weight: 700; color: #0d9488; background: #d8f2ee; padding: 4px 12px; border-radius: 999px; }
.gx-sections { display: flex; flex-direction: column; gap: 12px; }
.gx-section-top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px; }
.gx-section-top strong { color: #4f46e5; }
.gx-bar { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.gx-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #0d9488); }

/* 原卷标注 */
.pa-wrap { margin-top: 4px; }
.pa-hint { font-size: 12.5px; color: var(--muted); background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.pa-page { position: relative; margin-bottom: 18px; }
.pa-img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }
.pa-layer { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.pa-page-label { position: absolute; top: 8px; right: 10px; background: rgba(17,24,39,.7); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }

/* 工具栏 */
.gx-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.gx-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.gx-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.gx-btn.primary { background: #4f46e5; border-color: #4f46e5; color: #fff; }

/* 逐题卡片 */
.gx-section-head { justify-content: space-between; align-items: center; margin-top: 22px; font-size: 15px; }
.gx-section-head small { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.gq-card { margin-top: 10px; }
.gq-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gq-mark { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; font-size: 15px; font-weight: 800; border-radius: 8px; }
.gq-mark.ok { color: #16a34a; background: #dcfce7; }
.gq-mark.bad { color: #dc2626; background: #fee2e2; }
.gq-mark.circled { color: #dc2626; border: 2px solid #dc2626; border-radius: 50%; font-size: 13px; padding: 0 6px; min-width: 24px; }
.gq-type { font-size: 11.5px; color: var(--muted); background: #f1f5f9; padding: 2px 9px; border-radius: 999px; }
.gq-row { display: flex; gap: 10px; margin-top: 8px; font-size: 13.5px; }
.gq-label { flex: none; width: 64px; color: var(--muted); font-weight: 700; }
.gq-explain { margin-top: 8px; font-size: 13.5px; background: #f8fafc; border-radius: 8px; padding: 10px 12px; }
.gq-kp { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gq-kp span { font-size: 12px; color: #4338ca; background: #eef2ff; padding: 3px 10px; border-radius: 999px; }
.gx-overall { font-size: 14px; }

/* 思维导图 */
.mm-wrap { margin-top: 6px; }
.mm-center { display: inline-flex; align-items: center; gap: 8px; background: #4f46e5; color: #fff; font-weight: 800; padding: 10px 20px; border-radius: 999px; }
.mm-center svg { width: 20px; height: 20px; }
.mm-spine { width: 2px; height: 18px; background: #c7d2fe; margin: 0 auto; }
.mm-branches { display: flex; flex-wrap: wrap; gap: 12px; }
.mm-branch { flex: 1; min-width: 180px; border-radius: 12px; border: 1px solid var(--line); padding: 12px 14px; background: var(--surface); }
.mm-branch-head { font-weight: 800; margin-bottom: 8px; }
.mm-children { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 5px; }
.mm-good .mm-branch-head { color: #16a34a; }
.mm-weak .mm-branch-head { color: #dc2626; }
.mm-do .mm-branch-head { color: #2563eb; }
.mm-extra .mm-branch-head { color: #d97706; }

/* 作文分块 */
.gc-block.gc-good { border-left: 4px solid #16a34a; }
.gc-block.gc-bad { border-left: 4px solid #dc2626; }
.gc-block.gc-do { border-left: 4px solid #2563eb; }
.gc-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.gc-terms { display: flex; flex-wrap: wrap; gap: 8px; }
.gc-terms span { font-size: 12.5px; background: #f1f5f9; padding: 4px 12px; border-radius: 999px; color: #4338ca; }

@media print {
  .gx-toolbar, .pa-hint { display: none !important; }
}

/* ===================================================================
   AI 阅卷 / 作文点评 · 手机端黏土版（≤640px） · .avm- 命名空间
   拍照 / 相册双入口，多图预览，纵向卡片
   =================================================================== */
@media (max-width: 640px) {
  .ai-vision-screen {
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 28px;
    background:
      radial-gradient(120% 60% at 85% -5%, rgba(255, 224, 189, .5), transparent 60%),
      radial-gradient(90% 45% at -10% 0%, rgba(214, 234, 255, .45), transparent 55%),
      #F7F2E9;
    color: #2B2620;
  }
  .avm.av-wrap { max-width: 480px; margin: 0 auto; padding: 0 0 12px; }

  .avm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .avm-back {
    width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
    border: none; border-radius: 14px; color: #6F675C; background: #fff;
    box-shadow: 0 6px 16px rgba(168, 143, 104, .16); cursor: pointer;
  }
  .avm-back svg { width: 20px; height: 20px; }
  .avm-title { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: .3px; color: #2B2620; }

  /* 头图 */
  .avm-hero {
    position: relative; overflow: hidden; padding: 18px 18px 20px; border-radius: 24px;
    color: #fff; margin-bottom: 14px;
    background:
      radial-gradient(120% 120% at 96% -10%, rgba(255, 255, 255, .3), transparent 55%),
      linear-gradient(150deg, var(--av-theme), var(--av-theme-strong));
    box-shadow: 0 16px 32px rgba(20, 120, 110, .26);
  }
  .avm-hero::after {
    content: ""; position: absolute; right: -46px; bottom: -70px; width: 170px; height: 170px;
    border-radius: 50%; background: rgba(255, 255, 255, .12);
  }
  .avm-tag {
    display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 800;
    letter-spacing: .8px; background: rgba(255, 255, 255, .22);
  }
  .avm-hero h2 { margin: 10px 0 6px; font-size: 19px; font-weight: 800; line-height: 1.35; position: relative; z-index: 1; }
  .avm-hero p { margin: 0; font-size: 12.5px; line-height: 1.7; opacity: .92; position: relative; z-index: 1; }

  /* 分段切换 */
  .avm-tabs {
    display: flex; gap: 6px; padding: 5px; margin-bottom: 14px; border-radius: 16px;
    background: rgba(255, 255, 255, .72); box-shadow: inset 0 0 0 1px #F0E7D8;
  }
  .avm-tab {
    flex: 1; padding: 10px 8px; border: none; border-radius: 12px; background: transparent;
    font-family: inherit; font-size: 13.5px; font-weight: 700; color: #8D8377; cursor: pointer;
  }
  .avm-tab.is-on {
    color: #2B2620; background: #fff; box-shadow: 0 6px 14px rgba(168, 143, 104, .18);
  }

  /* 上传卡 */
  .avm-card {
    padding: 16px; border-radius: 24px; background: rgba(255, 253, 248, .97);
    box-shadow: 0 14px 30px rgba(168, 143, 104, .14), inset 0 1px 0 rgba(255, 255, 255, .9);
  }
  .avm-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .avm-card-head strong { font-size: 15px; font-weight: 800; color: #2B2620; }
  .avm-card-head span { font-size: 12px; color: #A79C8C; }

  .avm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .avm-act {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 18px 8px; border: none; border-radius: 18px; font-family: inherit; cursor: pointer;
    font-size: 13px; font-weight: 800; color: #2B2620; background: #FBF6EE;
    box-shadow: inset 0 0 0 1px #F0E6D6;
  }
  .avm-act:active { transform: translateY(1px); }
  .avm-act-ic {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(160deg, var(--av-theme), var(--av-theme-strong));
    box-shadow: 0 8px 18px rgba(13, 148, 136, .28);
  }
  .avm-act-ic svg { width: 22px; height: 22px; }
  .avm-album .avm-act-ic {
    background: linear-gradient(160deg, #FFC98A, #F49B4B); box-shadow: 0 8px 18px rgba(240, 145, 58, .3);
  }

  /* 缩略图 */
  .avm-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 12px; }
  .avm-thumb, .avm-thumb-add {
    position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
    background: #FBF6EE; box-shadow: inset 0 0 0 1px #F0E6D6;
  }
  .avm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .avm-thumb-page {
    position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px;
    font-size: 10.5px; font-weight: 700; color: #fff; background: rgba(43, 38, 32, .55);
  }
  .avm-thumb-remove {
    position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border: none; border-radius: 50%;
    background: rgba(43, 38, 32, .55); color: #fff; font-size: 14px; line-height: 1; cursor: pointer;
  }
  .avm-thumb-add {
    border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: #A08F79; font-family: inherit; font-size: 11.5px; cursor: pointer; background: #FCF8F1;
    box-shadow: inset 0 0 0 1.5px #E9DCC6;
  }
  .avm-thumb-add svg { width: 20px; height: 20px; }

  /* 年级 */
  .avm-sub-title { margin: 16px 2px 8px; font-size: 13px; font-weight: 800; color: #2B2620; }
  .avm-grades { display: flex; flex-wrap: wrap; gap: 8px; }
  .avm-grade {
    padding: 7px 13px; border: none; border-radius: 999px; font-family: inherit; font-size: 12.5px;
    font-weight: 700; color: #857B6D; background: #F5EEE2; cursor: pointer;
  }
  .avm-grade.is-on { color: #fff; background: linear-gradient(160deg, var(--av-theme), var(--av-theme-strong)); }

  /* 提交 */
  .avm-submit {
    width: 100%; margin-top: 16px; padding: 14px; border: none; border-radius: 16px;
    font-family: inherit; font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
    background: linear-gradient(180deg, #FFB25C, #F4913A); box-shadow: 0 10px 22px rgba(240, 145, 58, .3);
  }
  .avm-submit:disabled {
    background: #EDE5D8; color: #B3A996; box-shadow: none; cursor: not-allowed;
  }
  .avm-hint { margin: 10px 2px 0; font-size: 11.5px; line-height: 1.6; color: #ABA192; text-align: center; }

  /* 历史 & 详情沿用通用卡片，统一圆角与底色 */
  .avm .av-card {
    margin-top: 12px; border-radius: 24px; background: rgba(255, 253, 248, .97);
    box-shadow: 0 14px 30px rgba(168, 143, 104, .14); padding: 14px;
  }
  .avm .av-card:first-of-type { margin-top: 0; }
  .avm .av-card-title { font-size: 14.5px; }
  .avm .av-history-item { border-radius: 16px; background: #FBF6EE; }
  .avm .av-detail-back { border-radius: 999px; }
  .avm .av-error-box { border-radius: 14px; }
}

@media (max-width: 640px) {
  .avm-empty { margin: 14px 2px 0; font-size: 12.5px; color: #ABA192; text-align: center; }
}
