/* ============================================================
   Clash客户端 · base.css
   设计令牌 → reset → 版心与分区 → 排版 → 按钮 → 页头 → 页脚
   → 通用容器 → 滚动揭示 → 响应式与窄屏防溢出
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */
:root{
  /* 主色板（简报 palette 原值） */
  --bg:#002A6B;
  --bg-panel:#001F52;
  --bg-panel-2:#FFFFFF;
  --border:#1C4A96;
  --accent:#4F6DFF;
  --accent-dark:#2B3FD8;
  --cyan:#35D6FF;
  --text:#F2F6FF;
  --text-muted:#A3B4D6;
  --success:#CDF24B;
  --warn:#FFB454;
  --error:#FF6B7A;

  /* 浅色分区（白底）反转色 */
  --ink:#002A6B;
  --ink-muted:#4E6BA5;
  --line-light:#DCE4F4;
  --text-dim:#8FA5CE;

  /* 半透明层与描边 */
  --glass:rgba(255,255,255,.05);
  --glass-2:rgba(255,255,255,.10);
  --stroke-soft:rgba(163,180,214,.20);
  --stroke-accent:rgba(79,109,255,.62);
  --stroke-cyan:rgba(53,214,255,.40);
  --term-line:rgba(163,180,214,.15);
  --line-soft:rgba(28,74,150,.42);

  /* 发光与投影 */
  --glow-cyan:rgba(53,214,255,.24);
  --glow-blue:rgba(79,109,255,.32);
  --glow-lime:rgba(205,242,75,.55);
  --glow-red:rgba(255,107,122,.50);
  --glow-amber:rgba(255,180,84,.50);
  --shadow-deep:rgba(0,8,32,.72);
  --shadow-soft:0 18px 44px -30px rgba(0,8,32,.55);
  --shadow-lift:0 24px 52px -26px rgba(0,8,32,.62);

  /* 纹理与遮罩 */
  --grid-line:rgba(163,180,214,.085);
  --grid-line-light:rgba(0,42,107,.07);
  --mask-ink:#000000;

  /* 代码高亮（只用于 pre/code 内的语法字符） */
  --code-key:rgba(180,197,229,.84);
  --code-str:rgba(242,246,255,.88);
  --code-cmt:rgba(172,189,221,.80);
  --code-val:rgba(242,246,255,.95);

  /* 复合渐变与装置阴影 */
  --grad-accent:linear-gradient(100deg,var(--accent) 0%,var(--cyan) 100%);
  --term-bg:linear-gradient(180deg,#062A63 0%,#001A47 100%);
  --term-bar:linear-gradient(180deg,rgba(79,109,255,.14) 0%,rgba(79,109,255,0) 100%);
  --hero-halo:radial-gradient(760px 540px at 78% 30%,rgba(79,109,255,.30) 0%,rgba(79,109,255,0) 68%),radial-gradient(520px 440px at 97% 4%,rgba(53,214,255,.17) 0%,rgba(53,214,255,0) 70%);
  --hero-vignette:linear-gradient(180deg,rgba(0,10,40,.42) 0%,rgba(0,10,40,0) 22%,rgba(0,10,40,0) 66%,rgba(0,10,40,.46) 100%);
  --viz-halo:radial-gradient(46% 44% at 70% 26%,rgba(53,214,255,.20) 0%,rgba(53,214,255,0) 68%),radial-gradient(52% 50% at 34% 76%,rgba(79,109,255,.26) 0%,rgba(79,109,255,0) 72%);
  --viz-mask:radial-gradient(58% 56% at 66% 34%,#000 0%,rgba(0,0,0,.34) 52%,rgba(0,0,0,0) 80%);
  --btn-shadow:0 12px 30px -12px rgba(53,214,255,.55),0 4px 16px -8px rgba(79,109,255,.60);
  --term-shadow:0 0 0 1px rgba(53,214,255,.30),0 0 30px rgba(53,214,255,.22),0 0 84px rgba(79,109,255,.30),0 30px 64px -24px rgba(0,8,32,.75);
  --grid-tex:linear-gradient(to right,var(--grid-line) 1px,transparent 1px),linear-gradient(to bottom,var(--grid-line) 1px,transparent 1px);

  /* 圆角 */
  --r-s:6px;
  --r-m:8px;
  --r-l:10px;
  --r-pill:999px;

  /* 字体 */
  --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','SFMono-Regular',Menlo,Consolas,'Noto Sans SC','Noto Sans JP','Noto Sans KR',monospace;

  /* 尺度 */
  --gutter:32px;
  --wrap-max:1240px;
  --head-max:1280px;
  --head-h:72px;
  --sec-y:88px;
}

/* ---------- 2. reset ---------- */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  font-size:16px;
  line-height:1.7;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
h1,h2,h3,h4,h5{
  margin:0;
  font-family:var(--font-display);
  font-weight:800;
  line-height:1.2;
  letter-spacing:-.02em;
  color:inherit;
}
p{margin:0}
ul,ol{margin:0;padding:0;list-style:none}
a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit}
img,video{display:block;max-width:100%}
svg{display:block}
table{border-collapse:collapse}
::selection{background:rgba(79,109,255,.45);color:var(--text)}
:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

/* ---------- 3. 版心与分区 ---------- */
.wrap{
  width:100%;
  max-width:var(--wrap-max);
  margin-inline:auto;
  padding-inline:var(--gutter);
}
.sec{padding-top:var(--sec-y);padding-bottom:var(--sec-y);overflow-x:clip}
.sec-light{background:var(--bg-panel-2);color:var(--ink)}
.sec-deep{background:var(--bg-panel);color:var(--text)}
.sec-head{max-width:760px;min-width:0}
.sec-title{font-size:clamp(24px,2.6vw,34px);line-height:1.24}
.sec-lede{margin-top:14px;font-size:16px;color:var(--text-muted)}
.sec-light .sec-lede{color:var(--ink-muted)}
.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:9px;
  font-family:var(--font-mono);
  font-size:11.5px;
  letter-spacing:.18em;
  color:var(--text-muted);
}
.sec-light .eyebrow{color:var(--ink-muted)}
.eyebrow-dot{width:7px;height:7px;border-radius:50%;background:var(--grad-accent);flex:none}

.grid{display:grid;gap:24px}
.grid > *{min-width:0}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:40px;align-items:start}
.split > *{min-width:0}

/* ---------- 4. 排版 ---------- */
.h1{font-size:clamp(34px,3.4vw,48px);line-height:1.14;letter-spacing:-.02em}
.h2{font-size:clamp(24px,2.6vw,34px);line-height:1.24}
.h3{font-size:clamp(18px,1.7vw,22px);line-height:1.3}
.lead{margin-top:18px;font-size:17px;line-height:1.72;color:var(--text-muted)}
.sec-light .lead{color:var(--ink-muted)}
.muted{color:var(--text-muted)}
.sec-light .muted{color:var(--ink-muted)}
.dim{color:var(--text-dim)}
.mono{font-family:var(--font-mono);font-size:.9em;letter-spacing:.01em}
.nowrap{white-space:nowrap}
.strong{color:var(--text);font-weight:700}
.sec-light .strong{color:var(--ink)}
.hl{color:var(--success);font-weight:700}
.sec-light .hl{color:var(--accent-dark)}
.grad-text{
  background:var(--grad-accent);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  color:transparent;
}
.rule{height:1px;border:0;margin:0;background:var(--stroke-soft)}
.sec-light .rule{background:var(--line-light)}

/* 链接：深底用青，浅底用深蓝 */
.link{color:var(--cyan);border-bottom:1px solid var(--stroke-cyan);transition:color .18s ease,border-color .18s ease}
.link:hover{color:var(--text);border-color:var(--cyan)}
.sec-light .link{color:var(--accent-dark);border-color:rgba(43,63,216,.35)}
.sec-light .link:hover{color:var(--ink);border-color:var(--ink)}

/* 行内代码：超长不可断串（订阅地址/安装包文件名）必须能断 */
code,kbd,samp{
  font-family:var(--font-mono);
  font-size:.92em;
  overflow-wrap:anywhere;
  word-break:break-word;
  padding:1px 5px;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-s);
  background:var(--glass);
  color:var(--code-str);
}
.sec-light code,.sec-light kbd,.sec-light samp{
  background:rgba(0,42,107,.05);
  border-color:var(--line-light);
  color:var(--ink);
}
/* 浅底区块里的代码块仍走深面板配色，不能被上面的行内代码色压成隐形字 */
.sec-light pre code,.sec-light pre kbd,.sec-light pre samp{
  background:none;
  border:0;
  color:var(--code-str);
}
pre{
  margin:0;
  max-width:100%;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  padding:16px 18px;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-m);
  background:var(--bg-panel);
  color:var(--code-str);
  font-family:var(--font-mono);
  font-size:13.5px;
  line-height:1.85;
}
pre code{padding:0;border:0;background:none;color:inherit;overflow-wrap:normal;white-space:pre}

/* ---------- 5. 按钮 ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-height:50px;
  padding:0 22px;
  border:1px solid transparent;
  border-radius:var(--r-m);
  font-family:var(--font-display);
  font-size:15px;
  font-weight:700;
  letter-spacing:.005em;
  text-align:center;
  cursor:pointer;
  transition:transform .18s ease,box-shadow .18s ease,background-color .18s ease,border-color .18s ease,color .18s ease;
}
.btn svg{width:16px;height:16px;flex:none}
.btn-primary{background:var(--grad-accent);color:var(--bg-panel);box-shadow:var(--btn-shadow)}
.btn-primary:hover{transform:translateY(-2px);box-shadow:0 18px 38px -12px var(--glow-cyan),0 6px 18px -8px var(--glow-blue)}
.btn-primary:active{transform:translateY(0)}
.btn-ghost{background:var(--glass);color:var(--text);border-color:var(--stroke-accent)}
.btn-ghost:hover{transform:translateY(-2px);border-color:var(--cyan);background:var(--glass-2)}
.btn-ghost:active{transform:translateY(0)}
.btn-quiet{background:transparent;color:var(--text-muted);border-color:var(--stroke-soft)}
.btn-quiet:hover{color:var(--text);border-color:var(--stroke-accent)}
.btn-sm{min-height:40px;padding:0 16px;font-size:14px}
.btn-block{width:100%}
.btn[aria-disabled="true"],.btn.is-disabled{opacity:.45;pointer-events:none}
.sec-light .btn-ghost{background:rgba(0,42,107,.04);color:var(--ink);border-color:rgba(43,63,216,.45)}
.sec-light .btn-ghost:hover{border-color:var(--accent-dark);background:rgba(0,42,107,.07)}

/* ---------- 6. 页头 ---------- */
#site-header{position:relative;z-index:20}
.topbar{
  position:relative;
  z-index:20;
  display:flex;
  align-items:center;
  height:var(--head-h);
  background:var(--bg);
  border-bottom:1px solid var(--stroke-soft);
}
.topbar-in{
  display:flex;
  align-items:center;
  gap:26px;
  width:100%;
  max-width:min(100%,calc(var(--head-max) + var(--gutter) * 2));
  margin-inline:auto;
  padding-inline:var(--gutter);
}
.brand{display:flex;align-items:center;gap:11px;flex:none;color:var(--text)}
.brand-mark{
  width:32px;
  height:32px;
  flex:none;
  border-radius:50%;
  box-shadow:0 0 0 1px var(--stroke-accent),0 8px 20px -8px var(--glow-blue);
}
.brand-name{
  font-family:var(--font-display);
  font-weight:800;
  font-size:17.5px;
  letter-spacing:-.012em;
  color:var(--text);
  white-space:nowrap;
}

/* 桌面导航：ul 自身必须 flex，否则 li 会竖排堆叠 */
.nav{margin-left:auto;min-width:0}
.nav-list{display:flex;align-items:center;gap:30px;list-style:none;margin:0;padding:0}
.nav-list li{display:flex}
.nav-list a{
  position:relative;
  display:inline-flex;
  align-items:center;
  padding:6px 0;
  font-size:14.5px;
  font-weight:500;
  color:var(--text-muted);
  white-space:nowrap;
  transition:color .18s ease;
}
.nav-list a:hover{color:var(--text)}
.nav-list a.is-active{color:var(--text);font-weight:700}
.nav-list a.is-active::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-1px;
  height:2px;
  border-radius:2px;
  background:var(--grad-accent);
}

.tools{display:flex;align-items:center;gap:10px;flex:none;margin-left:4px}
.lang-wrap{position:relative}
.lang{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-height:38px;
  padding:0 12px;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-m);
  background:var(--glass);
  font-size:13.5px;
  color:var(--text-muted);
  white-space:nowrap;
  cursor:pointer;
  transition:border-color .18s ease,color .18s ease,background-color .18s ease;
}
.lang:hover{border-color:var(--stroke-accent);color:var(--text);background:var(--glass-2)}
.lang svg{width:15px;height:15px;flex:none}
.lang .caret-ic{width:13px;height:13px;opacity:.75}
.lang-short{display:none}
.lang-menu{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  z-index:70;
  display:none;
  min-width:184px;
  margin:0;
  padding:6px;
  list-style:none;
  background:var(--bg-panel);
  border:1px solid var(--border);
  border-radius:var(--r-m);
  box-shadow:var(--shadow-lift);
}
.lang-menu.is-open{display:block}
.lang-menu a{
  display:flex;
  align-items:center;
  width:100%;
  min-height:40px;
  padding:8px 12px;
  border-radius:var(--r-s);
  font-size:13.5px;
  color:var(--text-muted);
}
.lang-menu a:hover{background:var(--glass);color:var(--text)}
.lang-menu a.is-current{color:var(--text);font-weight:700}
.lang-menu a.is-current::after{
  content:"";
  width:6px;height:6px;
  margin-left:auto;
  border-radius:50%;
  background:var(--success);
  box-shadow:0 0 8px var(--glow-lime);
}

.nav-toggle{
  display:none;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:44px;
  padding:0;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-m);
  background:var(--glass);
  color:var(--text);
  cursor:pointer;
}
.nav-toggle-bars{position:relative;display:block;width:18px;height:12px}
.nav-toggle-bars i{
  position:absolute;
  left:0;right:0;
  height:2px;
  border-radius:2px;
  background:currentColor;
  transition:transform .2s ease,opacity .2s ease;
}
.nav-toggle-bars i:nth-child(1){top:0}
.nav-toggle-bars i:nth-child(2){top:5px}
.nav-toggle-bars i:nth-child(3){top:10px}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(1){transform:translateY(5px) rotate(45deg)}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(2){opacity:0}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(3){transform:translateY(-5px) rotate(-45deg)}

/* 抽屉：实色底，整行可点，独立滚动 */
.nav-drawer{
  display:none;
  position:fixed;
  inset:0;
  z-index:60;
  flex-direction:column;
  max-height:100dvh;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:14px var(--gutter) 36px;
  background:var(--bg-panel);
  color:var(--text);
}
.nav-drawer.is-open{display:flex}
.drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-bottom:14px;
  border-bottom:1px solid var(--line-soft);
}
.drawer-head .brand{flex:1;min-width:0;min-height:44px}
.drawer-close{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:44px;
  padding:0;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-m);
  background:var(--glass);
  color:var(--text);
  cursor:pointer;
}
.drawer-close svg{width:16px;height:16px}
.drawer-title{
  margin:22px 0 4px;
  font-family:var(--font-mono);
  font-size:11px;
  letter-spacing:.18em;
  color:var(--text-dim);
}
.drawer-list{list-style:none;margin:0;padding:0}
.drawer-list a{
  display:flex;
  align-items:center;
  width:100%;
  min-height:48px;
  padding:12px 4px;
  font-size:16px;
  font-weight:600;
  color:var(--text);
  border-bottom:1px solid var(--line-soft);
}
.drawer-list a:active{background:var(--glass)}
.drawer-list a.is-active{color:var(--cyan)}
.drawer-langs a{font-size:15px;font-weight:500;color:var(--text-muted)}
html.nav-open{overflow:hidden}

/* ---------- 7. 页脚 ---------- */
.foot{
  background:var(--bg-panel);
  color:var(--text);
  border-top:1px solid var(--line-soft);
  padding-top:56px;
  padding-bottom:28px;
}
.foot-grid{display:grid;grid-template-columns:1.5fr 1fr 1.3fr .9fr;gap:40px 32px}
.foot-grid > *{min-width:0}
.foot-desc{margin-top:14px;max-width:340px;font-size:13.5px;line-height:1.75;color:var(--text-muted)}
.foot-title{
  margin:0 0 14px;
  font-family:var(--font-mono);
  font-size:11.5px;
  font-weight:500;
  letter-spacing:.16em;
  color:var(--text-dim);
}
.foot-list{display:flex;flex-direction:column;gap:10px}
.foot-list a{font-size:14px;color:var(--text-muted);transition:color .18s ease}
.foot-list a:hover{color:var(--cyan)}
.foot-hot{display:flex;flex-wrap:wrap;gap:8px}
.foot-hot a{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  overflow:hidden;
  padding:5px 11px;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-pill);
  background:var(--glass);
  font-size:12.5px;
  color:var(--text-muted);
  white-space:nowrap;
  transition:border-color .18s ease,color .18s ease;
}
.foot-hot a:hover{border-color:var(--stroke-accent);color:var(--text)}
.foot-bottom{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin-top:44px;
  padding-top:20px;
  border-top:1px solid var(--line-soft);
}
.foot-copy{margin:0;font-size:13px;color:var(--text-dim)}
.foot-legal{display:flex;flex-wrap:wrap;gap:18px}
.foot-legal a{font-size:13px;color:var(--text-muted)}
.foot-legal a:hover{color:var(--cyan)}

/* ---------- 8. 通用卡片与面板 ---------- */
.card{
  min-width:0;
  padding:22px;
  border:1px solid var(--stroke-soft);
  border-radius:var(--r-l);
  background:var(--glass);
  color:var(--text);
}
.card-light{
  min-width:0;
  padding:22px;
  border:1px solid var(--line-light);
  border-radius:var(--r-l);
  background:var(--bg-panel-2);
  color:var(--ink);
}
.panel{
  min-width:0;
  padding:24px;
  border:1px solid var(--line-soft);
  border-radius:var(--r-l);
  background:var(--bg-panel);
  color:var(--text);
}
.card-title{margin-bottom:8px;font-size:17px;color:inherit}
.card-text{font-size:14.5px;line-height:1.72;color:var(--text-muted)}
.card-light .card-text{color:var(--ink-muted)}

/* ---------- 9. 滚动揭示 ---------- */
.reveal{
  opacity:0;
  transform:translateY(14px);
  transition:opacity .55s ease,transform .55s cubic-bezier(.22,.72,.28,1);
}
.reveal.shown{opacity:1;transform:none}

/* ---------- 10. 窄屏防溢出（惯犯就地防死） ---------- */
.tilt{transform:rotate(-1.5deg)}
img,svg{flex-shrink:0}

/* ---------- 11. 响应式 ---------- */
@media (max-width:1080px){
  :root{--sec-y:72px}
  .split{grid-template-columns:1fr;gap:32px}
}
@media (max-width:900px){
  :root{--sec-y:60px}
  #site-header{position:sticky;top:0;z-index:30}
  .nav{display:none}
  .nav-toggle{display:inline-flex}
  .tools{margin-left:auto}
  .topbar{height:auto;min-height:64px;padding-top:10px;padding-bottom:10px}
  .topbar-in{gap:14px}
  .grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .foot-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:768px){
  body{font-size:15.5px}
  .h1{font-size:clamp(24px,7vw,30px);line-height:1.22}
  .h2{font-size:clamp(21px,5.6vw,26px)}
  .lead{font-size:15.5px}
}
@media (max-width:720px){
  :root{--gutter:20px;--sec-y:52px}
  .foot{padding-top:44px;padding-bottom:24px}
}
@media (max-width:640px){
  .grid-2,.grid-3,.foot-grid{grid-template-columns:1fr}
  .tilt{transform:none}
  .foot-bottom{margin-top:32px}
}
@media (max-width:520px){
  .lang-full{display:none}
  .lang-short{display:inline}
  .brand-name{font-size:16px}
}
@media (max-width:420px){
  :root{--gutter:18px}
}

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