@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Inter:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  --bg: #030303;
  --surface: #0a0810;
  --surface-hover: #100d18;
  --border: rgba(191, 168, 255, 0.17);
  --border-strong: rgba(191, 168, 255, 0.35);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.58);
  --muted-soft: rgba(255, 255, 255, 0.38);
  --accent: #7733ff;
  --accent-light: #9b6cff;
  --danger: #ff6f78;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

.auth-shell {
  position: relative;
  min-height: 100dvh;
  isolation: isolate;
}

.auth-shell::before {
  position: fixed;
  z-index: -3;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 41% 0%, rgba(119, 51, 255, 0.1), transparent 29%),
    #030303;
}

.auth-shell::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  opacity: 0.28;
  content: "";
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 0.55px, transparent 0.65px);
  background-size: 5px 5px;
  mask-image: radial-gradient(ellipse at 33% 52%, #000, transparent 64%);
  pointer-events: none;
}

.auth-header {
  position: absolute;
  z-index: 10;
  top: 0;
  right: 50%;
  left: 50%;
  display: flex;
  width: min(calc(100% - 64px), 1520px);
  height: 92px;
  align-items: center;
  justify-content: space-between;
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(119, 51, 255, 0.25));
}

.back-link {
  display: inline-flex;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  transition: border-color 220ms ease, color 220ms ease, background 220ms ease, transform 220ms ease;
}

.back-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.back-link:hover {
  border-color: rgba(155, 108, 255, 0.45);
  color: #fff;
  background: rgba(119, 51, 255, 0.08);
  transform: translateY(-1px);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, 520px);
  gap: clamp(52px, 4vw, 72px);
  width: min(calc(100% - 64px), 1520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 112px 0 34px;
}

.auth-visual {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(390px, 1fr);
  gap: 28px;
  align-content: center;
  overflow: hidden;
  padding: 40px 0 0;
}

.auth-visual::before {
  display: none;
}

.visual-content {
  position: relative;
  z-index: 2;
  max-width: 620px;
}

.visual-label {
  display: block;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 14px;
}

.visual-content h1,
.form-wrap h2 {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.visual-content h1 {
  max-width: 610px;
  font-size: clamp(48px, 3.2vw, 60px);
  line-height: 1.04;
}

.visual-content p {
  max-width: 560px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  text-wrap: pretty;
}

.product-preview {
  position: relative;
  width: min(800px, 86%);
  height: clamp(330px, 38vh, 360px);
  min-height: 0;
  align-self: start;
  overflow: hidden;
  border: 1px solid rgba(177, 142, 255, 0.3);
  border-radius: 20px 20px 0 0;
  background: #05040a;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.product-preview img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 1;
  filter: brightness(1.1) contrast(1.06) saturate(1.04);
}

.product-preview::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(to bottom, transparent 74%, rgba(3, 3, 3, 0.74) 100%);
  pointer-events: none;
}

.auth-panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-panel::before {
  position: absolute;
  z-index: -1;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  content: "";
  background: radial-gradient(circle, rgba(119, 51, 255, 0.08), transparent 67%);
  pointer-events: none;
}

.form-wrap {
  width: 100%;
  max-width: 480px;
}

.auth-register .form-wrap {
  max-width: 520px;
}

.form-wrap h2 {
  font-size: 44px;
  line-height: 1.08;
}

.form-lead {
  margin: 12px 0 32px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
}

.input-wrap {
  position: relative;
}

.input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 19px;
  height: 19px;
  color: rgba(255, 255, 255, 0.4);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  height: 54px;
  padding: 0 48px;
  border: 1px solid var(--border);
  border-radius: 15px;
  outline: none;
  color: #fff;
  background: rgba(10, 8, 16, 0.84);
  font-size: 14px;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.input-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  box-shadow: 0 0 0 1000px #0d0a16 inset;
  transition: background-color 9999s ease-out;
}

.input-wrap input:hover {
  border-color: rgba(191, 168, 255, 0.28);
  background: rgba(13, 10, 21, 0.92);
}

.input-wrap input:focus {
  border-color: var(--accent-light);
  background: #0d0a16;
  box-shadow: 0 0 0 4px rgba(119, 51, 255, 0.11);
}

.input-wrap input.invalid {
  border-color: var(--danger);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.42);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 180ms ease, background 180ms ease;
}

.password-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.options,
.check {
  display: flex;
  align-items: center;
}

.options {
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.check {
  gap: 9px;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.terms {
  align-items: flex-start;
  margin: 1px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.text-link,
.terms a {
  color: #aa84ff;
  transition: color 180ms ease;
}

.text-link:hover,
.terms a:hover {
  color: #c8b0ff;
}

.primary-button,
.google-button {
  display: flex;
  width: 100%;
  height: 54px;
  align-items: center;
  justify-content: center;
  border-radius: 32px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease, box-shadow 200ms ease, filter 200ms ease;
}

.primary-button {
  border: 0;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 14px 40px rgba(119, 51, 255, 0.22);
}

.primary-button:hover {
  filter: brightness(1.1);
  box-shadow: 0 17px 48px rgba(119, 51, 255, 0.3);
  transform: translateY(-2px);
}

.primary-button:active,
.google-button:active,
.back-link:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.google-button:focus-visible,
.password-toggle:focus-visible,
.back-link:focus-visible,
.brand:focus-visible,
.text-link:focus-visible {
  outline: 2px solid #b99cff;
  outline-offset: 3px;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 21px 0;
  color: var(--muted-soft);
  font-size: 12px;
}

.divider::before,
.divider::after {
  height: 1px;
  content: "";
  background: rgba(255, 255, 255, 0.1);
}

.google-button {
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
  background: rgba(8, 7, 12, 0.55);
}

.google-button:hover {
  border-color: var(--border-strong);
  background: rgba(15, 12, 23, 0.82);
  transform: translateY(-2px);
}

.google-mark {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
}

.form-footer {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.form-footer a {
  margin-left: 6px;
  font-weight: 500;
}

.form-message {
  margin: -6px 0 14px;
  color: var(--danger);
  font-size: 12px;
}

.form-message:empty {
  display: none;
}

@media (max-width: 1180px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(410px, 480px);
    gap: 48px;
  }

  .visual-content h1 {
    font-size: 48px;
  }

  .product-preview {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .auth-header {
    width: min(calc(100% - 48px), 560px);
  }

  .auth-layout {
    display: block;
    width: min(calc(100% - 48px), 560px);
    padding: 120px 0 56px;
  }

  .auth-visual {
    display: none;
  }

  .auth-panel {
    min-height: calc(100dvh - 176px);
    overflow: hidden;
  }

  .auth-panel::before {
    width: 100vw;
    height: 100vw;
  }

  .auth-register .form-wrap,
  .form-wrap {
    max-width: 520px;
  }
}

@media (max-width: 560px) {
  .auth-header {
    width: calc(100% - 36px);
    height: 78px;
  }

  .brand {
    font-size: 18px;
  }

  .brand img {
    width: 25px;
    height: 25px;
  }

  .back-link {
    width: 40px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }

  .auth-layout {
    width: calc(100% - 36px);
    padding-top: 104px;
  }

  .auth-panel {
    min-height: auto;
    align-items: flex-start;
  }

  .form-wrap h2 {
    font-size: 38px;
  }

  .form-lead {
    margin-bottom: 28px;
    font-size: 14px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .input-wrap input {
    height: 52px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .brand,
  .back-link,
  .visual-content,
  .product-preview,
  .form-wrap {
    animation: auth-reveal 620ms cubic-bezier(.2, .8, .2, 1) both;
  }

  .back-link { animation-delay: 60ms; }
  .visual-content { animation-delay: 80ms; }
  .product-preview { animation-delay: 150ms; }
  .form-wrap { animation-delay: 120ms; }

  @keyframes auth-reveal {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .product-preview img {
    animation: preview-drift 10s ease-in-out infinite alternate;
  }

  @keyframes preview-drift {
    from { transform: scale(1.01) translateY(0); }
    to { transform: scale(1.025) translateY(-5px); }
  }
}
