:root,[data-theme="light"]{
  --bg:#f7f9fc; --bg2:#eef2fa; --card:#ffffff; --line:#d9e1ef;
  --text:#14203a; --muted:#51607e; --brand:#2f6bff; --brand2:#7a5cff; --ok:#0b8f63;
  --btn-text:#ffffff; --header-bg:rgba(247,249,252,.88); --post-text:#243252;
  --code-bg:#eef2fa; --hero-a:rgba(122,92,255,.14); --hero-b:rgba(47,107,255,.12);
  --radius:16px; --maxw:1080px; color-scheme:light;
}
[data-theme="dark"]{
  --bg:#0b1020; --bg2:#111833; --card:#161f40; --line:#26305c;
  --text:#e8ecf8; --muted:#9aa6cf; --brand:#6ea8ff; --brand2:#8b7bff; --ok:#34d399;
  --btn-text:#0b1020; --header-bg:rgba(11,16,32,.85); --post-text:#d5dbf1;
  --code-bg:#0a0f20; --hero-a:rgba(139,123,255,.25); --hero-b:rgba(110,168,255,.18);
  color-scheme:dark;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--text);
  font:16px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,Helvetica,Arial,sans-serif}
a{color:var(--brand);text-decoration:none} a:hover{text-decoration:underline}
img,svg{max-width:100%;height:auto}
.wrap{max-width:var(--maxw);margin:0 auto;padding:0 20px}
header.site{position:sticky;top:0;z-index:20;background:var(--header-bg);backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
header.site .wrap{display:flex;align-items:center;justify-content:space-between;min-height:64px;gap:12px;flex-wrap:wrap}
.logo{font-weight:800;font-size:20px;color:var(--text);letter-spacing:.3px}
.logo span{background:linear-gradient(90deg,var(--brand),var(--brand2));-webkit-background-clip:text;background-clip:text;color:transparent}
.right{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
nav a{color:var(--muted);margin-left:18px;font-size:15px}
nav a:hover,nav a.active{color:var(--text);text-decoration:none}
.ctrl{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:34px;padding:0 10px;margin-left:8px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--text);font:600 13px/1 inherit;cursor:pointer}
.ctrl:hover{border-color:var(--brand);text-decoration:none}
.langsw{display:inline-flex;margin-left:8px;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.langsw a,.langsw span{padding:8px 10px;font-size:13px;font-weight:700;line-height:1;color:var(--muted)}
.langsw span{background:var(--brand);color:var(--btn-text)}
.langsw a:hover{background:var(--bg2);text-decoration:none}
.btn{display:inline-block;padding:12px 22px;border-radius:12px;font-weight:600;border:1px solid transparent;cursor:pointer}
.btn.primary{background:linear-gradient(90deg,var(--brand),var(--brand2));color:var(--btn-text)}
.btn.primary:hover{text-decoration:none;filter:brightness(1.08)}
.btn.ghost{border-color:var(--line);color:var(--text);background:var(--card)}
.btn.ghost:hover{background:var(--bg2);text-decoration:none}
.hero{padding:88px 0 64px;background:radial-gradient(900px 400px at 70% -10%,var(--hero-a),transparent),radial-gradient(700px 360px at 10% 0,var(--hero-b),transparent)}
.hero h1{font-size:clamp(34px,6vw,58px);line-height:1.1;margin:0 0 18px;letter-spacing:-.02em}
.hero p.lead{font-size:20px;color:var(--muted);max-width:680px;margin:0 0 28px}
.hero .cta{display:flex;gap:12px;flex-wrap:wrap}
.pill{display:inline-block;font-size:13px;color:var(--brand);border:1px solid var(--line);border-radius:999px;padding:4px 12px;margin-bottom:18px;background:var(--bg2)}
section{padding:56px 0}
section h2{font-size:30px;margin:0 0 8px;letter-spacing:-.01em}
section .sub{color:var(--muted);margin:0 0 32px;max-width:700px}
.grid{display:grid;gap:20px}
.g3{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.g2{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:24px}
.card h3{margin:0 0 8px;font-size:20px}
.card p{margin:0 0 12px;color:var(--muted)}
.card ul{margin:0;padding-left:18px;color:var(--muted)}
.card .tag{font-size:12px;color:var(--ok);text-transform:uppercase;letter-spacing:.08em;margin-bottom:8px;display:block}
.band{background:var(--bg2);border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
.steps{counter-reset:s}
.steps .card::before{counter-increment:s;content:counter(s);display:inline-flex;width:30px;height:30px;border-radius:50%;background:var(--brand);color:var(--btn-text);font-weight:700;align-items:center;justify-content:center;margin-bottom:10px}
footer.site{border-top:1px solid var(--line);padding:32px 0;color:var(--muted);font-size:14px}
footer.site .wrap{display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}
footer.site a{color:var(--muted)} footer.site a:hover{color:var(--brand)}
/* article + legal */
article.post{max-width:780px;margin:0 auto;padding:48px 20px 72px}
article.post h1{font-size:clamp(30px,5vw,44px);line-height:1.15;letter-spacing:-.02em;margin:0 0 12px}
article.post .meta{color:var(--muted);font-size:14px;margin-bottom:32px}
article.post h2{font-size:26px;margin:44px 0 12px;padding-top:6px;border-top:1px solid var(--line)}
article.post h3{font-size:20px;margin:28px 0 8px}
article.post p,article.post li{color:var(--post-text)}
article.post figure{margin:28px 0;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;text-align:center}
article.post figcaption{color:#334;font-size:14px;margin-top:6px}
article.post pre{background:#0a0f20;border:1px solid var(--line);border-radius:12px;padding:16px;overflow-x:auto;font-size:14px;line-height:1.5}
article.post code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.92em}
article.post :not(pre)>code{background:var(--code-bg);border:1px solid var(--line);border-radius:6px;padding:1px 6px}
article.post table{border-collapse:collapse;width:100%;margin:20px 0;font-size:15px}
article.post th,article.post td{border:1px solid var(--line);padding:8px 12px;text-align:right}
article.post th:first-child,article.post td:first-child{text-align:left}
article.post th{background:var(--bg2)}
.callout{background:var(--bg2);border-left:4px solid var(--brand);padding:14px 18px;border-radius:8px;margin:24px 0}
.cta-box{background:linear-gradient(135deg,rgba(110,168,255,.15),rgba(139,123,255,.15));border:1px solid var(--line);border-radius:var(--radius);padding:24px;margin:40px 0}
.refs li{margin-bottom:8px}
.postlist .card{display:block;color:var(--text)}
.postlist .card:hover{text-decoration:none;border-color:var(--brand)}
.katex-display{overflow-x:auto;overflow-y:hidden}
@media(max-width:760px){
  header.site .wrap{padding-top:10px;padding-bottom:10px}
  .right{width:100%;justify-content:space-between}
  nav{display:flex;flex-wrap:wrap;gap:4px 0}
  nav a{margin-left:0;margin-right:14px;font-size:14px}
  .hero{padding:56px 0 40px}
}

.newslist .card{display:flex;flex-direction:column}.newsitem .src{font-size:13px;margin-top:auto;margin-bottom:0}.newsitem h3{font-size:18px}a.pill{text-decoration:none;margin-right:6px}a.pill:hover{border-color:var(--brand)}
