:root {
  --bg: #0b1020;
  --panel: #121a33;
  --text: #eaf0ff;
  --muted: #a8b3d6;
  --brand: #6ee7ff;
  --brand-2: #8b5cf6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --maxw: 1000px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(139, 92, 246, .15), transparent),
    radial-gradient(1000px 600px at 90% 10%, rgba(110, 231, 255, .12), transparent),
    var(--bg);
  color: var(--text);
  font: 16px/1.7 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a {
  color: var(--brand);
}

a:hover {
  text-decoration: none;
  filter: brightness(1.1);
}

.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 28px;
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(11, 16, 32, .9), rgba(11, 16, 32, .6));
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
}

.logo .mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: conic-gradient(from 180deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}

main {
  padding: 28px 0 60px;
}

.hero {
  padding: 36px 0 8px;
}

.hero h1 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  margin: 0;
}

.hero p {
  color: var(--muted);
  margin: 10px 0 0;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.paper {
  padding: 24px;
}

.paper h2 {
  font-size: 1.25rem;
  margin: 24px 0 8px;
}

.paper h3 {
  font-size: 1.05rem;
  margin: 16px 0 6px;
}

.paper ol,
.paper ul {
  margin: 8px 0 18px 18px;
}

.muted {
  color: var(--muted);
}

.note {
  padding: 12px 14px;
  border-left: 3px solid var(--brand);
  background: rgba(110, 231, 255, .06);
  border-radius: 12px;
}

.toc {
  position: sticky;
  top: 92px;
  align-self: flex-start;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
}

@media (max-width: 920px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .toc {
    position: relative;
    top: auto;
  }
}

.toc .card {
  padding: 16px;
}

.toc h3 {
  margin: 0 0 8px;
  font-size: .95rem;
}

.toc a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
}

.toc a:hover {
  color: var(--text);
  font-size: 16px;
}

footer {
  border-top: 1px solid rgba(255, 255, 255, .06);
  color: var(--muted);
}
html { scroll-behavior: smooth; }
.paper h2[id], .paper h3[id] { scroll-margin-top: 110px; } /* dopasuj do wysokości headera */

.toc a.active {
  color: var(--text);
  transition: color 0.3s ease;
  font-size: 18px;
  transition: font-size 0.2 ease;
  font-weight: 900;  
  transition: font-weight 0.1s ease;
}
.paper h2[id], .paper h3[id] {
  scroll-margin-top: 110px; /* dopasuj do wysokości headera */
}
html { scroll-behavior: smooth; }

/* żeby nagłówek nie chował się pod sticky headerem */
.paper h1[id], .paper h2[id], .paper h3[id],
section[id], h2[id], h3[id] {
  scroll-margin-top: 110px;  /* dopasuj do wysokości headera */
}
/* ===== Strzałka "powrót do góry" ===== */
#scrollTopBtn {
  position: fixed;
  right: 24px;
  bottom: 26px;
  z-index: 999;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #03121a;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#scrollTopBtn:hover {
  filter: brightness(1.1);
  transform: translateY(0) scale(1.05);
}

#scrollTopBtn.show {
  opacity: 1;
  transform: translateY(0);
}

/* Na małych ekranach lekko przesunięta */
@media (max-width:600px) {
  #scrollTopBtn {
    right: 16px;
    bottom: 18px;
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
}
