/* Страница выдачи пароля MotorState: графитовый фон с красными «полосами скорости»,
   белая карточка формы. Шрифт e-Ukraine, цвета — как в панели. */

@font-face {
  font-family: 'e-Ukraine';
  src: url('/assets/fonts/e-Ukraine-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'e-Ukraine';
  src: url('/assets/fonts/e-Ukraine-Medium.woff2') format('woff2');
  font-weight: 500 600;
  font-display: swap;
}
@font-face {
  font-family: 'e-Ukraine';
  src: url('/assets/fonts/e-Ukraine-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --red: #c00006;
  --red-hover: #a50005;
  --red-soft: #fdecec;
  --graphite: #363636;
  --night: #161616;
  --night-2: #202020;
  --ink: #1d1d1f;
  --muted: #6b6b6b;
  --line: #e4e4e2;
  --paper: #ffffff;
  --paper-2: #f6f6f5;
  --green: #1f8a4c;
  --green-soft: #e9f6ee;
  --amber: #a86500;
  --amber-soft: #fff4e0;
  --radius: 16px;
  color-scheme: light;
}

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

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'e-Ukraine', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 620px at 88% -8%, rgba(192, 0, 6, 0.42), transparent 62%),
    radial-gradient(900px 560px at -10% 110%, rgba(192, 0, 6, 0.16), transparent 60%),
    linear-gradient(160deg, var(--night-2) 0%, var(--night) 55%, #0f0f0f 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Фон: тонкая сетка и полосы скорости ── */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%);
}

.streak {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  transform: rotate(-14deg);
  background: linear-gradient(90deg, transparent, rgba(255, 60, 60, 0.75), transparent);
  opacity: 0.55;
  animation: streak 9s ease-in-out infinite;
}
.streak-1 {
  top: 18%;
  left: -10%;
  width: 46%;
}
.streak-2 {
  top: 31%;
  left: 58%;
  width: 52%;
  height: 1px;
  animation-delay: -3s;
  opacity: 0.4;
}
.streak-3 {
  top: 78%;
  left: 8%;
  width: 38%;
  animation-delay: -6s;
  opacity: 0.35;
}

@keyframes streak {
  0%,
  100% {
    translate: -4% 0;
  }
  50% {
    translate: 6% 0;
  }
}

/* ── Шапка ── */

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 20px 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px rgba(192, 0, 6, 0.45);
}

.brand-name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.langs {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
}

.langs button {
  min-width: 42px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.langs button:hover {
  color: #fff;
}
.langs button.active {
  background: #fff;
  color: var(--ink);
}
.langs button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ── Карточка ── */

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 40px 16px 32px;
}

.card {
  position: relative;
  width: min(480px, 100%);
  padding: 36px 36px 30px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 30px 80px rgba(0, 0, 0, 0.45),
    0 8px 24px rgba(0, 0, 0, 0.25);
  text-align: center;
  overflow: hidden;
  animation: rise 0.45s ease-out both;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--red), #ff3b3b 55%, var(--red));
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.logo {
  display: block;
  width: 168px;
  height: auto;
  margin: 0 auto 18px;
}

h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.lead {
  margin: 0 auto 20px;
  max-width: 36ch;
  color: var(--muted);
  font-size: 14px;
}

.topic {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  text-align: left;
}
.topic-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}
.topic-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.topic-forum {
  font-size: 13px;
  color: var(--muted);
}
.topic-checking {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Форма ── */

form {
  text-align: left;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

.field {
  position: relative;
}
.field-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 20px;
  height: 20px;
  translate: 0 -50%;
  fill: #9a9a98;
  pointer-events: none;
  transition: fill 0.15s;
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 44px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.field input::placeholder {
  color: #b3b3b1;
}
.field input:focus {
  outline: none;
  border-color: var(--graphite);
  box-shadow: 0 0 0 4px rgba(54, 54, 54, 0.1);
}
.field:focus-within .field-icon {
  fill: var(--graphite);
}
.field.invalid input {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(192, 0, 6, 0.1);
}
.field.invalid .field-icon {
  fill: var(--red);
}
.field input[readonly] {
  background: var(--paper-2);
}

.field-error {
  margin: 6px 0 0;
  color: var(--red);
  font-size: 13px;
}

/* Подсказка «возможно, вы имели в виду …» */
.hint {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #7a4a00;
  font-size: 13px;
  animation: rise 0.3s ease-out both;
}
.hint p {
  margin: 0;
  overflow-wrap: anywhere;
}
.hint b {
  color: var(--ink);
}
.hint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.hint-actions button {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.hint-fix {
  border: 0;
  background: var(--graphite);
  color: #fff;
}
.hint-fix:hover {
  background: var(--night);
}
.hint-keep {
  border: 1.5px solid #e2c48f;
  background: transparent;
  color: #7a4a00;
}
.hint-keep:hover {
  background: rgba(168, 101, 0, 0.08);
}
.hint-actions button[hidden] {
  display: none;
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(192, 0, 6, 0.28);
  transition:
    background 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
}
.submit:hover {
  background: var(--red-hover);
}
.submit:active {
  transform: translateY(1px);
}
.submit:focus-visible {
  outline: 3px solid rgba(192, 0, 6, 0.35);
  outline-offset: 2px;
}
.submit-arrow {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: translate 0.2s;
}
.submit:hover .submit-arrow {
  translate: 3px 0;
}
.submit.busy {
  cursor: progress;
  background: var(--graphite);
  box-shadow: none;
}
.submit.busy .submit-arrow {
  display: none;
}
.submit.busy::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  animation: scan 1.1s linear infinite;
}

@keyframes scan {
  from {
    translate: -100% 0;
  }
  to {
    translate: 100% 0;
  }
}

.notice {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.notice svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  fill: #9a9a98;
}

/* ── Тема не найдена ── */

.not-found {
  animation: rise 0.35s ease-out both;
}
.nf-code {
  margin: 4px 0 6px;
  font-size: 64px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--red);
}
.nf-text {
  margin: 0 auto 8px;
  max-width: 34ch;
  font-weight: 500;
}
.nf-hint {
  margin: 0 auto 22px;
  max-width: 40ch;
  color: var(--muted);
  font-size: 13px;
}
.nf-links {
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.nf-links h2 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.nf-links ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nf-links a {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 40px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.nf-links a::after {
  content: '→';
  position: absolute;
  top: 50%;
  right: 16px;
  translate: 0 -50%;
  color: var(--red);
  transition: translate 0.2s;
}
.nf-links a:hover,
.nf-links a:focus-visible {
  border-color: var(--red);
  background: #fff;
  outline: none;
}
.nf-links a:hover::after {
  translate: 3px -50%;
}
.nf-link-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

/* ── Прогресс ── */

.progress {
  --progress: 0;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 6px 0 18px;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}
.progress::before,
.progress::after {
  content: '';
  position: absolute;
  top: 11px;
  left: 16.66%;
  height: 2px;
  border-radius: 2px;
}
.progress::before {
  right: 16.66%;
  background: var(--line);
}
.progress::after {
  width: calc(66.66% * var(--progress));
  background: var(--red);
  transition: width 0.5s ease;
}

.progress li {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.progress .dot {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.progress li.done {
  color: var(--ink);
}
.progress li.done .dot {
  border-color: var(--red);
  background: var(--red);
}
.progress li.done .dot::after {
  content: '';
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  rotate: 45deg;
}
.progress li.active {
  color: var(--ink);
  font-weight: 500;
}
.progress li.active .dot {
  border-color: var(--red);
}
.progress li.active .dot::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.2s ease-in-out infinite;
}
.progress li.failed .dot {
  border-color: var(--red);
  background: var(--red-soft);
}

@keyframes pulse {
  50% {
    scale: 0.55;
    opacity: 0.5;
  }
}

/* ── Сообщения ── */

.message {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: left;
  font-size: 14px;
  animation: rise 0.3s ease-out both;
}
.message p {
  margin: 0;
}
.message-icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: currentColor;
}
.message-success {
  background: var(--green-soft);
  color: #155e34;
}
.message-info {
  background: var(--paper-2);
  color: var(--graphite);
}
.message-wait {
  background: var(--amber-soft);
  color: #7a4a00;
}
.message-error {
  background: var(--red-soft);
  color: #8e0004;
}
form + .progress[hidden] + .message {
  margin-top: 18px;
}

.again {
  margin-top: 16px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--graphite);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.again:hover {
  color: var(--red);
}

/* ── Ссылки ── */

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px 48px;
  width: min(480px, 100%);
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}
.links-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.links h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}
.social,
.useful {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.social-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
.social-link svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}
.social-link:hover,
.social-link:focus-visible {
  background: var(--red);
  border-color: var(--red);
  transform: translateY(-2px);
  outline: none;
}
.useful a {
  color: #fff;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 3px;
}
.useful a:hover {
  text-decoration-color: var(--red);
}

/* ── Подвал ── */

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  padding: 0 16px 24px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .topbar {
    padding: 14px 16px 0;
  }
  .brand-name,
  .footer-sep {
    display: none;
  }
  .footer {
    flex-direction: column;
  }
  .stage {
    padding-top: 24px;
  }
  .card {
    padding: 28px 20px 24px;
  }
  h1 {
    font-size: 20px;
  }
  .logo {
    width: 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
