/* ============================================================
   语通世界 · 设计系统
   美学方向：现代书院 —— 墨青(玉) · 朱砂 · 宣纸
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
  /* 冷灰底 / 墨蓝字（企业蓝主题，国际中文智慧教育平台风格） */
  --paper:      #eef2f9;
  --paper-2:    #e3e9f4;
  --surface:    #ffffff;
  --surface-2:  #f6f8fc;
  --surface-3:  #eef2f9;

  --ink:        #1b2638;
  --ink-soft:   #4a5568;
  --muted:      #8a93a6;
  --line:       #e2e8f2;
  --line-soft:  #eef2f8;

  /* 主蓝 / 辅蓝 / 点缀 */
  --jade:        #2f6bf6;
  --jade-bright: #4f86ff;
  --jade-deep:   #1f4fcc;
  --jade-tint:   #e8f0ff;
  --cinnabar:    #2f6bf6;
  --cinnabar-2:  #4f86ff;
  --cinnabar-tint:#e8f0ff;
  --gold:        #3b82c4;

  /* 语义色 */
  --success: #1f9d57;
  --warning: #e0922f;
  --danger:  #e0654a;
  --info:    #2f6bf6;

  /* 排版（企业风：无衬线标题） */
  --font-display: "Noto Sans SC", "PingFang SC", "HarmonyOS Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "HarmonyOS Sans", -apple-system,
    "Segoe UI", system-ui, sans-serif;

  /* 圆角 */
  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* 阴影（冷色柔和投影） */
  --shadow-sm: 0 1px 2px rgba(31,79,204,.06), 0 1px 3px rgba(31,79,204,.05);
  --shadow:    0 6px 20px -8px rgba(31,79,204,.16), 0 2px 6px rgba(31,79,204,.06);
  --shadow-lg: 0 24px 60px -20px rgba(31,79,204,.22), 0 8px 24px -12px rgba(31,79,204,.10);

  /* 间距与动效 */
  --gap: 16px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --t-fast: .16s var(--ease);
  --t: .28s var(--ease);

  --maxw: 1240px;
}

/* 暗色主题（企业蓝 · 深蓝灰底） */
[data-theme="dark"] {
  --paper:      #0e1626;
  --paper-2:    #0a111e;
  --surface:    #161f33;
  --surface-2:  #131b2d;
  --surface-3:  #1d2840;
  --ink:        #eaf0fb;
  --ink-soft:   #b3c0d6;
  --muted:      #7f8aa0;
  --line:       #263350;
  --line-soft:  #1f2c46;
  --jade:        #4f86ff;
  --jade-bright: #6f9eff;
  --jade-deep:   #2f6bf6;
  --jade-tint:   #16264a;
  --cinnabar:    #4f86ff;
  --cinnabar-2:  #6f9eff;
  --cinnabar-tint:#16264a;
  --gold:        #5a9ed0;
  --success: #46c088;
  --warning: #e0a942;
  --danger:  #e0654a;
  --info:    #5a9ed0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* 宣纸纤维质感：极淡的分形噪声叠加，去除纯色平涂的「数字感」。零外部依赖。 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}
[data-theme="dark"] body::before { opacity: .5; mix-blend-mode: screen; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--jade); color: #fff; }

:focus-visible { outline: 2px solid var(--jade-bright); outline-offset: 2px; border-radius: 4px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- 通用工具 ---------- */
.muted { color: var(--muted); }
.soft  { color: var(--ink-soft); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: var(--gap); }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.display { font-family: var(--font-display); letter-spacing: .2px; }

/* ---------- 按钮 ---------- */
.btn {
  --bg: var(--jade);
  --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px; font-weight: 600;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primary { background: var(--jade); }
.btn--primary:hover { background: var(--jade-deep); }
.btn--accent  { background: var(--cinnabar); }
.btn--accent:hover { background: #ad3a24; }
.btn--ghost   { background: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--surface-3); box-shadow: none; color: var(--ink); }
.btn--outline { background: transparent; color: var(--jade-deep); border-color: var(--line); }
.btn--outline:hover { border-color: var(--jade); background: var(--jade-tint); box-shadow: none; }
.btn--danger  { background: var(--danger); }
.btn--block { width: 100%; }
.btn--lg { padding: 13px 22px; font-size: 15px; border-radius: var(--r); }
.btn--sm { padding: 7px 13px; font-size: 13px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.label .req { color: var(--cinnabar); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-tint);
  outline: none;
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; }

/* 内嵌按钮型输入（如：发送验证码） */
.input-affix { position: relative; }
.input-affix .input { padding-right: 116px; }
.input-affix .affix-btn {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  padding: 7px 12px; font-size: 13px; border-radius: 8px;
  border: none; background: var(--jade-tint); color: var(--jade-deep); font-weight: 600;
}
.input-affix .affix-btn:hover { background: var(--jade); color: #fff; }
.input-affix .affix-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* 复选 */
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--jade); flex: none; }
.check a { color: var(--jade-deep); font-weight: 600; }
.check a:hover { color: var(--cinnabar); }

/* 角色切换 Tabs */
.role-tabs { display: flex; gap: 8px; }
.role-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border: 1.5px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 600;
  transition: all var(--t-fast);
}
.role-tab .ic { font-size: 20px; line-height: 1; }
.role-tab:hover { border-color: var(--jade-bright); }
.role-tab.active { border-color: var(--jade); background: var(--jade-tint); color: var(--jade-deep); box-shadow: 0 0 0 3px var(--jade-tint); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card--pad-lg { padding: 30px; }
.card-title { font-size: 16px; font-weight: 700; }

/* 标签 / 徽章 */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-soft);
}
.tag--jade { background: var(--jade-tint); color: var(--jade-deep); }
.tag--cinnabar { background: var(--cinnabar-tint); color: var(--cinnabar); }
.tag--gold { background: #f5edda; color: var(--gold); }
.badge { display:inline-flex; min-width:18px; height:18px; padding:0 5px; align-items:center; justify-content:center;
  background: var(--cinnabar); color:#fff; font-size:11px; font-weight:700; border-radius: var(--r-full); }

/* 头像 */
.avatar {
  width: 38px; height: 38px; border-radius: var(--r-full);
  display: grid; place-items: center; flex: none;
  background: var(--jade-deep);
  color: #fff; font-weight: 700; font-size: 15px; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -2px 4px rgba(0,0,0,.18);
}
.avatar--lg { width: 52px; height: 52px; font-size: 19px; }

.divider { height: 1px; background: var(--line-soft); border: 0; margin: 16px 0; }
.divider--text { display:flex; align-items:center; gap:12px; color:var(--muted); font-size:12px; margin:18px 0; }
.divider--text::before, .divider--text::after { content:""; flex:1; height:1px; background:var(--line-soft); }

/* 开关 */
.switch { position: relative; width: 44px; height: 25px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position:absolute; inset:0; background: var(--line); border-radius: 99px; transition: var(--t-fast); }
.switch .track::before { content:""; position:absolute; left:3px; top:3px; width:19px; height:19px; background:#fff; border-radius:50%; transition: var(--t-fast); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--jade); }
.switch input:checked + .track::before { transform: translateX(19px); }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation: spin .7s linear infinite; }
.spinner--ink { border-color: var(--line); border-top-color: var(--jade); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--r);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .32s var(--ease);
  max-width: min(90vw, 460px);
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.toast--success .dot { background: #5fd6a0; }
.toast--error .dot { background: var(--cinnabar-2); }
.toast--info .dot { background: #7fb6e0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* 进度环 */
.ring { --p: 0; width: 56px; height: 56px; border-radius: 50%;
  background: conic-gradient(var(--jade) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; }
.ring::after { content: attr(data-p) "%"; width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display:grid; place-items:center; font-size:12px; font-weight:700; color: var(--jade-deep); }

/* 全局加载遮罩 */
#app-loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--paper); z-index: 10000; transition: opacity .3s; }
#app-loading.hide { opacity: 0; pointer-events: none; }

/* 入场动画 */
.fade-up { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ============================================================
   无障碍辅助（v3.9 批次 4）
   ============================================================ */
/* 仅供屏幕阅读器的隐藏文本 */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* 「跳到主内容」链接：默认移出视口，键盘聚焦时滑入 */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 10000;
  transform: translateY(-160%);
  background: var(--jade); color: #fff; padding: 10px 16px;
  border-radius: var(--r-sm); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: translateY(0); outline: 2px solid #fff; outline-offset: 2px; }

/* 可键盘激活的卡片在聚焦时给出清晰提示 */
[role="button"][tabindex]:focus-visible { outline: 2px solid var(--jade-bright); outline-offset: 3px; }

/* 尊重系统「减少动态效果」设置：弱化动画与过渡，避免前庭不适 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
