/* ==========================================================================
   LWL — дизайн-система. Фирменные цвета и шрифт заголовков — из макета Figma;
   текст набран Inter для удобства чтения.
   ========================================================================== */

@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/russo-one-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/russo-one-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/russo-one-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/inter-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* фирменные цвета (Figma) */
  --c-bg: #2b2b2b;
  --c-header: #202020;
  --c-stripe: #005337;
  --c-surface: #343434;
  --c-surface-2: #3b3b3b;
  --c-surface-3: #454545;
  --c-field: #242424;
  --c-avatar-bg: #d9d9d9;
  --c-green: #1f9837;
  --c-green-soft: #6fdc88;
  --c-blue-1: #1598d9;
  --c-blue-2: #1ec5dc;
  --c-text: #ffffff;
  --c-text-2: rgba(255, 255, 255, 0.72);
  --c-text-3: rgba(255, 255, 255, 0.5);
  --c-border: rgba(255, 255, 255, 0.08);
  --c-border-strong: rgba(255, 255, 255, 0.16);
  --grad: linear-gradient(90deg, var(--c-blue-1) 0%, var(--c-blue-2) 100%);
  --grad-y: linear-gradient(180deg, var(--c-blue-1) 0%, var(--c-blue-2) 100%);

  /* состояния */
  --c-danger: #ff6b6b;
  --c-danger-strong: #d64545;
  --c-danger-bg: rgba(255, 107, 107, 0.12);
  --c-warning: #f2c14e;
  --c-warning-bg: rgba(242, 193, 78, 0.14);
  --c-info-bg: rgba(30, 197, 220, 0.12);
  --c-success-bg: rgba(31, 152, 55, 0.16);
  --c-focus: #7fe3f0;

  --font-display: 'Russo One', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-2: 0 24px 60px rgba(0, 0, 0, 0.45);
  --stripe-h: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.005em;
}

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

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

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

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 3px;
}

::selection {
  background: rgba(30, 197, 220, 0.45);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-sm);
  background: var(--c-surface);
  transition: top 0.15s;
}
.skip-link:focus {
  top: 16px;
}

.stripe {
  height: var(--stripe-h);
  background: var(--c-stripe);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-sm);
}
.brand img {
  width: 44px;
  height: 44px;
}
.brand__name {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.04em;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-blue-2);
}

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

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--grad);
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(21, 152, 217, 0.25);
  transition: filter 0.15s, transform 0.15s var(--ease), box-shadow 0.15s, background-color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 26px rgba(21, 152, 217, 0.35);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}
.btn[disabled],
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  opacity: 0.5;
  filter: none;
  transform: none;
  box-shadow: none;
}
.btn--sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 15px;
  border-radius: var(--r-sm);
}
.btn--lg {
  min-height: 56px;
  padding: 0 28px;
  font-size: 18px;
}
.btn--secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--c-border-strong);
  box-shadow: none;
}
.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.13);
  box-shadow: none;
  filter: none;
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--c-text-2);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  box-shadow: none;
  filter: none;
}
.btn--danger {
  background: var(--c-danger-strong);
  box-shadow: none;
}
.btn--danger:hover {
  box-shadow: 0 8px 22px rgba(214, 69, 69, 0.3);
}
.btn--block {
  width: 100%;
}
.btn.is-loading {
  color: transparent;
  pointer-events: none;
}
.btn.is-loading > * {
  visibility: hidden;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.link {
  color: var(--c-blue-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.link:hover {
  color: #fff;
}
.link-btn {
  color: var(--c-blue-2);
  font-weight: 500;
}
.link-btn:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--c-blue-2);
  animation: spin 0.8s linear infinite;
}

/* ------------------------------------------------------------------- формы */

.field {
  display: grid;
  gap: 8px;
  align-content: start;
}
.field__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-2);
}
.field__control {
  position: relative;
}
.input,
.textarea,
.select {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-field);
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--c-text-3);
}
.input:hover,
.textarea:hover,
.select:hover {
  border-color: rgba(255, 255, 255, 0.26);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--c-blue-2);
  box-shadow: 0 0 0 3px rgba(30, 197, 220, 0.22);
}
.input[readonly] {
  color: var(--c-text-2);
  background: rgba(255, 255, 255, 0.03);
}
.textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}
.select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.select option {
  background: var(--c-surface);
}
.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}
.field__error {
  color: var(--c-danger);
  font-size: 14px;
}
.field__error:empty {
  display: none;
}
.field__hint {
  font-size: 13px;
  color: var(--c-text-3);
}
.field__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.field__counter {
  font-size: 13px;
  color: var(--c-text-3);
  font-variant-numeric: tabular-nums;
}
.field__counter.is-over {
  color: var(--c-danger);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border-radius: 8px;
  color: var(--c-text-3);
}
.password-toggle:hover {
  color: #fff;
}
.password-toggle svg {
  width: 22px;
  height: 22px;
}
.input--with-toggle {
  padding-right: 52px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
}
.checkbox input {
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 6px;
  background: var(--c-field);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.checkbox input:checked {
  background: var(--grad);
  border-color: transparent;
}
.checkbox input:checked::after {
  content: '';
  width: 11px;
  height: 6px;
  border: solid #fff;
  border-width: 0 0 2.5px 2.5px;
  transform: translateY(-1px) rotate(-45deg);
}
.field.has-error .checkbox input {
  border-color: var(--c-danger);
}

.strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.strength span {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s;
}
.strength[data-level='1'] span:nth-child(-n + 1) {
  background: var(--c-danger);
}
.strength[data-level='2'] span:nth-child(-n + 2) {
  background: var(--c-warning);
}
.strength[data-level='3'] span:nth-child(-n + 3) {
  background: var(--c-blue-2);
}
.strength[data-level='4'] span {
  background: var(--c-green);
}

.form-alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--c-danger-bg);
  color: #ffd2d2;
  font-size: 15px;
  line-height: 1.45;
}
.form-alert--info {
  background: var(--c-info-bg);
  color: #c9f4fa;
}
.form-alert svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

/* ------------------------------------------------------------- модальные окна */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}
.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(6px);
  animation: fade-in 0.2s var(--ease);
}
.modal__dialog {
  position: relative;
  width: min(100%, 520px);
  padding: 32px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  box-shadow: var(--shadow-2);
  animation: pop-in 0.22s var(--ease);
}
.modal__dialog--sm {
  width: min(100%, 440px);
}
.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--c-text-3);
}
.modal__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.modal__close svg {
  width: 20px;
  height: 20px;
}
.modal__title {
  padding-right: 40px;
  margin-bottom: 8px;
  font-size: 26px;
}
.modal__text {
  font-size: 16px;
  color: var(--c-text-2);
}
.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.modal__actions .btn {
  flex: 1 1 150px;
}
body.has-modal {
  overflow: hidden;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

/* --------------------------------------------------------------- уведомления */

.toasts {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 10px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: #3a3a3a;
  box-shadow: var(--shadow-2);
  font-size: 15px;
  line-height: 1.4;
  pointer-events: auto;
  animation: pop-in 0.2s var(--ease);
}
.toast::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--c-blue-2);
}
.toast--error::before {
  background: var(--c-danger);
}
.toast--success::before {
  background: var(--c-green-soft);
}
.toast__body {
  flex: 1;
}
.toast__action {
  color: var(--c-blue-2);
  font-weight: 600;
  white-space: nowrap;
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s;
}

/* ------------------------------------------------------------ аватар */

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28%;
  background: var(--c-avatar-bg);
  flex: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar__initial {
  font-family: var(--font-display);
  font-size: 0.42em;
  color: #6b6b6b;
  text-transform: uppercase;
}

/* ------------------------------------------------------ вход / регистрация */

.auth-dialog {
  width: min(100%, 480px);
}
.auth__lead {
  margin: 0 0 18px;
  font-size: 15px;
  color: var(--c-text-2);
}
.auth__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 14px 0 22px;
  border-radius: var(--r-md);
  background: var(--c-field);
}
.auth__tab {
  min-height: 42px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--c-text-3);
  transition: background 0.15s, color 0.15s;
}
.auth__tab[aria-selected='true'] {
  background: var(--c-surface-3);
  color: #fff;
}
.auth__tab:not([aria-selected='true']):hover {
  color: #fff;
}
.auth__form {
  display: grid;
  gap: 16px;
}
.auth__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth__row .link-btn,
.auth__back {
  font-size: 15px;
}
.auth__back {
  justify-self: center;
}
.auth__note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.45;
  color: var(--c-text-3);
}
.auth__note svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

@media (max-width: 640px) {
  .modal {
    padding: 0;
    align-items: end;
  }
  .modal__dialog {
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    padding: 26px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .modal__title {
    font-size: 23px;
  }
  .toasts {
    right: 16px;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: auto;
  }
}

@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;
  }
}
