:root {
  /* Минимальная высота textarea после ручного ресайза (px). 20px с padding визуально почти ноль — ниже ~100px нельзя нормально набрать текст. */
  --textarea-min-height: 120px;
  --accent: #a855f7;
  --accent-dim: #7c3aed;
  --text: #f8fafc;
  --muted: #c4b5fd;
  --card: rgba(18, 10, 32, 0.72);
  --border: rgba(255, 255, 255, 0.12);
  --white-accent: #ffffff;
  /* Свечение текста при наведении */
  --text-glow-nav: 0 0 18px rgba(248, 250, 252, 0.35), 0 0 36px rgba(168, 85, 247, 0.55),
    0 0 54px rgba(124, 58, 237, 0.28);
  --text-glow-heading: 0 0 14px rgba(255, 255, 255, 0.25), 0 0 28px rgba(168, 85, 247, 0.45);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --footer-reserve: calc(10rem + env(safe-area-inset-bottom, 0px));
  /* Пустая зона под контентом перед футером (одинаково на десктопе и до 500px ширины и меньше) */
  --page-end-spacer: 500px;
  /* Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --motion-fast: 0.18s;
  --motion-medium: 0.28s;
  --motion-relaxed: 0.42s;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(
    155deg,
    #020006 0%,
    #12061a 38%,
    #1a0630 72%,
    #080212 100%
  );
  background-size: 250% 250%;
  background-attachment: fixed;
  animation: body-gradient-drift 22s cubic-bezier(0.42, 0.08, 0.58, 0.92) infinite alternate;
  line-height: 1.55;
}

@keyframes body-gradient-drift {
  0% {
    background-position: -8% -6%;
  }
  25% {
    background-position: 102% 28%;
  }
  50% {
    background-position: 12% 104%;
  }
  75% {
    background-position: 88% 82%;
  }
  100% {
    background-position: 52% -4%;
  }
}

.bg-orbit {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-orbit::before,
.bg-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  transition: opacity 0.01s;
}

/* Два набора «орбит» — контрастнее и быстрее смена оттенков */
.bg-orbit::before {
  background:
    radial-gradient(ellipse 92% 58% at 10% -14%, rgba(216, 160, 254, 0.52), transparent 60%),
    radial-gradient(ellipse 66% 50% at 98% 4%, rgba(168, 85, 247, 0.38), transparent 56%),
    radial-gradient(ellipse 54% 44% at 36% 112%, rgba(91, 33, 182, 0.42), transparent 50%);
  animation: bg-orbit-crossfade-a 11s cubic-bezier(0.45, 0.12, 0.55, 0.88) infinite alternate;
}

.bg-orbit::after {
  background:
    radial-gradient(ellipse 80% 54% at 88% -2%, rgba(96, 165, 250, 0.34), transparent 58%),
    radial-gradient(ellipse 74% 50% at 2% 36%, rgba(124, 58, 237, 0.36), transparent 54%),
    radial-gradient(ellipse 62% 46% at 54% 88%, rgba(76, 29, 149, 0.26), transparent 52%),
    radial-gradient(ellipse 48% 40% at 58% 26%, rgba(196, 181, 253, 0.22), transparent 56%);
  animation: bg-orbit-crossfade-b 11s cubic-bezier(0.45, 0.12, 0.55, 0.88) infinite alternate;
}

@keyframes bg-orbit-crossfade-a {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes bg-orbit-crossfade-b {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Подсветка фона у курсора + координатная сетка (desktop, без prefers-reduced-motion) */
.cursor-spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle max(620px, 68vmin) at var(--cursor-x, 50%) var(--cursor-y, 50%),
    rgba(168, 85, 247, 0.38) 0%,
    rgba(124, 58, 237, 0.14) 44%,
    transparent 72%
  );
  opacity: 0;
  transition: opacity 0.45s var(--ease-out-expo);
}

.cursor-spotlight.is-active {
  opacity: 1;
}

.cursor-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s var(--ease-out-expo),
    visibility 0.35s;
}

.cursor-grid.is-active {
  opacity: 1;
  visibility: visible;
}

.cursor-grid__pattern {
  width: 100%;
  height: 100%;
  /* Мягкая «дыра»: без резкого края */
  -webkit-mask-image: radial-gradient(
    circle max(600px, 66vmin) at var(--cursor-x, 50%) var(--cursor-y, 50%),
    rgba(0, 0, 0, 0.92) 32%,
    rgba(0, 0, 0, 0.45) 52%,
    rgba(0, 0, 0, 0.12) 68%,
    transparent 84%
  );
  mask-image: radial-gradient(
    circle max(600px, 66vmin) at var(--cursor-x, 50%) var(--cursor-y, 50%),
    rgba(0, 0, 0, 0.92) 32%,
    rgba(0, 0, 0, 0.45) 52%,
    rgba(0, 0, 0, 0.12) 68%,
    transparent 84%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Тише линии: мелкая 28px + крупная каждые 5 ячеек (140px) */
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      rgba(168, 85, 247, 0.085) 27px,
      rgba(168, 85, 247, 0.085) 28px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 27px,
      rgba(168, 85, 247, 0.085) 27px,
      rgba(168, 85, 247, 0.085) 28px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 138px,
      rgba(196, 181, 253, 0.16) 138px,
      rgba(196, 181, 253, 0.16) 140px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 138px,
      rgba(196, 181, 253, 0.16) 138px,
      rgba(196, 181, 253, 0.16) 140px
    );
}

/* Редкие проблески сетки в фиксированных зонах экрана (не только у курсора) */
.ambient-grid-sparkles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.ambient-grid-sparkles__zone {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 27px,
      rgba(168, 85, 247, 0.125) 27px,
      rgba(168, 85, 247, 0.125) 28px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 27px,
      rgba(168, 85, 247, 0.125) 27px,
      rgba(168, 85, 247, 0.125) 28px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 138px,
      rgba(196, 181, 253, 0.22) 138px,
      rgba(196, 181, 253, 0.22) 140px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 138px,
      rgba(196, 181, 253, 0.22) 138px,
      rgba(196, 181, 253, 0.22) 140px
    );
  -webkit-mask-image: radial-gradient(
    circle clamp(120px, 22vmin, 340px) at var(--sparkle-at-x, 50%) var(--sparkle-at-y, 50%),
    rgba(0, 0, 0, 0.88) 18%,
    rgba(0, 0, 0, 0.55) 42%,
    rgba(0, 0, 0, 0.18) 72%,
    transparent 88%
  );
  mask-image: radial-gradient(
    circle clamp(120px, 22vmin, 340px) at var(--sparkle-at-x, 50%) var(--sparkle-at-y, 50%),
    rgba(0, 0, 0, 0.88) 18%,
    rgba(0, 0, 0, 0.55) 42%,
    rgba(0, 0, 0, 0.18) 72%,
    transparent 88%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  opacity: 0;
  will-change: opacity;
}

.ambient-grid-sparkles__zone--a {
  --sparkle-at-x: 14%;
  --sparkle-at-y: 22%;
  animation: ambient-grid-sparkle-a 41s cubic-bezier(0.37, 0, 0.21, 1) infinite;
  animation-delay: -4s;
}

.ambient-grid-sparkles__zone--b {
  --sparkle-at-x: 86%;
  --sparkle-at-y: 38%;
  animation: ambient-grid-sparkle-b 43s cubic-bezier(0.37, 0, 0.21, 1) infinite;
  animation-delay: -18s;
}

.ambient-grid-sparkles__zone--c {
  --sparkle-at-x: 44%;
  --sparkle-at-y: 78%;
  animation: ambient-grid-sparkle-c 39s cubic-bezier(0.37, 0, 0.21, 1) infinite;
  animation-delay: -11s;
}

.ambient-grid-sparkles__zone--d {
  --sparkle-at-x: 72%;
  --sparkle-at-y: 84%;
  animation: ambient-grid-sparkle-d 46s cubic-bezier(0.37, 0, 0.21, 1) infinite;
  animation-delay: -27s;
}

.ambient-grid-sparkles__zone--e {
  --sparkle-at-x: 28%;
  --sparkle-at-y: 58%;
  animation: ambient-grid-sparkle-e 44s cubic-bezier(0.37, 0, 0.21, 1) infinite;
  animation-delay: -31s;
}

/* Один длинный мягкий подъём и спад за цикл — без резких вспышек */
@keyframes ambient-grid-sparkle-a {
  0%,
  28%,
  100% {
    opacity: 0;
  }
  34% {
    opacity: 0.12;
  }
  40% {
    opacity: 0.32;
  }
  46% {
    opacity: 0.46;
  }
  52% {
    opacity: 0.48;
  }
  58% {
    opacity: 0.46;
  }
  64% {
    opacity: 0.38;
  }
  71% {
    opacity: 0.22;
  }
  78% {
    opacity: 0.08;
  }
  84% {
    opacity: 0;
  }
}

@keyframes ambient-grid-sparkle-b {
  0%,
  9%,
  100% {
    opacity: 0;
  }
  15% {
    opacity: 0.1;
  }
  22% {
    opacity: 0.28;
  }
  29% {
    opacity: 0.42;
  }
  36% {
    opacity: 0.46;
  }
  43% {
    opacity: 0.44;
  }
  51% {
    opacity: 0.36;
  }
  59% {
    opacity: 0.24;
  }
  67% {
    opacity: 0.12;
  }
  74% {
    opacity: 0;
  }
}

@keyframes ambient-grid-sparkle-c {
  0%,
  48%,
  100% {
    opacity: 0;
  }
  54% {
    opacity: 0.14;
  }
  60% {
    opacity: 0.34;
  }
  66% {
    opacity: 0.46;
  }
  72% {
    opacity: 0.48;
  }
  78% {
    opacity: 0.42;
  }
  84% {
    opacity: 0.28;
  }
  90% {
    opacity: 0.12;
  }
  95% {
    opacity: 0;
  }
}

@keyframes ambient-grid-sparkle-d {
  0%,
  38%,
  100% {
    opacity: 0;
  }
  44% {
    opacity: 0.11;
  }
  50% {
    opacity: 0.3;
  }
  56% {
    opacity: 0.44;
  }
  62% {
    opacity: 0.47;
  }
  69% {
    opacity: 0.4;
  }
  76% {
    opacity: 0.26;
  }
  83% {
    opacity: 0.1;
  }
  89% {
    opacity: 0;
  }
}

@keyframes ambient-grid-sparkle-e {
  0%,
  18%,
  100% {
    opacity: 0;
  }
  24% {
    opacity: 0.13;
  }
  30% {
    opacity: 0.33;
  }
  36% {
    opacity: 0.45;
  }
  43% {
    opacity: 0.47;
  }
  50% {
    opacity: 0.41;
  }
  57% {
    opacity: 0.3;
  }
  65% {
    opacity: 0.16;
  }
  72% {
    opacity: 0.04;
  }
  77% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
    background-size: auto;
  }

  .bg-orbit::before,
  .bg-orbit::after {
    animation: none !important;
  }

  .bg-orbit::before {
    opacity: 1;
  }

  .bg-orbit::after {
    opacity: 0.45;
  }

  .ambient-grid-sparkles {
    display: none !important;
  }

  .cursor-spotlight,
  .cursor-grid {
    display: none !important;
  }
}

@media (pointer: coarse) {
  body {
    animation: none;
    background-size: auto;
  }

  .bg-orbit::before,
  .bg-orbit::after {
    animation: none !important;
  }

  .bg-orbit::before {
    opacity: 1;
  }

  .bg-orbit::after {
    opacity: 0.45;
  }

  /* Фоновые вспышки координатной сетки (без привязки к курсору). */
  .cursor-spotlight,
  .cursor-grid {
    display: none !important;
  }
}

.container {
  width: min(1080px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  /* Без backdrop-filter: иначе fixed-потомки (меню и оверлей) режутся рамкой шапки во многих браузерах. */
  background: linear-gradient(180deg, rgba(10, 4, 20, 0.97), rgba(8, 4, 16, 0.9));
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0;
  flex-wrap: nowrap;
}

.logo-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  max-width: min(100%, 22rem);
  flex: 1 1 auto;
  min-width: 0;
  transition:
    opacity var(--motion-fast) var(--ease-out-expo),
    transform var(--motion-medium) var(--ease-out-expo),
    filter var(--motion-medium) ease;
}

@media (hover: hover) and (pointer: fine) {
  .logo-block:hover {
    transform: translateX(2px);
    filter: drop-shadow(0 0 14px rgba(168, 85, 247, 0.28));
  }
}

.logo-title {
  font-weight: 700;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  color: var(--white-accent);
  letter-spacing: 0.03em;
  line-height: 1.25;
  text-shadow: none;
  transition: text-shadow var(--motion-medium) var(--ease-out-expo);
}

.logo-tagline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: none;
  text-shadow: none;
  transition: text-shadow var(--motion-medium) var(--ease-out-expo);
}

@media (hover: hover) and (pointer: fine) {
  .logo-block:hover .logo-title {
    text-shadow: var(--text-glow-nav);
  }

  .logo-block:hover .logo-tagline {
    text-shadow: 0 0 12px rgba(196, 181, 253, 0.65), 0 0 24px rgba(168, 85, 247, 0.35);
  }
}

.nav {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid transparent;
  text-shadow: none;
  transition:
    color var(--motion-fast) var(--ease-out-expo),
    border-color var(--motion-fast) var(--ease-out-expo),
    background var(--motion-fast) ease,
    box-shadow var(--motion-medium) var(--ease-out-expo),
    transform var(--motion-medium) var(--ease-out-expo),
    text-shadow var(--motion-medium) var(--ease-out-expo);
}

@media (hover: hover) and (pointer: fine) {
  .nav a:hover {
    color: var(--white-accent);
    border-color: var(--border);
    background: rgba(168, 85, 247, 0.12);
    box-shadow:
      0 4px 18px rgba(0, 0, 0, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
    text-shadow: var(--text-glow-nav);
  }
}

@media not all and (hover: hover) {
  .nav a:hover {
    color: var(--white-accent);
    border-color: var(--border);
    background: rgba(168, 85, 247, 0.08);
  }
}

.nav a.active {
  color: var(--white-accent);
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(0, 0, 0, 0.2));
}

.nav a:focus-visible {
  outline: 2px solid rgba(168, 85, 247, 0.75);
  outline-offset: 2px;
}

.logo-block:focus-visible {
  outline: 2px solid rgba(168, 85, 247, 0.75);
  outline-offset: 3px;
  border-radius: 8px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  margin-top: 0.1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--white-accent);
  cursor: pointer;
  transition:
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    transform var(--motion-medium) var(--ease-spring),
    box-shadow var(--motion-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .nav-toggle:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(168, 85, 247, 0.16);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
    transform: scale(1.05);
  }

  .nav-toggle:active {
    transform: scale(0.97);
  }
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(168, 85, 247, 0.65);
  outline-offset: 2px;
}

.nav-toggle-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 1.15rem;
}

.nav-toggle-lines span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

@media (min-width: 769px) {
  .header-inner {
    align-items: center;
  }

  .site-header .nav {
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    flex: 1 1 auto;
  }
}

@keyframes nav-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  body.nav-open {
    overflow: hidden;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-header .nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(288px, 88vw);
    max-width: 100vw;
    margin: 0;
    padding: calc(5rem + env(safe-area-inset-top)) 1rem calc(2rem + env(safe-area-inset-bottom))
      1.15rem;
    gap: 0.35rem;
    background: linear-gradient(205deg, rgba(22, 8, 40, 0.98), rgba(6, 2, 14, 0.99));
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55);
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    overflow-y: auto;
  }

  body.nav-open .site-header .nav {
    transform: translateX(0);
  }

  body:not(.nav-open) .site-header .nav {
    pointer-events: none;
  }

  body.nav-open .site-header .nav {
    pointer-events: auto;
  }

  .site-header .nav a {
    padding: 0.6rem 0.85rem;
    position: relative;
    z-index: 1;
  }

  /* Координатная сетка внизу ящика: сильнее у нижнего края, гаснет к верху */
  .site-header .nav::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(48vh, 260px);
    pointer-events: none;
    z-index: 0;
    background-image:
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 19px,
        rgba(168, 85, 247, 0.1) 19px,
        rgba(168, 85, 247, 0.1) 20px
      ),
      repeating-linear-gradient(
        to right,
        transparent 0,
        transparent 19px,
        rgba(168, 85, 247, 0.1) 19px,
        rgba(168, 85, 247, 0.1) 20px
      ),
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 99px,
        rgba(196, 181, 253, 0.12) 99px,
        rgba(196, 181, 253, 0.12) 100px
      ),
      repeating-linear-gradient(
        to right,
        transparent 0,
        transparent 99px,
        rgba(196, 181, 253, 0.12) 99px,
        rgba(196, 181, 253, 0.12) 100px
      );
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.35) 52%, transparent 100%);
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.35) 52%, transparent 100%);
  }

  .nav-overlay[hidden] {
    display: none !important;
  }

  /*
   * Оверлей вне .site-header (см. base.html): backdrop-filter внутри шапки смешивает слои в WebKit и блюрит панель.
   * Слои: контент ниже → оверлей (blur) → шапка z-index 120 с боковым меню поверх без blur.
   */
  .nav-overlay:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 118;
    background: rgba(3, 0, 12, 0.52);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: nav-fade-in 0.22s ease;
  }
}

@media (min-width: 769px) {
  .nav-overlay {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .nav {
    transition-duration: 0.01ms;
  }

  .site-header .nav::after {
    display: none;
  }

  .nav-overlay:not([hidden]) {
    animation: none;
  }

  .main {
    animation: page-fade-soft 0.28s ease both !important;
  }
}

@keyframes page-fade-soft {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes page-content-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main {
  padding: 2rem 0 calc(var(--footer-reserve) + var(--page-end-spacer));
  animation: page-content-in 0.5s var(--ease-out-expo) both;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 0.75rem 0 calc(0.85rem + env(safe-area-inset-bottom));
  margin-top: 0;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18, 8, 32, 0.78), rgba(6, 2, 12, 0.96));
  backdrop-filter: blur(14px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
  :root {
    --footer-reserve: calc(1.75rem + env(safe-area-inset-bottom, 0px));
  }

  body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .main {
    flex: 1 1 auto;
    width: 100%;
    padding: 1.75rem 0 calc(1.75rem + env(safe-area-inset-bottom, 0px) + var(--page-end-spacer));
    box-sizing: border-box;
  }

  /* Небольшие поля по краям экрана + safe-area (раньше 92vw давало вплотную к рамке) */
  .container {
    width: 100%;
    max-width: 100%;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  h1 {
    margin-bottom: 0.85rem;
  }

  h2 {
    margin-top: 1.75rem;
    margin-bottom: 0.95rem;
  }

  .site-footer {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 1;
    margin-top: auto;
    flex-shrink: 0;
    box-shadow: none;
    backdrop-filter: blur(10px);
    padding: 0.65rem 0 calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .site-footer .container {
    width: 100%;
    max-width: 100%;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .footer-inner {
    gap: 0.35rem;
    align-items: stretch;
  }

  .footer-col--left,
  .footer-col--right {
    min-width: 0;
    max-width: 100%;
  }

  .footer-note,
  .footer-dev {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Контактная строка — прижать к правому краю контейнера, без разрыва слов из base */
  .footer-col--right {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .footer-dev {
    align-self: flex-start;
    font-size: 0.85rem;
  }

  .footer-contacts {
    align-self: stretch;
    width: 100%;
    margin-left: 0;
    text-align: left;
    word-break: normal;
    overflow-wrap: normal;
    white-space: normal;
    font-size: 0.82rem;
  }

  .footer-note {
    font-size: 0.8rem;
    line-height: 1.3;
  }
}

.footer-inner {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
}

.footer-col--left {
  flex: 1 1 16rem;
  min-width: min(100%, 14rem);
}

.footer-col--right {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
  text-align: left;
}

.footer-note {
  max-width: none;
  line-height: 1.45;
  margin: 0;
  text-align: left;
}

@media (max-width: 680px) {
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
  }

  .footer-col--left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .footer-col--right {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.4rem;
    margin-left: 0;
  }

  .footer-contacts {
    align-self: stretch;
    width: 100%;
    margin-left: 0;
    max-width: none;
    text-align: left;
    word-break: normal;
    overflow-wrap: normal;
    white-space: normal;
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .footer-dev {
    font-size: 0.8rem;
    align-self: flex-start;
  }

  .footer-note {
    font-size: 0.74rem;
    line-height: 1.3;
  }
}

.footer-dev {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--white-accent);
  letter-spacing: 0.02em;
  flex: 1 1 auto;
  min-width: 0;
}

.footer-contacts {
  margin: 0;
  font-size: 0.88rem;
  text-align: left;
  flex: 0 1 auto;
}

@media (min-width: 769px) {
  .footer-contacts {
    text-align: right;
    white-space: nowrap;
  }
}

.footer-handle {
  color: var(--muted);
  font-weight: 500;
}

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

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: none;
  transition: text-shadow var(--motion-medium) var(--ease-out-expo);
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2rem);
  color: var(--white-accent);
}

h2 {
  font-size: 1.35rem;
  color: var(--white-accent);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

@media (hover: hover) and (pointer: fine) {
  .main h1:hover,
  .main h2:hover {
    text-shadow: var(--text-glow-heading);
  }

  .card:hover :is(h1, h2, h3) {
    text-shadow: var(--text-glow-heading);
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  transition:
    transform var(--motion-medium) var(--ease-out-expo),
    box-shadow var(--motion-medium) var(--ease-out-expo),
    border-color var(--motion-fast) ease,
    background 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow:
      var(--shadow),
      0 0 0 1px rgba(168, 85, 247, 0.15),
      0 22px 50px rgba(0, 0, 0, 0.5);
    transform: translateY(-3px);
  }

  .thread-link:hover .card {
    transform: translateY(-4px);
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow:
      var(--shadow),
      0 14px 40px rgba(88, 28, 135, 0.28),
      0 0 40px rgba(168, 85, 247, 0.12);
  }

  .thread-link:active .card {
    transform: translateY(-1px);
  }

  .pinned:hover {
    border-color: rgba(255, 255, 255, 0.42);
  }
}

.thread-link:focus-visible .card {
  outline: 2px solid rgba(168, 85, 247, 0.7);
  outline-offset: 3px;
}

.card-soft {
  background: rgba(255, 255, 255, 0.04);
}

.pinned {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(168, 85, 247, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background: linear-gradient(155deg, rgba(88, 28, 135, 0.45), rgba(10, 6, 20, 0.85));
}

/* Новости: шапка + быстрые ссылки на секции (справа от заголовка) */
.news-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.75rem;
}

.news-page-head__lead {
  flex: 1 1 220px;
  min-width: 0;
}

.news-page-head__lead h1 {
  margin: 0 0 0.35rem;
}

.news-page-head__tagline {
  margin: 0;
}

.news-quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  align-self: flex-start;
  margin-left: auto;
}

.news-quicklinks .news-quicklinks__btn {
  padding: 0.42rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  /* те же цвета, что у .btn, с полупрозрачным слоем (~50%) */
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.5),
    rgba(76, 29, 149, 0.5)
  );
  box-shadow: 0 3px 16px rgba(88, 28, 135, 0.22);
}

@media (hover: hover) and (pointer: fine) {
  .news-quicklinks .news-quicklinks__btn:hover {
    background: linear-gradient(
      135deg,
      rgba(124, 58, 237, 0.62),
      rgba(76, 29, 149, 0.62)
    );
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.38);
  }
}

.news-anchor-section {
  scroll-margin-top: 5rem;
}

.news-notes-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.news-notes-feed .news-note-card {
  margin-bottom: 0;
}

.news-note-card__title {
  margin: 0 0 0.45rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white-accent);
}

.news-note-card__time {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
}

.news-note-card__body {
  margin: 0;
  white-space: pre-wrap;
  color: rgba(248, 250, 252, 0.94);
  line-height: 1.55;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  transition:
    transform var(--motion-fast) var(--ease-spring),
    box-shadow var(--motion-fast) ease,
    border-color var(--motion-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .badge:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    border-color: rgba(168, 85, 247, 0.4);
  }
}

.badge-ok {
  background: rgba(52, 211, 153, 0.2);
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.45);
}

.badge-warn {
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
}

.badge-bad {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.grid-2 {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.thread-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: color var(--motion-fast) ease;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  transition:
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    background 0.22s ease,
    transform var(--motion-fast) var(--ease-out-expo);
}

textarea.form-control {
  resize: vertical;
  max-width: 100%;
  min-width: 0;
  min-height: var(--textarea-min-height) !important;
  box-sizing: border-box;
}

.form-control:hover:not(:focus) {
  border-color: rgba(255, 255, 255, 0.22);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-row {
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, var(--accent-dim), #4c1d95);
  color: var(--white-accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  text-shadow: none;
  transition:
    transform var(--motion-medium) var(--ease-out-expo),
    box-shadow var(--motion-medium) var(--ease-out-expo),
    filter var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    background 0.28s ease,
    text-shadow var(--motion-medium) var(--ease-out-expo);
  box-shadow: 0 4px 22px rgba(88, 28, 135, 0.35);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    filter: brightness(1.1);
    box-shadow:
      0 8px 36px rgba(124, 58, 237, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.5), 0 0 28px rgba(168, 85, 247, 0.4);
  }

  .btn:active {
    transform: translateY(0);
    filter: brightness(0.96);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
}

.btn:focus-visible {
  outline: 2px solid rgba(168, 85, 247, 0.85);
  outline-offset: 3px;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
    filter: none;
  }

  .btn-ghost:active {
    transform: translateY(0);
  }
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.msg {
  padding: 0.65rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.msg-success {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
}

.msg-error {
  background: rgba(248, 113, 113, 0.15);
}

.msg-warning {
  background: rgba(251, 191, 36, 0.12);
}

.changelog-feed {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.changelog-card__label {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white-accent);
  letter-spacing: 0.02em;
}

.changelog-card__rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 1rem;
}

.changelog-card__body {
  margin: 0;
}

.changelog-line {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(248, 250, 252, 0.93);
}

.changelog-line:last-child {
  margin-bottom: 0;
}

.changelog-card__date {
  margin: 1rem 0 0;
  font-size: 0.88rem;
}

.changelog-tag {
  font-weight: 700;
  color: var(--white-accent);
}

.patch-list {
  margin: 0;
  padding-left: 1.15rem;
}

.patch-list li {
  margin-bottom: 0.35rem;
}

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

.media-grid img,
.media-grid video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #000;
  transition:
    transform var(--motion-medium) var(--ease-out-expo),
    box-shadow var(--motion-medium) var(--ease-out-expo),
    border-color var(--motion-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .media-grid img:hover,
  .media-grid video:hover {
    transform: translateY(-2px) scale(1.015);
    box-shadow:
      0 12px 32px rgba(0, 0, 0, 0.55),
      0 0 0 1px rgba(168, 85, 247, 0.25);
  }
}

.errorlist {
  color: #fecaca;
  margin: 0.25rem 0 0;
  padding-left: 1rem;
}

.like-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.file-upload__control {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.file-upload__native {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  opacity: 0;
  cursor: pointer;
  font-size: 1rem;
}

.file-upload__native:focus {
  outline: none;
}

.file-upload__btn {
  position: relative;
  z-index: 0;
  pointer-events: none;
  margin: 0;
}

/* Курсор над прозрачным input, не над label — .btn:hover не срабатывает */
@media (hover: hover) and (pointer: fine) {
  .file-upload__control:hover .file-upload__btn {
    filter: brightness(1.1);
    box-shadow:
      0 8px 36px rgba(124, 58, 237, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.5), 0 0 28px rgba(168, 85, 247, 0.4);
  }

  .file-upload__control:active .file-upload__btn {
    transform: translateY(0);
    filter: brightness(0.96);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  }
}

.file-upload__native:focus-visible + .file-upload__btn {
  outline: 2px solid rgba(168, 85, 247, 0.85);
  outline-offset: 3px;
}

.file-upload__status {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.9rem;
  word-break: break-word;
}

/* Комментарии к предложениям */
.comments-section {
  margin-top: 2rem;
}

.comments-heading {
  font-size: 1.2rem;
  color: var(--white-accent);
  margin: 0 0 1rem;
}

.comments-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.comment-card {
  margin-bottom: 0;
}

.comment-meta {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.comment-author {
  font-weight: 600;
  color: #e9d5ff;
}

.comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.comments-empty {
  margin: 0 0 1rem;
}

.comment-form-card .comment-form-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--white-accent);
}

.comment-form-note {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.comment-form {
  margin: 0;
}

/* Переход страниц — тусклая вспышка */
html.page-flash-enter::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
  background: rgba(255, 252, 248, 0.12);
  opacity: 1;
  animation: navFlashEnter 0.48s ease-out forwards;
}

@media (prefers-color-scheme: dark) {
  html.page-flash-enter::before {
    background: rgba(190, 185, 215, 0.09);
  }
}

@keyframes navFlashEnter {
  to {
    opacity: 0;
  }
}

html.page-flash-leaving::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
  background: rgba(255, 252, 248, 0.11);
  opacity: 0;
  animation: navFlashLeave 0.22s ease-in forwards;
}

@media (prefers-color-scheme: dark) {
  html.page-flash-leaving::before {
    background: rgba(165, 160, 200, 0.1);
  }
}

@keyframes navFlashLeave {
  to {
    opacity: 1;
  }
}

body.page-flash-busy {
  overflow: clip;
}
