/* 只有系统没有 SF / 苹方的设备才会下载这些文件；苹果设备继续用系统字体。数字和英文走 Inter，中文走 Noto */
@font-face { font-family: "Inter Subset"; src: url("/fonts/Inter.subset.woff2?v=1") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Noto Sans SC Subset"; src: url("/fonts/NotoSansSC-Regular.subset.woff2?v=7") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans SC Subset"; src: url("/fonts/NotoSansSC-Medium.subset.woff2?v=7") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Noto Sans SC Subset"; src: url("/fonts/NotoSansSC-Semibold.subset.woff2?v=7") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --bg-page: #ffffff;
  --fill: #f5f5f7;
  --seg-active: #ffffff;
  --logo-fill: #ffffff;
  --bg-raised: #ffffff;
  --bg-field: #ffffff;
  --nav-glass: rgba(255, 255, 255, 0.78);
  --text-main: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --link-blue: #0066cc;
  --cta-bg: #1d1d1f;
  --cta-bg-hover: #3a3a3c;
  --cta-fg: #ffffff;
  --fill-soft: rgba(0, 0, 0, 0.06);
  --fill-soft-hover: rgba(0, 0, 0, 0.1);
  --track: rgba(0, 0, 0, 0.09);
  --hairline: rgba(0, 0, 0, 0.08);
  --field-border: #d2d2d7;
  --seg-indigo: #4f5bd5;
  --seg-peach: #ff9a76;
  --seg-citrus: #e0c93a;
  --ok: #248a3d;
  --warn: #b25000;
  --bad: #d70015;
  --pill-radius: 980px;
  --page-max: 1240px;
  --gutter: 48px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #000000;
  --fill: #1d1d1f;
  --seg-active: #3a3a3c;
  --logo-fill: #1d1d1f;
  --bg-raised: #1d1d1f;
  --bg-field: rgba(255, 255, 255, 0.09);
  --nav-glass: rgba(0, 0, 0, 0.72);
  --text-main: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #86868b;
  --link-blue: #2997ff;
  --cta-bg: #f5f5f7;
  --cta-bg-hover: #ffffff;
  --cta-fg: #000000;
  --fill-soft: rgba(255, 255, 255, 0.11);
  --fill-soft-hover: rgba(255, 255, 255, 0.17);
  --track: rgba(255, 255, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.14);
  --field-border: transparent;
  --seg-indigo: #7c88ff;
  --seg-peach: #ff9a76;
  --seg-citrus: #eed94f;
  --ok: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: "SF Pro SC", "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Inter Subset", "Noto Sans SC Subset", "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html { background: var(--bg-page); scrollbar-gutter: stable; }
body { background: var(--bg-page); color: var(--text-main); min-height: 100vh; min-height: 100dvh; font-size: 15px; line-height: 1.45; }
main { padding-bottom: 72px; }
h1, h2, h3, h4 { font-weight: 600; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--link-blue); outline-offset: 2px; }
.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 整页纯白，不用灰白通栏交替；分段只靠留白 */
.section { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 80px var(--gutter) 0; }
/* 每个页面的第一段贴近导航，不用分段间距 */
.section-hero, .admin-tab-content > .section:first-child, .admin-tab-content > #sharedClientGuide > .section { padding-top: 48px; }
.headline { font-size: 28px; line-height: 1.25; font-weight: 600; letter-spacing: 0.1px; color: var(--text-main); }
.headline-row { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-bottom: 24px; }
.headline-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.lead { font-size: 15px; color: var(--text-secondary); margin-top: 6px; }
.lead b { color: var(--text-main); font-weight: 600; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 19px; line-height: 1.25; font-weight: 600; }
.footnote { font-size: 13px; color: var(--text-tertiary); margin-top: 20px; }

/* 毛玻璃导航：名称居左，目录居中，操作居右 */
.topbar { position: sticky; top: 0; z-index: 100; }
/* 毛玻璃放在伪元素上：backdrop-filter 会让子元素的 fixed 相对顶栏定位，影响手机端底部标签栏 */
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--nav-glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
body.is-scrolled .topbar::before { box-shadow: 0 1px 0 var(--hairline); }
.topbar-inner { max-width: var(--page-max); height: 52px; margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.brand-logo { width: 26px; height: 26px; flex-shrink: 0; }
.brand-area { display: flex; align-items: center; gap: 9px; min-width: 0; justify-self: start; }
.brand-title-text { font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }
.topbar-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 4px; }
.header-actions { display: flex; align-items: center; gap: 2px; }
.btn-text-nav { background: none; border: none; font-size: 14px; color: var(--text-secondary); cursor: pointer; padding: 6px 12px; border-radius: var(--pill-radius); white-space: nowrap; transition: background 0.15s; }
.btn-text-nav:hover { color: var(--text-main); background: var(--fill-soft); }
.theme-toggle { width: 32px; height: 32px; margin-right: -7px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: transparent; color: var(--text-secondary); cursor: pointer; transition: background 0.15s; }
.theme-toggle:hover { color: var(--text-main); background: var(--fill-soft); }
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.apple-segmented-admin { display: none; align-items: center; }
body[data-view="admin"] .apple-segmented-admin { display: flex; }
.apple-segmented-admin .segmented-item { height: 32px; padding: 0 22px; background: transparent; color: var(--text-secondary); font-size: 15px; border: none; border-radius: var(--pill-radius); white-space: nowrap; cursor: pointer; transition: color 0.15s; }
.apple-segmented-admin .segmented-item:hover { color: var(--text-main); }
.apple-segmented-admin .segmented-item.active { color: var(--text-main); font-weight: 500; }

/* 首屏：不加底色，左边总量，右边分项；两栏与下方服务器两列对齐 */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; align-items: end; }
.hero-user { grid-template-columns: 200px minmax(0, 1fr); align-items: center; }
.hero-number { font-size: 80px; line-height: 1.08; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; white-space: nowrap; }
.hero-number small { font-size: 24px; font-weight: 500; letter-spacing: 0; color: var(--text-secondary); margin-left: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat-label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.stat-val { display: block; font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 6px; white-space: nowrap; }
.stat-val small { font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-secondary); }
.stat-note { display: block; font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }

/* 普通用户：用量圆环 */
.quota-ring-wrap { position: relative; width: 200px; aspect-ratio: 1; justify-self: center; }
.quota-ring { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.quota-ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--track); }
.ring-fill { stroke: url(#auroraGrad); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 1s cubic-bezier(0.16, 1, 0.3, 1); }
.ring-fill.is-warn { stroke: var(--warn); }
.ring-fill.is-full { stroke: var(--bad); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-used { font-size: 44px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-total { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.quota-meta { display: grid; grid-template-columns: 1fr 1fr 1.8fr; gap: 24px; margin-top: 28px; }
.quota-meta div { min-width: 0; }
.quota-remain { font-size: 40px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.quota-remain b { font-weight: 600; }
.quota-meta dt { font-size: 13px; color: var(--text-tertiary); margin-bottom: 2px; }
.quota-meta dd { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.is-ok { color: var(--ok); }
.is-bad { color: var(--bad); }

/* 服务器对比 */
.server-grid { display: grid; grid-template-columns: minmax(0, 580px); gap: 72px; }
.server-col { min-width: 0; }
.server-name { font-size: 19px; line-height: 1.25; font-weight: 600; }
.server-desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; font-variant-numeric: tabular-nums; }
.server-number { font-size: 40px; line-height: 1.15; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 16px; white-space: nowrap; }
.server-number small { font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--text-secondary); margin-left: 6px; }
.multi-progress-track { height: 6px; background: var(--track); border-radius: var(--pill-radius); overflow: hidden; display: flex; margin: 16px 0; }
.multi-seg { height: 100%; width: 0; transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.seg-direct { background: var(--seg-indigo); }
.seg-agent { background: var(--seg-peach); }
.seg-client { background: var(--seg-citrus); }
.viz-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.viz-legend div { min-width: 0; font-size: 14px; }
.viz-legend span { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); }
.viz-legend b { display: block; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 1px; }
.dot-direct, .dot-agent, .dot-client { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-direct { background: var(--seg-indigo); }
.dot-agent { background: var(--seg-peach); }
.dot-client { background: var(--seg-citrus); }

/* 节点延迟 */
.nodes-latency-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 72px; }
.latency-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* 服务器商和接入点只给管理员看 */
body:not([data-view="admin"]) .admin-only { display: none; }
.latency-flag { font-size: 14px; color: var(--text-secondary); }
.latency-badge { font-size: 32px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.latency-badge.is-down { color: var(--bad); }
.latency-item small { font-size: 13px; color: var(--text-tertiary); min-height: 19px; }

/* 客户端 */
.apple-segmented-clients { background: var(--fill); padding: 3px; border-radius: var(--pill-radius); display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; width: 380px; flex-shrink: 0; }
.apple-segmented-clients .segmented-item { height: 32px; padding: 0 6px; border: none; background: transparent; color: var(--text-secondary); border-radius: var(--pill-radius); font-size: 14px; white-space: nowrap; cursor: pointer; transition: color 0.15s; }
.apple-segmented-clients .segmented-item:hover { color: var(--text-main); }
.apple-segmented-clients .segmented-item.active { background: var(--seg-active); color: var(--text-main); font-weight: 500; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* 接入流程：一条从上到下的步骤，每步的按钮就放在这一步里 */
.setup-steps { list-style: none; counter-reset: step; }
.setup-steps > li { counter-increment: step; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 18px; align-items: start; padding: 28px 0; }
.setup-steps > li:first-child { padding-top: 12px; }
.setup-steps > li::before { content: counter(step); width: 32px; height: 32px; border-radius: 50%; background: var(--fill); color: var(--text-main); font-size: 15px; font-weight: 600; line-height: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.step-body { min-width: 0; }
.step-body:last-child { grid-column: 2 / -1; }
.setup-steps h3 { font-size: 19px; line-height: 32px; font-weight: 600; }
.setup-steps p { font-size: 15px; color: var(--text-secondary); line-height: 1.55; margin-top: 2px; max-width: 720px; }
.setup-steps .step-note { font-size: 13px; color: var(--text-tertiary); margin-top: 6px; }
.step-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 2px; }
/* 链接和操作按钮排在一行，复制按钮紧贴链接 */
.sub-link-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.sub-link-row .step-actions { flex-shrink: 0; flex-wrap: nowrap; padding-top: 0; }
/* 管理员的 master 链接不受 4 台设备限制，这句提示只对普通用户成立 */
body[data-view="admin"] .step-note { display: none; }
.sub-url-input { display: block; flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--field-border); outline: none; border-radius: 12px; background: var(--bg-field); font-size: 14px; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; text-overflow: ellipsis; cursor: pointer; }
.guide-shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 200px)); gap: 16px; margin-top: 16px; }
.guide-shot { margin: 0; }
.guide-shot img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--hairline); }
.guide-shot figcaption { font-size: 13px; color: var(--text-secondary); margin-top: 8px; text-align: center; }

/* 交互反馈 */
.btn-apple-primary:active, .btn-apple-action-dark:active, .btn-apple-action-gray:active { transform: scale(0.97); }
.btn-apple-action-gray.is-done, .btn-apple-action-dark.is-done { background: var(--ok); color: var(--cta-fg); }
.admin-tab-content, .client-card-content { animation: viewIn 0.24s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes viewIn {
  from { transform: translateY(4px); }
  to { transform: translateY(0); }
}
.is-idle .usage-total, .is-idle .device-count { color: var(--text-tertiary); }
@media (hover: hover) {
  .action-btn-sm.delete { opacity: 0; transition: opacity 0.12s ease; }
  tbody tr:hover .action-btn-sm.delete, .action-btn-sm.delete:focus-visible { opacity: 1; }
}

/* 校验保存的登录期间不显示内容 */
body[data-view="checking"] main { visibility: hidden; }

/* 登录页 */
body[data-view="login"] .brand-area { visibility: hidden; }
body[data-view="login"] .topbar::before { display: none; }
body[data-view="login"] .topbar { position: absolute; left: 0; right: 0; }
body[data-view="login"] main { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 64px 22px 24px; }
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-header-icon { display: block; width: 64px; height: 64px; margin: 0 auto 14px; }
.login-eyebrow { font-size: 17px; font-weight: 600; }
.login-title { font-size: 40px; line-height: 1.12; font-weight: 600; margin: 2px 0 6px; }
.login-desc { font-size: 15px; color: var(--text-secondary); margin-bottom: 26px; }
.form-group { margin-bottom: 14px; text-align: left; }
.form-group-last { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; color: var(--text-secondary); margin-bottom: 7px; }
.form-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.btn-forgot-link { background: none; border: none; font-size: 14px; color: var(--link-blue); cursor: pointer; padding: 0; }
.btn-forgot-link:hover { text-decoration: underline; }
.apple-input { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--field-border); font-size: 16px; color: var(--text-main); background: var(--bg-field); transition: border-color 0.15s ease, box-shadow 0.15s ease; outline: none; }
.apple-input::placeholder { color: var(--text-tertiary); }
.apple-input:focus { border-color: var(--link-blue); box-shadow: 0 0 0 3px rgba(41, 151, 255, 0.25); }
.input-with-btn { display: flex; gap: 8px; align-items: center; }
.input-with-btn .apple-input { min-width: 0; flex: 1; }
.input-with-btn button { flex-shrink: 0; white-space: nowrap; }

/* 按钮：黑色胶囊主行动（深色模式反白） */
.btn-apple-primary { width: 100%; height: 46px; background: var(--cta-bg); color: var(--cta-fg); border: none; border-radius: var(--pill-radius); font-size: 16px; font-weight: 500; cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; }
.btn-apple-primary:hover { background: var(--cta-bg-hover); }
.btn-apple-action-dark, .btn-apple-action-gray { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 18px; border: none; border-radius: var(--pill-radius); font-size: 15px; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; }
.btn-apple-action-dark { background: var(--cta-bg); color: var(--cta-fg); }
.btn-apple-action-dark:hover { background: var(--cta-bg-hover); }
.btn-apple-action-gray { background: var(--fill); color: var(--text-main); }
.btn-apple-action-gray:hover { background: var(--fill-soft); }
/* 深色模式下 --fill 与弹窗底色相同，弹窗里改用半透明底，否则取消按钮看不见 */
.modal-card .btn-apple-action-gray { background: var(--fill-soft); }
.modal-card .btn-apple-action-gray:hover { background: var(--fill-soft-hover); }
.action-btn-sm { background: none; border: none; padding: 2px 0; font-size: 15px; color: var(--text-secondary); white-space: nowrap; cursor: pointer; }
.action-btn-sm:hover { color: var(--text-main); text-decoration: underline; }
.action-btn-sm.quiet { color: var(--text-tertiary); }
.action-btn-sm.delete { color: var(--text-tertiary); }
.action-btn-sm.delete:hover { color: var(--bad); text-decoration: none; }

/* 账号列表 */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; padding: 0 12px 8px; font-size: 13px; font-weight: 400; color: var(--text-tertiary); white-space: nowrap; }
td { padding: 18px 12px; vertical-align: middle; }
/* 只留表头下的一条线，行与行靠留白分开；没有用量的账号不显示空进度条 */
tbody tr:first-child td { border-top: 1px solid var(--hairline); }
.is-idle .usage-bar { visibility: hidden; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; text-align: right; }
.table-empty { text-align: center !important; color: var(--text-secondary); padding: 48px 12px !important; }
.user-email { font-weight: 500; overflow-wrap: anywhere; }
.pwd-initial { background: none; border: none; padding: 0; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 14px; color: var(--text-secondary); }
.pwd-initial:hover { color: var(--link-blue); }
.pwd-modified-tag { color: var(--text-tertiary); }
.usage-total { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-bar { height: 4px; width: 180px; max-width: 100%; background: var(--track); border-radius: 4px; overflow: hidden; margin: 5px 0; }
.usage-bar i { display: block; height: 100%; background: var(--seg-indigo); }
.usage-bar i.is-warn { background: var(--warn); }
.usage-bar i.is-full { background: var(--bad); }
.usage-sub { font-size: 13px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.device-count { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 模态框 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.42); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 20px; }
.modal-card { background: var(--bg-raised); border-radius: 22px; padding: 28px; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.modal-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 18px; }
.create-result { margin-bottom: 24px; }
.create-result div { padding: 8px 0; }
.create-result dt { font-size: 13px; color: var(--text-tertiary); margin-bottom: 2px; }
.create-result dd { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; }

@keyframes modalPop {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 提示 Toast */
.apple-toast { position: fixed; bottom: calc(32px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); text-align: center; background: var(--cta-bg); color: var(--cta-fg); padding: 11px 20px; border-radius: var(--pill-radius); font-size: 15px; font-weight: 500; display: none; z-index: 99999; pointer-events: none; animation: toastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes toastIn {
  from { transform: translate(-50%, 8px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 1040px) {
  :root { --gutter: 28px; }
  /* 这个宽度放不下左右两栏，四位数流量会撑破页面 */
  .hero { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .hero-user { grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
  .hero-number { font-size: 64px; }
  .stat-val { font-size: 24px; }
  .server-grid { gap: 40px; }
  .nodes-latency-grid { gap: 32px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .section { padding-top: 56px; }
  .section-hero, .admin-tab-content > .section:first-child, .admin-tab-content > #sharedClientGuide > .section { padding-top: 24px; }
  .hero, .hero-user { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  body[data-view="admin"] main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .topbar-inner { display: flex; gap: 4px; padding: 0 12px 0 16px; }
  .brand-area { margin-right: auto; }
  .theme-toggle { margin-right: -3px; }

  /* 管理员目录变为底部悬浮标签栏 */
  .apple-segmented-admin { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: none; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 4px; border-radius: var(--pill-radius); background: var(--nav-glass); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14), 0 0 0 1px var(--hairline); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); }
  body[data-view="admin"] .apple-segmented-admin { display: grid; }
  .apple-segmented-admin .segmented-item { height: 44px; padding: 0; font-size: 15px; }
  .apple-segmented-admin .segmented-item.active { background: var(--fill-soft); }
  .apple-toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .stat-row { gap: 12px; }
  .quota-meta { grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
  .quota-meta div:last-child { grid-column: 1 / -1; }
  .nodes-latency-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  .eyebrow { font-size: 17px; }
  .hero-number { font-size: 56px; }
  .stat-val { font-size: 20px; }
  .stat-val small { font-size: 12px; }
  .stat-label { font-size: 12px; }
  .stat-note { display: none; }
  .headline { font-size: 22px; }
  .headline-row { flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
  .apple-segmented-clients { width: 100%; }
  .server-grid { grid-template-columns: 1fr; gap: 36px; }
  .setup-steps > li { grid-template-columns: 32px minmax(0, 1fr); column-gap: 14px; padding: 24px 0; }
  .step-actions { grid-column: 2; justify-content: flex-start; padding-top: 14px; }
  .sub-link-row { flex-wrap: wrap; }
  .sub-link-row .step-actions { grid-column: auto; }
  .sub-url-input { flex-basis: 100%; font-size: 16px; }
  .guide-shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .guide-shot figcaption { font-size: 12px; }
  .quota-ring-wrap { width: 170px; }
  .latency-badge { font-size: 22px; }
  .latency-item small { font-size: 12px; }
  .latency-flag { font-size: 13px; white-space: nowrap; }

  /* 账号表格转列表 */
  .user-table-wrap thead { display: none; }
  .user-table-wrap table, .user-table-wrap tbody, .user-table-wrap tr, .user-table-wrap td { display: block; width: 100%; }
  .user-table-wrap tr { padding: 14px 0; border-top: 1px solid var(--hairline); }
  .user-table-wrap tbody tr:first-child td { border-top: none; }
  .user-table-wrap td { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 5px 0; border: none; text-align: right; }
  .user-table-wrap td:first-child { text-align: left; padding-bottom: 10px; }
  .user-table-wrap td[data-label]::before { content: attr(data-label); flex-shrink: 0; font-size: 14px; color: var(--text-tertiary); }
  .user-table-wrap td:last-child { justify-content: flex-end; }
  .user-table-wrap td.table-empty { justify-content: center; }
  .usage-cell { text-align: right; }
  .usage-bar { margin-left: auto; }
  .is-idle .usage-bar { display: none; }
}
