* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* чтобы липкий топбар не перекрывал заголовок секции при переходе по якорю */
  scroll-padding-top: 4.5rem;
}

:root {
  --surface: #14161d;
  --panel: #1b1e28;
  --card: #20242f;
  --dot: rgba(50, 52, 62, 0.45);
  --line: #2c3140;
  --text: #e8eaf0;
  --muted: #9aa0b4;
  --accent: #c8ff00;
  --accent-dim: #9dcc00;
  --pink: #ff5ea8;
  --blue: #4da6ff;
  --orange: #ffab2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SN Pro", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--surface);
  background-image: radial-gradient(var(--dot) 1px, var(--surface) 1px);
  background-size: 20px 20px;
}

h1,
h2,
h3 {
  font-family: "SN Pro", system-ui, sans-serif;
}

/* ---------- Топбар ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 22, 29, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar__logo {
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  color: var(--accent);
}

.topbar__logo span {
  color: var(--text);
}

.topbar__nav {
  display: flex;
  gap: 1.1rem;
}

.topbar__nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.topbar__nav a:hover {
  color: var(--accent);
}

/* ---------- Герой ---------- */
.hero {
  max-width: 60rem;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  text-align: center;
}

.hero__badge {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}

.hero__title {
  margin: 1rem 0 0.75rem;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.1;
  font-weight: 800;
}

.accent {
  color: var(--accent);
}

.hero__lead {
  margin: 0 auto;
  max-width: 40rem;
  color: var(--muted);
  line-height: 1.6;
}

.hero__search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.6rem;
}

.hero__search input {
  width: min(24rem, 100%);
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.hero__search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.15);
}

.hero__count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Каталог ---------- */
.catalog {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.6rem;
}

.filter {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.filter:hover {
  border-color: var(--accent-dim);
  color: var(--text);
  transform: translateY(-1px);
}

.filter--on {
  background: var(--accent);
  border-color: var(--accent);
  color: #14161d;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  animation: pop 0.35s both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent-dim);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  outline: none;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__logo {
  font-size: 2rem;
}

.card__level {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--orange);
}

.card__name {
  margin: 0.6rem 0 0.15rem;
  font-size: 1.15rem;
}

.card__tag {
  margin: 0;
  font-size: 0.78rem;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}

.card__desc {
  margin: 0.55rem 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
}

.card__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
}

.card__year {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.card__more {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

/* ---------- Панели ---------- */
.panel {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
}

.panel__title {
  text-align: center;
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin: 0 0 1.4rem;
}

.panel__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem;
}

.chip h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.chip p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.chip b {
  color: var(--text);
}

.chip--easy {
  border-top: 3px solid var(--accent);
}
.chip--fast {
  border-top: 3px solid var(--orange);
}
.chip--web {
  border-top: 3px solid var(--blue);
}
.chip--strict {
  border-top: 3px solid var(--pink);
}

.chip--easy h3 {
  color: var(--accent);
}
.chip--fast h3 {
  color: var(--orange);
}
.chip--web h3 {
  color: var(--blue);
}
.chip--strict h3 {
  color: var(--pink);
}

/* Вспышка заголовка секции при переходе по кнопке меню */
.panel__title.flash,
.hero__title.flash {
  animation: flash 0.9s ease;
}

@keyframes flash {
  0% {
    color: var(--accent);
    text-shadow: 0 0 18px rgba(200, 255, 0, 0.65);
    transform: scale(1);
  }
  35% {
    transform: scale(1.03);
  }
  100% {
    color: inherit;
    text-shadow: none;
    transform: scale(1);
  }
}

.steps {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.2rem 1.4rem 1.2rem 3.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  line-height: 1.7;
}

.steps li {
  margin-bottom: 0.6rem;
  color: var(--muted);
}

.steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.steps b {
  color: var(--text);
}

/* ---------- Футер ---------- */
.footer {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: "JetBrains Mono", monospace;
}

/* ---------- Модалка ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 13, 0.75);
  backdrop-filter: blur(3px);
}

.modal__card {
  position: relative;
  width: min(36rem, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem;
  animation: pop 0.25s both;
}

.modal__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
}

.modal__close:hover {
  border-color: var(--pink);
  color: var(--pink);
}

.modal__head {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.modal__logo {
  font-size: 2.6rem;
}

.modal__head h2 {
  margin: 0;
  font-size: 1.5rem;
}

.modal__tag {
  margin: 0.15rem 0 0;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
}

.modal__desc {
  margin: 1rem 0;
  line-height: 1.65;
  color: var(--muted);
}

.modal__facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.modal__facts div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  text-align: center;
}

.modal__facts span {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal__facts b {
  font-size: 0.9rem;
}

.modal__subtitle {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.modal__code {
  margin: 0;
  padding: 0.9rem 1rem;
  background: #0e1016;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  color: #b9f06a;
}

.modal__note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--orange);
  background: rgba(255, 171, 46, 0.08);
  border: 1px dashed rgba(255, 171, 46, 0.4);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .topbar__nav {
    display: none;
  }
  .modal__facts {
    grid-template-columns: 1fr;
  }
}
