/* App（uniapp scan-result）同款解题结果样式：答案 / 解析 / 卡片 / 练习 / 应用 / 作图。
   取值来自 App 组件（rpx ≈ 0.5px，桌面正文略放大）；暗色跟随网页 html.night，对齐 App theme-1。 */
.sovi-v4 {
  --v4-brand: #8c55f2;
  --v4-text: #000;
  --v4-muted: #aeaeb2;
  --v4-answer-bg: #f8f2ff;
  --v4-option-bg: #ffffff;
  --v4-chip-box: #fbfbff;
  --v4-index-bg: #f8f2ff;
  --v4-card-bg: #fcfcff;
  --v4-pill-bg: #f5f6fa;
  --v4-dash: #d9d9d9;
  color: var(--v4-text);
  font-size: 15px;
  line-height: 1.65;
  min-width: 0;
  overflow-wrap: anywhere;
}
html.night .sovi-v4 {
  --v4-text: #ffffff;
  --v4-answer-bg: #4b4458;
  --v4-option-bg: #2c2a31;
  --v4-chip-box: #444444;
  --v4-index-bg: #4b4458;
  --v4-card-bg: #2c2a31;
  --v4-pill-bg: #3a3840;
  --v4-dash: #55525c;
}

/* 顶部 Tab（App scan-result-tabs） */
.sovi-v4 .v4-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.sovi-v4 .v4-tab { border: 0; cursor: pointer; padding: 4px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--v4-pill-bg); color: var(--v4-text); opacity: .72; }
.sovi-v4 .v4-tab:hover { opacity: 1; color: var(--v4-brand); }

/* 区块标题（星标 + 标题）与区块分隔虚线 */
.sovi-v4 .v4-section { padding: 12px 0 14px; border-bottom: 1px dashed var(--v4-dash); }
.sovi-v4 .v4-section:last-child { border-bottom: 0; }
.sovi-v4 .v4-title { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; line-height: 1.3; }
.sovi-v4 .v4-title img { height: 17px; width: auto; }
.sovi-v4 .v4-title.v4-title-base { color: var(--v4-brand); }
html.night .sovi-v4 .v4-title.v4-title-base { color: #a777ff; }

/* 答案框（App .answer-markdown） */
.sovi-v4 .v4-answer-box { margin-top: 12px; background: var(--v4-answer-bg); border-radius: 16px; padding: 14px 16px 16px; min-height: 60px; }
.sovi-v4 .v4-answer-box, .sovi-v4 .v4-answer-box * { font-weight: 700; }
.sovi-v4 .v4-thinking { display: flex; gap: 5px; padding: 6px 2px; }
.sovi-v4 .v4-thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--v4-brand); opacity: .35; animation: v4-dot 1.2s infinite ease-in-out; }
.sovi-v4 .v4-thinking i:nth-child(2) { animation-delay: .15s; } .sovi-v4 .v4-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes v4-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

/* 选择题选项（App mcq-option / mcq-correct） */
.sovi-v4 .v4-mcq { display: block; padding: 10px 15px; background: var(--v4-option-bg); border: 1px solid var(--v4-option-bg);
  border-radius: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--v4-text); cursor: pointer; position: relative; }
.sovi-v4 .v4-mcq:last-child { margin-bottom: 0; }
.sovi-v4 .v4-mcq p { margin: 0 !important; }
.sovi-v4 .v4-mcq.v4-mcq-correct { border-color: #95e8c6; background: #ebfff7; padding-right: 50px; }
html.night .sovi-v4 .v4-mcq.v4-mcq-correct { background: #486b5b; }
.sovi-v4 .v4-mcq.v4-mcq-correct::after { content: ''; position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; background: url('/app-solve/right.png') center / 100% no-repeat; }
.sovi-v4 .v4-mcq-why { display: flex; justify-content: flex-end; margin-top: 9px; }
.sovi-v4 .v4-mcq-why span { background: #f7f7f7 url('/app-solve/why.png') 5px center / 12px no-repeat; padding: 0 9px 0 20px; height: 17px;
  line-height: 17px; border-radius: 9px; color: var(--v4-muted); font-size: 12px; font-style: italic; font-weight: 500; }
html.night .sovi-v4 .v4-mcq-why span { background-color: #242424; }

/* 填空（App blank） */
.sovi-v4 .v4-blank { border: 1px solid var(--v4-brand); border-radius: 2px; display: inline-block; color: var(--v4-brand);
  font-weight: 700; padding: 1px 4px; margin: 1px 0; line-height: 1.5; }
.sovi-v4 .v4-blank p { display: inline; margin: 0; }

/* 解析：概念卡片标签（App explanation-markdown-top / concept-item） */
.sovi-v4 .v4-concepts { margin-top: 12px; background: var(--v4-chip-box); border-radius: 8px; padding: 8px 10px; display: grid; gap: 8px; }
.sovi-v4 .v4-concepts-title { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.sovi-v4 .v4-chip { display: inline-flex; align-items: center; height: 24px; border-radius: 12px; padding: 0 9px; margin: 0 6px 6px 0;
  font-size: 12.5px; font-weight: 500; }
.sovi-v4 .v4-chip-name { text-decoration: underline; text-underline-offset: 3px; padding-right: 8px; margin-right: 8px; position: relative; }
.sovi-v4 .v4-chip-name::after { content: ''; position: absolute; right: 0; top: 3px; bottom: 3px; width: 1px; background: currentColor; }
.sovi-v4 .v4-chip svg { width: 15px; height: 15px; margin-right: 5px; flex-shrink: 0; }
.sovi-v4 .v4-chip-new { background: #f0fff4; color: #4eb45d; }
.sovi-v4 .v4-chip-novice { background: #f0f9ff; color: #62b0fd; }
.sovi-v4 .v4-chip-expert { background: #f6f0ff; color: #9f74ee; }
.sovi-v4 .v4-chip-mastered { background: #fffbe9; color: #f3ab26; }
html.night .sovi-v4 .v4-chip-new { background: #425f4a; } html.night .sovi-v4 .v4-chip-novice { background: #546674; }
html.night .sovi-v4 .v4-chip-expert { background: #54466d; } html.night .sovi-v4 .v4-chip-mastered { background: #6f684c; }

/* 解析：分步（App mode-explanation：序号圆点 + 标题 + 缩进正文） */
.sovi-v4 .v4-explanation { margin-top: 8px; }
.sovi-v4 .v4-step { margin-bottom: 10px; }
.sovi-v4 .v4-step:last-child { margin-bottom: 0; }
.sovi-v4 .v4-step-head { display: flex; align-items: baseline; }
.sovi-v4 .v4-step-index { width: 20px; height: 20px; border-radius: 50%; background: var(--v4-index-bg); color: var(--v4-brand); font-size: 11px;
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: 10px; transform: translateY(-1px); line-height: 1; }
.sovi-v4 .v4-step-head h2, .sovi-v4 .v4-step-head h3 { margin: 10px 0 5px; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--v4-text); }
.sovi-v4 .v4-step-body { padding-left: 30px; }
.sovi-v4 .v4-step-body .katex-display { text-align: left; margin: 8px 0; overflow-x: auto; overflow-y: hidden; }
.sovi-v4 .v4-step-body .katex-display > .katex { text-align: left; }

/* 卡片（App scan-result-cards：真实卡面轨道见 /app-cards/cards.css；学习计划在网页内完成） */
.sovi-v4 .v4-plan-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; height: 47px; border: 0; border-radius: 999px;
  background: #000; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: transform .12s ease, box-shadow .2s ease; box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.sovi-v4 .v4-plan-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.sovi-v4 .v4-plan-sub { margin-top: 6px; text-align: center; font-size: 12px; color: var(--v4-muted, #8a8796); }
html.night .sovi-v4 .v4-plan-btn { background: #fff; color: #000; }

/* 练习（Sovi Learn 题卡样式：圆角白卡 + 浅灰胶囊选项；答后留在网页里继续） */
.sovi-v4 .v4-practice { position: relative; margin-top: 12px; padding: 20px 18px 18px; border-radius: 22px; background: var(--v4-card-bg);
  box-shadow: 0 4px 22px rgba(40, 30, 90, .07); overflow: hidden; transition: background .3s ease, border-color .3s ease; border: 1px solid transparent; }
.sovi-v4 .v4-practice.is-correct { border-color: rgba(127, 220, 191, .7); background: radial-gradient(120% 90% at 50% 0%, #eefcf7 0%, var(--v4-card-bg) 70%); }
.sovi-v4 .v4-practice.is-wrong { border-color: rgba(246, 165, 167, .7); background: radial-gradient(120% 90% at 50% 0%, #fff6f5 0%, var(--v4-card-bg) 70%); }
.sovi-v4 .v4-practice-q { font-size: 16.5px; font-weight: 700; line-height: 1.5; margin-bottom: 14px; }
.sovi-v4 .v4-practice-q p { margin: 0; }
.sovi-v4 .v4-practice-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sovi-v4 .v4-practice-opt { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 12px 16px; border-radius: 999px; border: 2px solid transparent;
  background: var(--v4-pill-bg); color: var(--v4-text); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; transition: transform .12s ease, background .2s ease; }
.sovi-v4 .v4-practice-opt:not(:disabled):hover { background: #ece8f9; }
.sovi-v4 .v4-practice-opt:not(:disabled):active { transform: scale(.98); }
.sovi-v4 .v4-practice-opt p { margin: 0; }
.sovi-v4 .v4-practice-k { color: #8a8796; font-size: 12.5px; }
.sovi-v4 .v4-practice-opt.is-correct, .sovi-v4 .v4-practice-opt.is-answer { border-color: #7fdcbf; background: #e9fbf4; }
.sovi-v4 .v4-practice-opt.is-wrong { border-color: #f6a5a7; background: #fff1f1; animation: v4-shake .35s ease; }
.sovi-v4 .v4-practice-opt.is-correct { animation: v4-pop .4s cubic-bezier(.2,1.5,.4,1); }
@keyframes v4-pop { 50% { transform: scale(1.04); } } @keyframes v4-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sovi-v4 .v4-practice-opt img { width: 16px; height: 16px; }
.sovi-v4 .v4-practice-after { margin-top: 14px; animation: v4-rise .3s ease; }
@keyframes v4-rise { from { opacity: 0; transform: translateY(6px); } }
.sovi-v4 .v4-practice-msg { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }
.sovi-v4 .v4-practice.is-correct .v4-practice-msg { color: #2c9a7b; } .sovi-v4 .v4-practice.is-wrong .v4-practice-msg { color: #d9534f; }
.sovi-v4 .v4-practice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sovi-v4 .v4-btn-dark, .sovi-v4 .v4-btn-soft { border: 0; border-radius: 999px; padding: 10px 16px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.sovi-v4 .v4-btn-dark { background: #000; color: #fff; } .sovi-v4 .v4-btn-soft { background: var(--v4-pill-bg); color: var(--v4-text); }
html.night .sovi-v4 .v4-btn-dark { background: #fff; color: #000; }
html.night .sovi-v4 .v4-practice.is-correct { background: radial-gradient(120% 90% at 50% 0%, #173a31 0%, var(--v4-card-bg) 70%); }
html.night .sovi-v4 .v4-practice.is-wrong { background: radial-gradient(120% 90% at 50% 0%, #3d2224 0%, var(--v4-card-bg) 70%); }
html.night .sovi-v4 .v4-practice-opt.is-correct, html.night .sovi-v4 .v4-practice-opt.is-answer { background: #173a31; }
html.night .sovi-v4 .v4-practice-opt.is-wrong { background: #3d2224; }

/* 应用（App scan-result-application；点击在页内打开实验） */
.sovi-v4 .v4-application { position: relative; margin-top: 12px; aspect-ratio: 16 / 9; min-height: 200px; border-radius: 16px; padding: 14px; background: #eee center / cover no-repeat;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .12); display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.sovi-v4 .v4-application:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(40, 30, 90, .18); }
.sovi-v4 .v4-application:focus-visible { outline: 2px solid #8c55f2; outline-offset: 3px; }
html.night .sovi-v4 .v4-application { background-color: #4b4454; }
.sovi-v4 .v4-application-name { max-width: 60%; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.88); color: #1d1b26; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sovi-v4 .v4-application-try { min-width: 120px; height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: #000; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; box-shadow: inset 0 2px 4px rgba(255, 255, 255, .3); }
.sovi-v4 .v4-application-try img { width: 12px; height: 12px; }

/* 下一步（网页亮点：交互实验 / 音频 / 视频 / 闪卡） */
.sovi-v4 .v4-next { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--v4-divider, #ececf2); }
.sovi-v4 .v4-next-title { display: flex; align-items: center; gap: 6px; margin-bottom: 9px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary, #8c55f2); }
.sovi-v4 .v4-next-title svg { width: 14px; height: 14px; }
/* Even grid: two equal columns (an odd last capsule spans the row), one column when the answer
   column itself is narrow (container query; viewport fallback for old engines).
   The label wraps to two lines before it is clipped, and the full text stays in the tooltip. */
.sovi-v4 .v4-next { container-type: inline-size; }
.sovi-v4 .v4-next-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sovi-v4 .v4-next-list > .aha-capsule:last-child:nth-child(odd) { grid-column: 1 / -1; }
@container (max-width: 520px) { .sovi-v4 .v4-next-list { grid-template-columns: minmax(0, 1fr); } }
@supports not (container-type: inline-size) { @media (max-width: 600px) { .sovi-v4 .v4-next-list { grid-template-columns: minmax(0, 1fr); } } }
.sovi-v4 .v4-next .aha-capsule { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 48px; margin: 0;
  padding: 9px 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--primary, #8c55f2) 20%, var(--line, #e5e2ec));
  background: var(--card, #fff); color: var(--ink, #1d1b26); font: inherit; font-size: 13px; line-height: 1.35; text-align: start;
  cursor: pointer; box-shadow: 0 1px 2px rgba(29, 27, 38, .04); -webkit-tap-highlight-color: transparent;
  transition: transform .15s cubic-bezier(.2,1.2,.4,1), border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
.sovi-v4 .v4-next .aha-capsule-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 46%; padding: 3px 8px; border-radius: 8px;
  font-family: inherit; font-size: 11.5px; font-weight: 650; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--primary, #8c55f2) 11%, transparent); color: var(--primary-strong, #6b3fd4); }
.sovi-v4 .v4-next .aha-capsule-label { flex: 1 1 auto; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow-wrap: anywhere; word-break: normal; }
.sovi-v4 .v4-next .aha-capsule-arrow { flex: none; width: 14px; height: 14px; margin-inline-start: auto; color: var(--primary, #8c55f2); opacity: .7;
  transition: transform .15s ease, opacity .15s ease; }
.sovi-v4 .v4-next .aha-capsule:hover { border-color: color-mix(in srgb, var(--primary, #8c55f2) 55%, var(--line, #e5e2ec)); background: color-mix(in srgb, var(--primary, #8c55f2) 4%, var(--card, #fff));
  transform: translateY(-1px); box-shadow: 0 6px 16px rgba(140, 85, 242, .10); }
.sovi-v4 .v4-next .aha-capsule:hover .aha-capsule-arrow { transform: translateX(2px); opacity: 1; }
.sovi-v4 .v4-next .aha-capsule:focus { outline: none; }
.sovi-v4 .v4-next .aha-capsule:focus-visible { outline: 2px solid var(--primary, #8c55f2); outline-offset: 2px; }
[dir="rtl"] .sovi-v4 .v4-next .aha-capsule-arrow { transform: scaleX(-1); }
[dir="rtl"] .sovi-v4 .v4-next .aha-capsule:hover .aha-capsule-arrow { transform: scaleX(-1) translateX(2px); }
@media (hover: none) { .sovi-v4 .v4-next .aha-capsule:hover { transform: none; box-shadow: 0 1px 2px rgba(29, 27, 38, .04); } }
@media (prefers-reduced-motion: reduce) { .sovi-v4 .v4-next .aha-capsule, .sovi-v4 .v4-next .aha-capsule-arrow { transition: none; } .sovi-v4 .v4-next .aha-capsule:hover { transform: none; } }
.dark .sovi-v4 .v4-next .aha-capsule, [data-theme="dark"] .sovi-v4 .v4-next .aha-capsule { background: rgba(39, 39, 42, .7); color: #f4f4f5; border-color: rgba(167, 139, 250, .28); }
.dark .sovi-v4 .v4-next .aha-capsule-badge, [data-theme="dark"] .sovi-v4 .v4-next .aha-capsule-badge { color: #c4b5fd; background: rgba(139, 92, 246, .18); }

/* 作图（App graph-image：JSXGraph 渲染页 iframe） */
.sovi-v4 .v4-plot { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1 / 1; border-radius: 7px; overflow: hidden; margin-top: 10px; background: #ececef; }
.sovi-v4 .v4-plot iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.sovi-v4 .v4-plot-loading { position: absolute; inset: auto 0 0 0; padding: 10px; font-size: 12px; text-align: center; color: #6a6a6a; }

/* App math-markdown 标题：28rpx / 600，正文字体（不继承网页衬线标题样式） */
.sovi-v4 .v4-md h1, .sovi-v4 .v4-md h2, .sovi-v4 .v4-md h3, .sovi-v4 .v4-md h4 {
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.4; margin: 10px 0 6px; color: var(--v4-text); letter-spacing: 0; }
.sovi-v4 .v4-md > :first-child, .sovi-v4 .v4-md > :first-child h2 { margin-top: 0; }
.sovi-v4 .v4-md p { margin: 0 0 8px; color: var(--v4-text); }

/* 揭晓节奏（M3）：答案先落定，解析步骤按节拍跟进；仅限本次实时解答，历史记录不重播。 */
.sovi-v4 .v4-answer-box.v4-reveal { position: relative; animation: v4-reveal-in .5s cubic-bezier(.2,.9,.3,1) both; }
.sovi-v4 .v4-answer-box.v4-reveal::after { content: ''; position: absolute; inset: -1px; border-radius: 16px; pointer-events: none; box-shadow: 0 0 0 0 rgba(140,85,242,.38); animation: v4-reveal-ring .9s ease-out .15s both; }
@keyframes v4-reveal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes v4-reveal-ring { 55% { box-shadow: 0 0 0 12px rgba(140,85,242,0); } 100% { box-shadow: 0 0 0 14px rgba(140,85,242,0); } }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > * { animation: v4-reveal-step .36s ease both; }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > *:nth-child(2) { animation-delay: .07s; }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > *:nth-child(3) { animation-delay: .14s; }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > *:nth-child(4) { animation-delay: .21s; }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > *:nth-child(5) { animation-delay: .28s; }
.sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > *:nth-child(n+6) { animation-delay: .35s; }
@keyframes v4-reveal-step { from { opacity: 0; transform: translateY(7px); } }
@media (prefers-reduced-motion: reduce) {
  .sovi-v4 .v4-answer-box.v4-reveal, .sovi-v4 .v4-answer-box.v4-reveal::after,
  .sovi-v4:has(.v4-answer-box.v4-reveal) .v4-explanation > * { animation: none; }
}

/* Repeated formulas connect the answer to its derivation without changing the math. */
.sovi-v4 .v4-linked-formula { cursor: pointer; border-bottom: 1px dashed currentColor; border-radius: 3px; -webkit-tap-highlight-color: transparent; }
.sovi-v4 .v4-linked-formula:focus-visible { outline: 2px solid var(--v4-brand); outline-offset: 4px; }
.sovi-v4 .is-formula-highlight { background: #eadcff; color: #4e278b; box-shadow: 0 0 0 4px #eadcff; border-radius: 3px; }
.sovi-v4 .v4-step.is-formula-linked { box-shadow: inset 3px 0 #8c55f2; border-radius: 3px; }
.sovi-v4 .v4-formula-status { color: #694098; font-size: 12px; font-weight: 500; margin-top: 10px; }
.sovi-v4 .v4-formula-status:empty { margin-top: 0; }
.sovi-v4 .v4-mcq-why button { font: inherit; font-size: 12px; color: #686372; background: var(--v4-pill-bg); border: 0; border-radius: 999px; padding: 5px 12px; min-height: 32px; cursor: pointer; }
.sovi-v4 .v4-mcq-why button:focus-visible { outline: 2px solid var(--v4-brand); outline-offset: 2px; }
html.night .sovi-v4 .is-formula-highlight { background: #5a3c7d; color: #fff; box-shadow: 0 0 0 4px #5a3c7d; }
html.night .sovi-v4 .v4-formula-status { color: #d3b4ff; }
html.night .sovi-v4 .v4-mcq-why button { color: #e0dce9; }
