/* ================================================================
   vrcnotifier 前端样式
   设计系统: Primitive(原始色) -> Semantic(语义) -> Component(组件)
   主题: 默认深色, 可手动切换 深/浅/自动(跟随系统)
   风格: 毛玻璃卡片 + 渐变光晕 + 丝滑过渡(尊重 prefers-reduced-motion)
   ================================================================ */

/* ---------- 字体: 自托管 woff2(原由 Google Fonts CDN 加载, 现本地化, 声明与 Google 原 CSS 一致) ----------
   来源: Google Fonts(Inter v20 / Space Grotesk v22), 仅取 latin / latin-ext 子集。
   中文与未覆盖字形走 --font / h1 字体栈中的系统字体回退。 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(fonts/space-grotesk-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url(fonts/space-grotesk-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Primitive(原始色) ---------- */
:root {
  --p-accent: #5b8cff;
  --p-accent2: #8b5cf6;
  --p-ok: #3fb950;
  --p-warn: #d29922;
  --p-bad: #f85149;
  --p-online: #2ed319;
  --p-joinme: #00b8ff;
  --p-askme: #e97c03;
  --p-busy: #c80928;
  --p-offline: #737f8d;
}

/* ---------- Semantic(语义): 双主题单份定义, 由 color-scheme 切换 ---------- */
:root {
  color-scheme: light dark; /* auto: 跟随系统 */
  --bg: light-dark(#eef1f6, #0b0d13);
  --glow-1: light-dark(rgba(91,140,255,.16), rgba(91,140,255,.13));
  --glow-2: light-dark(rgba(139,92,246,.12), rgba(139,92,246,.11));
  --header-bg: light-dark(rgba(238,241,246,.72), rgba(11,13,19,.68));
  --card-bg: light-dark(rgba(255,255,255,.58), rgba(255,255,255,.045));
  --card-bg-hover: light-dark(rgba(255,255,255,.85), rgba(255,255,255,.075));
  --card-border: light-dark(rgba(23,32,52,.10), rgba(255,255,255,.09));
  --card-hl: light-dark(rgba(255,255,255,.85), rgba(255,255,255,.05));
  --line: light-dark(rgba(23,32,52,.09), rgba(255,255,255,.085));
  --line-strong: light-dark(rgba(23,32,52,.18), rgba(255,255,255,.16));
  --text-1: light-dark(#171c28, #f2f5fa);
  --text-2: light-dark(#414a5c, #b9c0cd);
  --text-3: light-dark(#6d7688, #828ba0);
  --accent: light-dark(#3b6fe0, var(--p-accent));
  --accent-2: light-dark(#7c5ce0, var(--p-accent2));
  --accent-contrast: #fff;
  --accent-soft: light-dark(rgba(59,111,224,.13), rgba(91,140,255,.16));
  --ok: light-dark(#1a7f37, var(--p-ok));
  --warn: light-dark(#9a6700, var(--p-warn));
  --bad: light-dark(#cf222e, var(--p-bad));
  --ok-soft: light-dark(rgba(26,127,55,.12), rgba(63,185,80,.14));
  --warn-soft: light-dark(rgba(154,103,0,.12), rgba(210,153,34,.14));
  --bad-soft: light-dark(rgba(207,34,46,.12), rgba(248,81,73,.14));
  --status-online: light-dark(#1f9d0e, var(--p-online));
  --status-joinme: light-dark(#0092c9, var(--p-joinme));
  --status-askme: light-dark(#c46502, var(--p-askme));
  --status-busy: light-dark(#a80722, var(--p-busy));
  --status-offline: light-dark(#5b6572, var(--p-offline));
  --input-bg: light-dark(rgba(23,32,52,.05), rgba(255,255,255,.05));
  --input-bg-hover: light-dark(rgba(23,32,52,.09), rgba(255,255,255,.09));
  --btn-sec: light-dark(rgba(23,32,52,.07), rgba(255,255,255,.075));
  --btn-sec-hover: light-dark(rgba(23,32,52,.12), rgba(255,255,255,.13));
  --shadow-1: 0 1px 2px rgba(0,0,0,.16), 0 6px 20px rgba(0,0,0,.10);
  --scrollbar: light-dark(rgba(23,32,52,.2), rgba(255,255,255,.14));
}
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

/* ---------- Component(组件级 token) ---------- */
:root {
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
   --blur: 18px;
   --t-fast: .16s ease;
   --t-med: .28s cubic-bezier(.22,.8,.3,1);
   --font: 'Inter Variable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
   --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }
/* 预留滚动条空间: 切换 tab 时页面出现/消失滚动条不再引起整页横移 */
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg); /* 渐变光晕移至固定层 #bgGlow, 避免滚动时整页背景逐帧重绘 */
  color: var(--text-1);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: color .3s ease;
}
/* 全站默认不可选中文本; 仅好友名字/世界名(.name, 含状态行)与日志可复制 */
body { user-select: none; -webkit-user-select: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
.friend .name, .self-info .name { user-select: text; -webkit-user-select: text; }
#log, #log * { user-select: text; -webkit-user-select: text; }

/* 固定背景光晕层: 一次合成, 滚动零重绘 */
#bgGlow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 88% -12%, var(--glow-1), transparent 60%),
    radial-gradient(900px 640px at -8% 28%, var(--glow-2), transparent 55%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }

/* ---------- 顶部栏(毛玻璃吸顶) ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 60;
  animation: riseIn .4s cubic-bezier(.22,.8,.3,1) backwards; /* 标题栏最先淡入 */
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  border-bottom: 1px solid var(--line);
}
header h1 {
  font-family: 'Space Grotesk', 'Inter Variable', system-ui, sans-serif; /* 标题专用几何字体 */
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.4px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* 外链(非 <a>): 与服务器状态卡一致的点击行为; 视觉与原来的文字链接一致(悬停不下划线) */
.ext-link { cursor: pointer; }
.hint .ext-link { color: var(--accent); }
/* 页脚品牌标识(点击跳转 GitHub) */
.site-mark {
  margin-top: 8em; /* 空约 5 行 */
  margin-bottom: 8px;
  text-align: center;
  font-size: 15px;
  animation: riseIn .4s cubic-bezier(.22,.8,.3,1) backwards;
  animation-delay: calc(var(--i, 9) * 40ms); /* 底部文字最后淡入(好友行多时由 JS 顺延) */
}
.site-mark .ext-link {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -.2px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.conn-form { display: flex; align-items: center; gap: 8px; }
.conn-form input { width: auto; margin: 0; }
header .spacer { flex: 1; }
/* 门禁页连接表单: 分段式地址输入 + 令牌 + 连接反馈 */
.gate-form { display: flex; flex-direction: column; gap: 12px; }
.gate-form .field label { color: var(--text-2); }
.url-row { display: flex; align-items: stretch; margin: 4px 0 8px; }
.url-row > * { margin: 0; }
.url-row .dd { flex: 0 0 96px; }
.url-row .dd-btn { width: 100%; height: 100%; justify-content: center; gap: 6px; border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; }
.url-row .gate-host { flex: 1; min-width: 0; border-radius: 0; }
.url-row .gate-port { flex: 0 0 88px; border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.gate-actions { margin-top: 2px; }
.btn-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 布局 ---------- */
.container { max-width: 980px; margin: 0 auto; padding: 24px 20px 56px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.actions { margin-top: 14px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }

/* ---------- 统计小卡 ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--btn-sec);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.stat:hover { background: var(--btn-sec-hover); transform: translateY(-1px); border-color: var(--line-strong); }
.stat-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 13px; color: var(--text-1); word-break: break-all; }

/* ---------- 毛玻璃卡片 ---------- */
.card {
  position: relative;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(calc(var(--blur) - 4px)) saturate(140%);
  backdrop-filter: blur(calc(var(--blur) - 4px)) saturate(140%);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--card-hl);
  animation: riseIn .4s cubic-bezier(.22,.8,.3,1) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: border-color var(--t-med), box-shadow var(--t-med);
}
.card:hover { border-color: var(--line-strong); }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#gateView .card, #loginView .card { max-width: 480px; }
/* 登录页: 左侧登录卡 + 右侧服务器状态卡(与主界面 overview-item 一致) */
#loginView .login-split { display: flex; gap: 16px; align-items: flex-start; }
#loginView .login-main { flex: 0 1 480px; min-width: 0; }
#loginView .login-status { flex: 0 0 240px; min-width: 0; }
/* 居中弹窗(登出确认/后端断开) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: light-dark(rgba(23,32,52,.35), rgba(0,0,0,.6));
}
.modal {
  position: relative;
  isolation: isolate;
  width: min(400px, calc(100vw - 40px));
  background: light-dark(rgba(252,253,255,.97), rgba(19,22,29,.97));
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--card-hl);
  padding: 20px 22px;
  animation: riseIn .28s cubic-bezier(.22,.8,.3,1) backwards;
}
/* 门禁/登录卡与弹窗: 与卡内元素一致的鼠标跟随高光 */
#gateView .card::before,
#loginView .login-main::before,
.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity .2s ease-out;
  z-index: -1;
  pointer-events: none;
}
#gateView .card:hover::before,
#loginView .login-main:hover::before,
.modal:hover::before { opacity: 1; }
.modal h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.modal p.muted { margin: 0 0 6px; }
.modal .modal-body { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Tab 切换(pill 胶囊) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  width: fit-content;
  padding: 4px;
  background: var(--btn-sec);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: riseIn .4s cubic-bezier(.22,.8,.3,1) backwards;
  animation-delay: calc(var(--i, 5) * 40ms); /* 概览条(0~4)之后 */
}
 .tab {
   position: relative;
   isolation: isolate;
   background: transparent;
   color: var(--text-2);
   border: 0;
   border-radius: var(--r-pill);
   padding: 7px 18px;
   box-shadow: none;
   transition: color var(--t-fast);
 }
 .tab::before {
   content: '';
   position: absolute;
   inset: 0;
   border-radius: inherit;
   background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 68%);
   opacity: 0;
   transition: opacity .2s ease-out;
   z-index: -1;
   pointer-events: none;
 }
 .tab::after {
   content: '';
   position: absolute;
   inset: 1px;
   border-radius: inherit;
   background: var(--btn-sec-hover);
   opacity: 0;
   transition: opacity .2s ease-out;
   z-index: -2;
   pointer-events: none;
 }
 .tab:hover { color: var(--text-1); }
 .tab:hover::before, .tab:hover::after { opacity: 1; }
 .tab.active::after { display: none; }
 .tab.active {
   background: linear-gradient(135deg, var(--accent), var(--accent-2));
   color: var(--accent-contrast);
   box-shadow: 0 2px 10px var(--accent-soft);
}
/* ---------- 表单控件 ---------- */
input[type='text'], input[type='password'], input[type='number'], input[type='email'], select, textarea {
  width: 100%;
  background: var(--input-bg);
  color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin: 4px 0 8px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:hover, select:hover, textarea:hover { background: var(--input-bg-hover); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { color: var(--text-2); }

/* ---------- 按钮 ---------- */
button {
  font: inherit;
  color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: var(--r-sm);
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 4px 12px var(--accent-soft);
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast), background var(--t-fast);
}
button:hover { filter: brightness(1.07); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.97); }
button:disabled { opacity: .5; cursor: default; transform: none; filter: none; box-shadow: none; }
button.secondary {
  background: var(--btn-sec);
  color: var(--text-1);
  box-shadow: none;
}
button.secondary:hover { background: var(--btn-sec-hover); filter: none; }
button.danger { background: linear-gradient(135deg, var(--bad), #b4232c); box-shadow: none; }
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 主题切换按钮 ---------- */
.theme-btn {
  width: 34px; height: 34px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--btn-sec);
  color: var(--text-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: none;
}
.theme-btn:hover { background: var(--btn-sec-hover); filter: none; }
.theme-btn svg { width: 16px; height: 16px; }

/* ---------- 开关 ---------- */
.switch { position: relative; width: 36px; height: 20px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--line-strong); border-radius: var(--r-pill); transition: background var(--t-fast); }
.switch .slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .18s cubic-bezier(.3,.8,.3,1.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 徽章 ---------- */
 .badge {
   display: inline-flex;
   align-items: center;
   gap: 5px;
   font-size: 11px;
   font-weight: 600;
   letter-spacing: .02em;
   line-height: 1;
   white-space: nowrap;
   padding: 2px 10px;
   border-radius: var(--r-pill);
   background: var(--btn-sec);
  color: var(--text-2);
  border: 1px solid var(--line);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* ---------- 好友列表 ---------- */
.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-2);
  margin: 18px 0 6px;
}
.group-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
/* 分组折叠按钮 */
.group-title .group-toggle {
  width: 22px; height: 22px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-3);
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  flex: 0 0 auto;
  transition: background var(--t-fast), color var(--t-fast);
}
.group-title .group-toggle:hover { background: var(--btn-sec-hover); color: var(--text-1); }
.group-title .group-toggle svg { width: 14px; height: 14px; transition: transform .2s cubic-bezier(.22,.8,.3,1); }
.group-title.collapsed .group-toggle svg { transform: rotate(-90deg); }
/* 折叠动画: grid-rows 0fr/1fr 过渡, 内容隐藏但保留动画 */
.group-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .3s cubic-bezier(.22,.8,.3,1);
}
.group-body.collapsed { grid-template-rows: 0fr; }
.group-inner { overflow: hidden; min-height: 0; }
/* FLIP 动画期间放开裁剪, 行飞越分组边界时不被吞掉; 折叠组保持裁剪以免内容漏出 */
#friendsList.flipping .group-body:not(.collapsed) .group-inner { overflow: visible; }
/* 页面标题栏"我": 头像+圆点语义与好友行一致, 尺寸适配标题栏 */
.self-info { display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 48vw; }
.self-info .avatar-wrap { position: relative; width: 32px; height: 32px; flex: 0 0 auto; }
.self-info .avatar, .self-info .avatar-fallback {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--btn-sec);
  font-size: 14px;
  font-weight: 600;
}
.self-info .avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.self-info .avatar-wrap::after {
  content: '';
  position: absolute;
  right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--status-offline);
  box-shadow: 0 0 0 2px var(--bg);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.self-info .avatar-wrap.st-online.status-active::after { background: var(--status-online); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-online) 50%, transparent); }
.self-info .avatar-wrap.st-online.status-joinme::after { background: var(--status-joinme); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-joinme) 50%, transparent); }
.self-info .avatar-wrap.st-online.status-askme::after { background: var(--status-askme); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-askme) 50%, transparent); }
.self-info .avatar-wrap.st-online.status-busy::after { background: var(--status-busy); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-busy) 50%, transparent); }
.self-info .avatar-wrap.st-active.status-active::after { background: var(--bg); border: 3px solid var(--status-online); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-online) 50%, transparent); }
.self-info .avatar-wrap.st-active.status-joinme::after { background: var(--bg); border: 3px solid var(--status-joinme); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-joinme) 50%, transparent); }
.self-info .avatar-wrap.st-active.status-askme::after { background: var(--bg); border: 3px solid var(--status-askme); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-askme) 50%, transparent); }
.self-info .avatar-wrap.st-active.status-busy::after { background: var(--bg); border: 3px solid var(--status-busy); box-shadow: 0 0 0 2px var(--bg), 0 0 5px color-mix(in srgb, var(--status-busy) 50%, transparent); }
.self-info .name {
  min-width: 0;
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.self-info .state {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border-bottom: 1px solid var(--line);
}
/* 悬停高光: 径向光斑跟随鼠标, 位置由 JS 写入 --mx/--my 并补间 */
.friend::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 68%);
  opacity: 0;
  transition: opacity .5s ease-out;
  z-index: -1;
  pointer-events: none;
}
/* 基底浮起层: 与光斑叠加, 让整行有柔和抬升感 */
.friend::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--r-md) - 2px);
  background: var(--card-bg-hover);
  opacity: 0;
  transition: opacity .5s ease-out;
  z-index: -2;
  pointer-events: none;
}
.friend:last-child { border-bottom: 0; }
.friend:hover::before, .friend:hover::after { opacity: 1; transition-duration: .2s; }
.friend:focus-within::after { opacity: 1; }
/* 特别关注切换: 被移动行的高光脉冲(与 FLIP 位移同步) */
.friend.fav-spot::after {
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(260px circle at 12% 50%, var(--accent-soft), transparent 70%);
  animation: favSpot .7s cubic-bezier(.22,.8,.3,1) both;
}
@keyframes favSpot {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}
.friend .avatar-wrap {
  position: relative;
  width: 40px; height: 40px;
  flex: 0 0 auto;
}
.friend .avatar, .friend .avatar-fallback {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--btn-sec);
}
.friend .avatar { transition: transform var(--t-med), filter var(--t-med); }
.friend:hover .avatar { transform: scale(1.07); }
.friend .avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 15px;
  font-weight: 600;
  transition: background var(--t-med), color var(--t-med);
}
.friend:hover .avatar-fallback { background: var(--accent-soft); color: var(--accent); }
/* 状态圆点(VRCX): 颜色=社交状态, 实心=游戏在线, 空心=网页在线, 灰=离线 */
.friend .avatar-wrap::after {
  content: '';
  position: absolute;
  right: -2px; bottom: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--status-offline);
  box-shadow: 0 0 0 2px var(--bg);
  transition: background var(--t-med), border-color var(--t-med), box-shadow var(--t-med), transform var(--t-med);
}
/* 游戏在线: 实心彩点 + 柔和光晕 */
.friend .avatar-wrap.st-online.status-active::after { background: var(--status-online); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-online) 50%, transparent); }
.friend .avatar-wrap.st-online.status-joinme::after { background: var(--status-joinme); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-joinme) 50%, transparent); }
.friend .avatar-wrap.st-online.status-askme::after { background: var(--status-askme); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-askme) 50%, transparent); }
.friend .avatar-wrap.st-online.status-busy::after { background: var(--status-busy); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-busy) 50%, transparent); }
/* 网页在线: 空心彩环 + 柔和光晕 */
.friend .avatar-wrap.st-active.status-active::after { background: var(--bg); border: 3px solid var(--status-online); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-online) 50%, transparent); }
.friend .avatar-wrap.st-active.status-joinme::after { background: var(--bg); border: 3px solid var(--status-joinme); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-joinme) 50%, transparent); }
.friend .avatar-wrap.st-active.status-askme::after { background: var(--bg); border: 3px solid var(--status-askme); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-askme) 50%, transparent); }
.friend .avatar-wrap.st-active.status-busy::after { background: var(--bg); border: 3px solid var(--status-busy); box-shadow: 0 0 0 2px var(--bg), 0 0 6px color-mix(in srgb, var(--status-busy) 50%, transparent); }
/* 离线: 灰点 + 头像灰度(VRCX), hover 恢复彩色 */
.friend .avatar-wrap.st-offline .avatar { filter: grayscale(1); transition: filter var(--t-fast); }
.friend:hover .avatar-wrap.st-offline .avatar { filter: none; }
.friend:hover .avatar-wrap::after { transform: scale(1.1); }
.friend .name { flex: 1; min-width: 0; font-weight: 500; transition: color var(--t-med); }
/* 信任等级名字颜色: 严格使用 VRChat 官方 5 色, 悬停不变 */
.friend .name.tl-trusted { color: #8143e6; }
.friend .name.tl-known { color: #ff7c42; }
.friend .name.tl-user { color: #2acf5b; }
.friend .name.tl-new { color: #1678ff; }
.friend .name.tl-visitor { color: #bababa; }
.friend .state { font-size: 12px; color: var(--text-3); margin-top: 1px; transition: color var(--t-med); position: relative; overflow: hidden; }
/* 状态行翻动: 旧文案向上滚出、新文案从下方滚入(与「平均 x 次/分钟」同款观感) */
.friend .state .st-roll { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend .state .st-roll.st-old { position: absolute; inset: 0; animation: stateRollOut .3s cubic-bezier(.22,.8,.3,1) both; }
.friend .state .st-roll.st-new { animation: stateRollIn .3s cubic-bezier(.22,.8,.3,1) both; }
@keyframes stateRollIn { from { opacity: 0; transform: translateY(110%); } to { opacity: 1; transform: none; } }
@keyframes stateRollOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-110%); } }
.friend:hover .state { color: var(--text-2); }
.friend .checks { display: flex; gap: 10px; font-size: 12px; white-space: nowrap; }
.friend label { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-2); }

/* 好友行小复选框(自绘) */
.friend .checks input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.friend .checks input[type='checkbox']:hover { transform: scale(1.1); }
.friend .checks input[type='checkbox']::before {
  content: '';
  width: 9px; height: 9px;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: var(--accent-contrast);
  transform: scale(0);
  transition: transform .12s ease;
}
.friend .checks input[type='checkbox']:checked { background: var(--accent); border-color: var(--accent); }
.friend .checks input[type='checkbox']:checked::before { transform: scale(1); }

/* 登出弹窗勾选框: 与好友行自绘勾选框同款 */
.modal .modal-body label.row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.modal .modal-body input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  flex: 0 0 auto;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.modal .modal-body input[type='checkbox']:hover { transform: scale(1.1); }
.modal .modal-body input[type='checkbox']::before {
  content: '';
  width: 9px; height: 9px;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: var(--accent-contrast);
  transform: scale(0);
  transition: transform .12s ease;
}
.modal .modal-body input[type='checkbox']:checked { background: var(--accent); border-color: var(--accent); }
.modal .modal-body input[type='checkbox']:checked::before { transform: scale(1); }

/* 登录页「记住我」勾选框: 与好友行/登出弹窗自绘勾选框同款 */
#loginView .login-main label.row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
#loginView .login-main input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  flex: 0 0 auto;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
#loginView .login-main input[type='checkbox']:hover { transform: scale(1.1); }
#loginView .login-main input[type='checkbox']::before {
  content: '';
  width: 9px; height: 9px;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: var(--accent-contrast);
  transform: scale(0);
  transition: transform .12s ease;
}
#loginView .login-main input[type='checkbox']:checked { background: var(--accent); border-color: var(--accent); }
#loginView .login-main input[type='checkbox']:checked::before { transform: scale(1); }

/* ---------- 日志 ---------- */
#log {
  height: calc(250vh - 1550px); /* 日志高度 = 最初的 2.5 倍 */
  min-height: 600px;
  max-height: 1800px;
  overflow: auto;
  font: 12px/1.6 var(--font-mono);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
#log div { padding: 2px 6px; border-radius: 4px; border-bottom: 1px dashed var(--line); }
/* OpenClash 观感: 级别词着色(绿/黄/红徽章) + 分类彩色徽章 */
#log .log-row { display: flex; align-items: baseline; gap: 8px; }
#log .log-row:hover { background: var(--input-bg-hover); }
#log .log-time { flex: 0 0 auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
#log .log-lv { flex: 0 0 auto; min-width: 34px; text-align: center; font-weight: 700; font-size: 11px; line-height: 1.7; border-radius: 4px; padding: 0 5px; }
#log .lv-debug { color: var(--p-offline); background: light-dark(rgba(115,127,141,.14), rgba(115,127,141,.2)); }
#log .lv-info { color: var(--ok); background: var(--ok-soft); }
#log .lv-warn { color: var(--warn); background: var(--warn-soft); }
#log .lv-error { color: var(--bad); background: var(--bad-soft); }
#log .log-cat { flex: 0 0 auto; font-size: 11px; line-height: 1.7; padding: 0 7px; border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--c, #8b94a5) 34%, transparent); color: var(--c, var(--text-2)); background: color-mix(in srgb, var(--c, #8b94a5) 13%, transparent); }
#log .log-body { word-break: break-all; white-space: pre-wrap; }
.cat-startup { --c: #94a3b8; }
.cat-server { --c: #818cf8; }
.cat-auth { --c: #c084fc; }
.cat-monitor { --c: #a78bfa; }
.cat-ws { --c: #38bdf8; }
.cat-vrcapi { --c: #2dd4bf; }
.cat-world { --c: #34d399; }
.cat-qq { --c: #60a5fa; }
.cat-notify { --c: #f472b6; }
.cat-avatar { --c: #fb923c; }
.cat-status { --c: #a3e635; }
.cat-other { --c: #8b94a5; }

/* ---------- 日志筛选工具栏 ---------- */
.log-tools { display: inline-flex; gap: 8px; margin-left: auto; }
.log-tools .dd-btn { font-size: 12px; padding: 5px 9px; }
.log-tools .dd-item { font-size: 12px; }

/* ---------- 自定义下拉(替代原生 select): 玻璃拟态 + 动画 ---------- */
.dd { position: relative; display: inline-flex; flex: 0 0 auto; }
.dd-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.dd-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--input-bg); color: var(--text-1);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 10px; font: inherit; cursor: pointer; box-shadow: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.dd-btn:hover { background: var(--input-bg-hover); }
.dd.open .dd-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dd-arrow { width: 13px; height: 13px; flex: 0 0 auto; color: var(--text-3); transition: transform .22s cubic-bezier(.22,.8,.3,1); }
.dd.open .dd-arrow { transform: rotate(180deg); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 280px; overflow: auto;
  z-index: 130; margin: 0; padding: 4px;
  background: light-dark(rgba(243,246,252,.96), rgba(16,19,26,.96)); /* 近实底: 降低透明度, 菜单内容清晰可读 */
  -webkit-backdrop-filter: blur(calc(var(--blur) - 4px)) saturate(150%);
  backdrop-filter: blur(calc(var(--blur) - 4px)) saturate(150%);
  border: 1px solid var(--card-border); border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transform-origin: top left;
  /* 淡入淡出: 由 .dd.open 驱动双向过渡(不能用全局 .hidden, 其 display:none 会跳过透明度过渡, 同 .to-top.off 手法) */
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-5px) scale(.97);
  transition: opacity .16s ease, transform .2s cubic-bezier(.4,0,.7,1), visibility 0s linear .16s;
}
.dd.open .dd-menu {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity .22s cubic-bezier(.22,.8,.3,1), transform .26s cubic-bezier(.22,.8,.3,1), visibility 0s;
}
.dd-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 10px; border-radius: var(--r-sm); cursor: pointer;
  color: var(--text-2); font-size: 13px; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform .1s ease;
}
.dd-item:hover, .dd-item.act { background: var(--btn-sec-hover); color: var(--text-1); }
.dd-item:active { transform: scale(.985); } /* 点击按压反馈, 同按钮 :active 质感 */
/* 多选下拉: 复选框行(与好友行/登出弹窗自绘勾选框同款) */
.dd-check { justify-content: flex-start; gap: 8px; }
.dd-cb {
  width: 15px; height: 15px; flex: 0 0 auto;
  border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--input-bg);
  display: inline-grid; place-content: center;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.dd-cb::before {
  content: ''; width: 9px; height: 9px;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: var(--accent-contrast);
  transform: scale(0);
  transition: transform .18s cubic-bezier(.3,.8,.3,1.2); /* 弹性回弹, 同开关滑块手感 */
}
.dd-check.on .dd-cb { background: var(--accent); border-color: var(--accent); }
.dd-check.on .dd-cb::before { transform: scale(1); }
.dd-check.ind .dd-cb { background: var(--accent); border-color: var(--accent); }
.dd-check.ind .dd-cb::before { clip-path: none; width: 8px; height: 2px; transform: scale(1); }
.dd-check .dd-lb { color: var(--text-2); transition: color var(--t-fast); }
.dd-check.on .dd-lb { color: var(--text-1); }
/* 展开时选项逐行淡入(轻微级联, 每行 20ms, 同页面 riseIn 语汇) */
@keyframes ddItemIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.dd.open .dd-item { animation: ddItemIn .26s cubic-bezier(.22,.8,.3,1) backwards; }
.dd.open .dd-item:nth-child(2) { animation-delay: .02s; }
.dd.open .dd-item:nth-child(3) { animation-delay: .04s; }
.dd.open .dd-item:nth-child(4) { animation-delay: .06s; }
.dd.open .dd-item:nth-child(5) { animation-delay: .08s; }
.dd.open .dd-item:nth-child(6) { animation-delay: .1s; }
.dd.open .dd-item:nth-child(7) { animation-delay: .12s; }
.dd.open .dd-item:nth-child(8) { animation-delay: .14s; }
.dd.open .dd-item:nth-child(9) { animation-delay: .16s; }
.dd.open .dd-item:nth-child(10) { animation-delay: .18s; }
.dd.open .dd-item:nth-child(11) { animation-delay: .2s; }
.dd.open .dd-item:nth-child(12) { animation-delay: .22s; }
.field .dd, .field .dd-btn { width: 100%; }

/* ---------- 概览条(常驻) ---------- */
.overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
 .overview-item {
   position: relative;
   isolation: isolate;
   display: flex;
   flex-direction: column;
   justify-content: flex-start;
   gap: 6px;
   min-width: 0;
   padding: 11px 14px 12px;
   background: var(--btn-sec);
   border: 1px solid var(--line);
   border-radius: var(--r-md);
   box-shadow: inset 0 1px 0 var(--card-hl);
   transition: border-color var(--t-fast), background var(--t-fast);
   animation: riseIn .42s cubic-bezier(.22,.8,.3,1) backwards;
   animation-delay: calc(var(--i, 0) * 40ms);
 }
 .overview-item::before {
   content: '';
   position: absolute;
   inset: 0;
   border-radius: inherit;
   background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 68%);
   opacity: 0;
   transition: opacity .2s ease-out;
   z-index: -1;
   pointer-events: none;
 }
 .overview-item::after {
   content: '';
   position: absolute;
   inset: 2px;
   border-radius: calc(var(--r-md) - 2px);
   background: var(--btn-sec-hover);
   opacity: 0;
   transition: opacity .2s ease-out;
   z-index: -2;
   pointer-events: none;
 }
 .overview-item:hover { border-color: var(--line-strong); }
 .overview-item:hover::before, .overview-item:hover::after { opacity: 1; }
 .ov-label {
   display: flex;
   align-items: baseline;
   justify-content: space-between;
   gap: 8px;
   font-size: 10px;
   font-weight: 600;
   letter-spacing: .09em;
   line-height: 1.4;
   text-transform: uppercase;
   color: var(--text-3);
   white-space: nowrap;
   transition: color var(--t-fast);
 }
 .ov-label-text { flex-shrink: 0; }
 .ov-meta {
   min-width: 0;
   font-family: var(--font-mono);
   font-size: 11px;
   font-weight: 400;
   letter-spacing: .01em;
   text-transform: none;
   color: var(--text-3);
   opacity: .78;
   overflow: hidden;
   text-overflow: ellipsis;
 }
 .ov-meta.lat-ok { color: var(--ok); }
 .ov-meta.lat-warn { color: var(--warn); }
 .ov-meta.lat-bad { color: var(--bad); }
 .overview-item:hover .ov-label { color: var(--text-2); }
 .ov-value {
   display: block;
   line-height: 24px;
   font-size: 13px;
   font-weight: 500;
   font-variant-numeric: tabular-nums;
   letter-spacing: .01em;
   color: var(--text-1);
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
 }
 .ov-num {
   font-size: 21px;
   font-weight: 700;
   letter-spacing: -.01em;
   line-height: 24px;
   background: linear-gradient(135deg, var(--accent), var(--accent-2));
   -webkit-background-clip: text;
   background-clip: text;
   -webkit-text-fill-color: transparent;
   color: var(--accent);
 }
 .ov-num-sm { font-size: 15px; font-weight: 600; line-height: 24px; color: var(--text-1); }
 .overview-item .badge {
   width: fit-content;
   min-height: 24px;
   font-size: 11.5px;
   font-weight: 600;
   padding: 3px 11px;
   transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
 }
 .overview-item .badge::before { width: 8px; height: 8px; }
.overview-item.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; }
.overview-item.wide .ov-label { min-width: 96px; justify-content: flex-start; }
 .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.ws-panel-row { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.ws-total { font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 次数切换的上下翻动动画: 右对齐槽位, 滚动期间宽度取新旧较宽者, 结束后收缩(无多余空格) */
.ws-num-wrap {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
  overflow: hidden;
  min-width: 1ch;
  height: 1.05em;
  line-height: 1;
}
.ws-num-in { display: inline-block; line-height: 1; }
.ws-num-in.roll { animation: wsRollIn .45s cubic-bezier(.22,.8,.3,1); }
.ws-old {
  position: absolute;
  right: 0;
  top: 0;
  line-height: 1;
  pointer-events: none;
  animation: wsRollOut .45s cubic-bezier(.22,.8,.3,1) forwards;
}
@keyframes wsRollIn { from { transform: translateY(110%); } to { transform: translateY(0); } }
@keyframes wsRollOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-110%); opacity: 0; } }
.ws-chart-clip {
  flex: 1;
  min-width: 120px;
  height: 30px;
  line-height: 0;
}
.ws-chart {
  width: 100%;
  height: 100%;
  display: block;
}
.ws-chart-tip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  padding: 5px 10px;
  border-radius: 8px;
  background: light-dark(rgba(252,253,255,.92), rgba(21,24,31,.92));
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-1);
  color: var(--text-1);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transform: translate(-50%, 6px);
  opacity: 0;
}
.ws-chart-tip:not(.hidden) {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 入场动画: 好友行与分组标题(仅首次渲染由 JS 标记 .enter, 快照/搜索重渲染不重播) ---------- */
.group-title.enter, .friend.enter {
  animation: riseIn .32s cubic-bezier(.22,.8,.3,1) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}
/* 页面切换: 旧页快速淡出, 新页从 0 开始立即淡入(覆盖静态 --i, 不再等待概览条等固定内容占用的序号) */
section.page-fade-out { animation: pageOut .12s ease forwards; }
@keyframes pageOut { from { opacity: 1; } to { opacity: 0; } }
#tab-friends.switch-in > .card { animation-delay: 0ms; }
#tab-settings.switch-in > .card:nth-child(1) { animation-delay: 0ms; }
#tab-settings.switch-in > .card:nth-child(2) { animation-delay: 40ms; }

/* ---------- 好友工具栏 ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 160px; margin: 0; }
.toolbar .muted { font-size: 12px; }

/* ---------- 提示文本 ---------- */
.hint { font-size: 12px; margin: 0 0 10px; }

/* ---------- 设置字段 ---------- */
.field { display: flex; flex-direction: column; gap: 2px; }
.field label { font-size: 12px; color: var(--text-2); }
.field input, .field select { margin: 0; }

/* ---------- 表单分组 ---------- */
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); margin: 0 0 12px; padding: 12px 14px; }
legend { font-size: 13px; color: var(--text-3); padding: 0 6px; }
h3.chan { font-size: 13px; margin: 16px 0 6px; color: var(--text-2); font-weight: 600; }

/* ---------- 回到顶部按钮(固定右下角, 最顶层悬浮) ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 12.5vh; /* 悬浮在页面八分之一高度处 */
  z-index: 400; /* 悬浮在最顶层(弹窗 200 之上) */
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  overflow: hidden;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--card-border);
  border-radius: 14px; /* 圆角正方形 */
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--card-hl);
  transition: color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), opacity .5s cubic-bezier(.22,.8,.3,1), transform .5s cubic-bezier(.22,.8,.3,1);
}
/* 鼠标跟随径向高光(与好友行/导航/卡片一致) */
.to-top::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(90px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity .2s ease-out;
  z-index: -1;
  pointer-events: none;
}
.to-top:hover::before { opacity: 1; }
.to-top:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-2px);
  box-shadow: var(--shadow-1), 0 4px 18px var(--accent-soft), inset 0 1px 0 var(--card-hl);
}
.to-top:active { transform: translateY(0) scale(.96); }
/* 淡出态: 用专用类(不能用全局 .hidden, 其 display:none 会跳过透明度过渡) */
.to-top.off { opacity: 0; pointer-events: none; transform: translateY(18px) scale(.8); }
.to-top svg { width: 48px; height: 48px; }

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

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  header { flex-wrap: wrap; padding: 10px 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .overview { grid-template-columns: 1fr 1fr; }
  .overview-item.wide { flex-wrap: wrap; }
  .overview-item.wide .ov-label { min-width: 100%; }
  .ws-panel-row { width: 100%; }
  .friend { flex-wrap: wrap; }
  .friend .checks { width: 100%; flex-wrap: wrap; gap: 8px 14px; padding-left: 52px; }
  .tabs { position: static; transform: none; width: 100%; flex-direction: row; margin-bottom: 16px; }
  .tab { flex: 1; writing-mode: horizontal-tb; padding: 8px 14px; }
  #mainView.container { margin-left: 0; margin-right: 0; max-width: 980px; }
  button { min-height: 40px; }
  #loginView .login-split { flex-direction: column; }
  #loginView .login-main { flex: 0 0 auto; }
  #loginView .login-status { width: 240px; min-width: 0; flex: 0 0 auto; }
  .url-row .dd { flex: 0 0 88px; }
  .url-row .gate-port { flex: 0 0 76px; }
}

/* ---------- 无障碍: 减少动画 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

