/* nox — общий слой: токены, типографика, кнопки, поля, модалки, тосты */

:root {
  --bg: #06060b;
  --bg-2: #0a0a12;
  --surface: #0e0e17;
  --raised: #14141f;
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #eceaf6;
  --muted: #8f8da6;
  --dim: #5c5a72;

  --acc: #6d5cff;
  --acc-rgb: 109, 92, 255;
  --acc-hi: #8b7dff;
  --acc-lo: #3a2cb0;
  --blue: #4a78ff;
  --violet: #9a5cff;
  --ok: #58d6a0;
  --bad: #ff6b81;

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.12);
  --wrap: 1180px;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* зерно поверх всего — убирает «пластиковую» гладкость градиентов */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(var(--acc-rgb), 0.45);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--acc-hi);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 40px, var(--wrap));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-feature-settings: 'zero', 'ss01';
  letter-spacing: -0.02em;
}

.svg {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* иконки площадок: один svg-файл, цвет берётся из текста */
.ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
}

/* ---------------------------------------------------------------- логотип */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 19px/1 var(--display);
  letter-spacing: -0.04em;
}

.logo__mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 68% 34%, var(--bg) 0 42%, transparent 43%), linear-gradient(140deg, var(--blue), var(--violet));
  box-shadow: 0 0 18px rgba(var(--acc-rgb), 0.55);
}

/* ---------------------------------------------------------------- кнопки */

.btn {
  --h: 44px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: var(--h);
  padding: 0 18px;
  border-radius: 12px;
  font: 600 15px/1 var(--font);
  letter-spacing: -0.01em;
  white-space: nowrap;
  user-select: none;
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background 0.16s, color 0.16s;
}

.btn .svg {
  font-size: 17px;
}

/* «клавиша» с настоящей толщиной: поднимается под курсором, проваливается при нажатии */
.btn--primary {
  color: #fff;
  background: linear-gradient(180deg, #7d6eff 0%, #5a48f0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 0 var(--acc-lo), 0 12px 22px -14px rgba(var(--acc-rgb), 0.5);
  transform: translateY(-2px);
}

.btn--primary:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.36), 0 4px 0 var(--acc-lo), 0 16px 26px -14px rgba(var(--acc-rgb), 0.6);
}

.btn--primary:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 var(--acc-lo), 0 6px 12px -8px rgba(var(--acc-rgb), 0.45);
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

.btn--quiet {
  color: var(--muted);
  padding: 0 12px;
}

.btn--quiet:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn--danger:hover {
  color: var(--bad);
}

.btn--sm {
  --h: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
}

.btn--lg {
  --h: 54px;
  padding: 0 26px;
  border-radius: 15px;
  font-size: 16px;
}

.btn--block {
  width: 100%;
}

.btn[disabled],
.btn[aria-busy='true'] {
  pointer-events: none;
  opacity: 0.55;
}

.btn--icon {
  width: var(--h);
  padding: 0;
}

/* ---------------------------------------------------------------- поля */

.field {
  display: grid;
  /* не auto: иначе поле с приклеенным адресом сайта на узком экране шире своей колонки */
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
}

.field__label small {
  font: 400 12px var(--mono);
  color: var(--dim);
}

.input,
.textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 6px rgba(0, 0, 0, 0.35);
  outline: none;
  transition: box-shadow 0.16s, background 0.16s;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--dim);
}

.input:hover,
.textarea:hover {
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.input:focus,
.textarea:focus {
  background: rgba(var(--acc-rgb), 0.06);
  box-shadow: inset 0 0 0 1.5px var(--acc), 0 0 0 4px rgba(var(--acc-rgb), 0.16);
}

.field--bad .input,
.field--bad .inbox {
  box-shadow: inset 0 0 0 1.5px var(--bad), 0 0 0 4px rgba(255, 107, 129, 0.12);
}

.field__msg {
  min-height: 18px;
  font-size: 13px;
  line-height: 18px;
  color: var(--dim);
}

.field--bad .field__msg {
  color: var(--bad);
}

.field--ok .field__msg {
  color: var(--ok);
}

/* поле с приклеенным префиксом (nox.bio/…) или кнопкой внутри */
.inbox {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 6px 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.16s, background 0.16s;
  cursor: text;
}

.inbox:focus-within {
  background: rgba(var(--acc-rgb), 0.06);
  box-shadow: inset 0 0 0 1.5px var(--acc), 0 0 0 4px rgba(var(--acc-rgb), 0.16);
}

.inbox__prefix {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}

.inbox input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  padding: 0 8px 0 1px;
}

.inbox input::placeholder {
  color: var(--dim);
}

.inbox__btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 17px;
}

.inbox__btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

/* ---------------------------------------------------------------- сегменты и переключатели */

.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg button {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.seg button:hover {
  color: var(--text);
}

.seg button[aria-pressed='true'],
.seg button[aria-selected='true'] {
  color: #fff;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.7);
}

.switch {
  position: relative;
  flex: none;
  width: 42px;
  height: 25px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #cfcde0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.14);
  transition: transform 0.24s var(--spring), background 0.2s;
}

.switch[aria-checked='true'] {
  background: var(--acc);
}

.switch[aria-checked='true']::after {
  transform: translateX(17px);
  background: #fff;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  transition: transform 0.18s var(--spring);
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch[aria-pressed='true'] {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- модалки */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  perspective: 1300px;
  visibility: hidden;
  transition: visibility 0s 0.32s;
}

.modal[data-open] {
  visibility: visible;
  transition-delay: 0s;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 8, 0.7);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
  opacity: 0;
  transition: opacity 0.3s;
}

.modal__panel {
  position: relative;
  width: min(100%, var(--w, 440px));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 120px), var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 40px 90px -20px rgba(0, 0, 0, 0.9),
    0 0 120px -40px rgba(var(--acc-rgb), 0.26);
  opacity: 0;
  transform: translateY(36px) rotateX(14deg) scale(0.95);
  transform-origin: 50% 100%;
  transition: transform 0.24s var(--ease), opacity 0.2s;
}

.modal[data-open] .modal__scrim {
  opacity: 1;
}

.modal[data-open] .modal__panel {
  opacity: 1;
  transform: none;
  transition: transform 0.5s var(--spring), opacity 0.22s;
}

.modal__x {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 18px;
}

.modal__x:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.modal__title {
  font: 600 21px/1.2 var(--display);
  letter-spacing: -0.03em;
  padding-right: 36px;
}

.modal__sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14.5px;
}

.modal__body {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.modal__foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

@media (max-width: 560px) {
  .modal {
    padding: 0;
    place-items: end center;
  }

  .modal__panel {
    width: 100%;
    max-height: 92dvh;
    padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
}

/* ---------------------------------------------------------------- тосты */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  display: grid;
  gap: 8px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px 11px 16px;
  border-radius: 14px;
  background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 20px 40px -12px rgba(0, 0, 0, 0.85);
  font-size: 14.5px;
  pointer-events: auto;
  animation: toast-in 0.36s var(--spring);
}

.toast[data-out] {
  animation: toast-out 0.2s forwards;
}

.toast--bad {
  box-shadow: inset 0 0 0 1px rgba(255, 107, 129, 0.5), 0 20px 40px -12px rgba(0, 0, 0, 0.85);
}

.toast button {
  color: var(--acc-hi);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
}

.toast button:hover {
  background: rgba(var(--acc-rgb), 0.16);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- переключатель языка */

/* кнопка, которая выглядит как соседние ссылки в подвале */
.langlink {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: color 0.15s;
}

.langlink:hover {
  color: var(--text);
}