:root{
  --bg:#10192b;
  --panel:#17233c;
  --panel-soft:#1d2a48;
  --text:#edf3ff;
  --muted:#c8d4ee;
  --line:rgba(255,255,255,.08);
  --accent:#5ea4ff;
  --accent-2:#8fc7ff;
  --ok:#36c690;
  --warn:#f0b35c;
  --shadow:0 18px 44px rgba(0,0,0,.18);
  --code:#0b1222;
}

html[data-theme="light"]{
  --bg:#f7f1e8;
  --panel:#fffdfa;
  --panel-soft:#f4eadf;
  --text:#1d2840;
  --muted:#66738d;
  --line:rgba(29,40,64,.12);
  --accent:#356fe8;
  --accent-2:#73a7ff;
  --ok:#07885d;
  --warn:#a66a0a;
  --shadow:0 14px 30px rgba(34,48,74,.10);
  --code:#f2f5fb;
}

*{box-sizing:border-box}
body{margin:0;font-family:Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}
main{width:min(100% - 28px, 1280px);margin:0 auto;padding:24px 0 42px}
a{color:inherit;text-decoration:none}
.card{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:22px;margin-bottom:16px;box-shadow:var(--shadow)}
.topbar{display:flex;position:relative;justify-content:space-between;gap:10px;flex-wrap:wrap;align-items:flex-start}
.topbar > div:first-child{flex:1 1 560px;min-width:0}
.actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;margin-left:auto}
.btn{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:0 12px;border-radius:11px;border:1px solid var(--line);background:rgba(255,255,255,.04);font-weight:700;font-size:.95rem;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}
.btn:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--accent) 45%,var(--line));box-shadow:0 12px 24px rgba(0,0,0,.12)}
html[data-theme="light"] .btn{background:rgba(29,40,64,.03)}
.theme-toggle{width:38px;height:38px;padding:0;font-size:1rem;flex:0 0 auto}
.home-btn{width:38px;height:38px;padding:0;font-size:1rem;flex:0 0 auto}
.actions .theme-toggle,.actions .home-btn{position:static}
.actions .home-btn{margin-left:auto}
h1,h2,h3{margin-top:0;color:color-mix(in srgb,var(--text) 86%,var(--muted));font-weight:650}
h1{font-size:clamp(1.38rem,1.54vw,1.88rem);line-height:1.12;letter-spacing:0}
h2{font-size:1.22rem;line-height:1.18;letter-spacing:0}
h3{font-size:1.05rem;line-height:1.22;letter-spacing:0}
p,li{font-size:.94rem;line-height:1.55;color:var(--muted)}
li+li{margin-top:8px}
.answer{font-size:.95rem;color:color-mix(in srgb,var(--text) 92%,var(--muted))}
.muted{color:var(--muted)}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.links{display:grid;gap:10px;margin-top:14px}
.links a,.accent-link{color:var(--accent);font-weight:700}
.simple-list{padding-left:20px}
.hero-icon{width:136px;height:120px;min-height:120px;border-radius:18px;border:1px solid var(--line);display:grid;place-items:center;background:radial-gradient(circle at 50% 35%,rgba(94,164,255,.16),transparent 54%),rgba(255,255,255,.04)}
.hero-icon img{display:block;width:min(72%,116px);height:auto;filter:drop-shadow(0 14px 20px rgba(0,0,0,.18))}
.topbar.with-visual,
.topic-hero{
  display:grid;
  grid-template-columns:136px minmax(0,calc(50% - 154px)) minmax(0,calc(50% - 18px));
  grid-template-areas:"visual content actions";
  column-gap:18px;
  min-height:120px;
  align-items:stretch;
}
.topbar.with-visual > div:first-child,
.topic-hero > div:first-child{
  grid-area:content;
  min-width:0;
  max-width:34rem;
  align-self:start;
  padding-top:2px;
}
.topbar.with-visual .hero-icon,
.topic-hero .topic-visual{
  grid-area:visual;
  order:-1;
  align-self:start;
  justify-self:start;
}
.topbar.with-visual .actions,
.topic-hero > .actions{
  grid-area:actions;
  width:100%;
  margin-left:0;
  align-self:end;
  justify-self:end;
  justify-content:flex-end;
  flex-wrap:wrap-reverse;
  align-content:flex-start;
  min-height:120px;
  padding:0 100px 0 0;
  max-width:100%;
  position:relative;
}
.topbar.with-visual h1,
.topic-hero h1{margin-bottom:8px}
.topbar.with-visual p,
.topic-hero p{
  max-width:30rem;
  margin:0;
  line-height:1.46;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.topbar.with-visual .actions .home-btn,
.topic-hero > .actions .home-btn{margin-left:0}
.topbar.with-visual .actions .home-btn,
.topic-hero > .actions .home-btn,
.topbar.with-visual .actions .theme-toggle,
.topic-hero > .actions .theme-toggle{
  position:absolute;
  bottom:0;
}
.topbar.with-visual .actions .home-btn,
.topic-hero > .actions .home-btn{right:46px}
.topbar.with-visual .actions .theme-toggle,
.topic-hero > .actions .theme-toggle{right:0}
.search-card{padding:18px}
.search-label{display:block;margin-bottom:8px;color:var(--muted);font-weight:800;font-size:.9rem}
.search-input{width:100%;min-height:46px;border-radius:13px;border:1px solid var(--line);background:rgba(255,255,255,.04);color:var(--text);padding:0 14px;font:inherit;font-weight:700;outline:none}
.search-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 20%,transparent)}
html[data-theme="light"] .search-input{background:rgba(29,40,64,.03)}
.search-results{display:grid;gap:8px;margin-top:12px}
.search-result{padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.03)}
.search-result strong{display:block;margin-bottom:4px;color:var(--text)}
.search-result span{color:var(--muted);font-size:.9rem;line-height:1.45}
.kb-card{display:grid;grid-template-columns:minmax(0,1fr) 168px;gap:16px;min-height:210px;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease}
.kb-card:hover{transform:translateY(-4px);border-color:color-mix(in srgb,var(--accent) 45%,var(--line));box-shadow:0 18px 38px rgba(0,0,0,.16)}
.tag{display:inline-flex;margin-bottom:14px;padding:6px 10px;border-radius:999px;background:rgba(94,164,255,.12);color:var(--accent);font-size:.82rem;font-weight:800}
.topic-hero{position:relative}
.topic-visual,.kb-visual{min-height:148px;border-radius:18px;border:1px solid var(--line);background:linear-gradient(145deg,color-mix(in srgb,var(--panel-soft) 84%,#fff 16%),var(--panel-soft));position:relative;overflow:hidden}
.topic-visual{width:136px;height:120px;min-height:120px}
.kb-visual::before,.topic-visual::before{content:"";position:absolute;inset:22px;border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line));border-radius:16px;background:linear-gradient(180deg,rgba(255,255,255,.12),rgba(255,255,255,.02));opacity:.9}
.kb-visual::after,.topic-visual::after{content:"";position:absolute;width:72px;height:72px;right:22px;bottom:22px;border-radius:22px;background:linear-gradient(135deg,var(--accent-2),var(--accent));box-shadow:0 18px 34px rgba(0,0,0,.16)}
.visual-lines{position:absolute;left:22px;top:24px;display:grid;gap:10px;width:58%}
.visual-lines span{display:block;height:10px;border-radius:999px;background:rgba(255,255,255,.38)}
html[data-theme="light"] .visual-lines span{background:rgba(29,40,64,.14)}
.visual-lines span:nth-child(2){width:76%}
.visual-lines span:nth-child(3){width:58%}
.visual-icon{position:absolute;right:44px;bottom:42px;color:#fff;font-size:2rem;font-weight:900;z-index:1}
.kb-visual.has-image,.topic-visual.has-image{display:grid;place-items:center;background:radial-gradient(circle at 50% 35%,rgba(94,164,255,.16),transparent 54%),linear-gradient(145deg,color-mix(in srgb,var(--panel-soft) 88%,#fff 12%),var(--panel-soft))}
.kb-visual.has-image::before,.kb-visual.has-image::after,.topic-visual.has-image::before,.topic-visual.has-image::after,.has-image .visual-lines,.has-image .visual-icon{display:none}
.kb-icon-img{display:block;width:min(82%,176px);height:auto;filter:drop-shadow(0 18px 24px rgba(0,0,0,.18))}
.topic-visual .kb-icon-img{width:min(72%,116px)}
.symbol-visual{display:grid;place-items:center;background:radial-gradient(circle at 50% 38%,rgba(94,164,255,.18),transparent 56%),linear-gradient(145deg,color-mix(in srgb,var(--panel-soft) 88%,#fff 12%),var(--panel-soft))}
.symbol-visual::before,.symbol-visual::after{display:none}
.big-symbol{display:grid;place-items:center;width:96px;height:96px;border-radius:24px;background:linear-gradient(135deg,var(--accent-2),var(--accent));color:#fff;font-weight:900;font-size:2.35rem;box-shadow:0 20px 32px rgba(0,0,0,.18)}
.big-symbol.linux{background:linear-gradient(135deg,#ffffff,#ffd95b);color:#15213a}
.big-symbol.docker{background:linear-gradient(135deg,#6bd6ff,#356fe8)}
.big-symbol.site{background:linear-gradient(135deg,#a4f4c6,#36c690);color:#082c1f}
.big-symbol.backup{background:linear-gradient(135deg,#ffd36b,#ff8b4a);color:#2f1608}
.big-symbol.postgres{background:linear-gradient(135deg,#8fc7ff,#356fe8)}
.big-symbol.net{background:linear-gradient(135deg,#8fc7ff,#5ea4ff);color:#09203d}
.big-symbol.windows{background:linear-gradient(135deg,#6bd6ff,#2f75ff)}
.big-symbol.security{background:linear-gradient(135deg,#ff9c6b,#ff5c7a)}
.big-symbol.home{background:linear-gradient(135deg,#b7ffcc,#73a7ff);color:#09203d}
.steps{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.steps .wide{grid-column:1 / -1}
.section-nav{
  position:sticky;
  top:10px;
  z-index:20;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  margin:0 0 18px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:18px;
  background:color-mix(in srgb,var(--panel) 78%,transparent);
  box-shadow:0 16px 34px rgba(0,0,0,.10);
  backdrop-filter:blur(14px);
}
.section-nav-spacer{flex:1 1 auto;min-width:12px}
.section-nav a{
  display:inline-flex;
  align-items:center;
  min-height:36px;
  padding:0 10px;
  border-radius:12px;
  border:1px solid var(--line);
  color:var(--muted);
  font-weight:800;
  font-size:.94rem;
  background:rgba(255,255,255,.04);
}
.section-nav a:hover,.section-nav a.is-active{color:var(--text);border-color:var(--accent);background:rgba(94,164,255,.13)}
.nav-icon{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;min-height:36px;padding:0;border-radius:12px;border:1px solid var(--line);background:rgba(255,255,255,.04);color:var(--text);font-weight:900;font-size:.98rem;cursor:pointer;flex:0 0 auto}
.nav-icon:hover{border-color:var(--accent);background:rgba(94,164,255,.13);transform:translateY(-1px)}
.nav-sticky-action{opacity:0;pointer-events:none;transform:translateY(-4px);transition:opacity .18s ease,transform .18s ease}
body.is-scrolled .nav-sticky-action{opacity:1;pointer-events:auto;transform:translateY(0)}
.nav-search[hidden]{display:none}
.code-card{background:var(--code);border:1px solid var(--line);border-radius:14px;padding:12px;overflow:auto}
pre{margin:0;color:var(--text);font:700 .92rem/1.56 Consolas,"SFMono-Regular",monospace;white-space:pre-wrap}
.command-list{display:grid;gap:8px}
.command-row{display:grid;grid-template-columns:auto minmax(0,1fr);gap:9px;align-items:center;padding:7px 10px 7px 7px;border-radius:10px;border:1px solid transparent}
.command-row:hover{border-color:color-mix(in srgb,var(--accent) 35%,var(--line));background:rgba(94,164,255,.08)}
.command-text{font:700 .92rem/1.5 Consolas,"SFMono-Regular",monospace;white-space:pre-wrap;overflow-wrap:anywhere}
.copy-command{position:relative;width:34px;height:34px;min-height:34px;padding:0;border-radius:9px;border:1px solid var(--line);background:rgba(255,255,255,.05);color:transparent;font-size:0;cursor:pointer}
.copy-command::before,.copy-command::after{content:"";position:absolute;width:12px;height:14px;border:2px solid var(--text);border-radius:3px}
.copy-command::before{left:9px;top:11px;opacity:.55}
.copy-command::after{left:13px;top:7px;background:var(--code)}
.copy-command.is-copied::before{display:none}
.copy-command.is-copied::after{content:"✓";display:grid;place-items:center;left:0;top:0;width:100%;height:100%;border:0;background:transparent;color:var(--ok);font-size:1rem;font-family:Segoe UI,Arial,sans-serif;font-weight:900}
.copy-command:hover{border-color:var(--accent)}
.details-link{display:inline-flex;margin-top:12px;color:var(--accent);font-size:.94rem;font-weight:800}
.cheat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.cheat-card{min-height:210px}
.full-span{grid-column:1 / -1}
.section-title{display:flex;align-items:center;gap:10px}
.heading-link{display:inline-flex;align-items:center;gap:10px;color:inherit;text-decoration:none}
.heading-link:hover{color:var(--accent)}
.title-icon{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:10px;background:rgba(94,164,255,.16);box-shadow:inset 0 0 0 1px var(--line);font-size:1rem;flex:0 0 auto}
.title-icon.warn{background:linear-gradient(135deg,#ffcf5b,#ff6b6b);color:#18233b}
.title-icon.linux{background:linear-gradient(135deg,#fff,#ffd95b);color:#18233b}
.title-icon.docker{background:linear-gradient(135deg,#6bd6ff,#356fe8);color:#fff}
.title-icon.site{background:linear-gradient(135deg,#a4f4c6,#36c690);color:#082c1f}
.title-icon.postgres{background:linear-gradient(135deg,#8fc7ff,#356fe8);color:#fff}
.title-icon.net{background:linear-gradient(135deg,#8fc7ff,#5ea4ff);color:#082044}
.title-icon.windows{background:linear-gradient(135deg,#6bd6ff,#2f75ff);color:#fff}
.title-icon.security{background:linear-gradient(135deg,#ff9c6b,#ff5c7a);color:#fff}
.title-icon.home{background:linear-gradient(135deg,#b7ffcc,#73a7ff);color:#09203d}
.safety-strip{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin:10px 0 0;padding:0;list-style:none}
.safety-strip li{margin:0;padding:14px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.035)}
.linux-fast .command-list{grid-template-columns:repeat(3,minmax(0,1fr))}
.linux-fast .command-row{align-items:start}
.danger{border-color:color-mix(in srgb,#ff6b6b 42%,var(--line))}
.safe{border-color:color-mix(in srgb,var(--ok) 34%,var(--line))}
.mini-list{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.mini-list a,.mini-list span{padding:8px 10px;border-radius:999px;border:1px solid var(--line);color:var(--muted);font-weight:700;font-size:.9rem}
.mini-list a:hover{color:var(--text);border-color:var(--accent)}

@media (max-width:980px){
  .topbar.with-visual,
  .topic-hero{grid-template-columns:1fr;grid-template-areas:"visual" "content" "actions"}
  .topbar.with-visual .actions,
  .topic-hero > .actions{min-height:0;padding-right:0}
  .topbar.with-visual .actions .home-btn,
  .topic-hero > .actions .home-btn,
  .topbar.with-visual .actions .theme-toggle,
  .topic-hero > .actions .theme-toggle{position:static}
  .steps{grid-template-columns:1fr}
  .steps .wide{grid-column:auto}
}

@media (max-width:760px){
  main{width:min(100% - 20px, 1280px);padding:14px 0 30px}
  .grid,.cheat-grid{grid-template-columns:1fr}
  .kb-card{grid-template-columns:minmax(0,1fr) 88px;gap:12px;min-height:0}
  .topbar.with-visual,
  .topic-hero{
    grid-template-columns:86px minmax(0,1fr);
    grid-template-areas:"visual content" "actions actions";
    column-gap:12px;
    row-gap:10px;
    min-height:0;
    align-items:start;
  }
  .topbar.with-visual > div:first-child,
  .topic-hero > div:first-child,
  .topbar.with-visual .hero-icon,
  .topic-hero .topic-visual,
  .topbar.with-visual .actions,
  .topic-hero > .actions{grid-column:auto;grid-row:auto}
  .topbar.with-visual > div:first-child,
  .topic-hero > div:first-child{align-self:center;padding-top:0}
  .hero-icon{width:86px;height:78px;min-height:78px;border-radius:14px}
  .hero-icon img{width:min(70%,70px)}
  .kb-visual{width:88px;height:84px;min-height:84px;order:0;border-radius:14px}
  .topic-visual{width:86px;height:78px;min-height:78px;border-radius:14px}
  .kb-visual::after,.topic-visual::after{width:50px;height:50px;right:18px;bottom:18px;border-radius:16px}
  .kb-icon-img{width:min(66%,72px)}
  .topic-visual .kb-icon-img{width:min(66%,70px)}
  .visual-icon{right:28px;bottom:25px;font-size:1.2rem}
  .visual-lines{top:22px;gap:8px}
  .section-nav{top:6px;overflow-x:auto;flex-wrap:nowrap;gap:6px;padding:7px;border-radius:14px;margin-bottom:12px}
  .section-nav a{white-space:nowrap;min-height:32px;padding:0 9px;border-radius:10px;font-size:.82rem}
  .nav-icon{width:32px;height:32px;min-height:32px;border-radius:10px;font-size:.9rem}
  .section-nav-spacer{min-width:6px}
  .safety-strip{grid-template-columns:1fr}
  .linux-fast .command-list{grid-template-columns:1fr}
  .actions{width:100%;justify-content:flex-end;gap:6px;padding-right:0}
  .topbar.with-visual .actions,
  .topic-hero > .actions{
    grid-area:actions;
    margin:2px 0 0;
    min-height:0;
    min-width:0;
    max-width:100%;
    justify-self:stretch;
    justify-content:flex-end;
    align-content:flex-end;
    align-items:flex-end;
    flex-wrap:wrap-reverse;
    padding:0;
  }
  .topbar.with-visual .actions .home-btn,
  .topic-hero > .actions .home-btn,
  .topbar.with-visual .actions .theme-toggle,
  .topic-hero > .actions .theme-toggle{
    position:static;
    margin-left:0;
  }
  .topbar.with-visual .actions .home-btn,
  .topic-hero > .actions .home-btn{order:98}
  .topbar.with-visual .actions .theme-toggle,
  .topic-hero > .actions .theme-toggle{order:99}
  .topbar.with-visual p,.topic-hero p{max-width:none}
  .big-symbol{width:58px;height:58px;border-radius:16px;font-size:1.55rem}
  .btn{min-height:32px;padding:0 9px;border-radius:10px;font-size:.82rem}
  .theme-toggle,.home-btn{width:32px;height:32px;min-height:32px;font-size:.9rem}
  .card{padding:14px;border-radius:14px;margin-bottom:12px}
  h1{font-size:1.26rem}
  h2{font-size:1.08rem}
  p,li{font-size:.88rem;line-height:1.48}
}

@media (max-width:420px){
  .kb-card{grid-template-columns:minmax(0,1fr) 76px}
  .kb-visual{width:76px;height:72px;min-height:72px}
  .kb-icon-img{width:min(66%,62px)}
  .topbar.with-visual .actions,
  .topic-hero > .actions{gap:5px}
  .topbar.with-visual .actions .btn:not(.home-btn):not(.theme-toggle),
  .topic-hero > .actions .btn:not(.home-btn):not(.theme-toggle){
    min-height:30px;
    padding:0 8px;
    font-size:.76rem;
  }
}
