:root {
  --bg:#f6f7fb; --bg-2:#eef1f8; --card:rgba(255,255,255,.92); --card-2:#ffffff;
  --ink:#0f172a; --muted:#5b6478; --line:rgba(109,40,217,.16); --line-2:rgba(15,23,42,.10);
  --p1:#6d28d9; --p2:#0891b2; --grad:linear-gradient(135deg,#7c3aed 0%,#06b6d4 100%);
  --ink-grad:linear-gradient(135deg,#6d28d9 0%,#0891b2 100%);
  --ok:#047857; --warn:#b45309; --bad:#dc2626; --r:18px; --safe-b:env(safe-area-inset-bottom,0px);
  --font:-apple-system,BlinkMacSystemFont,"SF Pro Display","PingFang SC","HarmonyOS Sans SC","MiSans","Noto Sans SC","Microsoft YaHei",sans-serif;
  --shadow:0 10px 30px rgba(15,23,42,.07);
}
* { box-sizing:border-box; }
html,body { margin:0; color:var(--ink); font:16px/1.55 var(--font); -webkit-text-size-adjust:100%; background:var(--bg); }
body { background:radial-gradient(760px 380px at 50% -6%,rgba(124,58,237,.16),transparent 70%),radial-gradient(1000px 520px at 92% 0%,rgba(6,182,212,.13),transparent 62%),radial-gradient(900px 520px at -10% 105%,rgba(124,58,237,.10),transparent 62%),linear-gradient(180deg,#fdfdff 0%,var(--bg) 42%,#eceff7 100%); min-height:100vh; }
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.5; background-image:linear-gradient(rgba(15,23,42,.045) 1px,transparent 1px),linear-gradient(90deg,rgba(15,23,42,.045) 1px,transparent 1px); background-size:28px 28px; mask-image:radial-gradient(ellipse at top,black 25%,transparent 78%); }
.hidden { display:none !important; }
button,input,select,textarea { font:inherit; color:inherit; }
button { min-height:44px; border:1px solid var(--line-2); background:var(--card-2); color:var(--ink); border-radius:12px; padding:0 14px; cursor:pointer; transition:transform .15s ease,background .2s ease,border-color .2s ease,box-shadow .2s ease; box-shadow:0 1px 2px rgba(15,23,42,.04); }
button svg { width:20px; height:20px; vertical-align:-4px; flex:none; }
button.primary svg { color:#fff; }
.pick-btn svg { width:26px !important; height:26px !important; }
main, #tabs { max-width:560px; margin-left:auto; margin-right:auto; }
/* 底部导航：left/right 由 48 行固定为 0，靠 max-width + margin:auto 居中。不要用 translateX(-50%)，
   否则窄屏会被推出屏幕一半，标签就只剩右边两个。 */
#tabs { width:100%; border-left:1px solid var(--line-2); border-right:1px solid var(--line-2); }
@media (min-width:600px) { .login-box { margin-top:14vh; } }
button:active { transform:scale(.97); }
button.primary { background:var(--grad); color:#fff; border:0; box-shadow:0 8px 22px rgba(124,58,237,.28); font-weight:700; }
button.primary:disabled { opacity:1; background:linear-gradient(135deg,#ece9fd,#e2f4fb); color:#7c3aed; border:1px solid rgba(124,58,237,.18); box-shadow:none; }
button.ghost { background:rgba(255,255,255,.7); border-color:var(--line-2); color:var(--muted); }
button:disabled { opacity:.45; cursor:default; }
input,select,textarea { width:100%; min-height:44px; border:1px solid var(--line-2); border-radius:12px; padding:10px 12px; background:#fff; color:var(--ink); outline:none; transition:border-color .2s,box-shadow .2s; }
input:focus,select:focus,textarea:focus { border-color:var(--p1); box-shadow:0 0 0 3px rgba(124,58,237,.16); }
select option { background:#fff; }
textarea { min-height:110px; resize:vertical; line-height:1.6; }
.muted { color:var(--muted); font-size:14px; }
.err { color:var(--bad); font-size:14px; min-height:1.2em; }
h1,h2,h3 { margin:0 0 8px; line-height:1.3; font-weight:700; letter-spacing:-.01em; }
h1 { font-size:26px; background:var(--ink-grad); -webkit-background-clip:text; background-clip:text; color:transparent; }
h2 { font-size:20px; position:relative; padding-bottom:6px; }
h2::after { content:""; position:absolute; left:0; bottom:0; width:46px; height:3px; border-radius:2px; background:var(--grad); opacity:.9; } h3 { font-size:15px; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; font-weight:600; }
.kicker { font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:var(--p2); font-weight:600; }
.card { background-image:linear-gradient(180deg,rgba(255,255,255,.96),rgba(255,255,255,.72)); border:1px solid var(--line-2); border-radius:var(--r); padding:16px; margin:12px; backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); box-shadow:var(--shadow); animation:rise .35s ease both; }
.card.flat { box-shadow:none; background:transparent; border-color:transparent; }
@keyframes rise { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; } }
.row { display:flex; gap:8px; flex-wrap:wrap; } .row > * { flex:1 1 0; min-width:0; }
.stack > * + * { margin-top:10px; }
.pill { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:999px; font-size:13px; line-height:1.45; background:rgba(124,58,237,.09); color:#5b21b6; margin:2px 4px 2px 0; border:1px solid rgba(124,58,237,.22); max-width:100%; white-space:normal; overflow-wrap:anywhere; }
.pill.warn { background:rgba(245,158,11,.13); color:var(--warn); border-color:rgba(180,83,9,.25); }
.pill.bad { background:rgba(220,38,38,.09); color:var(--bad); border-color:rgba(220,38,38,.22); }
.pill.ok { background:rgba(5,150,105,.10); color:var(--ok); border-color:rgba(5,150,105,.22); }
/* 错题本：摘要行可点，展开区在卡片内 */
.wrong-item .weak-row { cursor:pointer; }
.wrong-item.open { border-color:rgba(124,58,237,.35); }
.wr-full { margin-top:10px; padding-top:10px; border-top:1px dashed rgba(15,23,42,.12); display:flex; flex-direction:column; gap:8px; font-size:14px; }
.wr-head { display:flex; flex-wrap:wrap; gap:4px; }
.wr-stem { line-height:1.7; }
.wr-opts { display:flex; flex-direction:column; gap:6px; }
.wr-opt { display:flex; gap:8px; align-items:flex-start; padding:7px 10px; border-radius:10px; border:1px solid rgba(15,23,42,.10); font-size:14px; line-height:1.5; }
.wr-opt b { flex:0 0 auto; }
.wr-opt.ok { background:rgba(5,150,105,.08); border-color:rgba(5,150,105,.35); }
.wr-opt.bad { background:rgba(220,38,38,.07); border-color:rgba(220,38,38,.25); }
.wr-opt .pill { margin:0 0 0 auto; }
.wr-answer { display:flex; flex-wrap:wrap; gap:6px 10px; align-items:center; font-size:15px; }
.wr-answer b { font-size:18px; }
.wr-records { font-size:13px; }
.wr-del.danger { color:var(--bad); border-color:rgba(220,38,38,.45); background:rgba(220,38,38,.06); }
/* 全局 input 是 44px 高的表单样式，复选框要单独还原 */
#wr-only { width:16px; height:16px; min-height:0; padding:0; margin:0; accent-color:var(--p1); flex:0 0 auto; }
/* 改答案：输入框在行内收缩，别撑满 */
.fix-answer input, .wr-fix input { min-height:40px; flex:1 1 auto; width:auto; }
.fix-answer, .wr-fix { align-items:center; }
#xc-answer-card h3 { margin-bottom:4px; font-size:18px; }
#xc-answer-card h3 b { font-size:24px; }
.tag { font-size:12px; color:var(--muted); }
main { padding:14px 0 calc(78px + var(--safe-b)); min-height:100vh; }
#tabs { position:fixed; left:0; right:0; bottom:0; display:flex; background-color:rgba(255,255,255,.92); background-image:linear-gradient(180deg,rgba(124,58,237,.07),rgba(255,255,255,0) 62%); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); border-top:1px solid var(--line-2); padding-bottom:var(--safe-b); z-index:10; }
#tabs button { flex:1 1 0; min-width:0; border:0; border-radius:0; background:transparent; color:var(--muted); font-weight:600; font-size:13px; display:grid; justify-items:center; align-content:start; gap:2px; padding:6px 2px 5px; min-height:56px; overflow:visible; box-shadow:none; }
#tabs button span { display:block; max-width:100%; white-space:nowrap; line-height:1.3; }
#tabs button svg { width:22px; height:22px; }
#tabs button.on { color:var(--p1); background:linear-gradient(180deg,rgba(124,58,237,.12),transparent); }
#tabs button.on svg { filter:drop-shadow(0 4px 10px rgba(124,58,237,.35)); }
.toast { position:fixed; left:50%; bottom:calc(96px + var(--safe-b)); transform:translateX(-50%); background:rgba(15,23,42,.92); border:1px solid rgba(15,23,42,.2); color:#fff; padding:10px 16px; border-radius:999px; font-size:14px; z-index:20; max-width:90vw; box-shadow:0 10px 30px rgba(15,23,42,.28); }
.login-box { max-width:380px; margin:16vh auto 0; padding:28px 24px; display:grid; gap:14px; }
.login-box h1 { text-align:center; font-size:30px; }
.login-box .muted { text-align:center; }
.glow { height:120px; margin:-10px auto 0; width:120px; border-radius:50%; background:var(--grad); filter:blur(48px); opacity:.38; animation:breath 3.2s ease-in-out infinite; }
@keyframes breath { 0%,100% { transform:scale(.9); opacity:.28; } 50% { transform:scale(1.1); opacity:.5; } }
.camera { display:grid; gap:10px; }
.camera .pick { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.camera label.pick-btn { display:grid; place-items:center; gap:4px; min-height:96px; border:1px dashed rgba(109,40,217,.42); border-radius:16px; color:var(--p1); background:rgba(124,58,237,.05); cursor:pointer; font-weight:600; font-size:14px; }
.camera label.pick-btn svg { width:26px; height:26px; }
.camera input[type=file] { display:none; }
.camera img { max-width:100%; border-radius:14px; border:1px solid var(--line-2); }
.field { display:grid; gap:5px; font-size:13px; color:var(--muted); }
.field input,.field select,.field textarea { color:var(--ink); font-size:16px; }
.chat { display:grid; gap:8px; }
.msg { padding:11px 13px; border-radius:16px; max-width:100%; word-break:break-word; animation:rise .25s ease both; }
.msg.user { background:var(--grad); color:#fff; align-self:flex-end; border-bottom-right-radius:6px; box-shadow:0 6px 18px rgba(124,58,237,.24); }
.msg.bot { background:#fff; border:1px solid var(--line-2); align-self:flex-start; border-bottom-left-radius:6px; box-shadow:0 2px 10px rgba(15,23,42,.05); }
.msg.bot .md > :first-child { margin-top:0; } .msg.bot .md > :last-child { margin-bottom:0; }
.md h1,.md h2,.md h3 { font-size:16px; margin:12px 0 6px; color:var(--ink); }
.md h1 { font-size:17px; } .md strong { color:#020617; }
.md p { margin:6px 0; } .md ul,.md ol { margin:6px 0 6px 20px; padding:0; }
.md code { background:rgba(124,58,237,.10); padding:1px 6px; border-radius:5px; font-size:14px; color:#5b21b6; }
.md pre { background:#f4f5fa; color:#1f2937; padding:10px; border-radius:10px; overflow:auto; font-size:13px; border:1px solid var(--line-2); }
.md table { border-collapse:collapse; width:100%; font-size:13px; margin:8px 0; } .md th,.md td { border:1px solid var(--line-2); padding:6px; text-align:left; vertical-align:top; } .md th { background:rgba(124,58,237,.07); color:#5b21b6; }
.md blockquote { margin:6px 0; padding:4px 10px; border-left:3px solid var(--p2); color:#475569; background:rgba(6,182,212,.05); }
.dots { display:inline-flex; gap:5px; padding:10px 14px; align-self:flex-start; }
.dots span { width:7px; height:7px; border-radius:50%; background:var(--p1); animation:pulse 1.1s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay:.15s; } .dots span:nth-child(3) { animation-delay:.3s; }
@keyframes pulse { 0%,100% { opacity:.22; transform:scale(.8); } 50% { opacity:1; transform:scale(1); } }
.thinking-label { font-size:12px; color:var(--muted); align-self:flex-start; padding:0 14px 4px; }
.choices { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-top:6px; }
.choices button { padding:0; font-weight:800; font-size:17px; background:rgba(124,58,237,.07); border-color:rgba(124,58,237,.24); color:var(--p1); }
.choices button:active { background:var(--grad); color:#fff; }
.fanwen { background:#fffdf5; color:#1f2937; border:1px solid #e3d9c3; padding:8px; overflow-x:auto; font-family:"Kaiti SC","STKaiti","KaiTi",serif; font-size:15px; border-radius:10px; }
.fanwen .ln { display:grid; grid-template-columns:repeat(25,1.6em); border-bottom:1px solid #efe6d2; min-height:1.9em; align-items:center; position:relative; }
.fanwen .c { display:inline-block; width:1.6em; text-align:center; }
.fanwen .c.first { padding-left:1.6em; }
.fanwen .cnt { position:absolute; right:4px; font-size:11px; color:#a8996a; }
.stat { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px; }
.stat .card { margin:0; text-align:center; padding:14px 8px; }
.stat b { display:block; font-size:28px; background:var(--ink-grad); -webkit-background-clip:text; background-clip:text; color:transparent; font-variant-numeric:tabular-nums; line-height:1.1; }
.stat span { font-size:12px; }
.three button { font-weight:700; font-size:14px; }
.big { width:100%; min-height:54px; font-weight:700; font-size:16px; letter-spacing:.02em; }
.warm-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.warm-grid button { padding:0; font-size:13px; }
details summary { cursor:pointer; color:var(--p1); font-weight:600; min-height:36px; }
.exam { display:grid; gap:6px; }
.exam-title { font-weight:700; font-size:15px; }
.exam-meta { color:var(--muted); font-size:12px; display:flex; gap:6px; flex-wrap:wrap; }
.q-card { border:1px solid var(--line-2); border-radius:12px; padding:10px 12px; background:#fbfcff; cursor:pointer; }
.q-card:active { border-color:var(--p1); }
.q-card .q-head { display:flex; gap:6px; align-items:center; font-size:12px; color:#5b21b6; font-weight:600; }
.q-card .q-stem { font-size:14px; margin-top:4px; }
.icon-btn svg { width:20px; height:20px; vertical-align:-4px; }
.back { color:var(--muted); font-size:14px; background:transparent; border:0; padding:0 0 6px; min-height:0; box-shadow:none; }
.weak-row { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; padding:8px 0; border-bottom:1px solid var(--line-2); font-size:14px; }
.weak-row > :first-child { flex:1 1 auto; min-width:0; overflow-wrap:anywhere; }
.weak-row .pill { flex:0 0 auto; white-space:nowrap; }
.weak-row:last-child { border-bottom:0; }

/* ============================================================
   v8 视觉升级：精致浅色 + 玻璃质感 + 品牌化登录页
   ============================================================ */
:root {
  --r-lg:22px; --r:18px;
  --shadow-1:0 1px 2px rgba(15,23,42,.04),0 8px 24px rgba(15,23,42,.05);
  --shadow-2:0 2px 6px rgba(15,23,42,.05),0 18px 44px rgba(15,23,42,.09);
  --ease:cubic-bezier(.22,.61,.36,1);
}

/* ---- 全局细节 ---- */
body { -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility; }
::selection { background:rgba(124,58,237,.18); }
button { -webkit-tap-highlight-color:transparent; transition:transform .18s var(--ease),box-shadow .2s var(--ease),background .2s,border-color .2s,color .2s; }
button:active { transform:scale(.965); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline:2px solid var(--p1); outline-offset:2px;
}
button:not(:disabled):hover { box-shadow:0 4px 14px rgba(15,23,42,.08); }
button.primary:not(:disabled):hover { box-shadow:0 10px 26px rgba(124,58,237,.34); }

/* ---- 卡片：更干净的层次 + 顶部细高光 ---- */
.card {
  position:relative; border-radius:var(--r-lg);
  background:linear-gradient(180deg,#ffffff 0%,rgba(255,255,255,.86) 100%);
  border:1px solid rgba(255,255,255,.85);
  box-shadow:var(--shadow-1), inset 0 1px 0 #fff;
  transition:box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card::before {
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  background:linear-gradient(140deg,rgba(124,58,237,.05),transparent 38%);
}
.card > * { position:relative; }
.card.flat::before { display:none; }
.q-card { transition:border-color .2s,box-shadow .2s,transform .18s var(--ease); }
.q-card:active { transform:scale(.985); box-shadow:0 6px 18px rgba(124,58,237,.12); }

/* ---- 输入与选择 ---- */
input,select,textarea {
  border-radius:14px; border:1.5px solid rgba(15,23,42,.09);
  background:#fbfcfe; transition:border-color .18s,box-shadow .18s,background .18s;
}
input:hover,textarea:hover { border-color:rgba(15,23,42,.16); }
input:focus,select:focus,textarea:focus {
  border-color:var(--p1); background:#fff;
  box-shadow:0 0 0 4px rgba(124,58,237,.12);
}
.field > span { font-weight:500; letter-spacing:.01em; }

/* ---- 统计数字 ---- */
.stat .card { padding:16px 8px 14px; }
.stat b { font-size:30px; letter-spacing:-.02em; }
.stat span { color:var(--muted); }

/* ---- 底部导航：悬浮胶囊 + 选中高亮 pill ---- */
#tabs {
  border:1px solid rgba(255,255,255,.9);
  background:rgba(255,255,255,.82);
  box-shadow:0 -6px 30px rgba(15,23,42,.06), inset 0 1px 0 #fff;
}
#tabs button { position:relative; padding-top:7px; }
#tabs button svg { transition:transform .25s var(--ease); }
#tabs button.on svg { transform:translateY(-1px) scale(1.06); }
#tabs button.on::before {
  content:""; position:absolute; top:4px; left:50%; transform:translateX(-50%);
  width:52px; height:30px; border-radius:12px;
  background:linear-gradient(135deg,rgba(124,58,237,.14),rgba(6,182,212,.12));
  z-index:-1;
}
#tabs button.on span { color:var(--p1); }

/* ---- 对话气泡 ---- */
.msg { box-shadow:var(--shadow-1); }
.msg.user { border:1px solid rgba(255,255,255,.25); }
.msg.bot { border:1px solid rgba(15,23,42,.06); }
.md h2::after, .md h3::after { display:none; }  /* 正文小标题不要下划线 */
.md strong { color:#1e1b4b; }

/* ---- 拍照按钮 ---- */
.camera label.pick-btn {
  background:linear-gradient(160deg,rgba(124,58,237,.06),rgba(6,182,212,.05));
  border:1.5px dashed rgba(109,40,217,.35);
  transition:background .2s,border-color .2s,transform .18s var(--ease);
}
.camera label.pick-btn:active { transform:scale(.98); }

/* ---- 页面切换 stagger ---- */
.view:not(.hidden) > .card { animation:rise .38s var(--ease) both; }
.view:not(.hidden) > .card:nth-child(2) { animation-delay:.05s; }
.view:not(.hidden) > .card:nth-child(3) { animation-delay:.1s; }
.view:not(.hidden) > .card:nth-child(4) { animation-delay:.15s; }
.stat .card:nth-child(2) { animation-delay:.04s; }
.stat .card:nth-child(3) { animation-delay:.08s; }

/* ============================================================
   登录页：整屏场景
   ============================================================ */
.login-scene {
  position:relative; min-height:100vh; min-height:100dvh;
  display:flex; flex-direction:column; align-items:center;
  padding:calc(48px + env(safe-area-inset-top,0px)) 22px calc(28px + var(--safe-b));
  overflow:hidden;
}
.login-bg { position:absolute; inset:0; pointer-events:none; }
.orb { position:absolute; border-radius:50%; filter:blur(60px); opacity:.55; }
.orb-a { width:300px; height:300px; left:-90px; top:-70px; background:radial-gradient(circle at 35% 35%,#c4b5fd,#a78bfa 60%,transparent 72%); animation:drift 14s ease-in-out infinite; }
.orb-b { width:260px; height:260px; right:-80px; top:6%; background:radial-gradient(circle at 60% 40%,#a5f3fc,#67e8f9 55%,transparent 72%); animation:drift 17s ease-in-out infinite reverse; }
.orb-c { width:340px; height:340px; left:50%; bottom:-160px; transform:translateX(-50%); background:radial-gradient(circle at 50% 30%,#ddd6fe,#c7d2fe 55%,transparent 75%); opacity:.5; }
@keyframes drift { 0%,100% { transform:translate(0,0) scale(1); } 50% { transform:translate(14px,20px) scale(1.06); } }
.ring { position:absolute; border:1px solid rgba(124,58,237,.14); border-radius:50%; }
.ring-1 { width:420px; height:420px; left:50%; top:-120px; transform:translateX(-50%); }
.ring-2 { width:560px; height:560px; left:50%; top:-190px; transform:translateX(-50%); border-color:rgba(6,182,212,.12); }

.login-hero { position:relative; text-align:center; margin-top:4vh; animation:rise .5s var(--ease) both; }
.brand-mark { width:84px; height:84px; margin:0 auto 18px; filter:drop-shadow(0 14px 28px rgba(124,58,237,.32)); animation:floaty 5s ease-in-out infinite; }
.brand-mark svg { width:100%; height:100%; display:block; }
@keyframes floaty { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-7px); } }
.login-title {
  font-size:34px; letter-spacing:.02em; margin:10px 0 10px;
  background:linear-gradient(120deg,#312e81 0%,#6d28d9 45%,#0891b2 100%);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.login-sub { color:var(--muted); font-size:15px; margin:0; }
.login-points { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:16px; font-size:12.5px; color:#6b7280; letter-spacing:.04em; }
.login-points i { width:3px; height:3px; border-radius:50%; background:linear-gradient(135deg,var(--p1),var(--p2)); }

.login-card {
  position:relative; width:100%; max-width:400px;
  margin-top:auto; padding:26px 22px 20px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(255,255,255,.95);
  border-radius:26px;
  backdrop-filter:blur(20px) saturate(1.3); -webkit-backdrop-filter:blur(20px) saturate(1.3);
  box-shadow:var(--shadow-2), inset 0 1px 0 #fff;
  display:grid; gap:12px;
  animation:rise .55s var(--ease) .08s both;
}
.login-label { font-size:13px; font-weight:600; color:#374151; letter-spacing:.02em; }
.pw-field {
  display:flex; align-items:center; gap:10px;
  background:#fff; border:1.5px solid rgba(15,23,42,.1); border-radius:16px;
  padding:0 8px 0 14px; min-height:54px;
  transition:border-color .18s,box-shadow .18s;
}
.pw-field:focus-within { border-color:var(--p1); box-shadow:0 0 0 4px rgba(124,58,237,.13); }
.pw-field > svg { width:20px; height:20px; color:#9ca3af; flex:none; }
.pw-field input { border:0; background:transparent; box-shadow:none; min-height:50px; padding:0; font-size:17px; letter-spacing:.06em; }
.pw-field input:focus { box-shadow:none; }
.pw-eye { min-height:40px; min-width:40px; padding:0; border:0; background:transparent; box-shadow:none; color:#9ca3af; border-radius:10px; display:grid; place-items:center; }
.pw-eye svg { width:21px; height:21px; }
.pw-eye .eye-shut { display:none; }
.pw-visible .pw-eye .eye-open { display:none; }
.pw-visible .pw-eye .eye-shut { display:block; }
.pw-visible .pw-eye { color:var(--p1); }

.login-submit { position:relative; display:flex; align-items:center; justify-content:center; gap:8px; min-height:54px; border-radius:16px; font-size:17px; letter-spacing:.14em; overflow:hidden; }
.login-submit::after { content:""; position:absolute; inset:0; background:linear-gradient(110deg,transparent 30%,rgba(255,255,255,.35) 50%,transparent 70%); transform:translateX(-120%); transition:transform .8s var(--ease); }
.login-submit:not(:disabled):hover::after { transform:translateX(120%); }
.btn-arrow { width:20px; height:20px; transition:transform .25s var(--ease); }
.login-submit:not(:disabled):hover .btn-arrow { transform:translateX(4px); }
.btn-spinner { display:none; width:20px; height:20px; border-radius:50%; border:2.5px solid rgba(255,255,255,.35); border-top-color:#fff; animation:spin .7s linear infinite; }
.login-submit.loading .btn-arrow { display:none; }
.login-submit.loading .btn-spinner { display:inline-block; }
@keyframes spin { to { transform:rotate(360deg); } }
#login-err { margin:-2px 0 0; text-align:center; min-height:1.2em; }
.login-foot { text-align:center; font-size:11.5px; color:#9aa3b2; margin:2px 0 0; letter-spacing:.02em; }
.login-card.shake { animation:shake .4s var(--ease); }
@keyframes shake { 0%,100% { transform:translateX(0); } 20% { transform:translateX(-8px); } 45% { transform:translateX(7px); } 70% { transform:translateX(-4px); } }

@media (min-width:600px) {
  .login-hero { margin-top:7vh; }
  .brand-mark { width:96px; height:96px; }
}
@media (prefers-reduced-motion:reduce) {
  .orb,.brand-mark { animation:none !important; }
}

/* ============================================================
   v9 修正：密码框、气泡边距、历史折叠
   ============================================================ */

/* ---- 密码框：只留外层容器一圈边，内层 input 完全透明 ---- */
.pw-field { background:#f8f9fd; border:1.5px solid rgba(15,23,42,.08); }
.pw-field:focus-within { background:#fff; border-color:var(--p1); box-shadow:0 0 0 4px rgba(124,58,237,.12); }
.pw-field input,
.pw-field input:focus,
.pw-field input:hover,
.pw-field input:focus-visible {
  border:0 !important; outline:none !important; box-shadow:none !important;
  background:transparent !important; border-radius:0;
}
.pw-eye:focus-visible { outline:2px solid var(--p1); outline-offset:1px; }

/* ---- 聊天气泡：别贴两边 ---- */
.chat { padding:0 4px; }
.msg { max-width:88%; }
.msg.user { margin-right:6px; }
.msg.bot { margin-left:6px; }
/* 元信息条（落盘/判定 chip）保持整宽 */
.msg.bot:has(> .pill):not(:has(.md)) { max-width:100%; margin-left:0; }

/* ---- 行测历史对话折叠 ---- */
.xc-history { margin:12px; }
.xc-history > summary {
  list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px;
  padding:12px 14px; border-radius:14px;
  background:linear-gradient(180deg,#fff,#fbfcff);
  border:1px solid var(--line-2); box-shadow:var(--shadow-1);
  font-size:13px; color:var(--muted); font-weight:500;
}
.xc-history > summary::-webkit-details-marker { display:none; }
.xc-history > summary::before {
  content:""; width:7px; height:7px; border-radius:50%; flex:none;
  background:linear-gradient(135deg,var(--p1),var(--p2));
}
.xc-history > summary .h-title { color:var(--ink); font-weight:600; }
.xc-history > summary .h-arrow { margin-left:auto; transition:transform .2s var(--ease); color:#9aa3b2; width:16px; height:16px; }
.xc-history[open] > summary .h-arrow { transform:rotate(180deg); }
.xc-history > .h-body { padding-top:6px; }
.xc-history .h-actions { display:flex; justify-content:flex-end; padding:4px 2px 0; }
.xc-history .h-actions button { min-height:32px; font-size:12px; padding:0 10px; color:var(--muted); }

/* ---- 单轮对话折叠（在 createChat 内部插入） ---- */
.turn-fold { margin:2px 0 4px; }
.turn-fold > summary {
  list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px;
  padding:9px 12px; margin:0 6px;
  border-radius:12px;
  background:linear-gradient(180deg,#fbfcff,#f6f7fc);
  border:1px dashed rgba(15,23,42,.1);
  font-size:12.5px; color:var(--muted);
  transition:background .18s,border-color .18s;
}
.turn-fold > summary::-webkit-details-marker { display:none; }
.turn-fold > summary:hover { background:#fff; border-color:rgba(124,58,237,.25); }
.tf-dot { width:6px; height:6px; border-radius:50%; flex:none; background:linear-gradient(135deg,var(--p1),var(--p2)); opacity:.7; }
.tf-title { color:#475569; font-weight:500; }
.tf-time { font-size:11.5px; color:#9aa3b2; }
.tf-arrow { margin-left:auto; width:14px; height:14px; color:#9aa3b2; transition:transform .2s var(--ease); }
.turn-fold[open] > summary .tf-arrow { transform:rotate(180deg); }
.turn-fold > .tf-body { padding:6px 0 2px; display:grid; gap:8px; }
.turn-fold[open] > summary { border-style:solid; border-color:rgba(124,58,237,.2); }

/* ---- 气泡对齐：.chat 是 grid，align-self 只管纵向，横向要用 justify-self ---- */
.chat { justify-items:stretch; }
.msg.user { justify-self:end; align-self:auto; }
.msg.bot { justify-self:start; align-self:auto; }
.dots, .thinking-label { justify-self:start; }
/* 元信息 chip 行（已落盘/判定）保持整宽 */
.msg.bot:has(> .pill):not(:has(.md)) { justify-self:stretch; }
