/* ==========================================================================
   大衍堂 · 数学思维解构
   设计基调：HarmonyOS / 华为风格 —— 浅灰底、白卡、细线、单一品牌蓝、胶囊控件
   ========================================================================== */

:root{
  --hw-blue:#0A59F7;
  --hw-blue-strong:#0848D0;
  --hw-blue-soft:#EAF1FF;
  --hw-blue-line:#D8E7FF;
  --bg:#F1F3F5;
  --card:#FFFFFF;
  --ink:#182431;
  --ink-2:#3B4654;
  --sub:#5E6875;
  --muted:#8D959F;
  --line:#E8EAED;
  --line-soft:#EEF0F2;
  --radius-lg:26px;
  --radius-md:18px;
  --radius-sm:12px;
  --shadow-card:0 10px 34px rgba(20,35,50,.06);
  --font:-apple-system,BlinkMacSystemFont,"HarmonyOS Sans SC","HarmonyOS Sans","PingFang SC","Microsoft YaHei",sans-serif;
}

*{box-sizing:border-box}
html{height:100%;font-size:16px;-webkit-text-size-adjust:100%}
body{
  min-height:100%;margin:0;background:var(--bg);color:var(--ink);font:16px/1.65 var(--font);
  -webkit-font-smoothing:antialiased;
}
body:has(.result-screen:not(.hidden)){background:var(--bg)}
button,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
button:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid #7DA9FF;outline-offset:3px}
button:disabled{opacity:.4;cursor:default}
.hidden{display:none!important}

/* ---------- 顶栏 ---------- */
.header{
  position:sticky;top:0;z-index:30;height:64px;display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding-inline:clamp(18px,4vw,56px);background:rgba(255,255,255,.86);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  border-bottom:1px solid var(--line);
}
.brand{border:0;background:none;display:flex;align-items:center;gap:11px;text-align:left;padding:0}
.brand-mark{width:36px;height:36px;display:grid;place-items:center;border-radius:11px;background:var(--hw-blue);color:#fff;box-shadow:0 4px 12px rgba(10,89,247,.22)}
.brand-mark svg{width:24px;height:24px}
.brand strong,.brand small{display:block;line-height:1.15}
.brand strong{font-size:17px;font-weight:700;letter-spacing:.06em;color:var(--ink)}
.brand small{margin-top:3px;color:var(--muted);font-size:10px;letter-spacing:.06em}
.header-actions{display:flex;align-items:center;gap:6px;white-space:nowrap}
.ghost{background:none;border:0;color:var(--sub);padding:8px 12px;border-radius:999px;font-size:14px;font-weight:500;transition:background .18s,color .18s}
.ghost:hover{background:#F1F3F5;color:var(--ink)}
.ghost.small{padding:4px 10px;font-size:12px}
.api-state{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px;padding-right:8px}
.api-state:before{content:"";width:6px;height:6px;background:#D0A24C;border-radius:50%;box-shadow:0 0 0 3px rgba(208,162,76,.14)}
.api-state.ready:before{background:#2FA673;box-shadow:0 0 0 3px rgba(47,166,115,.14)}

/* ---------- 首页 ---------- */
.main{width:100%}
.input-screen{
  max-width:1180px;margin:0 auto;width:100%;
  min-height:calc(100dvh - 64px);padding:clamp(28px,5vh,56px) clamp(18px,4vw,56px) 40px;
  display:flex;flex-direction:column;justify-content:center;
}
.hero{display:grid;grid-template-columns:1.02fr .98fr;gap:clamp(32px,5vw,76px);align-items:center;width:100%}
.eyebrow{display:inline-flex;align-items:center;gap:8px;color:var(--hw-blue);font-size:12px;font-weight:650;letter-spacing:.1em}
.eyebrow:before{content:"";width:16px;height:2px;border-radius:2px;background:var(--hw-blue)}
.hero-copy h1{
  font-size:clamp(36px,4.6vw,56px);line-height:1.14;letter-spacing:-.035em;margin:14px 0 16px;font-weight:750;color:var(--ink);
}
.hero-copy h1 em{font-style:normal;color:var(--hw-blue)}
.hero-lead{margin:0;color:var(--sub);font-size:15.5px;line-height:1.85;max-width:34em}
.hero-points{list-style:none;margin:32px 0 0;padding:0;display:flex;flex-direction:column;gap:16px}
.hero-points li{display:flex;align-items:center;gap:13px}
.point-icon{width:38px;height:38px;flex-shrink:0;display:grid;place-items:center;border-radius:12px;background:var(--hw-blue-soft);color:var(--hw-blue)}
.point-icon svg{width:21px;height:21px}
.hero-points strong{display:block;font-size:14.5px;font-weight:650;color:var(--ink)}
.hero-points small{display:block;font-size:12.5px;color:var(--muted);margin-top:1px}

/* ---------- 输入卡 ---------- */
.editor{
  background:var(--card);border:1px solid var(--line);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-card);padding:22px;display:flex;flex-direction:column;gap:12px;min-width:0;
  transition:border-color .2s,box-shadow .2s;
}
.editor.drag{border-color:#9FC3FF;box-shadow:0 0 0 4px rgba(10,89,247,.08)}
.editor-top{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:22px}
.editor-top label{font-size:15px;font-weight:650;color:var(--ink)}
.editor-top-right{display:flex;align-items:center;gap:12px}
.editor-top .text-action{font-size:12.5px;padding:0}
.editor-hint{font-size:12px;color:var(--muted);letter-spacing:.02em}
.editor-area{
  min-height:0;height:clamp(180px,26dvh,262px);width:100%;overflow:hidden;
  background:#F7F8FA;border:1px solid transparent;border-radius:var(--radius-md);transition:background .2s,border-color .2s;
}
.editor-area:focus-within{background:#fff;border-color:var(--hw-blue-line)}
.editor textarea,.math-preview{
  border:0;outline:none!important;padding:16px 18px;background:transparent;width:100%;height:100%;
  font-size:16px;line-height:1.9;resize:none;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;
}
.editor textarea::placeholder{color:#A3ABB5;line-height:1.9}
.math-preview{color:var(--ink-2)}
.math-preview mjx-container{max-width:100%}
.image-row{display:flex;gap:10px;align-items:center;padding:8px 10px;border-radius:14px;background:#F7F8FA;border:1px solid var(--line-soft)}
.image-row img{width:38px;height:38px;object-fit:cover;border-radius:8px}
.image-row>div{flex:1;min-width:0}
.image-row strong,.image-row small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}
.image-row strong{font-size:12.5px;font-weight:600}
.image-row small{font-size:11.5px;color:var(--muted)}
.message{font-size:13px;padding:9px 12px;background:#FFF1F1;color:#B23A3A;border-radius:10px;line-height:1.6}
.message.info{color:#215EAE;background:var(--hw-blue-soft)}
.editor-bottom{display:flex;flex-direction:column;gap:9px;margin-top:10px}
.upload-primary{
  display:flex;align-items:center;gap:11px;width:100%;
  padding:9px 14px;border:1px solid rgba(31,111,235,.22);border-radius:14px;
  background:linear-gradient(180deg,#f2f7ff,#e8f1ff);color:#1d4ed8;text-align:left;cursor:pointer;
  transition:background .18s,border-color .18s,box-shadow .18s,transform .18s;
}
.upload-primary:hover{background:#e2edff;border-color:rgba(31,111,235,.38);box-shadow:0 4px 14px rgba(31,111,235,.12)}
.upload-primary:active{transform:translateY(1px)}
.upload-primary-icon{
  width:40px;height:40px;flex:none;border-radius:11px;background:#fff;
  display:grid;place-items:center;color:#1f6feb;box-shadow:0 1px 3px rgba(16,40,80,.12);
}
.upload-primary-icon svg{width:21px;height:21px}
.upload-primary-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.upload-primary-copy b{font-size:14.5px;font-weight:650;color:#17408f}
.upload-primary-copy small{font-size:11.5px;color:#5a6d86;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.upload-primary-arrow{margin-left:auto;font-size:16px;color:#1f6feb;flex:none}
.editor-bottom .primary{width:100%;min-height:48px}
.upload,.secondary,select{
  background:#fff;border:1px solid #E1E5E9;border-radius:999px;height:44px;padding:0 17px;
  color:var(--ink-2);font-size:14px;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:7px;
  transition:background .18s,border-color .18s,color .18s;
}
.upload{background:#F4F6F8;border-color:transparent;color:#2C3A4A}
.upload:hover{background:#EDF0F3}
.upload svg{width:18px;height:18px;color:var(--hw-blue)}
select{padding-inline:14px 34px;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238D959F' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;background-size:11px}
.secondary:hover{background:#F7F8FA}
.primary{
  border:0;background:var(--hw-blue);border-radius:999px;color:#fff;min-height:46px;padding:0 24px;
  font-size:15px;font-weight:650;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  box-shadow:0 6px 16px rgba(10,89,247,.22);transition:background .18s,transform .18s,box-shadow .18s;
}
.primary:hover{background:var(--hw-blue-strong);box-shadow:0 8px 20px rgba(10,89,247,.26)}
.primary:active{transform:translateY(1px)}
.primary span{font-size:14px;opacity:.85}
.resume-link{align-self:center;background:none;border:0;color:var(--hw-blue);font-size:13px;font-weight:600;padding:14px 0 0}

/* 输入区展开态（粘贴长题 / 上传图片后） */
.input-screen.has-problem{max-width:1120px;justify-content:flex-start;padding-top:clamp(14px,2.5vh,28px)}
.input-screen.has-problem .hero{grid-template-columns:1fr;gap:0}
.input-screen.has-problem .hero-copy{display:none}
.input-screen.has-problem .editor{padding:20px 22px 20px;box-shadow:none}
.input-screen.has-problem .editor-area{height:auto;min-height:clamp(220px,52dvh,520px);overflow:visible;background:#F9FAFB}
.input-screen.has-problem .math-preview{height:auto;min-height:inherit;overflow:visible;padding:20px clamp(16px,2.4vw,32px);font-size:clamp(16px,1.3vw,19px);line-height:1.9}
.input-screen.has-problem .math-preview mjx-container[display="true"]{overflow-x:auto;overflow-y:hidden;max-width:100%}
.input-screen.has-problem .editor textarea{height:auto;min-height:inherit;overflow:visible;padding:18px 20px}

/* ---------- 结果页 ---------- */
.result-screen{
  max-width:1080px;margin:0 auto;width:100%;
  padding:clamp(20px,3vw,34px) clamp(16px,4vw,40px) 48px;
}
.result-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:24px}
.result-title-group{min-width:0}
.result-title-group .eyebrow:before{display:none}
.result-title-group h1{
  font-size:clamp(23px,2.6vw,34px);line-height:1.32;letter-spacing:-.022em;margin:7px 0 13px;font-weight:720;color:var(--ink);
}
.result-meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px}
.tags{display:flex;flex-wrap:wrap;gap:6px}
.tag{
  display:inline-flex;align-items:center;font-size:12px;padding:5px 11px;border-radius:999px;
  color:#3D4A57;background:#fff;border:1px solid var(--line);font-weight:500;line-height:1.3;
}
.original{margin:0;display:block}
.original summary{display:inline-flex;align-items:center;gap:5px;list-style:none;cursor:pointer;font-size:12.5px;font-weight:600;color:var(--hw-blue);padding:5px 11px;border-radius:999px;background:var(--hw-blue-soft);line-height:1.3}
.original summary::-webkit-details-marker{display:none}
.original[open] summary{background:#DCE9FF}
.original[open]{flex-basis:100%}
.original #currentProblem{
  margin-top:10px;background:#fff;border:1px solid var(--line);border-radius:14px;
  padding:14px 16px;font-size:15px;line-height:1.85;color:var(--ink-2);white-space:pre-wrap;overflow-wrap:anywhere;
}
.result-actions{display:flex;flex-direction:column;align-items:flex-end;gap:10px;flex-shrink:0}
.action-row{display:flex;gap:8px;align-items:center}
.secondary.accent{color:var(--hw-blue);border-color:var(--hw-blue-line);background:var(--hw-blue-soft)}
.secondary.accent:hover{background:#DCE9FF}
.answer-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:11px 16px;min-width:150px;box-shadow:0 6px 18px rgba(20,35,50,.05)}
.answer-card small{display:block;font-size:11px;color:var(--muted);letter-spacing:.06em;margin-bottom:3px}
.answer-card #answerBody{font-size:16px;font-weight:650;color:var(--hw-blue);line-height:1.6}
.result-actions .secondary{height:40px;font-size:13.5px;background:#fff}

/* 顶部步骤导航 */
.step-bar{
  position:sticky;top:76px;z-index:20;margin-bottom:16px;padding:9px 12px;
  background:rgba(255,255,255,.94);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  border:1px solid var(--line);border-radius:20px;box-shadow:0 8px 24px rgba(20,35,50,.05);
}
.step-bar-top{display:flex;align-items:center;gap:12px}
.layer-tabs{display:flex;flex:1;gap:4px;min-width:0}
.layer-tabs button{
  flex:1;min-width:0;display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:9px;text-align:left;
  border:0;background:transparent;border-radius:12px;padding:8px 10px;color:#55606C;font-size:14px;font-weight:600;
  transition:background .18s,color .18s;
}
.layer-tabs button:hover{background:#F7F8FA}
.layer-tabs .step-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.layer-tabs .step-index{
  width:28px;height:28px;border-radius:9px;display:grid;place-items:center;
  background:#F1F3F5;color:#8A939D;font-size:12px;font-weight:700;transition:background .18s,color .18s;
}
.layer-tabs button.done .step-index{background:var(--hw-blue-soft);color:var(--hw-blue)}
.layer-tabs button.active{background:#F2F6FF;color:var(--hw-blue)}
.layer-tabs button.active .step-index{background:var(--hw-blue);color:#fff;box-shadow:0 4px 10px rgba(10,89,247,.25)}
.step-count{font-size:12px;color:var(--muted);white-space:nowrap;padding-right:6px;letter-spacing:.03em}
.report-banner{
  position:sticky;top:76px;z-index:20;margin-bottom:16px;padding:14px 18px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px;font-weight:650;color:var(--ink-2);
  background:rgba(255,255,255,.94);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  border:1px solid var(--line);border-radius:20px;box-shadow:0 8px 24px rgba(20,35,50,.05);
}
.report-banner-label:before{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:var(--hw-blue);margin-right:8px;vertical-align:2px}
.report-banner-hint{font-size:12px;font-weight:500;color:var(--muted)}

.study-main{min-width:0;width:100%;display:flex;flex-direction:column;gap:14px}
.result-body{background:var(--card);border:1px solid var(--line);border-radius:var(--radius-lg);overflow:hidden}
.analysis-paper{width:100%;padding:clamp(26px,3.2vw,48px) clamp(20px,4.4vw,54px);overflow-wrap:anywhere}

/* 步骤头 */
.section-head{display:flex;align-items:flex-start;gap:18px;margin-bottom:24px}
.section-no{
  width:52px;height:52px;flex-shrink:0;border-radius:16px;display:grid;place-items:center;
  background:var(--hw-blue-soft);color:var(--hw-blue);font-size:17px;font-weight:750;letter-spacing:-.02em;
}
.section-head-text{min-width:0;padding-top:2px}
.section-kicker{font-size:11.5px;font-weight:650;letter-spacing:.12em;color:var(--muted);margin:0 0 6px}
.case-heading{font-size:clamp(24px,2.7vw,31px);line-height:1.42;font-weight:720;letter-spacing:-.02em;margin:0;color:var(--ink)}

/* 要点块 */
.block-list{display:flex;flex-direction:column}
.study-block{display:grid;grid-template-columns:36px minmax(0,1fr);gap:16px;padding:26px 0;border-top:1px solid var(--line-soft)}
.block-list>.study-block:first-child{border-top:0;padding-top:2px}
.block-no{
  width:32px;height:24px;border-radius:8px;background:#F1F3F5;color:#7C8794;
  display:grid;place-items:center;font-size:11.5px;font-weight:700;margin-top:3px;letter-spacing:.02em;
}
.block-body{min-width:0}
.case-subheading{font-size:18px;font-weight:650;line-height:1.55;margin:0 0 10px;color:#1C2937;letter-spacing:-.01em}
.case-paragraph{font-size:17px;line-height:2;color:var(--ink-2);margin:0 0 14px;white-space:pre-line;letter-spacing:.006em}
.case-paragraph:last-child{margin-bottom:0}
.para-step{color:var(--hw-blue);font-weight:650;margin-right:2px}
.case-paragraph mjx-container[display="true"]{
  max-width:100%;overflow-x:auto;overflow-y:hidden;margin:12px 0!important;
  background:#F7F9FC;border:1px solid var(--line-soft);border-radius:12px;padding:12px 16px;
}

/* 关键洞察 */
.case-insight{
  margin:30px 0 4px;padding:20px 24px;border-radius:18px;font-style:normal;
  background:linear-gradient(135deg,#EDF4FF 0%,#F7FAFF 78%);border:1px solid var(--hw-blue-line);
}
.insight-tag{display:block;font-size:11px;font-weight:700;letter-spacing:.14em;color:var(--hw-blue);margin-bottom:7px}
.case-insight p{margin:0;font-size:16.5px;font-weight:600;line-height:1.95;color:#17427F}

/* 报告模式 */
.report-mark{font-size:12px;font-weight:650;letter-spacing:.14em;color:var(--hw-blue);margin-bottom:14px}
.case-section+.case-section{margin-top:40px;padding-top:40px;border-top:1px solid var(--line)}
.report .case-section{padding-top:32px}
.report .case-section:first-of-type{padding-top:0;border-top:0}

/* 通用内容元素 */
.layer-kicker{font-size:11px;font-weight:650;letter-spacing:.12em;color:var(--muted)}
.layer-section h2{font-size:24px;line-height:1.4;margin:6px 0 10px;font-weight:720}
.layer-purpose{font-size:14px;color:var(--sub);margin:0 0 12px}
.layer-summary{border-left:3px solid #9FC3FF;padding-left:14px;line-height:1.85;font-size:17px;margin:12px 0 16px;font-weight:500;color:var(--ink-2)}
.report p{font-size:16px;line-height:1.95;color:var(--ink-2);white-space:pre-wrap;margin:0 0 12px}
.labeled{margin:14px 0}
.labeled b{display:block;color:var(--muted);font-size:12px;letter-spacing:.04em;margin-bottom:4px;font-weight:600}
.labeled p{font-size:15.5px;line-height:1.85;white-space:pre-wrap;margin:0;color:var(--ink-2)}
.section-heading{font-size:15px;font-weight:650;margin:20px 0 8px;color:#232F3B}
.body-list{padding-left:21px;margin:6px 0;font-size:15.5px;line-height:1.9;color:var(--ink-2)}
.body-list li{margin:4px 0}
.extra{border:1px solid var(--line);border-radius:14px;margin:16px 0;padding:2px 16px;background:#FAFBFC}
.extra summary{padding:12px 0;color:#3D4A57;font-size:13.5px;font-weight:650;cursor:pointer}
.extra>div,.extra>section{padding:0 0 14px}
.extra h3{font-size:16px;margin:8px 0}
.extra .labeled p{font-size:14.5px}
.tree-item{padding:10px 0 10px calc(var(--indent,0)*12px);border-bottom:1px solid var(--line-soft)}
.tree-item strong{font-size:15px}
.tree-item p{font-size:14px;color:var(--sub);margin:3px 0}
.text-action{background:none;border:0;color:var(--hw-blue);font-size:13px;font-weight:600;padding:3px 0}
.transfer{border-bottom:1px solid var(--line-soft);padding:14px 0}
.task{font-size:16px;margin:8px 0;line-height:1.85}
.hint{font-size:13px;margin-bottom:8px}
.hint summary{color:var(--sub);cursor:pointer}
.practice-input{width:100%;border:1px solid #E1E5E9;background:#fff;border-radius:12px;padding:10px 12px;min-height:76px;font-size:14px;resize:vertical;margin:6px 0}
.feedback{background:#EDF8F2;padding:10px 12px;margin:8px 0;border-radius:10px;font-size:14px;white-space:pre-wrap;color:#2C6A4C}
.report-step{border-top:1px solid var(--line-soft);padding:18px 0}
.report-step h3{font-size:19px;margin:4px 0 10px}
.report-step h4{font-size:15px;color:var(--sub);margin:14px 0 6px}
.checks .labeled p{font-size:14.5px}

/* 底部步骤条 */
.result-bottom{
  display:flex;align-items:center;gap:12px;background:#fff;border:1px solid var(--line);
  border-radius:20px;padding:12px 16px;
}
.result-bottom .secondary{padding:0 18px;height:42px;font-size:13.5px}
.step-buttons{margin-left:auto;display:flex;gap:8px}
.result-bottom .primary{min-height:42px;padding:0 20px;font-size:14px}
#backButton{max-width:42%;white-space:nowrap}
#resultMessage{margin:0 2px 12px;max-width:1240px}

/* ---------- 加载态 ---------- */
.loading{position:fixed;inset:0;z-index:80;display:grid;place-items:center;padding:20px;background:linear-gradient(180deg,#f8fafc 0%,#eef3fa 58%,#e9f0f9 100%);opacity:1;transition:opacity .26s ease}
.loading.entering{opacity:0}
.loading.leaving{opacity:0;pointer-events:none}
.loading-card{
  width:min(440px,100%);background:#fff;text-align:center;padding:36px 32px 30px;border-radius:28px;
  border:1px solid var(--line);box-shadow:0 28px 90px rgba(20,35,50,.16);
  animation:cardIn .38s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes cardIn{from{opacity:0;transform:translateY(10px) scale(.98)}to{opacity:1;transform:none}}
.loading-spinner{position:relative;width:112px;height:112px;margin:0 auto 22px;display:grid;place-items:center}
.loading-spinner:before{
  content:"";position:absolute;inset:0;border-radius:50%;
  background:conic-gradient(from 0deg,#0A59F7 0%,#9FC3FF 42%,#E6EFFC 72%,#E6EFFC 100%);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 7px),#000 calc(100% - 6px));
  mask:radial-gradient(farthest-side,transparent calc(100% - 7px),#000 calc(100% - 6px));
  animation:spin 1.8s linear infinite;
}
.loading-spinner:after{
  content:"";position:absolute;inset:12px;border-radius:50%;
  border:1px dashed rgba(10,89,247,.22);animation:spin 9s linear infinite reverse;
}
.core-symbol{
  position:relative;width:58px;height:58px;border-radius:18px;display:grid;place-items:center;
  background:var(--hw-blue-soft);color:var(--hw-blue);font-size:24px;font-weight:700;animation:breathe 2.4s ease-in-out infinite;
}
.loading h2{font-size:20px;line-height:1.35;margin:10px 0 4px;font-weight:700}
.loading p{font-size:13.5px;color:var(--sub);margin:0 0 20px}
.loading-stages{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;text-align:left}
.loading-stages span{padding:9px 11px;background:#F5F7F9;color:#8B95A0;border-radius:10px;font-size:12px;display:flex;align-items:center;gap:7px}
.loading-stages span:before{content:"";width:5px;height:5px;border-radius:50%;background:#CBD1D8}
.loading-stages span.active{color:var(--hw-blue);background:var(--hw-blue-soft);font-weight:650}
.loading-stages span.active:before{background:var(--hw-blue)}
.loading-track{height:4px;overflow:hidden;background:#EDF0F3;border-radius:999px;margin:20px 0 10px}
.loading-track span{display:block;width:32%;height:100%;border-radius:999px;background:linear-gradient(90deg,#7FB0FF,var(--hw-blue));animation:sweep 2.2s ease-in-out infinite}
.loading small{color:var(--muted);font-size:11.5px;letter-spacing:.02em}

/* ---------- 弹窗 ---------- */
dialog{width:min(520px,calc(100% - 24px));border:1px solid var(--line);border-radius:24px;padding:26px;color:var(--ink);box-shadow:0 24px 80px rgba(20,35,50,.18)}
dialog::backdrop{background:rgba(18,32,48,.36);backdrop-filter:blur(4px)}
.dialog-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.dialog-head h2{margin:0;font-size:23px;font-weight:700}
dialog p,dialog li{font-size:15.5px;line-height:1.9;color:var(--ink-2)}
dialog ol{padding-left:22px}
dialog li{margin:9px 0}
dialog .secondary{height:42px;margin-top:8px}

/* ---------- 响应式 ---------- */
@media (max-width:1024px){
  .hero{gap:36px}
}

@media (max-width:900px){
  .layer-tabs button{grid-template-columns:26px minmax(0,1fr);gap:8px;padding:8px;font-size:13px}
  .layer-tabs .step-index{width:26px;height:26px;border-radius:8px}
  .analysis-paper{padding:26px 22px}
}

@media (max-width:760px){
  .hero{grid-template-columns:1fr;gap:24px}
  .input-screen{justify-content:flex-start;padding-top:clamp(24px,5vh,40px)}
  .hero-copy h1{font-size:clamp(31px,8.4vw,40px);margin:12px 0 12px}
  .hero-lead{font-size:14.5px}
  .hero-points{display:none}
  .hero-copy{margin-bottom:2px}
}

@media (max-width:640px){
  .header{height:58px;padding-inline:16px}
  .brand-mark{width:32px;height:32px;border-radius:10px}
  .brand-mark svg{width:21px;height:21px}
  .brand strong{font-size:15.5px}
  .brand small{font-size:9.5px}
  .header-actions{gap:2px}
  .ghost{padding:7px 9px;font-size:13px}
  .api-state{font-size:11px;padding-right:4px}
  .input-screen{min-height:calc(100dvh - 58px);padding:clamp(18px,4vh,30px) 16px 22px}
  .eyebrow{font-size:11px}
  .editor{padding:16px;border-radius:20px;gap:10px}
  .editor-area{height:clamp(142px,24dvh,210px);border-radius:14px}
  .editor textarea,.math-preview{padding:13px 14px}
  .editor-bottom{gap:8px}
  .upload-primary{min-height:60px;padding:9px 12px}
  .upload-primary-copy b{font-size:14px}
  .upload-primary-copy small{font-size:11px}
  .primary{width:100%;min-height:48px}
  .input-screen.has-problem{max-width:none;padding:12px 12px 18px}
  .input-screen.has-problem .editor{padding:14px 14px 16px;border-radius:18px}
  .input-screen.has-problem .editor-area{min-height:clamp(180px,42dvh,420px)}
  .input-screen.has-problem .math-preview{padding:15px 13px;font-size:16px}
  .input-screen.has-problem .editor textarea{padding:13px;font-size:16px}
  .input-screen.has-problem .editor-bottom{gap:8px}

  .result-screen{padding:16px 12px 32px}
  .result-head{flex-direction:column;gap:12px;margin-bottom:16px}
  .result-title-group h1{font-size:22px;margin:5px 0 10px}
  .result-actions{flex-direction:column;align-items:stretch;justify-content:flex-start;width:100%;gap:8px}
  .answer-card{min-width:0;padding:9px 13px;border-radius:14px}
  .answer-card #answerBody{font-size:14.5px}
  .action-row{justify-content:flex-end}
  .result-actions .secondary{height:38px;padding:0 14px}
  .tag{font-size:11px;padding:4px 9px}
  .step-bar{top:66px;border-radius:16px;padding:7px 8px 8px}
  .step-bar-top{gap:8px}
  .layer-tabs{gap:2px;overflow-x:auto;scrollbar-width:none}
  .layer-tabs::-webkit-scrollbar{display:none}
  .layer-tabs button{flex:0 0 auto;grid-template-columns:22px auto;gap:7px;padding:7px 10px 7px 7px;border-radius:999px;font-size:12.5px;background:#F5F7F9}
  .layer-tabs button.active{background:var(--hw-blue-soft)}
  .layer-tabs .step-index{width:22px;height:22px;border-radius:50%;font-size:10.5px;background:#E9EDF1}
  .step-count{display:none}
  .report-banner{top:66px;border-radius:16px;padding:12px 14px;font-size:12.5px}
  .result-body{border-radius:20px}
  .analysis-paper{padding:24px 18px}
  .section-head{gap:12px;margin-bottom:18px}
  .section-no{width:44px;height:44px;border-radius:14px;font-size:15px}
  .section-kicker{font-size:10.5px}
  .case-heading{font-size:22px;line-height:1.45}
  .study-block{grid-template-columns:28px minmax(0,1fr);gap:11px;padding:22px 0}
  .block-no{width:28px;height:22px;font-size:10.5px}
  .case-subheading{font-size:17px}
  .case-paragraph,.report p{font-size:16.5px;line-height:1.95}
  .case-insight{padding:16px 17px;border-radius:16px;margin-top:24px}
  .case-insight p{font-size:15.5px}
  .case-section+.case-section{margin-top:30px;padding-top:30px}
  .result-bottom{border-radius:16px;padding:10px;gap:8px}
  .result-bottom .secondary{padding:0 13px;height:40px;font-size:12.5px}
  .result-bottom .primary{height:40px;min-height:40px;padding:0 15px;font-size:13px}
  #backButton{max-width:none;padding:0 10px;font-size:12px}
  .loading-card{padding:28px 20px 24px;border-radius:24px}
  .loading h2{font-size:19px}
}

@media (max-width:360px){
  .brand small{display:none}
  .layer-tabs button{font-size:11.5px}
  .case-heading{font-size:18.5px}
  .step-buttons{gap:6px}
  .result-bottom .primary{padding:0 12px}
}

@media (max-height:640px) and (min-width:761px){
  .input-screen{padding-top:20px;padding-bottom:20px}
  .hero-copy h1{font-size:clamp(32px,4vw,44px);margin:10px 0 12px}
  .hero-points{margin-top:22px;gap:11px}
  .editor-area{height:clamp(150px,30dvh,220px)}
}

@media (prefers-reduced-motion:reduce){
  .loading-spinner:before,.core-symbol,.loading-track span{animation:none}
  *{scroll-behavior:auto}
}

@keyframes spin{to{transform:rotate(360deg)}}
@keyframes breathe{50%{transform:scale(1.06)}}
@keyframes sweep{0%{transform:translateX(-110%)}100%{transform:translateX(400%)}}
