/* ===========================
   БАЗОВЫЕ ПЕРЕМЕННЫЕ ТЕМЫ
   =========================== */

:root {
  --bg-main: #05060a;
  --bg-elevated: #11131a;
  --bg-elevated-soft: #101321;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.14);
  --accent-strong: #63c3ff;
  --text-main: #f5f7ff;
  --text-muted: #9aa1b8;
  --text-soft: #717894;
  --border-subtle: #252838;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-soft: 0 22px 45px rgba(0, 0, 0, 0.6);
  --nav-height: 60px;
}

/* ===========================
   СБРОС И ГЛОБАЛЬНЫЙ СТИЛЬ
   =========================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, #29325a 0, transparent 55%),
    radial-gradient(circle at 100% 0%, #2c365c 0, transparent 50%),
    radial-gradient(circle at 50% 100%, #191b32 0, #05060a 55%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Лёгкий шум через псевдоэлемент для фона */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.18) 1px, transparent 0);
  background-size: 2px 2px;
  mix-blend-mode: soft-light;
  z-index: -1;
}

/* ===========================
   ШАПКА И НАВИГАЦИЯ
   =========================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgba(5, 7, 15, 0.95), rgba(5, 7, 15, 0.85));
  border-bottom: 1px solid rgba(120, 131, 172, 0.24);
}

.nav-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #ffe08a, #ff6d4a 50%, #3f3cf5 100%);
  color: #05060a;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.nav-logo-text {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.top-nav {
  height: 100%;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-link:hover {
  color: var(--accent-strong);
  background-color: rgba(77, 163, 255, 0.07);
}

.nav-link.active {
  color: #ffffff;
}

/* Подменю */

.has-submenu > .nav-link::after {
  content: "▾";
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.8;
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  padding: 6px 0;
  margin: 0;
  list-style: none;
  background: rgba(8, 10, 21, 0.98);
  border-radius: 12px;
  border: 1px solid rgba(111, 126, 178, 0.35);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  display: none;
}

.submenu-right {
  top: 0;
  left: 100%;
}

.submenu-link {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.submenu-link:hover {
  background-color: rgba(77, 163, 255, 0.14);
  color: #ffffff;
  padding-left: 19px;
}

.has-submenu:hover > .submenu {
  display: block;
}

/* ===========================
   ОСНОВНОЙ КОНТЕНТ
   =========================== */

.page-main {
  flex: 1;
}

.hero {
  max-width: 1180px;
  margin: 40px auto 32px auto;
  padding: 24px 22px 36px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 32px;
  align-items: center;
}

.hero-text h1 {
  margin: 0 0 14px 0;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.hero-text p {
  margin: 0 0 20px 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* Статус генератора */

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(12, 17, 31, 0.9);
  border: 1px solid rgba(99, 112, 162, 0.7);
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.8);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.7);
}

.status-dot--unknown {
  background: #737b8e;
}

.status-dot--ok {
  background: #30d47a;
  box-shadow: 0 0 8px rgba(48, 212, 122, 0.9);
}

.status-dot--warn {
  background: #f4c04b;
  box-shadow: 0 0 8px rgba(244, 192, 75, 0.9);
}

.status-dot--error {
  background: #ff4b6b;
  box-shadow: 0 0 8px rgba(255, 75, 107, 0.9);
}

/* Блок превью */

.hero-preview {
  position: relative;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 0 0, rgba(255, 192, 120, 0.45), transparent 55%),
              radial-gradient(circle at 100% 100%, rgba(102, 196, 255, 0.35), transparent 55%),
              linear-gradient(145deg, #141729, #050814);
  padding: 16px 16px 14px 16px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.preview-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(240, 244, 255, 0.7);
  margin-bottom: 10px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(var(--preview-columns, 12), var(--preview-cell-size, 18px));
  gap: 2px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(7, 9, 19, 0.88);
  border: 1px solid rgba(104, 122, 184, 0.4);
  max-height: 260px;
  overflow: hidden;
}

.preview-cell {
  width: var(--preview-cell-size, 18px);
  height: var(--preview-cell-size, 18px);
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
}

.preview-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(225, 231, 255, 0.8);
}

/* ===========================
   КНОПКИ
   =========================== */

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.1s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #02030a;
  box-shadow: 0 14px 28px rgba(45, 160, 255, 0.5);
}

.btn.primary:hover {
  box-shadow: 0 16px 34px rgba(45, 160, 255, 0.7);
  transform: translateY(-1px);
}

.btn.secondary {
  background: rgba(10, 13, 26, 0.9);
  color: var(--text-muted);
  border: 1px solid rgba(116, 132, 179, 0.7);
}

.btn.secondary:hover {
  background: rgba(17, 22, 43, 0.95);
  color: #e5ebff;
}

.btn.tiny {
  padding: 5px 10px;
  font-size: 11px;
  background: rgba(7, 11, 22, 0.9);
  color: rgba(230, 236, 255, 0.85);
  border: 1px solid rgba(119, 134, 182, 0.7);
}

.btn.tiny:hover {
  background: rgba(19, 25, 44, 0.95);
}

/* ===========================
   БЛОК ФИЧ
   =========================== */

.feature-section {
  max-width: 1180px;
  margin: 0 auto 40px auto;
  padding: 0 22px 10px 22px;
}

.feature-section h2 {
  margin: 0 0 18px 0;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 0 0, rgba(74, 143, 255, 0.28), transparent 45%),
              linear-gradient(155deg, rgba(9, 11, 23, 0.98), rgba(8, 10, 21, 0.96));
  border: 1px solid rgba(103, 121, 177, 0.6);
  padding: 14px 14px 16px 14px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.65);
}

.feature-card h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
}

.feature-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}

/* ===========================
   ФУТЕР
   =========================== */

.site-footer {
  border-top: 1px solid rgba(44, 51, 82, 0.9);
  background: radial-gradient(circle at 50% 0, rgba(41, 61, 120, 0.3), rgba(5, 7, 14, 0.98));
  padding: 12px 22px 16px 22px;
  color: var(--text-muted);
  font-size: 12px;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-separator {
  opacity: 0.6;
}

/* ===========================
   ОТЗЫВЧИВОСТЬ
   =========================== */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .hero-preview {
    order: -1;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .nav-container {
    padding-inline: 14px;
  }

  .nav-menu {
    gap: 0;
  }

  .nav-link {
    padding-inline: 10px;
    font-size: 13px;
  }

  .hero {
    padding-inline: 16px;
  }

  .feature-section {
    padding-inline: 16px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   ВРЕМЕННАЯ СОВМЕСТИМОСТЬ
   (если старые страницы ещё не переписаны)
   =========================== */

.color-grid,
#hexContainer,
#binaryContainer {
  text-align: center;
  margin-top: 20px;
}

.color-square {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  margin: 2px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
}

/* ===========================
   ADAPTIVE CAPTCHA (PATCH 2)
   =========================== */

body.captcha-open {
  overflow: hidden;
}

.captcha-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 20% 0%, rgba(77, 163, 255, 0.18), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(99, 195, 255, 0.12), transparent 40%),
    rgba(3, 6, 15, 0.84);
  backdrop-filter: blur(14px);
}

.captcha-overlay.visible {
  display: flex;
}

.captcha-modal {
  width: 100%;
  max-width: 980px;
}

.captcha-panel {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(108, 126, 182, 0.45);
  background:
    linear-gradient(180deg, rgba(14, 18, 34, 0.96), rgba(8, 12, 24, 0.98));
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.captcha-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.captcha-eyebrow {
  margin-bottom: 8px;
  color: rgba(120, 170, 255, 0.92);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.captcha-title {
  margin: 0;
  color: #f5f7ff;
  font-size: 26px;
  line-height: 1.2;
}

.captcha-subtitle {
  margin: 10px 0 0 0;
  max-width: 720px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 14px;
}

.captcha-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.captcha-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(108, 126, 182, 0.45);
  background: rgba(10, 15, 29, 0.82);
  color: #dfe8ff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.captcha-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
}

.captcha-grid-wrap,
.captcha-side {
  min-width: 0;
}

.captcha-grid-wrap {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(108, 126, 182, 0.28);
  background:
    linear-gradient(180deg, rgba(9, 12, 24, 0.96), rgba(6, 9, 19, 0.98));
}

.captcha-grid {
  --captcha-grid-size: 6;
  display: grid;
  grid-template-columns: repeat(var(--captcha-grid-size), minmax(0, 1fr));
  gap: 8px;
}

.captcha-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(72, 92, 140, 0.7);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(14, 20, 39, 0.95), rgba(8, 12, 24, 0.98));
  color: #d8e4ff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.captcha-cell:hover {
  transform: translateY(-1px);
  border-color: rgba(120, 175, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(120, 175, 255, 0.22) inset;
}

.captcha-cell.is-start {
  border-color: rgba(116, 222, 165, 0.92);
  box-shadow: 0 0 0 1px rgba(116, 222, 165, 0.26) inset;
}

.captcha-cell.is-finish {
  border-color: rgba(94, 188, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(94, 188, 255, 0.28) inset;
}

.captcha-cell.is-required::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 214, 97, 0.95);
  pointer-events: none;
}

.captcha-cell.is-blocked {
  background:
    linear-gradient(180deg, rgba(51, 16, 26, 0.94), rgba(28, 11, 18, 0.98));
  border-color: rgba(224, 96, 124, 0.82);
  cursor: not-allowed;
}

.captcha-cell.is-blocked::before,
.captcha-cell.is-blocked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66%;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 178, 195, 0.9);
}

.captcha-cell.is-blocked::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.captcha-cell.is-blocked::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.captcha-cell.is-path {
  background:
    linear-gradient(180deg, rgba(27, 53, 100, 0.95), rgba(18, 33, 67, 0.98));
  border-color: rgba(120, 178, 255, 0.96);
  box-shadow:
    0 0 0 1px rgba(120, 178, 255, 0.22) inset,
    0 0 18px rgba(77, 163, 255, 0.16);
}

.captcha-cell.is-current {
  box-shadow:
    0 0 0 2px rgba(164, 209, 255, 0.78) inset,
    0 0 22px rgba(102, 181, 255, 0.26);
}

.captcha-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.captcha-status,
.captcha-legend,
.captcha-meta {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(108, 126, 182, 0.28);
  background: rgba(8, 12, 24, 0.88);
}

.captcha-status {
  min-height: 78px;
  color: #dce7ff;
  font-size: 14px;
  line-height: 1.55;
}

.captcha-status.is-error {
  border-color: rgba(226, 96, 126, 0.45);
  color: #ffd8df;
}

.captcha-status.is-success {
  border-color: rgba(116, 222, 165, 0.42);
  color: #dcfff0;
}

.captcha-status.is-info {
  border-color: rgba(108, 145, 255, 0.34);
}

.captcha-legend {
  display: grid;
  gap: 10px;
}

.captcha-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8e2fb;
  font-size: 13px;
}

.captcha-legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(72, 92, 140, 0.74);
  background: rgba(14, 20, 39, 0.95);
}

.captcha-legend-swatch.start {
  border-color: rgba(116, 222, 165, 0.92);
}

.captcha-legend-swatch.finish {
  border-color: rgba(94, 188, 255, 0.96);
}

.captcha-legend-swatch.required {
  border-style: dashed;
  border-color: rgba(255, 214, 97, 0.96);
}

.captcha-legend-swatch.blocked {
  border-color: rgba(224, 96, 124, 0.82);
  background: rgba(51, 16, 26, 0.94);
}

.captcha-meta {
  display: grid;
  gap: 10px;
}

.captcha-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.captcha-meta-row strong {
  color: #f5f7ff;
  font-size: 14px;
}

.captcha-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.captcha-actions .btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .captcha-panel {
    padding: 18px;
  }

  .captcha-header,
  .captcha-body {
    grid-template-columns: 1fr;
    display: grid;
  }

  .captcha-header {
    gap: 12px;
  }

  .captcha-badges {
    justify-content: flex-start;
  }

  .captcha-grid-wrap {
    padding: 14px;
  }
}

@media (max-width: 640px) {
  .captcha-overlay {
    padding: 12px;
  }

  .captcha-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .captcha-title {
    font-size: 21px;
  }

  .captcha-subtitle {
    font-size: 13px;
  }

  .captcha-grid {
    gap: 6px;
  }

  .captcha-cell {
    border-radius: 12px;
    font-size: 12px;
  }

  .captcha-cell.is-required::after {
    inset: 8px;
  }

  .captcha-status,
  .captcha-legend,
  .captcha-meta {
    padding: 12px 13px;
  }

  .captcha-actions {
    justify-content: stretch;
  }

  .captcha-actions .btn {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
  }
}
