/* Aceastar 学生端 · 统一设计系统 v2(2026-10-06)
 * 一处定义:配色 / 字号 / 间距 / 圆角 / 阴影 / 组件 / 外壳(手机底部 5 标签 + 电脑左侧导航)。
 * 由 /student/ui/student-shell.js 注入导航;各页只需在 </head> 前引本文件、</body> 前引 shell。
 * 旧页面(内联样式)靠文末「旧版兼容层」统一观感,不改业务脚本。
 */
:root {
  --sx-page: #f5f7fb;
  --sx-surface: #ffffff;
  --sx-surface-2: #f8fafc;
  --sx-ink: #0f172a;
  --sx-text: #1e293b;
  --sx-muted: #64748b;
  --sx-faint: #94a3b8;
  --sx-line: #e2e8f0;
  --sx-line-2: #eef2f7;
  --sx-brand: #2563eb;
  --sx-brand-600: #1d4ed8;
  --sx-brand-50: #eff6ff;
  --sx-brand-100: #dbeafe;
  --sx-green: #059669;
  --sx-green-50: #ecfdf5;
  --sx-amber: #b45309;
  --sx-amber-50: #fffbeb;
  --sx-red: #dc2626;
  --sx-red-50: #fef2f2;
  --sx-violet: #7c3aed;
  --sx-violet-50: #f5f3ff;
  --sx-r-sm: 10px;
  --sx-r: 14px;
  --sx-r-lg: 18px;
  --sx-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 10px rgba(15, 23, 42, .04);
  --sx-shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
  --sx-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --sx-tabbar-h: 64px;
  --sx-topbar-h: 52px;
  --sx-side-w: 236px;
  --sx-safe-b: env(safe-area-inset-bottom, 0px);
}

/* ───────── 基础 ───────── */
html.sx { -webkit-text-size-adjust: 100%; }
html.sx body {
  margin: 0;
  background: var(--sx-page);
  color: var(--sx-text);
  font-family: var(--sx-font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
html.sx *, html.sx *::before, html.sx *::after { box-sizing: border-box; }
.sx-icon { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sx-icon.sm { width: 18px; height: 18px; }
.sx-icon.lg { width: 26px; height: 26px; }
.sx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

html.sx [hidden] { display: none !important; }
/* 专注模式(入学诊断等自带底部提交栏的页面):不显示底部导航 */
html.sx body.sx-focus .sx-tabbar { display: none !important; }
html.sx body.sx-focus.sx-has-shell { padding-bottom: 0; }

/* ───────── 外壳布局 ───────── */
html.sx body.sx-has-shell { padding-bottom: calc(var(--sx-tabbar-h) + var(--sx-safe-b) + 16px); }
.sx-main { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; }
.sx-main.wide { max-width: 1080px; }

/* 手机顶栏 */
.sx-topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--sx-topbar-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 16px;
  background: rgba(245, 247, 251, .88);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.sx-topbar.is-scrolled { border-bottom-color: var(--sx-line); }
.sx-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--sx-ink); font-weight: 800; font-size: 16px; text-decoration: none; letter-spacing: -.01em; }
.sx-brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, #3b82f6, #1d4ed8); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0; box-shadow: 0 4px 10px rgba(37, 99, 235, .25); }
.sx-topbar .sx-spacer { flex: 1; }
.sx-iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--sx-text); cursor: pointer; text-decoration: none; }
.sx-iconbtn:active { background: var(--sx-line-2); }
.sx-avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sx-brand); color: #fff; font-size: 14px; font-weight: 700; border: 0; cursor: pointer; }
.sx-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--sx-red); border: 2px solid var(--sx-page); }

/* 手机底部标签栏 */
.sx-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--sx-tabbar-h) + var(--sx-safe-b));
  padding: 6px 4px calc(6px + var(--sx-safe-b));
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--sx-line);
}
.sx-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; color: var(--sx-faint); font-size: 11px; font-weight: 600; text-decoration: none; border-radius: 12px; }
.sx-tab .sx-icon { width: 24px; height: 24px; }
.sx-tab.is-active { color: var(--sx-brand); }
.sx-tab.is-active .sx-icon { stroke-width: 2.1; }
.sx-tab.sx-tab-cta .sx-cta-disc { display: grid; place-items: center; width: 44px; height: 44px; margin-top: -18px; border-radius: 16px; background: linear-gradient(140deg, #3b82f6, #1d4ed8); color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .32); }
.sx-tab.sx-tab-cta .sx-cta-disc .sx-icon { stroke-width: 2.1; }
.sx-tab.sx-tab-cta { color: var(--sx-text); }
.sx-tab.sx-tab-cta.is-active { color: var(--sx-brand); }

/* 电脑左侧导航 */
.sx-side { display: none; }
@media (min-width: 960px) {
  html.sx body.sx-has-shell { padding-bottom: 0; padding-left: var(--sx-side-w); }
  .sx-topbar, .sx-tabbar { display: none; }
  .sx-side {
    position: fixed; inset: 0 auto 0 0; z-index: 30;
    width: var(--sx-side-w);
    display: flex; flex-direction: column;
    padding: 20px 14px 16px;
    background: var(--sx-surface);
    border-right: 1px solid var(--sx-line);
    overflow-y: auto;
  }
  .sx-side .sx-brand { padding: 2px 8px 18px; }
  .sx-side-group { margin: 10px 0 4px; padding: 0 12px; color: var(--sx-faint); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
  .sx-side-link { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 11px; color: var(--sx-muted); font-size: 14.5px; font-weight: 600; text-decoration: none; }
  .sx-side-link:hover { background: var(--sx-surface-2); color: var(--sx-ink); }
  .sx-side-link.is-active { background: var(--sx-brand-50); color: var(--sx-brand-600); }
  .sx-side-link .sx-icon { width: 20px; height: 20px; }
  .sx-side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--sx-line); display: flex; align-items: center; gap: 10px; }
  .sx-side-foot .sx-who { flex: 1; min-width: 0; }
  .sx-side-foot .sx-who b { display: block; color: var(--sx-ink); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sx-side-foot .sx-who small { display: block; color: var(--sx-faint); font-size: 12px; }
  .sx-main { padding: 32px 32px 48px; }
}

/* 「我的」底部弹层 */
.sx-sheet[hidden] { display: none; }
.sx-sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.sx-sheet-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .38); border: 0; animation: sx-fade .18s ease; }
.sx-sheet-panel { position: relative; width: 100%; max-width: 520px; max-height: 82vh; overflow: auto; padding: 8px 16px calc(20px + var(--sx-safe-b)); border-radius: 22px 22px 0 0; background: var(--sx-surface); box-shadow: var(--sx-shadow-lg); animation: sx-up .22s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 960px) { .sx-sheet { align-items: center; } .sx-sheet-panel { border-radius: 22px; padding-bottom: 20px; } }
.sx-sheet-grip { width: 38px; height: 5px; margin: 4px auto 14px; border-radius: 3px; background: var(--sx-line); }
.sx-me { display: flex; align-items: center; gap: 12px; padding: 4px 4px 16px; }
.sx-me .sx-avatar { width: 46px; height: 46px; font-size: 18px; }
.sx-me b { display: block; color: var(--sx-ink); font-size: 17px; }
.sx-me small { color: var(--sx-muted); font-size: 13px; }
.sx-menu { margin: 0; padding: 0; list-style: none; border-radius: var(--sx-r); background: var(--sx-surface-2); overflow: hidden; }
.sx-menu a, .sx-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; border: 0; background: transparent; color: var(--sx-text); font: inherit; font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; }
.sx-menu li + li { border-top: 1px solid var(--sx-line); }
.sx-menu .sx-icon { color: var(--sx-muted); }
.sx-menu .sx-chev { margin-left: auto; color: var(--sx-faint); }
.sx-menu .danger { color: var(--sx-red); }
.sx-menu .danger .sx-icon { color: var(--sx-red); }
.sx-ver { margin: 14px 0 0; color: var(--sx-faint); font-size: 12px; text-align: center; }
.sx-confirm { margin-top: 12px; padding: 14px; border-radius: var(--sx-r); background: var(--sx-red-50); color: #7f1d1d; font-size: 14px; }
.sx-confirm-row { display: flex; gap: 10px; margin-top: 12px; }
@keyframes sx-up { from { transform: translateY(24px); } to { transform: none; opacity: 1; } }
@keyframes sx-fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────── 组件 ───────── */
.sx-h1 { margin: 6px 0 4px; color: var(--sx-ink); font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -.02em; }
.sx-sub { margin: 0 0 16px; color: var(--sx-muted); font-size: 14px; }
.sx-section { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.sx-section h2 { margin: 0; color: var(--sx-ink); font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.sx-section .sx-more { margin-left: auto; color: var(--sx-brand); font-size: 13.5px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px; margin-right: -4px; }   /* uat-student-20261024:手机上手指点得到(原 22px 高) */
.sx-card { background: var(--sx-surface); border: 1px solid var(--sx-line); border-radius: var(--sx-r-lg); box-shadow: var(--sx-shadow); padding: 16px; }
.sx-card + .sx-card { margin-top: 12px; }
.sx-card.flush { padding: 0; overflow: hidden; }
.sx-list { margin: 0; padding: 0; list-style: none; }
.sx-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 16px; color: inherit; text-decoration: none; }
.sx-list > li + li .sx-row, .sx-list > li + li > .sx-row { border-top: 1px solid var(--sx-line-2); }
a.sx-row:active { background: var(--sx-surface-2); }
.sx-row .sx-row-main { flex: 1; min-width: 0; }
.sx-row .sx-row-title { display: block; color: var(--sx-ink); font-size: 15px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-row .sx-row-meta { display: block; margin-top: 2px; color: var(--sx-muted); font-size: 12.5px; }
.sx-row .sx-chev { color: var(--sx-faint); }
.sx-tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sx-brand-50); color: var(--sx-brand); flex: 0 0 auto; }
.sx-tile-icon.green { background: var(--sx-green-50); color: var(--sx-green); }
.sx-tile-icon.amber { background: var(--sx-amber-50); color: var(--sx-amber); }
.sx-tile-icon.violet { background: var(--sx-violet-50); color: var(--sx-violet); }
.sx-tile-icon.red { background: var(--sx-red-50); color: var(--sx-red); }

.sx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 13px; font: inherit; font-size: 15.5px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .06s, background .15s, box-shadow .15s; }
.sx-btn:active { transform: scale(.985); }
.sx-btn:disabled, .sx-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.sx-btn.primary { background: var(--sx-brand); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .25); }
.sx-btn.primary:hover { background: var(--sx-brand-600); }
.sx-btn.secondary { background: var(--sx-surface); border-color: var(--sx-line); color: var(--sx-ink); }
.sx-btn.ghost { background: var(--sx-brand-50); color: var(--sx-brand-600); }
.sx-btn.danger { background: var(--sx-red); color: #fff; }
.sx-btn.block { display: flex; width: 100%; }
.sx-btn.lg { min-height: 54px; font-size: 17px; border-radius: 15px; }
.sx-btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }

.sx-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sx-line-2); color: var(--sx-muted); }
.sx-pill.blue { background: var(--sx-brand-50); color: var(--sx-brand-600); }
.sx-pill.green { background: var(--sx-green-50); color: var(--sx-green); }
.sx-pill.amber { background: var(--sx-amber-50); color: var(--sx-amber); }
.sx-pill.red { background: var(--sx-red-50); color: var(--sx-red); }

.sx-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sx-quick { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 4px 12px; border-radius: var(--sx-r); background: var(--sx-surface); border: 1px solid var(--sx-line); color: var(--sx-text); font-size: 13px; font-weight: 650; text-decoration: none; box-shadow: var(--sx-shadow); }
.sx-quick:active { background: var(--sx-surface-2); }

.sx-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; color: var(--sx-muted); font-size: 14px; text-align: center; }
.sx-empty .sx-tile-icon { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 4px; }
.sx-empty b { color: var(--sx-ink); font-size: 15.5px; }

.sx-skel { position: relative; overflow: hidden; border-radius: 8px; background: var(--sx-line-2); height: 14px; }
.sx-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: sx-shine 1.2s infinite; }
@keyframes sx-shine { to { transform: translateX(100%); } }

.sx-toast { position: fixed; left: 50%; bottom: calc(var(--sx-tabbar-h) + var(--sx-safe-b) + 18px); z-index: 120; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; background: rgba(15, 23, 42, .92); color: #fff; font-size: 14px; font-weight: 600; transform: translate(-50%, 8px); opacity: 0; transition: opacity .18s, transform .18s; pointer-events: none; text-align: center; }
.sx-toast.show { opacity: 1; transform: translate(-50%, 0); }
.sx-offline { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 130; padding: 10px 14px; border-radius: 12px; background: rgba(15, 23, 42, .94); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.45; text-align: center; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); pointer-events: none; }
.sx-offline[hidden] { display: none; }
@media (min-width: 960px) { .sx-offline { left: calc(var(--sx-side-w) + 24px); right: 24px; } }
@media (min-width: 960px) { .sx-toast { bottom: 28px; margin-left: calc(var(--sx-side-w) / 2); } }

.sx-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sx-chips::-webkit-scrollbar { display: none; }

:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* ═════════ 旧版兼容层:让未重写的页面先统一观感(配色/卡片/按钮/标题),不改业务脚本 ═════════ */
html.sx body.sx-legacy {
  --ink: #0f172a; --nav: #1d4ed8; --acc: #059669; --warn: #b45309; --red: #dc2626; --mut: #64748b;
  --hair: #e2e8f0; --bg1: #f1f5f9; --warm: #f8fafc; --page: #f5f7fb; --card: #fff; --blue: #2563eb;
  --page-bg: #f5f7fb; --text: #1e293b; --muted: #64748b; --line: #e2e8f0; --brand: #2563eb; --brand-soft: #eff6ff;
  font-family: var(--sx-font) !important;
}
html.sx body.sx-legacy .kicker, html.sx body.sx-legacy .eyebrow { display: none !important; }
html.sx body.sx-legacy .wrap { max-width: 760px; padding: 8px 16px 32px; }
html.sx body.sx-legacy h1 { color: var(--sx-ink); font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; margin: 6px 0 4px; }
html.sx body.sx-legacy .sub { color: var(--sx-muted); font-size: 14px; }
html.sx body.sx-legacy .sec { margin: 24px 0 10px; padding: 0; background: none !important; color: var(--sx-ink) !important; border-radius: 0; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
html.sx body.sx-legacy .card, html.sx body.sx-legacy .gate, html.sx body.sx-legacy .panel { background: #fff; border: 1px solid var(--sx-line) !important; border-top-width: 1px !important; border-radius: var(--sx-r-lg) !important; box-shadow: var(--sx-shadow); }
html.sx body.sx-legacy .note, html.sx body.sx-legacy .tip { border-left: 0 !important; border-radius: 12px; background: var(--sx-surface-2); color: var(--sx-muted); }
html.sx body.sx-legacy .actions a, html.sx body.sx-legacy .links a, html.sx body.sx-legacy .dl a,
html.sx body.sx-legacy .ls-actions a, html.sx body.sx-legacy .btn-row a {
  min-height: 46px; padding: 0 18px; border: 1px solid var(--sx-line) !important; border-radius: 13px !important; background: #fff !important; color: var(--sx-ink) !important; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
html.sx body.sx-legacy .actions a.primary, html.sx body.sx-legacy .links a.primary, html.sx body.sx-legacy .dl a.primary,
html.sx body.sx-legacy .ls-actions a.primary, html.sx body.sx-legacy a.btn.primary, html.sx body.sx-legacy .primary-button {
  background: var(--sx-brand) !important; border-color: var(--sx-brand) !important; color: #fff !important; box-shadow: 0 6px 16px rgba(37, 99, 235, .22);
}
html.sx body.sx-legacy .pill { border-radius: 999px; }
html.sx body.sx-legacy table th { background: var(--sx-surface-2); }
html.sx body.sx-legacy .kpi { border-left: 0 !important; border-radius: 12px; background: var(--sx-surface-2) !important; }
html.sx body.sx-legacy a.back { display: none; }
/* 旧外壳(侧栏/顶栏/面包屑)交给新外壳:隐藏旧导航,内容区占满 */
html.sx body.sx-legacy .app-shell { display: block; min-height: 0; }
html.sx body.sx-legacy .app-shell > .sidebar, html.sx body.sx-legacy .student-fixed-nav, html.sx body.sx-legacy .w5-more-layer { display: none !important; }
html.sx body.sx-legacy .workspace > .topbar { display: none !important; }
html.sx body.sx-legacy main { width: auto !important; max-width: 1080px; margin: 0 auto; padding: 8px 16px 32px !important; }
@media (min-width: 960px) { html.sx body.sx-legacy main { padding: 32px 32px 48px !important; } html.sx body.sx-legacy .wrap { padding: 32px 32px 48px; } }
/* 任务页:去掉重复标题与手机上用处不大的视图切换/筛选说明(只改展示,不动 tasks.js) */
html.sx body.sx-legacy .task-results .results-heading h2, html.sx body.sx-legacy .filter-line > strong { display: none; }
@media (max-width: 959px) { html.sx body.sx-legacy .view-toggle, html.sx body.sx-legacy .active-filter-summary { display: none !important; } }

/* uat-student-20261024:本学科未开放自选刷题时的入口切换(判据见 /student/subject-access.js) */
html[data-practice="closed"] [data-practice-only] { display: none !important; }
html:not([data-practice="closed"]) [data-practice-closed] { display: none !important; }
/* uat-student-20261024:练习中心/错题本的页面样式给所有 button 加了内边距和 44px 最小高,把顶栏头像撑成椭圆、挤出屏幕右边;外壳自己的按钮复位 */
html.sx .sx-topbar button.sx-avatar { padding: 0; min-height: 0; width: 34px; height: 34px; border: 0; background: var(--sx-brand); color: #fff; }
