/* ==========================================================================
   VPNEH · base.css
   设计令牌 · 重置 · 排版 · 按钮 · 头部导航 · 页脚 · 通用面板 · 响应式护栏
   体系:porcelain-light「焊点信号台」
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root{
  /* 底色与面板(瓷白体系) */
  --bg:#F6F5F2;
  --bg-top:#FFFFFF;
  --bg-bottom:#EFEDE8;
  --bg-panel:#FFFFFF;
  --bg-panel-soft:#FBFAF8;
  --bg-panel-2:#EDECE7;

  /* 描边 */
  --border:#DDDAD3;
  --border-strong:#C9C5BC;

  /* 主色 · 文字 · 语义色 */
  --accent:#D81E5B;
  --accent-dark:#A8103F;
  --text:#16161A;
  --text-muted:#5C5B62;
  --text-on-accent:#FFFFFF;
  --success:#0FA97F;
  --warn:#FF9A3C;
  --error:#B3261E;

  /* 派生透明色(只在这里定义一次) */
  --accent-a00:rgba(216,30,91,0);
  --accent-a06:rgba(216,30,91,.06);
  --accent-a08:rgba(216,30,91,.08);
  --accent-a10:rgba(216,30,91,.10);
  --accent-a14:rgba(216,30,91,.14);
  --accent-a18:rgba(216,30,91,.18);
  --accent-a30:rgba(216,30,91,.30);
  --accent-a45:rgba(216,30,91,.45);
  --accent-a60:rgba(216,30,91,.60);
  --warn-a12:rgba(255,154,60,.12);
  --warn-a30:rgba(255,154,60,.30);
  --warn-a50:rgba(255,154,60,.50);
  --ok-a12:rgba(15,169,127,.12);
  --ok-a16:rgba(15,169,127,.16);
  --ok-a50:rgba(15,169,127,.50);
  --ink-a04:rgba(22,22,26,.04);
  --ink-a08:rgba(22,22,26,.08);
  --ink-a22:rgba(22,22,26,.22);
  --ink-a35:rgba(22,22,26,.35);
  --dust-a:rgba(216,30,91,.10);
  --dust-b:rgba(22,22,26,.09);
  --white-a90:rgba(255,255,255,.90);
  --white-a24:rgba(255,255,255,.24);

  /* 旗帜色(内联 SVG 国旗取色) */
  --flag-red:#D8232A;
  --flag-white:#FFFFFF;
  --flag-blue:#2E3A6B;

  /* 字体 */
  --font-display:'Inter','Noto Sans SC','Noto Sans JP','Noto Sans KR',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-body:'Inter','Noto Sans SC','Noto Sans JP','Noto Sans KR',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-mono:'JetBrains Mono','Noto Sans SC',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

  /* 圆角 */
  --r-xs:4px;
  --r-sm:6px;
  --r-md:8px;
  --r-lg:12px;
  --r-pill:999px;

  /* 投影 */
  --sh-nav:0 1px 0 rgba(22,22,26,.03);
  --sh-panel:0 30px 64px -30px var(--accent-a45),0 4px 12px var(--ink-a04);
  --sh-card:0 18px 40px -22px var(--ink-a35);
  --sh-float:0 14px 28px -14px var(--ink-a35);
  --sh-btn:0 10px 24px -12px var(--accent-a60);
  --sh-inset-top:inset 0 1px 0 var(--white-a90);

  /* 间距(8px 网格) */
  --space-1:4px;
  --space-2:8px;
  --space-3:12px;
  --space-4:16px;
  --space-5:24px;
  --space-6:32px;
  --space-7:48px;
  --space-8:64px;
  --space-9:88px;

  /* 版式尺寸 */
  --gutter:32px;
  --nav-h:66px;
  --content-max:1180px;
  --reading-max:768px;
}

@media (max-width:980px){
  :root{--gutter:22px;--nav-h:60px;}
}

@media (max-width:640px){
  :root{--gutter:18px;}
}

/* ---------- 2. 重置与基础 ---------- */
*,
*::before,
*::after{box-sizing:border-box;}

html{
  -webkit-text-size-adjust:100%;
  scroll-behavior:smooth;
  scroll-padding-top:calc(var(--nav-h) + 16px);
}

html.nav-open{overflow:hidden;}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:16px;
  line-height:1.65;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

img,
svg{max-width:100%;}

img{height:auto;}

a{color:inherit;}

button{font:inherit;color:inherit;}

table{border-collapse:collapse;}

hr{
  border:0;
  border-top:1px solid var(--border);
  margin:var(--space-5) 0;
}

::selection{
  background:var(--accent-a18);
  color:var(--text);
}

/* 键盘焦点环:全站交互元素统一 */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-radius:var(--r-xs);
}

.skip-link{
  position:absolute;
  left:12px;
  top:-56px;
  z-index:90;
  padding:10px 16px;
  border-radius:var(--r-xs);
  background:var(--accent);
  color:var(--text-on-accent);
  font-size:13px;
  font-weight:600;
  text-decoration:none;
  transition:top .18s ease;
}

.skip-link:focus{top:12px;}

/* ---------- 3. 排版 ---------- */
h1,
h2,
h3,
h4{
  margin:0;
  font-family:var(--font-display);
  font-weight:800;
  line-height:1.18;
  letter-spacing:-.02em;
  color:var(--text);
}

h1{
  font-size:clamp(30px,4.8vw,56px);
  line-height:1.1;
}

h2{
  font-size:clamp(24px,2.8vw,36px);
  letter-spacing:-.02em;
}

h3{
  font-size:clamp(18px,1.7vw,22px);
  letter-spacing:-.01em;
}

h4{
  font-size:16px;
  letter-spacing:0;
}

p{margin:0 0 var(--space-4);}

ul,
ol{margin:0 0 var(--space-4);}

small{font-size:12.5px;}

strong{font-weight:600;}

code,
kbd,
samp{
  font-family:var(--font-mono);
  font-size:.92em;
  overflow-wrap:anywhere;
  word-break:break-word;
}

pre{
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:0 0 var(--space);
  padding:var(--space-4);
;
  border:1px solid var(--border);
  border-radius:var(--r-sm);
  background:var(--bg-panel-soft);
  font-size:13px;
  line-height:1.65;
}

pre code{
  background:none;
  padding:0;
  overflow-wrap:normal;
  word-break:normal;
  white-space:pre;
}

@media (max-width:768px){
  h1{font-size:clamp(26px,7vw,36px);}
  h2{font-size:clamp(22px,5.4vw,28px);}
}

/* 中文标题防断词:只包 2~4 个汉字 */
.no-break{white-space:nowrap;}

.u-mono{font-family:var(--font-mono);}
.u-muted{color:var(--text-muted);}
.u-accent{color:var(--accent);}

/* ---------- 4. 版心与区块 ---------- */
.shell,
.wrap{
  width:100%;
  max-width:var(--content-max);
  margin-in:auto;
  margin-inline:auto;
  padding-inline:var(--gutter);
}

/* 区块节奏只声明纵向内边距,横向留白永远归版心类 */
.sec{padding-block:var(--space-8);}
.sec--tight{padding-block:var(--space-6);}
.sec--loose{padding-block:var(--space-9);}

@media (max-width:768px){
  .sec{padding-block:var(--space-7);}
  .sec--loose{padding-block:var(--space-8);}
}

.prose{
  max-width:var(--reading-max);
  font-size:15.5px;
  line-height:1.8;
}

.prose h2{
  margin-top:var(--space-7);
  margin-bottom:var(--space-3);
}

.prose h3{
  margin-top:var(--space-6);
  margin-bottom:var(--space-2);
}

.prose p{margin:0 0 var(--space-4);}

.prose ul,
.prose ol{padding-left:1.35em;}

.prose li{margin-bottom:6px;}

.prose a{
  color:var(--accent);
  text-decoration:underline;
  text-underline-offset:2px;
}

.prose blockquote{
  margin:0 0 var(--space-4);
  padding:var(--space-3) var(--space-5);
  border-left:3px solid var(--border-strong);
  color:var(--text-muted);
}

.prose img{
  max-width:100%;
  height:auto;
  border-radius:var(--r-sm);
}

/* ---------- 5. 按钮 ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:46px;
  padding:0 27px;
  border:0;
  border-radius:var(--r-xs);
  font-family:var(--font-body);
  font-size:14.5px;
  font-weight:600;
  letter-spacing:.01em;
  text-decoration:none;
  white-space:nowrap;
  cursor:pointer;
  transition:transform .16s ease,background .2s ease,box-shadow .2s ease,border-color .2s ease,color .2s ease;
}

.btn-primary{
  background:var(--accent);
  color:var(--text-on-accent);
  box-shadow:var(--sh-btn),inset 0 1px 0 var(--white-a24);
}

.btn-primary:hover{
  background:var(--accent-dark);
  transform:translateY(-1px);
}

.btn-ghost{
  background:var(--bg-panel);
  color:var(--text);
  border:1px solid var(--border);
  box-shadow:0 2px 6px var(--ink-a04);
}

.btn-ghost:hover{
  border-color:var(--text);
  transform:translateY(-1px);
}

.btn-secondary{
  background:var(--accent-a06);
  color:var(--accent);
  border:1px solid var(--accent-a30);
}

.btn-secondary:hover{
  background:var(--accent);
  color:var(--text-on-accent);
  border-color:var(--accent);
}

.btn-sm{
  height:38px;
  padding:0 18px;
  font-size:13px;
}

.btn-block{width:100%;}

.btn[aria-disabled="true"],
.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  transform:none;
}

/* ---------- 6. 头部导航 ---------- */
.topbar{
  position:relative;
  z-index:30;
  background:rgba(255,255,255,.86);
  border-bottom:1px solid var(--border);
  box-shadow:var(--sh-nav);
}

.topbar-inner{
  display:flex;
  align-items:center;
  gap:24px;
  height:var(--nav-h);
}

.brand{
  display:inline-flex;
  align-items:center;
  gap:9px;
  flex:none;
  text-decoration:none;
  color:var(--text);
}

.brand-mark{
  display:inline-flex;
  width:26px;
  height:26px;
  flex:none;
}

.brand-mark img{
  display:block;
  width:26px;
  height:26px;
  border-radius:50%;
}

.brand-word{
  font-family:var(--font-display);
  font-size:17px;
  font-weight:800;
  letter-spacing:.02em;
}

.brand-cn{
  padding-left:9px;
  border-left:1px solid var(--border);
  font-size:12.5px;
  font-weight:500;
  line-height:1.2;
  letter-spacing:.02em;
  color:var(--text-muted);
}

.tabs{
  display:flex;
  align-items:center;
  gap:1px;
  margin:0 0 0 auto;
  padding:0;
  list-style:none;
  min-width:0;
}

.tabs-list{
  display:flex;
  align-items:center;
  gap:1px;
  margin:0;
  padding:0;
  list-style:none;
}

.tab{
  position:relative;
  display:block;
  padding:0 11px;
  line-height:var(--nav-h);
  font-size:13.5px;
  color:var(--text-muted);
  text-decoration:none;
  white-space:nowrap;
  transition:color .18s ease;
}

.tab:hover{color:var(--text);}

.tab.is-active{
  color:var(--text);
  font-weight:600;
}

.tab.is-active::after{
  content:"";
  position:absolute;
  left:11px;
  right:11px;
  bottom:-1px;
  height:2px;
  border-radius:2px;
  background:var(--accent);
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:12px;
  flex:none;
}

.lang-wrap{position:relative;flex:none;}

.lang{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  min-height:32px;
  padding:6px 6px;
  border:0;
  background:transparent;
  font-family:var(--font-body);
  font-size:12.5px;
  color:var(--text-muted);
  cursor:pointer;
  white-space:nowrap;
}

.lang:hover{color:var(--text);}

.lang svg{
  display:block;
  width:10px;
  height:10px;
  opacity:.7;
  flex:none;
}

.lang-menu{
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  z-index:50;
  display:none;
  min-width:140px;
  margin:0;
  padding:6px;
  list-style:none;
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--r-sm);
  box-shadow:var(--sh-float);
}

.lang-menu.is-open{display:block;}

.lang-menu a{
  display:flex;
  align-items:center;
  width:100%;
  min-height:36px;
  padding:6px 10px;
  border-radius:var(--r-xs);
  font-size:13px;
  color:var(--text);
  text-decoration:none;
  white-space:nowrap;
}

.lang-menu a:hover{background:var(--bg-panel-soft);}

.lang-menu a[aria-current="true"]{
  color:var(--accent);
  font-weight:600;
}

.login{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:34px;
  padding:0 16px;
  border:1px solid var(--accent);
  border-radius:var(--r-xs);
  background:var(--accent-a06);
  color:var(--accent);
  font-size:13px;
  font-weight:600;
  letter-spacing:.01em;
  text-decoration:none;
  white-space:nowrap;
  transition:background .18s ease,color .18s ease;
}

.login:hover{
  background:var(--accent);
  color:var(--text-on-accent);
}

.burger{
  display:none;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:44px;
  padding:0;
  border:1px solid var(--border);
  border-radius:var(--r-xs);
  background:var(--bg-panel);
  color:var(--text);
  cursor:pointer;
  flex:none;
}

.burger svg{
  display:block;
  width:18px;
  height:18px;
}

/* 移动端抽屉:实色背景,整行可点 */
.nav-drawer{
  position:fixed;
  top:var(--nav-h);
  left:0;
  right:0;
  z-index:60;
  display:none;
  max-height:calc(100dvh - var(--nav-h));
  overflow-y:auto;
  overscroll-behavior:contain;
  background:var(--bg-panel);
  border-bottom:1px solid var(--border);
  box-shadow:0 24px 40px -24px var(--ink-a35);
}

.nav-drawer.is-open{display:block;}

.nav-drawer ul{
  margin:0;
  padding:6px 0;
  list-style:none;
}

.nav-drawer a{
  display:flex;
  align-items:center;
  width:100%;
  min-height:44px;
  padding:11px var(--gutter);
  border-bottom:1px solid var(--border);
  font-size:14.5px;
  color:var(--text);
  text-decoration:none;
}

.nav-drawer a:hover{background:var(--bg-panel-soft);}

.nav-drawer a.is-active{
  color:var(--accent);
  font-weight:600;
}

.nav-drawer .drawer-group{
  border-top:1px solid var(--border);
}

.nav-drawer .drawer-title{
  margin:0;
  padding:14px var(--gutter) 6px;
  font-family:var(--font-mono);
  font-size:11px;
  letter-spacing:.12em;
  color:var(--text-muted);
}

@media (max-width:1120px){
  .tab{padding:0 8;font-size:12.5px;}
  .tab.is-active::after{left:8px;right:8px;}
  .brand-cn{display:none;}
}

@media (max-width:980px){
  .topbar{
    position:sticky;
    top:0;
  }
  .topbar-inner{gap:14px;}
  .tabs{display:none;}
  .topbar-actions{margin-left:auto;}
  .lang-wrap{display:none;}
  .burger{display:inline-flex;}
}

@media (max-width:640px){
  .brand-word{font-size:16px;}
  .login{height:36px;padding:0 13px;font-size:12.5px;}
}

/* ---------- 7. 页脚 ---------- */
.site-footer{
  position:relative;
  margin-top:var(--space-9);
  padding-block:var(--space-8) var(--space-5);
  background:var(--bg-panel-2);
  border-top:1px solid var(--border);
  overflow-x:clip;
}

.site-footer::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:2px;
  background:linear-gradient(90deg,var(--accent-a00),var(--accent) 34%,var(--warn) 62%,var(--success) 84%,var(--accent-a00));
  opacity:.55;
  pointer-events:none;
}

.footer-grid{
  display:grid;
  grid-template-columns:minmax(0,1.5fr) repeat(3,minmax(0,1fr));
  gap:var(--space-6);
}

.footer-brand{min-width:0;}

.footer-logo{
  display:inline-flex;
  align-items:center;
  gap:9px;
  text-decoration:none;
  color:var(--text);
}

.footer-logo img{
  display:block;
  width:28px;
  height:28px;
  border-radius:50%;
  flex:none;
}

.footer-logo span{
  font-family:var(--font-display);
  font-size:17px;
  font-weight:800;
  letter-spacing:.02em;
}

.footer-tagline{
  margin:12px 0 0;
  max-width:36ch;
  font-size:13px;
  line-height:1.7;
  color:var(--text-muted);
}

.footer-trust{
  margin:12px 0 0;
  font-family:var(--font-mono);
  font-size:11.5px;
  letter-spacing:.02em;
  color:var(--accent);
}

.footer-col{min-width:0;}

.footer-col-title{
  margin:0 0 12px;
  font-family:var(--font-body);
  font-size:12px;
  font-weight:600;
  letter-spacing:.08em;
  color:var(--text-muted);
}

.footer-links{
  display:flex;
  flex-direction:column;
  gap:2px;
  margin:0;
  padding:0;
  list-style:none;
}

.footer-links a{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:2px 0;
  font-size:13px;
  color:var(--text-muted);
  text-decoration:none;
}

.footer-links a:hover{color:var(--accent);}

.footer-links--kw{
  flex-direction:row;
  flex-wrap:wrap;
  gap:6px 8px;
}

.footer-links--kw a{
  min-height:26px;
  padding:2px 10px;
  border:1px solid var(--border);
  border-radius:var(--r-pill);
  background:var(--bg-panel);
  font-size:12.5px;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.footer-base{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px 20px;
  margin-top:var(--space-6);
  padding-top:var(--space-4);
  border-top:1px solid var(--border);
}

.footer-copy{
  margin:0;
  font-size:12.5px;
  color:var(--text-muted);
}

.footer-legal{
  display:flex;
  flex-wrap:wrap;
  gap:6px 16px;
  margin:0;
  padding:0;
  list-style:none;
  font-size:12.5px;
}

.footer-legal a{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  color:var(--text-muted);
  text-decoration:none;
}

.footer-legal a:hover{color:var(--text);}

@media (max-width:900px){
  .footer-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .footer-brand{grid-column:1 / -1;}
}

@media (max-width:560px){
  .footer-grid{grid-template-columns:minmax(0,1fr);}
  .site-footer{padding-block:var(--space-7) var(--space-4);}
}

/* ---------- 8. 通用面板与卡片 ---------- */
.panel{
  min-width:0;
  padding:var(--space-5);
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--r-md);
}

.panel--accent{
  border-color:var(--accent-a30);
  box-shadow:var(--sh-panel);
}

.panel--soft{background:var(--bg-panel-soft);}

.card{
  min-width:0;
  padding:var(--space-5);
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--r-md);
  box-shadow:var(--sh-card);
}

.card--flat{box-shadow:none;}

/* ---------- 9. 滚动淡入(reveal.js 配套) ---------- */
.reveal{transition:opacity .5s ease,transform .5s ease;}

.reveal.pending{
  opacity:0;
  transform:translateY(16px);
}

/* ---------- 10. 线路状态容器夹持(servers.js 注入位) ---------- */
#server-status{
  display:block;
  position:relative;
  max-width:100%;
  overflow:hidden;
  margin:0 0 var(--space-6);
}

#server-status *{min-width:0;}

#server-status table{max-width:100%;}

/* ---------- 11. 窄屏溢出护栏 ---------- */
.has-deco{
  position:relative;
  overflow-x:clip;
  max-width:100%;
}

.deco{
  position:absolute;
  pointer-events:none;
}

.tilt{transform:rotate(-.45deg);}

@media (max-width:640px){
  /* 中文标题在窄屏允许折行,桌面仍防断词 */
  .no-break{white-space:normal;}
  /* 微倾斜不许作用在长内容容器上 */
  .tilt,
  [class*="tilt"]{transform:none !important;}
  .deco{max-width:100%;}
}

/* ---------- 12. 动效偏好 ---------- */
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto;}
  *,
  *::before,
  *::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
  .reveal,
  .reveal.pending{
    opacity:1;
    transform:none;
  }
}

/* lh:local-harden:start */
:is(h1,h2,h3,h4){text-wrap:balance}
:is(p,li,dd,dt,figcaption,blockquote,td,th){text-wrap:pretty}
html[lang|="ko"] body{word-break:keep-all;overflow-wrap:break-word}
html[lang|="ja"] :is(h1,h2,h3,h4){word-break:auto-phrase}
.lh-tscroll{overflow-x:auto;max-width:100%;-webkit-overflow-scrolling:touch}
@media (max-width:640px){.lh-tscroll :is(th,td){min-width:5.5em}}
@supports (animation-timeline:scroll()){
  .float-cta{animation:lh-fab-in linear both;animation-timeline:scroll(root);animation-range:0 70vh}
}
@keyframes lh-fab-in{0%,45%{opacity:0;visibility:hidden}100%{opacity:1;visibility:visible}}
/* lh:local-harden:end */
