/* ============================================================================
   MediLex 医词通 · 主样式表（基础层）
   ----------------------------------------------------------------------------
   结构说明：
   1. 主题变量      —— 深/浅主题 × 6 套配色，全部通过 html[data-*] 属性切换
   2. 基础重置      —— reset、字体、滚动条
   3. 通用组件      —— 按钮 / 表单 / 卡片 / 徽章 / 进度 / 弹窗 / Toast / 空态
   4. 启动屏        —— boot screen
   5. 登录注册页    —— auth view
   6. 应用骨架      —— 侧边栏 / 顶栏 / 主区域 / 底部导航
   （各业务视图与动效见 pages.css）
   ========================================================================== */

/* ---------------------------------------------------------------- 1. 主题变量 */
:root {
  /* 尺寸与动画 */
  --sidebar-w: 252px;
  --topbar-h: 64px;
  --ai-drawer-w: 900px;      /* AI 抽屉默认宽度（拖拽后的宽度会持久化覆盖它） */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --dur: .32s;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-en: "Segoe UI", "Helvetica Neue", Arial, Georgia, sans-serif;
  --font-ipa: "Segoe UI", "Lucida Sans Unicode", "Arial Unicode MS", sans-serif;

  /* 语义色（浅色主题） */
  --ok: #10b981;      --ok-soft: rgba(16, 185, 129, .12);
  --warn: #f59e0b;    --warn-soft: rgba(245, 158, 11, .13);
  --danger: #ef4444;  --danger-soft: rgba(239, 68, 68, .11);
  --info: #3b82f6;    --info-soft: rgba(59, 130, 246, .12);
}

/* ---- 浅色主题 ---- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fb;
  --bg-grad: radial-gradient(1200px 600px at 85% -10%, var(--primary-soft), transparent 60%),
             radial-gradient(900px 500px at -10% 110%, var(--primary-soft), transparent 55%);
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --card-soft: #f8f9fd;
  --card-glass: rgba(255, 255, 255, .82);
  --text: #16181f;
  --text-2: #565d70;
  --text-3: #9198ab;
  --line: #e7e9f3;
  --line-soft: #eff1f8;
  --hover: #f1f2fa;
  --input-bg: #f8f9fd;
  --mask: rgba(22, 24, 31, .45);

  --shadow-sm: 0 1px 2px rgba(18, 22, 40, .05), 0 1px 3px rgba(18, 22, 40, .05);
  --shadow: 0 4px 14px rgba(18, 22, 40, .06), 0 2px 6px rgba(18, 22, 40, .04);
  --shadow-lg: 0 24px 60px -16px rgba(18, 22, 40, .22);
  --shadow-primary: 0 10px 26px -8px rgba(var(--primary-rgb), .5);
}

/* ---- 深色主题 ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1016;
  --bg-grad: radial-gradient(1200px 700px at 85% -10%, rgba(var(--primary-rgb), .10), transparent 60%),
             radial-gradient(900px 600px at -10% 110%, rgba(var(--primary-rgb), .08), transparent 55%);
  --bg-soft: #13161f;
  --card: #171a24;
  --card-soft: #1d212e;
  --card-glass: rgba(23, 26, 36, .78);
  --text: #eceef5;
  --text-2: #a4aabc;
  --text-3: #666d80;
  --line: #262a38;
  --line-soft: #20242f;
  --hover: #1e2230;
  --input-bg: #1b1f2b;
  --mask: rgba(5, 6, 10, .6);

  --ok: #34d399;      --ok-soft: rgba(52, 211, 153, .14);
  --warn: #fbbf24;    --warn-soft: rgba(251, 191, 36, .14);
  --danger: #f87171;  --danger-soft: rgba(248, 113, 113, .14);
  --info: #60a5fa;    --info-soft: rgba(96, 165, 250, .14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 6px 18px rgba(0, 0, 0, .34);
  --shadow-lg: 0 28px 70px -18px rgba(0, 0, 0, .66);
  --shadow-primary: 0 10px 28px -8px rgba(var(--primary-rgb), .45);
}

/* ---- 6 套配色方案（--primary / --primary-2 / --primary-rgb） ---- */
html[data-palette="indigo"]  { --primary: #6366f1; --primary-2: #8b5cf6; --primary-rgb: 99, 102, 241; }
html[data-palette="ocean"]   { --primary: #0ea5e9; --primary-2: #14b8a6; --primary-rgb: 14, 165, 233; }
html[data-palette="emerald"] { --primary: #10b981; --primary-2: #22c55e; --primary-rgb: 16, 185, 129; }
html[data-palette="rose"]    { --primary: #f43f5e; --primary-2: #fb923c; --primary-rgb: 244, 63, 94; }
html[data-palette="amber"]   { --primary: #f59e0b; --primary-2: #f97316; --primary-rgb: 245, 158, 11; }
html[data-palette="violet"]  { --primary: #a855f7; --primary-2: #ec4899; --primary-rgb: 168, 85, 247; }

/* 深色模式下整体提亮一档，保证对比度 */
html[data-theme="dark"][data-palette="indigo"]  { --primary: #818cf8; --primary-2: #a78bfa; --primary-rgb: 129, 140, 248; }
html[data-theme="dark"][data-palette="ocean"]   { --primary: #38bdf8; --primary-2: #2dd4bf; --primary-rgb: 56, 189, 248; }
html[data-theme="dark"][data-palette="emerald"] { --primary: #34d399; --primary-2: #4ade80; --primary-rgb: 52, 211, 153; }
html[data-theme="dark"][data-palette="rose"]    { --primary: #fb7185; --primary-2: #fdba74; --primary-rgb: 251, 113, 133; }
html[data-theme="dark"][data-palette="amber"]   { --primary: #fbbf24; --primary-2: #fb923c; --primary-rgb: 251, 191, 36; }
html[data-theme="dark"][data-palette="violet"]  { --primary: #c084fc; --primary-2: #f472b6; --primary-rgb: 192, 132, 252; }

/* 便捷变量：主色柔和底、渐变 */
html { --primary-soft: rgba(var(--primary-rgb), .12); --primary-soft-2: rgba(var(--primary-rgb), .2); }
html[data-theme="dark"] { --primary-soft: rgba(var(--primary-rgb), .16); --primary-soft-2: rgba(var(--primary-rgb), .26); }
:root { --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); }

/* ---------------------------------------------------------------- 2. 基础重置 */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .4s ease, color .3s ease;
  overflow-x: hidden;
}

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--primary-soft-2); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); border: 2px solid transparent; background-clip: padding-box; }

/* 图标基础样式（SVG use） */
svg.ic { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none;
         stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
svg.ic.fill { fill: currentColor; stroke: none; }

/* 数字统一等宽 */
.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 3. 通用组件 */

/* ---- 3.1 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px; border-radius: 12px;
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px rgba(var(--primary-rgb), .55); filter: saturate(1.08); }

.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft-2); transform: translateY(-1px); }

.btn-outline { border: 1.5px solid var(--line); color: var(--text-2); background: var(--card); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 50px; padding: 0 28px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text-2);
  transition: all var(--dur) var(--ease); position: relative;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.accent-btn { color: var(--primary); background: var(--primary-soft); }

/* ---- 3.2 表单 ---- */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }

.inp, .select, textarea.inp {
  width: 100%; height: 46px; padding: 0 15px;
  background: var(--input-bg); border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 14.5px; color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  outline: none;
}
textarea.inp { height: auto; padding: 12px 15px; resize: vertical; line-height: 1.6; }
.inp::placeholder, textarea.inp::placeholder { color: var(--text-3); }
.inp:focus, .select:focus, textarea.inp:focus {
  border-color: var(--primary); background: var(--card);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239198ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}

.field-pw { position: relative; display: block; }
.field-pw .pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: color var(--dur);
}
.field-pw .pw-toggle:hover { color: var(--primary); background: var(--primary-soft); }

.form-error { min-height: 18px; font-size: 13px; color: var(--danger); margin: -6px 0 10px; }
.auth-note { font-size: 12.5px; color: var(--text-3); margin-top: 14px; text-align: center; }
.auth-mode { margin-top: 22px; text-align: center; font-size: 11.5px; color: var(--text-3); letter-spacing: .02em; }
.auth-mode.cloud { color: var(--primary); }
.auth-mode.warn { color: #c0392b; font-weight: 600; }

/* ---- 3.2.1 登录 / 注册表单精修（图标输入框 + 大圆角 + 聚焦光晕） ---- */
.field-box { position: relative; display: block; }
.field-box .field-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-3); pointer-events: none;
  transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.auth-form .field { margin-bottom: 17px; }
.auth-form .field-label {
  font-size: 12.5px; font-weight: 650; letter-spacing: .05em;
  color: var(--text-3); margin-bottom: 8px;
}
.auth-form .inp {
  height: 52px; border-radius: 14px;
  padding-left: 46px; padding-right: 16px;
  background: var(--input-bg); border: 1.5px solid var(--line);
  font-size: 14.5px;
}
.auth-form .inp:hover { border-color: rgba(var(--primary-rgb), .35); }
.auth-form .inp:focus {
  background: var(--card); border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.field-box:focus-within .field-ico { color: var(--primary); transform: translateY(-50%) scale(1.06); }
.auth-form .field-pw .inp { padding-right: 48px; }
.auth-form .field-pw .pw-toggle {
  right: 9px; width: 34px; height: 34px; border-radius: 10px;
}
.auth-form .field-pw .pw-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.auth-form .form-error { margin: -4px 0 8px; }
.auth-form .btn-block {
  height: 52px; border-radius: 14px; font-size: 15px; font-weight: 700;
  letter-spacing: .03em; margin-top: 8px;
}

/* ---- 3.2.2 联想词汇弹窗 ---- */
.sim-list { display: flex; flex-direction: column; gap: 8px; }
.sim-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--input-bg);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.sim-item:hover { border-color: rgba(var(--primary-rgb), .42); background: var(--card); }
.sim-main { flex: 1; min-width: 0; }
.sim-word { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.35; }
.sim-word .ipa { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 5px; }
.sim-cn2 { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl {
  position: absolute; inset: 0; background: var(--line); border-radius: var(--r-full);
  transition: background .3s var(--ease); cursor: pointer;
}
.switch .sl::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 21px; height: 21px;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.22);
  transition: transform .3s var(--ease-bounce);
}
.switch input:checked + .sl { background: var(--grad); }
.switch input:checked + .sl::after { transform: translateX(19px); }

/* 滑杆 */
.range { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 6px; background: var(--line); outline: none; }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: none; box-shadow: 0 2px 8px rgba(var(--primary-rgb), .5), 0 0 0 5px var(--primary-soft);
  cursor: pointer; transition: transform .2s var(--ease-bounce);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* 分段选择器 */
.segmented {
  display: inline-flex; padding: 4px; gap: 3px; background: var(--input-bg);
  border: 1px solid var(--line); border-radius: 12px;
}
.seg {
  height: 34px; padding: 0 15px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--text-3); transition: all var(--dur) var(--ease); white-space: nowrap;
}
.seg:hover { color: var(--text-2); }
.seg.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .seg.active { background: var(--card-soft); }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--text-3);
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
  transition: all var(--dur) var(--ease); white-space: nowrap;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- 3.3 卡片 ---- */
.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur);
  position: relative;
}
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(var(--primary-rgb), .25); }
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 20px 0;
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.card-title svg.ic { width: 16px; height: 16px; color: var(--primary); }
.card-bd { padding: 17px 20px 20px; }
.card-link { font-size: 13px; color: var(--text-3); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; transition: color var(--dur); }
.card-link:hover { color: var(--primary); }

/* 密码 / 密钥输入：用 text + 文本遮罩代替 type=password，
   避免手机自动拉起「安全键盘」（安全键盘不支持复制粘贴） */
.pw-masked { -webkit-text-security: disc; }
.pw-masked.pw-shown { -webkit-text-security: none; }

/* 徽章 / 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: var(--r-full); font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.gray { background: var(--hover); color: var(--text-3); }

/* 进度条 */
.prog { height: 8px; background: var(--line-soft); border-radius: var(--r-full); overflow: hidden; }
.prog > i {
  display: block; height: 100%; border-radius: var(--r-full); background: var(--grad);
  transition: width .9s var(--ease);
}
.prog.thin { height: 5px; }

/* 空状态 */
.empty { text-align: center; padding: 52px 20px; color: var(--text-3); }
.empty .empty-ic {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
  background: var(--hover); display: flex; align-items: center; justify-content: center;
}
.empty .empty-ic svg.ic { width: 28px; height: 28px; color: var(--text-3); }
.empty h3 { font-size: 15px; color: var(--text-2); margin-bottom: 5px; }
.empty p { font-size: 13px; margin-bottom: 18px; }

/* 列表 */
.list-item {
  display: flex; align-items: center; gap: 13px; padding: 13px 14px;
  border-radius: var(--r-md); transition: background var(--dur) var(--ease); cursor: pointer;
}
.list-item:hover { background: var(--hover); }

/* 骨架屏 */
.skel {
  border-radius: 10px; background: linear-gradient(90deg, var(--hover) 25%, var(--line-soft) 50%, var(--hover) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}

/* ---- 3.4 弹窗 / 遮罩 / Toast ---- */
.overlay-mask {
  position: fixed; inset: 0; background: var(--mask); z-index: 900;
  opacity: 0; transition: opacity .25s ease;
}
.overlay-mask.show { opacity: 1; }

/* 弹窗打开时锁定页面滚动 */
body.modal-open { overflow: hidden; }
/* 弹窗打开期间暂停背景元素的模糊合成层，避免动画掉帧 */
body.modal-open .topbar,
body.modal-open .sidebar,
body.modal-open .bottom-nav { backdrop-filter: none !important; }

.modal {
  position: fixed; z-index: 910; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: min(90vh, 860px);
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 20px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .32s var(--ease);
  will-change: transform, opacity;
}
.modal.closing {
  opacity: 0; transform: translate(-50%, -47%) scale(.965);
  transition: opacity .24s ease, transform .24s ease;
}
.modal.wide { width: min(720px, calc(100vw - 32px)); }
.modal-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 22px; border-bottom: 1px solid var(--line-soft); flex: none;
}
.modal-hd h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-hd h3 svg.ic { color: var(--primary); }
.modal-bd { padding: 20px 22px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-ft {
  padding: 14px 22px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  flex: none; background: var(--card); flex-wrap: wrap;
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -46.5%) scale(.965); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#toast-root {
  position: fixed; top: 18px; right: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 360px; padding: 13px 16px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500;
  animation: slideInRight .45s var(--ease-bounce); position: relative; overflow: hidden;
}
.toast.out { animation: slideOutRight .3s ease forwards; }
.toast .t-ic {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none;
}
.toast.ok .t-ic { background: var(--ok-soft); color: var(--ok); }
.toast.err .t-ic { background: var(--danger-soft); color: var(--danger); }
.toast.info .t-ic { background: var(--info-soft); color: var(--info); }
.toast .t-ic svg.ic { width: 16px; height: 16px; }
.toast::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2.5px; width: 100%;
  background: var(--grad); transform-origin: left; animation: toastBar 2.6s linear forwards;
}

/* 工具类 */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; } .mb24 { margin-bottom: 24px; }
.t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.fs12 { font-size: 12px; } .fs13 { font-size: 13px; } .fs15 { font-size: 15px; } .fs17 { font-size: 17px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.mono-en { font-family: var(--font-en); }
.ipa { font-family: var(--font-ipa); color: var(--text-3); font-size: 13.5px; letter-spacing: .01em; }

/* ---------------------------------------------------------------- 4. 启动屏 */
.boot-screen {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  background-image: var(--bg-grad);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .5s ease, visibility .5s;
}
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-mark { position: relative; width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; }
.boot-glyph {
  width: 60px; height: 60px; background: var(--grad); border-radius: 19px; position: relative; z-index: 2;
  box-shadow: var(--shadow-primary); animation: bootBeat 1.5s var(--ease) infinite;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 36px; line-height: 1; padding-bottom: 5px;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Microsoft YaHei", sans-serif;
}
.boot-pulse { position: absolute; inset: 0; border-radius: 50%; border: 2.5px solid var(--primary); opacity: 0; animation: bootRing 1.6s var(--ease) infinite; }
.boot-name { font-size: 22px; font-weight: 800; letter-spacing: .04em; }
.boot-name span { font-size: 13px; font-weight: 600; color: var(--primary); margin-left: 7px; letter-spacing: .12em; }
.boot-bar { width: 150px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.boot-bar i { display: block; width: 45%; height: 100%; border-radius: 4px; background: var(--grad); animation: bootLoad 1.1s var(--ease) infinite; }

/* ---------------------------------------------------------------- 5. 登录注册页 */
.auth-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; position: relative; overflow: hidden; }
.auth-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-bg .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.auth-bg .b1 { width: 480px; height: 480px; background: var(--primary); top: -160px; left: -120px; animation: blobFloat 26s ease-in-out infinite alternate; }
.auth-bg .b2 { width: 420px; height: 420px; background: var(--primary-2); bottom: -140px; right: -100px; animation: blobFloat 32s ease-in-out infinite alternate-reverse; }
.auth-bg .b3 { width: 280px; height: 280px; background: var(--primary-2); top: 42%; left: 46%; opacity: .3; animation: blobFloat 24s ease-in-out infinite alternate; }

.auth-panel {
  position: relative; z-index: 2; display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  width: min(1020px, 100%); background: var(--card-glass); backdrop-filter: blur(28px) saturate(1.3);
  border: 1px solid var(--line-soft); border-radius: 30px; box-shadow: var(--shadow-lg); overflow: hidden;
}

.auth-brand { padding: 52px 48px; background: var(--grad); color: #fff; display: flex; flex-direction: column; position: relative; }
.auth-brand::after {
  content: ""; position: absolute; inset: 0; opacity: .16; pointer-events: none;
  background-image: radial-gradient(circle at 20% 20%, #fff 1.5px, transparent 1.5px),
                    radial-gradient(circle at 70% 60%, #fff 1.5px, transparent 1.5px),
                    radial-gradient(circle at 40% 85%, #fff 1.2px, transparent 1.2px);
  background-size: 140px 140px, 180px 180px, 120px 120px;
}
.auth-brand .brand-mark {
  width: 54px; height: 54px; border-radius: 16px; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; margin-bottom: 30px;
  backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.3);
}
.auth-brand .brand-mark .brand-glyph { font-size: 30px; padding-bottom: 4px; }
.auth-brand h1 { font-size: 30px; font-weight: 800; letter-spacing: .01em; }
.auth-brand h1 em { font-style: normal; font-weight: 600; font-size: 19px; opacity: .9; margin-left: 8px; letter-spacing: .14em; }
.auth-slogan { margin-top: 9px; font-size: 14px; opacity: .92; letter-spacing: .03em; }
.auth-features { margin-top: 40px; display: flex; flex-direction: column; gap: 15px; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: 13.8px; opacity: .96; }
.auth-features .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.22); flex: none; }
.auth-features li.feat-ai { align-items: flex-start; }
.feat-ai .dot { margin-top: 7px; }
.feat-ai .fa-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.feat-ai .fa-body b { font-weight: 700; font-size: 13.8px; letter-spacing: .01em; }
.feat-ai .fa-body span { font-size: 12.2px; opacity: .78; letter-spacing: .02em; line-height: 1.45; }
.auth-foot { margin-top: auto; padding-top: 40px; font-size: 12.5px; opacity: .75; letter-spacing: .02em; }

.auth-card { padding: 52px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-tabs { position: relative; display: flex; background: var(--input-bg); border: 1px solid var(--line); border-radius: 14px; padding: 5px; margin-bottom: 30px; }
.auth-tab { flex: 1; height: 42px; border-radius: 10px; font-size: 14.5px; font-weight: 700; color: var(--text-3); transition: color .3s; position: relative; z-index: 2; }
.auth-tab.active { color: var(--primary); }
.auth-tab-ink {
  position: absolute; z-index: 1; top: 5px; left: 5px; width: calc(50% - 5px); height: 42px;
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow-sm);
  transition: transform .38s var(--ease-bounce);
}
.auth-card[data-tab="register"] .auth-tab-ink { transform: translateX(100%); }
.auth-form { animation: fadeUp .45s var(--ease); }
.auth-card h2 { font-size: 21px; font-weight: 800; margin-bottom: 6px; }

/* ---------------------------------------------------------------- 6. 应用骨架 */
.app-shell { display: flex; min-height: 100vh; }

/* ---- 侧边栏 ---- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: var(--card); border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; padding: 18px 14px;
  transition: transform .38s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 20px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-primary); flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark .brand-glyph {
  color: #fff; font-size: 23px; line-height: 1; padding-bottom: 3px;
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Microsoft YaHei", sans-serif;
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; }
.brand-text { font-size: 16.5px; font-weight: 800; letter-spacing: .02em; line-height: 1.2; }
.brand-text small { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-3); letter-spacing: .14em; }

.side-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; padding-bottom: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: var(--text-2); position: relative;
  transition: all var(--dur) var(--ease);
}
.nav-item svg.ic { width: 19px; height: 19px; transition: transform var(--dur) var(--ease-bounce); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item:hover svg.ic { transform: translateX(2px) scale(1.06); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3.5px; height: 20px; border-radius: 4px; background: var(--grad);
  animation: popIn .3s var(--ease-bounce);
}
.nav-item .nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full);
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .nav-badge.soft { background: var(--primary-soft); color: var(--primary); }

.sidebar-user {
  border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 6px;
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff; flex: none; box-shadow: var(--shadow-sm);
}
.sidebar-user .u-meta { min-width: 0; }
.sidebar-user .u-name { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .u-sub { font-size: 11.5px; color: var(--text-3); }

.sidebar-mask { position: fixed; inset: 0; background: var(--mask); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .3s; }

/* ---- 主区域 / 顶栏 ---- */
.main-wrap { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  background: var(--card-glass); backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-title h1 { font-size: 17.5px; font-weight: 800; letter-spacing: .01em; line-height: 1.25; }
.topbar-title p { font-size: 12px; color: var(--text-3); line-height: 1.3; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.menu-btn { display: none; }

.view-root { padding: 26px 30px 90px; width: 100%; max-width: 1240px; margin: 0 auto; flex: 1; }

/* ---- 底部导航（移动端） ---- */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 58;
  height: 62px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card-glass); backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid var(--line-soft);
}
.bottom-nav .bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--text-3); border-radius: 12px;
  transition: color var(--dur); position: relative;
}
.bottom-nav .bn-item svg.ic { width: 20px; height: 20px; }
.bottom-nav .bn-item.active { color: var(--primary); }
