:root {
  --bg: #0d0a14;
  --bg2: #17111f;
  --card: #1e1629;
  --line: #34284a;
  --text: #ece6f5;
  --muted: #a99bbf;
  --orange: #ff7a1a;
  --purple: #a259ff;
  --green: #5dff9b;
  --red: #ff3355;
  --code-bg: #0a0710;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(162, 89, 255, .18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(255, 122, 26, .12), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 17px/1.6 "Nunito", system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--orange); }
a:hover { color: #ffa45c; }

h1, h2, h3 { font-family: "Creepster", "Nunito", cursive; font-weight: 400; letter-spacing: .03em; line-height: 1.15; }
h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); margin: .2em 0; color: var(--orange); text-shadow: 0 0 24px rgba(255, 122, 26, .45); }
h2 { font-size: clamp(1.8rem, 5vw, 2.4rem); color: var(--purple); margin: 1.6em 0 .4em; }
h3 { font-size: 1.5rem; color: var(--green); margin: 1.2em 0 .3em; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- nav ---------- */
nav.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(13, 10, 20, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
nav.top .brand { font-family: "Creepster", cursive; font-size: 1.5rem; color: var(--orange); text-decoration: none; margin-right: auto; }
nav.top a.lnk {
  color: var(--text); text-decoration: none; padding: 6px 12px; border-radius: 999px;
  font-weight: 700; font-size: .95rem;
}
nav.top a.lnk:hover { background: var(--card); }
nav.top a.lnk.on { background: var(--orange); color: #1a0d00; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 56px 0 24px; }
.hero p.lead { font-size: 1.25rem; color: var(--muted); max-width: 680px; margin: 0 auto; }
.flicker { animation: flicker 4s infinite; }
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: .35; }
}
.float { display: inline-block; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }

.pagehead { padding: 40px 0 8px; }
.pagehead .emoji { font-size: 3rem; }
.pagehead p { color: var(--muted); font-size: 1.15rem; margin-top: 0; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 28px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--text); display: block;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
a.card:hover { transform: translateY(-4px); border-color: var(--orange); box-shadow: 0 10px 30px rgba(255, 122, 26, .18); color: var(--text); }
.card .emoji { font-size: 2.6rem; }
.card h3 { margin: .3em 0 .2em; color: var(--orange); }
.card p { margin: 0; color: var(--muted); font-size: .97rem; }

.box {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--purple);
  border-radius: var(--radius); padding: 14px 18px; margin: 18px 0;
}
.box.warn { border-left-color: var(--red); }
.box.tip { border-left-color: var(--green); }
.box.idea { border-left-color: var(--orange); }
.box strong.t { display: block; margin-bottom: 4px; }

/* ---------- steps ---------- */
ol.steps { counter-reset: s; list-style: none; padding: 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 4px 0 14px 52px; }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 2px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--orange); color: #1a0d00; font-weight: 900;
  display: grid; place-items: center;
}

/* ---------- tables ---------- */
.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .97rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 6px; font-size: .92em; color: var(--green); }

/* ---------- code blocks ---------- */
.code { position: relative; margin: 14px 0 22px; }
.code .label {
  display: inline-block; background: var(--line); color: var(--muted);
  font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 8px 8px 0 0;
}
.code pre {
  margin: 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 16px; overflow-x: auto; font-size: .9rem; line-height: 1.5;
}
.code pre code { background: none; padding: 0; color: #e8e0f5; }
.code button.copy {
  position: absolute; top: 30px; right: 10px;
  background: var(--purple); color: #fff; border: 0; border-radius: 8px;
  padding: 6px 12px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.code button.copy.ok { background: var(--green); color: #002; }

.kw { color: #ff9de2; }
.fn { color: #ffcf6b; }
.str { color: #9dff9d; }
.num { color: #8fd3ff; }
.cm { color: #7d6f95; font-style: italic; }

/* ---------- parts list ---------- */
.parts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.parts li { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .93rem; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; border-left: 3px solid var(--purple); margin-left: 8px; }
.timeline li { padding: 4px 0 14px 20px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 10px; width: 15px; height: 15px; border-radius: 50%; background: var(--orange); }
.timeline b { color: var(--orange); }

footer { margin-top: 60px; padding: 30px 0 40px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .92rem; }

.next { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.next a { background: var(--card); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; text-decoration: none; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .flicker, .float { animation: none; }
  a.card { transition: none; }
}

/* ---------- block images ---------- */
figure.blk {
  margin: 12px 0 20px; background: #f7f4fb; border-radius: var(--radius);
  padding: 16px; overflow-x: auto; border: 1px solid var(--line);
}
figure.blk img { display: block; max-width: 100%; height: auto; }
figure.blk figcaption { color: #4a3d5e; font-weight: 800; margin-bottom: 10px; font-size: 1.05rem; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 700px) { .pair { grid-template-columns: 1fr; } }

.idea { margin: 34px 0; }
.idea h3 { margin-bottom: 0; }
.idea p { margin: 4px 0 0; color: var(--muted); }

/* ---------- channels ---------- */
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 18px 0; }
.chip { border-radius: var(--radius); padding: 12px 14px; background: var(--card); border: 1px solid var(--line); }
.chip b { display: block; font-size: 1.9rem; line-height: 1.1; font-family: "Creepster", cursive; font-weight: 400; }
.chip span { color: var(--muted); font-size: .92rem; }
.chip.no b { color: var(--red); text-decoration: line-through; }
.chip.pub b { color: var(--green); }
.chip.par b { color: var(--purple); }
.chip.lys b { color: #ffe066; }
.chip.lyd b { color: #6bd3ff; }
.chip.ram b { color: var(--orange); }

/* ---------- radio diagram ---------- */
.radio { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 26px 0; flex-wrap: wrap; text-align: center; }
.radio .mb { background: var(--card); border: 2px solid var(--purple); border-radius: 16px; padding: 14px 18px; min-width: 130px; }
.radio .mb .e { font-size: 2.4rem; }
.radio .mb b { display: block; }
.radio .mb small { color: var(--muted); }
.radio .waves { font-size: 1.6rem; color: var(--orange); letter-spacing: 4px; }
.radio .waves span { display: inline-block; animation: wave 1.2s infinite; opacity: .2; }
.radio .waves span:nth-child(2) { animation-delay: .2s; }
.radio .waves span:nth-child(3) { animation-delay: .4s; }
.radio .waves .msg { display: block; font-size: 1rem; letter-spacing: 0; color: var(--text); opacity: 1; animation: none; }
@keyframes wave { 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .radio .waves span { animation: none; opacity: 1; } }
