/* =========================================================
   一、全局基础样式
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f5f5f5;
  color: #171717;
  font-family:
    Arial,
    "Microsoft YaHei",
    "PingFang SC",
    sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

button,
textarea,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: #262626;
  color: #ffffff;
}


/* =========================================================
   二、页面布局
   ========================================================= */

.page {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}


/* =========================================================
   三、标题区域
   ========================================================= */

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #404040;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  color: #171717;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.subtitle {
  max-width: 760px;
  margin: 16px 0 0;
  color: #404040;
  line-height: 1.8;
}


/* =========================================================
   四、输入面板与结果卡片
   ========================================================= */

.panel,
.card {
  margin-bottom: 18px;
  padding: 22px;
  background: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
}

.card {
  min-width: 0;
}

.card h2 {
  margin: 0 0 16px;
  color: #171717;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.result-label {
  margin-bottom: 8px;
  font-weight: 700;
}


/* =========================================================
   五、题目输入框
   ========================================================= */

label {
  display: block;
  margin-bottom: 10px;
  color: #171717;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  resize: vertical;
  outline: none;
  background: #ffffff;
  color: #171717;
  border: 1px solid #a3a3a3;
  border-radius: 8px;
  line-height: 1.75;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

textarea::placeholder {
  color: #737373;
}

textarea:hover {
  border-color: #525252;
}

textarea:focus {
  border-color: #171717;
  box-shadow: 0 0 0 3px rgb(0 0 0 / 8%);
}

.input-help {
  margin: 8px 0 0;
  color: #737373;
  font-size: 13px;
}


/* =========================================================
   六、思考模式选择器
   ========================================================= */

.reasoning-selector {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.reasoning-selector legend {
  margin-bottom: 10px;
  font-weight: 700;
}

.reasoning-options {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);
  gap: 12px;
}

.reasoning-option {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

.reasoning-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.reasoning-option-content {
  display: block;
  min-height: 116px;
  padding: 15px 16px;
  background: #ffffff;
  border: 1px solid #a3a3a3;
  border-radius: 9px;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.reasoning-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.reasoning-title-row strong {
  color: #171717;
  font-size: 16px;
}

.reasoning-option-content small {
  display: block;
  color: #525252;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.65;
}

.reasoning-option:hover
.reasoning-option-content {
  border-color: #171717;
}

.reasoning-option input:checked
+ .reasoning-option-content {
  padding: 14px 15px;
  background: #f5f5f5;
  border: 2px solid #171717;
  box-shadow: 0 0 0 2px rgb(0 0 0 / 5%);
}

.reasoning-option input:focus-visible
+ .reasoning-option-content {
  outline: 3px solid rgb(0 0 0 / 18%);
  outline-offset: 2px;
}

.reasoning-option input:disabled
+ .reasoning-option-content {
  cursor: not-allowed;
  opacity: 0.6;
}

.mode-tag {
  padding: 2px 8px;
  color: #ffffff;
  background: #171717;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}


/* =========================================================
   七、按钮和操作区域
   ========================================================= */

.actions,
.feedback-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

button {
  min-height: 44px;
  padding: 10px 18px;
  cursor: pointer;
  background: #171717;
  color: #ffffff;
  border: 1px solid #171717;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.4;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease,
    opacity 0.2s ease;
}

button:hover:not(:disabled) {
  background: #404040;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid rgb(0 0 0 / 18%);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  background: #ffffff;
  color: #171717;
  border-color: #737373;
}

button.secondary:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #171717;
}

#statusText {
  color: #525252;
  font-size: 14px;
}

#feedbackStatus {
  min-height: 24px;
  margin: 14px 0 0;
  color: #404040;
}


/* =========================================================
   八、结果双栏布局
   ========================================================= */

.result-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(0, 1fr);
  gap: 18px;
}

.result-grid .card {
  min-width: 0;
}


/* =========================================================
   九、题型判断
   ========================================================= */

#selectedType p {
  margin: 0 0 10px;
}

#selectedType strong {
  font-size: 18px;
}

.mode-text {
  margin-top: 14px !important;
  color: #737373;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.evidence-list {
  margin: 6px 0 0;
  padding-left: 24px;
}


/* =========================================================
   十、候选题型
   ========================================================= */

.candidate {
  padding: 12px 0;
  border-bottom: 1px solid #e5e5e5;
}

.candidate:first-child {
  padding-top: 0;
}

.candidate:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.candidate strong {
  display: block;
  margin-bottom: 4px;
}

.candidate-score {
  color: #737373;
  font-size: 14px;
}


/* =========================================================
   十一、普通 LaTeX 区域
   ========================================================= */

.latex-content,
.latex-list-item {
  width: 100%;
  min-width: 0;
  padding: 4px 0;
  line-height: 1.8;
}

.latex-content {
  overflow-x: auto;
  overflow-y: hidden;
}

.latex-list-item {
  overflow-x: auto;
  overflow-y: hidden;
}

.katex {
  max-width: 100%;
  font-size: 1.08em;
}

.katex-display {
  max-width: 100%;
  margin: 10px 0;
  text-align: left;
}

.katex-display > .katex {
  display: inline-block;
  max-width: 100%;
}


/* =========================================================
   十二、本类题通法居中排版
   ========================================================= */

#generalMethod {
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  text-align: center;
}

#generalMethod .katex-display {
  width: 100%;
  max-width: 100%;
  margin: 8px auto;
  overflow: visible;
  text-align: center;
}

#generalMethod .katex-display > .katex {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}

#generalMethod .katex-html {
  max-width: 100%;
  text-align: center;
}

#generalMethod .base {
  margin-right: auto;
  margin-left: auto;
}


/* =========================================================
   十三、解题步骤排版优化
   ========================================================= */

#solutionSteps {
  width: 100%;
  margin: 0;
  padding-left: 34px;
}

#solutionSteps li {
  width: 100%;
  max-width: 100%;
  margin-bottom: 18px;
  padding: 12px 8px 16px;
  border-bottom: 1px solid #e5e5e5;
}

#solutionSteps li:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

#solutionSteps .latex-list-item {
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  text-align: center;
}

#solutionSteps .katex-display {
  width: 100%;
  max-width: 100%;
  margin: 4px auto;
  overflow: visible;
  text-align: center;
}

#solutionSteps .katex-display > .katex {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}

#solutionSteps .katex-html {
  max-width: 100%;
  text-align: center;
}

#solutionSteps .base {
  margin-right: auto;
  margin-left: auto;
}

#solutionSteps .katex {
  max-width: 100%;
  font-size: 1em;
}


/* =========================================================
   十四、最终答案
   ========================================================= */

.final-answer {
  padding: 14px 16px;
  overflow-x: auto;
  background: #fafafa;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
}

.final-answer .katex-display {
  margin: 4px 0;
  text-align: center;
}

.final-answer .katex-display > .katex {
  text-align: center;
}


/* =========================================================
   十五、列表
   ========================================================= */

ol,
ul {
  margin-top: 0;
}

li {
  margin-bottom: 12px;
  line-height: 1.75;
}

li:last-child {
  margin-bottom: 0;
}

#mistakes {
  margin-bottom: 0;
  padding-left: 26px;
}

.empty-content {
  color: #737373;
}


/* =========================================================
   十六、LaTeX 错误提示
   ========================================================= */

.latex-load-error,
.latex-render-error {
  padding: 10px;
  color: #404040;
  background: #fafafa;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
}


/* =========================================================
   十七、错误信息
   ========================================================= */

.error {
  margin-bottom: 18px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid #171717;
  border-radius: 8px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.method-policy-notice,
.diagram-status {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  background: #eff6ff;
  color: #334155;
  line-height: 1.7;
}

.method-solutions {
  display: grid;
  gap: 18px;
}

.method-solution {
  padding: 16px;
  border: 1px solid #dbe7f5;
  border-radius: 12px;
  background: #fbfdff;
}

.method-solution-title {
  margin: 0 0 12px;
  color: #17365d;
  font-size: 1.04rem;
}

.method-solution-steps {
  margin-bottom: 0;
}

.answer-diagram {
  display: block;
  width: min(100%, 900px);
  height: auto;
  margin: 8px auto 0;
  border: 1px solid #dce5f0;
  border-radius: 14px;
  background: #fff;
}


/* =========================================================
   十八、滚动条
   ========================================================= */

.latex-content::-webkit-scrollbar,
.latex-list-item::-webkit-scrollbar,
.final-answer::-webkit-scrollbar {
  height: 6px;
}

.latex-content::-webkit-scrollbar-track,
.latex-list-item::-webkit-scrollbar-track,
.final-answer::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.latex-content::-webkit-scrollbar-thumb,
.latex-list-item::-webkit-scrollbar-thumb,
.final-answer::-webkit-scrollbar-thumb {
  background: #a3a3a3;
  border-radius: 999px;
}


/*
 * 本类题通法和解题步骤不显示横向滚动条。
 */
#generalMethod::-webkit-scrollbar,
#solutionSteps .latex-list-item::-webkit-scrollbar {
  display: none;
}


/* =========================================================
   十九、平板和手机适配
   ========================================================= */

@media (max-width: 720px) {
  .page {
    width: min(100% - 24px, 960px);
    padding: 28px 0 56px;
  }

  h1 {
    font-size: 34px;
  }

  .panel,
  .card {
    padding: 18px;
  }

  .result-grid,
  .reasoning-options {
    grid-template-columns: 1fr;
  }

  .result-grid {
    gap: 0;
  }

  .reasoning-option-content {
    min-height: auto;
  }

  textarea {
    min-height: 160px;
  }

  .actions,
  .feedback-buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button,
  .feedback-buttons button {
    width: 100%;
  }

  #statusText {
    text-align: center;
  }

  #solutionSteps {
    padding-left: 26px;
  }

  #solutionSteps li {
    padding-right: 0;
    padding-left: 0;
  }

  #generalMethod .katex,
  #solutionSteps .katex {
    font-size: 0.94em;
  }

  .final-answer .katex {
    font-size: 1em;
  }
}


/* =========================================================
   二十、小屏手机适配
   ========================================================= */

@media (max-width: 420px) {
  .page {
    width: min(100% - 16px, 960px);
    padding-top: 20px;
  }

  h1 {
    font-size: 30px;
  }

  .panel,
  .card {
    padding: 15px;
  }

  textarea {
    min-height: 150px;
    padding: 12px;
  }

  #solutionSteps {
    padding-left: 22px;
  }

  #generalMethod .katex,
  #solutionSteps .katex {
    font-size: 0.86em;
  }
}


/* =========================================================
   二十一、减少动画
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}


html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

#firstReaction,
#generalMethod,
#solutionSteps,
#finalAnswer,
#mistakes,
#selectedType,
#candidateList {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden !important;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* 每一个数组元素都是真正独立的一行 */
.rich-line {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0.55rem 0;
  padding: 0;
  color: inherit;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  line-height: 1.9;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.rich-line.text-line {
  text-align: left;
}

.rich-line.center-line,
#generalMethod .rich-line,
#finalAnswer .rich-line {
  text-align: center;
}

/* 通法每一行单独居中，不再把整段拼成一个超长公式 */
#generalMethod {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  padding-inline: clamp(0.2rem, 2vw, 2rem);
}

#generalMethod .rich-line {
  margin: 0.36rem auto;
}

/* 本题解析改成重点卡片，去掉旧 ol 的机械数字 */
#solutionSteps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

#solutionSteps > li::marker {
  content: "";
}

.solution-highlight {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 1.25rem 0.35rem 1.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.solution-highlight:last-child {
  border-bottom: 0;
}

.highlight-title {
  display: block;
  width: 100%;
  margin-bottom: 0.7rem;
  color: #172033;
  font-size: clamp(1.03rem, 1.35vw, 1.2rem);
  font-weight: 700;
  line-height: 1.55;
  text-align: left;
  overflow-wrap: anywhere;
}

.highlight-body {
  width: 100%;
  max-width: 100%;
  padding-inline: clamp(0, 2vw, 1.8rem);
}

.highlight-body .text-line {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

/* 单独公式自动居中 */
.formula-line,
.math-block {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
}

.math-block {
  margin: 0.35rem auto;
  overflow: hidden !important;
}

.math-inline {
  display: inline-block;
  max-width: 100%;
  margin: 0 0.12em;
  vertical-align: -0.08em;
}

/* 禁止 KaTeX 自己生成横向滚动区域 */
.katex-display,
.katex-display > .katex,
.math-rendered,
.math-rendered .katex {
  max-width: 100%;
  overflow: hidden !important;
}

.katex-display {
  margin: 0.35rem 0 !important;
  padding: 0 !important;
}

.katex-display > .katex {
  display: inline-block;
  white-space: nowrap;
  transform-origin: center center;
}

/* app.js 会检测宽度并缩小公式；这里设置最低可读字号 */
.math-rendered {
  font-size: clamp(0.82rem, 1.55vw, 1.16rem);
  line-height: 1.55;
}

/* KaTeX 失败时不显示红色源码 */
.katex-error,
.latex-fallback {
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.list-line-content,
.evidence-list li,
#mistakes li {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.list-line-content .rich-line,
.evidence-list .rich-line,
#mistakes .rich-line {
  margin: 0.22rem 0;
  font-size: inherit;
  line-height: 1.7;
}

.empty-content {
  color: #7b8495;
}

/* 平板和手机进一步压缩留白 */
@media (max-width: 768px) {
  .rich-line {
    font-size: 1rem;
    line-height: 1.75;
  }

  .solution-highlight {
    padding: 1rem 0 1.15rem;
  }

  .highlight-body,
  #generalMethod {
    padding-inline: 0;
  }

  .math-rendered {
    font-size: 0.92rem;
  }
}


/* =========================================================
   二十二、图片识题区域
   ========================================================= */

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

.vision-upload-panel {
  margin: 0 0 22px;
  padding: 18px;
  background:
    linear-gradient(
      180deg,
      #f8fbff 0%,
      #ffffff 100%
    );
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}

.vision-upload-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.vision-upload-heading h2 {
  margin: 2px 0 6px;
  color: #172033;
  font-size: 19px;
  line-height: 1.45;
}

.vision-upload-heading p {
  margin: 0;
  color: #526076;
  font-size: 14px;
  line-height: 1.75;
}

.vision-kicker {
  color: #1d4ed8 !important;
  font-size: 12px !important;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.vision-service-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.vision-service-badge--checking {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.vision-service-badge--online {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.vision-service-badge--offline {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.vision-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.vision-action-button {
  min-width: 132px;
}

.vision-progress {
  margin-top: 14px;
}

.vision-progress-track {
  height: 6px;
  overflow: hidden;
  background: #dbeafe;
  border-radius: 999px;
}

.vision-progress-bar {
  width: 34%;
  height: 100%;
  background: #2563eb;
  border-radius: inherit;
  animation: vision-progress-move 1.3s ease-in-out infinite;
}

@keyframes vision-progress-move {
  0% {
    transform: translateX(-120%);
  }

  50% {
    transform: translateX(150%);
  }

  100% {
    transform: translateX(340%);
  }
}

.vision-status-text {
  min-height: 24px;
  margin: 10px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.65;
}

.vision-preview-section {
  margin-top: 16px;
}

.vision-preview-grid {
  display: grid;
  grid-template-columns:
    repeat(
      3,
      minmax(0, 1fr)
    );
  gap: 12px;
}

.vision-preview-card {
  min-width: 0;
  margin: 0;
  padding: 10px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
}

.vision-preview-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 150px;
  max-height: 270px;
  overflow: hidden;
  background:
    linear-gradient(
      45deg,
      #f8fafc 25%,
      #ffffff 25%,
      #ffffff 50%,
      #f8fafc 50%,
      #f8fafc 75%,
      #ffffff 75%
    );
  background-size: 18px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
}

.vision-preview-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 270px;
  object-fit: contain;
}

.vision-preview-card figcaption {
  margin-top: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.vision-recognized-panel {
  margin-top: 14px;
  padding: 15px 16px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
}

.vision-recognized-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.vision-recognized-header h3 {
  margin: 0;
  color: #172033;
  font-size: 16px;
  line-height: 1.5;
}

.vision-timing-text {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.vision-recognized-question {
  padding: 0;
  overflow: visible !important;
  color: #172033;
}

.vision-recognized-question .rich-line {
  margin: 0.35rem 0;
  font-size: 1rem;
  line-height: 1.8;
  text-align: left;
}

.vision-geometry-notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
}

.vision-warning-list {
  margin: 12px 0 0;
  padding: 10px 12px 10px 32px;
  color: #713f12;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 13px;
}

.vision-warning-list li {
  margin-bottom: 4px;
  line-height: 1.65;
}

.vision-warning-list li:last-child {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .vision-preview-grid {
    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);
  }

  .vision-preview-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .vision-upload-heading {
    flex-direction: column;
  }

  .vision-service-badge {
    align-self: flex-start;
  }

  .vision-upload-actions {
    flex-direction: column;
  }

  .vision-action-button {
    width: 100%;
  }

  .vision-preview-grid {
    grid-template-columns: 1fr;
  }

  .vision-preview-card:first-child {
    grid-column: auto;
  }

  .vision-recognized-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .vision-timing-text {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vision-progress-bar {
    animation: none;
    width: 100%;
  }
}

/* 账号、登录和历史记录 */
.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #fff;
  color: #334155;
}

.account-actions,
.login-tabs,
.sms-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.account-bar button,
.login-tabs button,
.sms-row button,
.modal-card button {
  width: auto;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.modal-card {
  position: relative;
  width: min(460px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 26px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-card--wide {
  width: min(820px, 100%);
}

.modal-card input {
  box-sizing: border-box;
  width: 100%;
  margin: 6px 0 14px;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font: inherit;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 26px;
}

.login-tabs {
  margin: 4px 0 16px;
}

.login-tabs .is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.sms-row input {
  margin-right: 4px;
}

.password-reset-box {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.password-reset-box summary {
  margin-bottom: 12px;
  cursor: pointer;
  color: #2563eb;
}

.modal-message {
  min-height: 1.4em;
  color: #b91c1c;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 14px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #f8fafc;
}

.history-item__meta {
  margin: 0 0 7px;
  color: #64748b;
  font-size: 0.88rem;
}

.history-item__question {
  margin: 0 0 10px;
  white-space: pre-wrap;
}

.teacher-override-answer {
  white-space: pre-wrap;
  line-height: 1.85;
}

@media (max-width: 640px) {
  .account-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions {
    width: 100%;
  }

  .account-actions button {
    flex: 1;
  }

  .modal-card {
    padding: 22px 18px;
  }
}
