:root {
  --bg: #05060d;
  --bg-alt: rgba(12, 16, 28, 0.82);
  --fg: #f0f7ff;
  --accent: #7800ff;
  --accent-alt: #3f9dff;
  --muted: #8b95a7;
  --panel-border: rgba(120, 0, 255, 0.35);
  --panel-shadow: rgba(120, 0, 255, 0.22);
  --badge-bg: linear-gradient(135deg, rgba(120, 0, 255, 0.35), rgba(63, 157, 255, 0.35));
  font-family: "IBM Plex Mono", "Fira Mono", Consolas, "Courier New", monospace;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 3rem clamp(1.5rem, 4vw, 4rem);
  color: var(--fg);
  background: radial-gradient(circle at 20% 20%, rgba(120, 0, 255, 0.18), transparent 45%),
              radial-gradient(circle at 80% 0%, rgba(63, 157, 255, 0.15), transparent 55%),
              var(--bg);
  position: relative;
  overflow-x: hidden;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02) 0,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  opacity: 0.35;
  z-index: 1;
}

.hero {
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;

  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: center;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.hero__content {
  max-width: 520px;
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--accent);
  letter-spacing: 0.28rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.hero__badge::after {
  content: "//";
  color: var(--accent-alt);
  font-weight: 700;
}

.hero__badge:hover {
  color: var(--accent-alt);
}

.hero__title {
  margin: 1.2rem 0 0.8rem;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero__description {
  margin: 0 0 1.2rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}

.hero__list li {
  position: relative;
  padding-left: 1.6rem;
  line-height: 1.5;
}

.hero__list li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.hero__visual {
  position: relative;
  justify-self: center;
  width: min(360px, 90%);
  background: linear-gradient(150deg, rgba(120, 0, 255, 0.22), rgba(63, 157, 255, 0.15));
  border: 1px solid rgba(120, 0, 255, 0.35);
  border-radius: 1.4rem;
  padding: 1.8rem;
  overflow: hidden;
  box-shadow: 0 30px 45px -25px rgba(120, 0, 255, 0.35);
}

.hero__visual::after {
  content: "";
  position: absolute;
  inset: 14% 12% 12% 14%;
  border: 1px solid rgba(120, 0, 255, 0.25);
  border-radius: 1rem;
  pointer-events: none;
}

.hero__visual img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 0 14px rgba(120, 0, 255, 0.35));
}

.stack {
  grid-auto-flow: row dense;

  max-width: 1500px;
  width: 100%;
  margin: 0 auto;

  display: grid;
  gap: 1.8rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  z-index: 2;
}

.panel {
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  border-radius: 1.1rem;
  padding: 1.7rem;
  box-shadow: 0 28px 40px -28px var(--panel-shadow);
  backdrop-filter: blur(10px);
}

.panel h2 {
  margin-top: 0;
  font-size: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.panel ul {
  padding-left: 1.1rem;
}

.panel li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.panel--spoilers {
  grid-column: span 2;

  display: grid;
  gap: 1rem;
}

.panel--flag {
  grid-column: span 2;
}

.flag-form {
  display: grid;
  gap: 1rem;
}

.flag-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.flag-form__field input {
  border-radius: 0.8rem;
  border: 1px solid rgba(120, 0, 255, 0.35);
  background: rgba(5, 7, 13, 0.72);
  color: var(--fg);
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.flag-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.flag-form__button {
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(120, 0, 255, 0.45);
  background: rgba(120, 0, 255, 0.22);
  color: var(--fg);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.flag-form__button:hover {
  background: rgba(120, 0, 255, 0.32);
}

.flag-form__button--ghost {
  background: transparent;
  border-color: rgba(63, 157, 255, 0.45);
  color: var(--accent-alt);
}

.flag-form__button--ghost:hover {
  background: rgba(63, 157, 255, 0.18);
}

.flag-form__result {
  margin: 0;
  border-radius: 0.8rem;
  border: 1px solid transparent;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  display: none;
}

.flag-form__result.is-visible {
  display: block;
}

.flag-form__result.is-success {
  border-color: rgba(63, 157, 255, 0.45);
  background: rgba(63, 157, 255, 0.18);
  color: var(--fg);
}

.flag-form__result.is-error {
  border-color: rgba(255, 77, 115, 0.45);
  background: rgba(255, 77, 115, 0.18);
  color: #ff9fb4;
}

.flag-form--busy {
  opacity: 0.85;
}

.footer__support {
  margin-top: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: 1px solid rgba(63, 157, 255, 0.45);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(63, 157, 255, 0.12);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.footer__support:hover {
  transform: translateY(-3px);
  background: rgba(63, 157, 255, 0.22);
  box-shadow: 0 18px 28px -20px rgba(63, 157, 255, 0.5);
}

.footer__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(63, 157, 255, 0.9), rgba(120, 0, 255, 0.7));
  color: #fff;
  box-shadow: 0 8px 16px -10px rgba(63, 157, 255, 0.6);
}

.footer__icon svg {
  width: 1rem;
  height: 1rem;
}

.panel--fixes {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* Теория - раскрывающийся блок на всю ширину */
.panel--theory {
  grid-column: 1 / -1;
  max-width: 100%;
}

.panel--theory details {
  margin-top: 1rem;
}

.panel--theory summary {
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-alt);
  padding: 1rem 1.5rem;
  background: rgba(120, 0, 255, 0.15);
  border: 1px solid rgba(120, 0, 255, 0.3);
  border-radius: 0.8rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.panel--theory summary::-webkit-details-marker {
  display: none;
}

.panel--theory summary::before {
  content: "📚";
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.panel--theory details[open] summary::before {
  transform: rotate(20deg);
}

.panel--theory summary:hover {
  background: rgba(120, 0, 255, 0.25);
  border-color: rgba(120, 0, 255, 0.5);
  transform: translateX(5px);
}

.panel--theory .theory-content {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.8rem;
  max-width: 100%;
}

.panel--theory table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.panel--theory th,
.panel--theory td {
  padding: 0.8rem 1rem;
  text-align: left;
  border: 1px solid rgba(120, 0, 255, 0.2);
}

.panel--theory th {
  background: rgba(120, 0, 255, 0.2);
  color: var(--accent-alt);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.panel--theory td {
  background: rgba(0, 0, 0, 0.2);
}

.panel--theory h3 {
  color: var(--accent-alt);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel--theory .theory-content > *:first-child {
  margin-top: 0;
}

/* Визуальные блоки теории */
.theory-visual,
.theory-comparison,
.theory-danger,
.theory-practice {
  margin: 2.5rem 0;
  padding: 2rem;
  background: rgba(120, 0, 255, 0.08);
  border: 1px solid rgba(120, 0, 255, 0.2);
  border-radius: 1rem;
  max-width: 1600px; /* Ограничение для всех блоков на широких экранах */
}

/* Схема атаки */
.attack-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 1.5rem 0;
}

.flow-step {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.8rem;
  align-items: flex-start;
}

.flow-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-content {
  flex: 1;
}

.flow-content strong {
  display: block;
  color: var(--accent-alt);
  margin-bottom: 0.8rem;
  font-size: 1.05rem;
}

.flow-content code {
  display: block;
  background: rgba(255, 0, 0, 0.1);
  padding: 0.5rem;
  border-radius: 0.4rem;
  margin: 0.5rem 0;
  word-break: break-all;
}

.flow-arrow {
  text-align: center;
  font-size: 2rem;
  margin: 0.5rem 0;
  color: var(--accent);
}

/* Примеры кода */
.example-bad,
.example-good {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border-radius: 0.8rem;
}

.example-bad {
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
}

.example-good {
  background: rgba(0, 255, 100, 0.1);
  border: 1px solid rgba(0, 255, 100, 0.3);
}

.example-bad h4 {
  color: #ff6b6b;
  margin-top: 0;
}

.example-good h4 {
  color: #00ff64;
  margin-top: 0;
}

/* Опасности */
.danger-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Всегда 2 колонки */
  gap: 1.5rem;
  margin: 1.5rem 0;
}

@media (max-width: 900px) {
  .danger-grid {
    grid-template-columns: 1fr; /* На мобильных — 1 колонка */
  }
}

.danger-item {
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 0.8rem;
  padding: 1.5rem;
  max-width: 650px; /* Макс ширина одной карточки */
}

.danger-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.danger-item h4 {
  color: #ff6b6b;
  margin: 0 0 1rem 0;
  font-size: 1rem;
}

.danger-item pre {
  font-size: 0.85rem;
  margin: 1rem 0;
  overflow-x: auto; /* Скролл для длинного кода */
}

.danger-item code {
  white-space: pre-wrap; /* Перенос длинных строк */
  word-break: break-word;
}

.danger-item p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Практические советы */
.practice-points {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.practice-point {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0, 255, 100, 0.08);
  border: 1px solid rgba(0, 255, 100, 0.2);
  border-radius: 0.8rem;
  align-items: flex-start;
}

.point-num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-alt);
  background: rgba(120, 0, 255, 0.3);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.point-content strong {
  display: block;
  color: #00ff64;
  margin-bottom: 0.5rem;
}

.point-content p {
  margin: 0.5rem 0 0 0;
  color: var(--fg);
  line-height: 1.6;
}

.fix-block {
  background: rgba(8, 6, 18, 0.68);
  border: 1px solid rgba(120, 0, 255, 0.24);
  border-radius: 0.9rem;
  padding: 1.6rem;
  box-shadow: 0 18px 32px -28px rgba(120, 0, 255, 0.32);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fix-block h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.code-block {
  margin: 0;
  padding: 1.2rem 1.3rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(120, 0, 255, 0.26);
  background: rgba(5, 6, 13, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.code-block code {
  display: block;
  font-family: "IBM Plex Mono", "Fira Mono", Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block--bad {
  border-color: rgba(255, 95, 109, 0.45);
  background: rgba(46, 8, 16, 0.65);
}

.code-block--good {
  border-color: rgba(65, 214, 133, 0.42);
  background: rgba(8, 28, 18, 0.65);
}

.diff-remove,
.diff-add {
  display: block;
  border-left: 3px solid;
  padding-left: 0.9rem;
  margin-left: -0.9rem;
  margin-right: -0.4rem;
}

.diff-remove {
  border-color: rgba(255, 95, 109, 0.85);
  background: rgba(255, 95, 109, 0.12);
  color: #ff9aa6;
}

.diff-add {
  border-color: rgba(65, 214, 133, 0.85);
  background: rgba(65, 214, 133, 0.12);
  color: #8ce5b2;
}

.fix-note {
  margin: 0;
  font-size: 0.95rem;
}

.panel,
.hero__visual,
.panel--spoilers .spoiler,
.hero__badge {
  transition: transform 0.45s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.45s ease;
  will-change: transform, box-shadow;
}

[data-animate] {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

body.animations-enabled [data-animate] {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
}

body.animations-enabled [data-animate].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.glitch {
  position: relative;
  display: inline-block;
  text-shadow: 0 0 2px rgba(120, 0, 255, 0.5);
  animation: glitch-skew 3.5s infinite linear alternate;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  opacity: 0.6;
}

.glitch::before {
  color: rgba(120, 0, 255, 0.7);
  transform: translate(-2px, 1px);
  animation: glitch-before 2.8s infinite linear alternate;
}

.glitch::after {
  color: rgba(63, 157, 255, 0.7);
  transform: translate(2px, -1px);
  animation: glitch-after 3.2s infinite linear alternate;
}

@media (hover: hover) and (pointer: fine) {
  .panel[data-animate]:hover,
  .hero__visual:hover {
    transform: translateY(-8px);
    box-shadow: 0 35px 60px -35px rgba(120, 0, 255, 0.45);
  }
}

@keyframes glitch-skew {
  0%, 100% { transform: skew(0.5deg); }
  50% { transform: skew(-0.5deg); }
}

@keyframes glitch-before {
  0% { clip-path: inset(0 0 80% 0); }
  20% { clip-path: inset(20% 0 40% 0); }
  40% { clip-path: inset(60% 0 10% 0); }
  60% { clip-path: inset(10% 0 70% 0); }
  80% { clip-path: inset(40% 0 30% 0); }
  100% { clip-path: inset(5% 0 20% 0); }
}

@keyframes glitch-after {
  0% { clip-path: inset(80% 0 0 0); }
  20% { clip-path: inset(40% 0 20% 0); }
  40% { clip-path: inset(10% 0 60% 0); }
  60% { clip-path: inset(70% 0 10% 0); }
  80% { clip-path: inset(30% 0 40% 0); }
  100% { clip-path: inset(20% 0 5% 0); }
}

.spoiler {
  background: rgba(8, 6, 18, 0.72);
  border: 1px solid rgba(120, 0, 255, 0.28);
  border-radius: 0.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.spoiler[open] {
  border-color: rgba(120, 0, 255, 0.45);
  box-shadow: 0 12px 24px -18px rgba(120, 0, 255, 0.35);
}

.spoiler summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  list-style: none;
  font-weight: 600;
  letter-spacing: 0.04em;
  position: relative;
}

.spoiler summary::-webkit-details-marker {
  display: none;
}

.spoiler summary::after {
  content: "+";
  position: absolute;
  right: 1rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.spoiler[open] summary::after {
  transform: rotate(45deg);
}

.spoiler pre {
  margin: 0;
  padding: 1rem 1.2rem 1.2rem;
  border-top: 1px solid rgba(120, 0, 255, 0.28);
  background: rgba(5, 6, 13, 0.45);
  border-radius: 0 0 0.8rem 0.8rem;
  overflow-x: auto;
}

pre {
  font-size: 0.95rem;
}

code {
  color: var(--accent-alt);
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.status {
  display: flex;
  flex-direction: column;
}

.status__body {
  flex: 1;
  background: rgba(8, 6, 18, 0.72);
  border: 1px dashed rgba(120, 0, 255, 0.35);
  border-radius: 0.9rem;
  padding: 1.2rem;
  font-size: 0.95rem;
  min-height: 140px;
}

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

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

.logs-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0.5rem;
  display: grid;
  gap: 0.4rem;
}

.logs-list li {
  color: var(--accent-alt);
  font-family: inherit;
}

.footer {
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 2rem 0 0;
  z-index: 2;
}

@media (max-width: 720px) {
  body {
    padding: 2.2rem 1.5rem;
  }

  .hero {
    margin-bottom: 2.5rem;
  }

  .hero__badge {
    letter-spacing: 0.2rem;
  }

  .hero__visual {
    width: min(320px, 100%);
  }
}

@media (max-width: 1400px) {
  .hero {
    max-width: 1200px;
  }
  .stack {
    max-width: 1200px;
  }

  .panel--spoilers {
    grid-column: span 1;
  }
}
