/* =========================================================
   Renova — User module design prototype
   Login / register, email-code flow. Standalone HTML/CSS/JS.
   ========================================================= */

:root {
  --ink: #181e1a;
  --ink-soft: #354238;
  --muted: #626d65;
  --muted-2: #667267;
  --placeholder: #6b766d;
  --line: #e4e9e3;
  --line-soft: #edf0e9;
  --line-strong: #d3dbd1;
  --green: #477c61;
  --green-deep: #183c2c;
  --green-dark: #243d2d;
  --green-button-1: #344a39;
  --green-button-2: #23372a;
  --sage: #f4f7ef;
  --sage-2: #eaf0e3;
  --sage-3: #e0e8d4;
  --surface: #fafbf9;
  --white: #fff;
  --danger: #b42318;
  --danger-soft: #fdf3f2;
  --danger-line: #f2d4d1;
  --focus: #609777;
  --ring-soft: rgba(71, 124, 97, 0.14);
  --selection-bg: #cfe0c6;
  --selection-ink: #122117;
  --page-bg: #fbfcf9;
  --glow-sage: rgba(237, 243, 231, 0.78);
  --glow-cream: rgba(246, 241, 233, 0.9);
  --shadow-card: 0 30px 80px -48px rgba(48, 65, 46, 0.42);
  --shadow-button:
    0 2px 3px rgba(27, 46, 32, 0.07), inset 0 1px rgba(255, 255, 255, 0.08);
  --shadow-button-hover: 0 10px 22px -14px rgba(27, 46, 32, 0.45);
  --toast-bg: rgba(24, 30, 26, 0.94);
  --toast-line: rgba(255, 255, 255, 0.18);
  --toast-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-card: 20px;

  --font-sans:
    "Geist", "Segoe UI Variable Display", "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Geist Mono", "Cascadia Code", "SFMono-Regular", Consolas,
    monospace;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);

  color-scheme: light;
}

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

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

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

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--selection-bg);
  color: var(--selection-ink);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 16px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--green-deep);
  color: var(--white);
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* =========================================================
   Page
   ========================================================= */

.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--page-bg);
  background-image:
    radial-gradient(
      ellipse 62% 48% at 16% -4%,
      var(--glow-sage),
      transparent 62%
    ),
    radial-gradient(
      ellipse 52% 44% at 92% 16%,
      var(--glow-cream),
      transparent 64%
    );
  background-repeat: no-repeat;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
  padding: 22px 0;
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.auth-back .icon {
  width: 15px;
  height: 15px;
  transition: transform 180ms var(--ease-out);
}

.auth-back:hover .icon {
  transform: translateX(-2px);
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--sage-3);
  border-radius: 99px;
  background: var(--sage);
  color: var(--green-deep);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.demo-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.auth-main {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 8px 24px 56px;
}

.auth-shell {
  width: min(100%, 460px);
}

/* =========================================================
   Card
   ========================================================= */

.auth-card {
  position: relative;
  padding: 34px 32px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1;
}

.auth-brand svg {
  width: 26px;
  height: 26px;
}

.auth-brand-dot {
  color: var(--green);
}

.auth-intro {
  margin-bottom: 20px;
  text-align: center;
}

.auth-title {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.auth-title:focus {
  outline: none;
}

.auth-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

/* =========================================================
   Steps
   ========================================================= */

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
}

.step + .step::before {
  content: "";
  width: 44px;
  height: 1px;
  margin-inline: 14px;
  background: var(--line);
}

.step-index {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.step-check {
  display: none;
  width: 12px;
  height: 12px;
}

.step.is-active {
  color: var(--green-deep);
}

.step.is-active .step-index {
  border-color: var(--green-deep);
  background: var(--green-deep);
  color: var(--white);
}

.step.is-done .step-index {
  border-color: var(--sage-3);
  background: var(--sage-2);
  color: var(--green-deep);
}

.step.is-done .step-num {
  display: none;
}

.step.is-done .step-check {
  display: block;
}

/* =========================================================
   Forms
   ========================================================= */

.auth-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.control {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
  appearance: none;
}

.control::placeholder {
  color: var(--placeholder);
}

.control:hover {
  border-color: var(--line-strong);
}

.control:focus,
.control:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--ring-soft);
}

.control[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.control-code {
  padding-inline: 0.32em 0;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.32em;
  text-align: center;
}

.field-hint {
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
}

.field-error:empty {
  display: none;
}

.form-error {
  padding: 9px 12px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}

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

.sent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.sent-row .icon {
  width: 16px;
  height: 16px;
  color: var(--green);
}

.sent-row strong {
  color: var(--ink-soft);
  font-weight: 600;
  word-break: break-all;
}

.sent-row .link-button {
  margin-left: auto;
  flex: 0 0 auto;
}

.demo-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.demo-hint code {
  padding: 2px 6px;
  border: 1px solid var(--sage-2);
  border-radius: 6px;
  background: var(--sage);
  color: var(--green-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

/* =========================================================
   Terms
   ========================================================= */

.terms {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  cursor: pointer;
}

.terms input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--green-deep);
  cursor: pointer;
}

.terms a {
  color: var(--green-deep);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.terms.is-invalid {
  color: var(--danger);
}

/* =========================================================
   Captcha
   ========================================================= */

.captcha {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--sage);
}

.captcha-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.captcha-title {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.captcha-label {
  display: block;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 600;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-image {
  display: grid;
  place-items: center;
  width: 128px;
  height: 46px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.captcha-image svg {
  width: 100%;
  height: 100%;
}

.captcha-digit {
  fill: var(--green-deep);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
}

.captcha-noise {
  fill: none;
  stroke: var(--green);
  stroke-width: 0.8;
  opacity: 0.35;
}

.captcha-dot {
  fill: var(--green);
  opacity: 0.3;
}

.control-captcha {
  flex: 1;
  min-width: 0;
  padding-inline-start: 0.16em;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
  text-align: center;
}

/* =========================================================
   Buttons and links
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--green-dark);
  border-radius: var(--radius-md);
  background: linear-gradient(
    180deg,
    var(--green-button-1),
    var(--green-button-2)
  );
  box-shadow: var(--shadow-button);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out),
    opacity 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
}

.btn-block {
  width: 100%;
}

.btn-soft {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  box-shadow: none;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.btn-soft:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.btn-compact {
  min-height: 44px;
  padding-inline: 12px;
  font-size: 12px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover:not(:disabled) {
  color: var(--green);
}

.link-button:disabled {
  color: var(--muted-2);
  text-decoration: none;
}

.link-button .icon {
  width: 13px;
  height: 13px;
}

.link-button-sm {
  font-size: 12px;
  font-weight: 500;
}

.auth-alt {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-alt a {
  color: var(--green-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-alt a:hover {
  color: var(--green);
}

.resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 13px;
}

/* =========================================================
   Footer
   ========================================================= */

.demo-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.auth-footer {
  max-width: 420px;
  margin: 16px auto 0;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.auth-footer a {
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-footer a:hover {
  color: var(--green);
}

.auth-noscript {
  position: fixed;
  z-index: 210;
  bottom: 16px;
  left: 50%;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--green-deep);
  color: var(--white);
  font-size: 12px;
  transform: translateX(-50%);
}

/* =========================================================
   Toast
   ========================================================= */

.toast {
  position: fixed;
  z-index: 120;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid var(--toast-line);
  border-radius: var(--radius-md);
  background: var(--toast-bg);
  box-shadow: var(--toast-shadow);
  color: var(--white);
  font-size: 12px;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 200ms ease,
    transform 260ms var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   Motion
   ========================================================= */

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

html.js .auth-card {
  animation: card-in 480ms var(--ease-out) both;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 560px) {
  .auth-topbar {
    width: calc(100% - 32px);
    padding: 16px 0;
  }

  .auth-main {
    padding: 8px 16px 40px;
  }

  .auth-card {
    padding: 28px 20px 22px;
    border-radius: var(--radius-lg);
  }

  .auth-title {
    font-size: 24px;
  }

  .captcha-image {
    width: 112px;
  }

  .captcha-row {
    gap: 8px;
  }

  .step + .step::before {
    width: 28px;
    margin-inline: 9px;
  }

  .sent-row {
    flex-wrap: wrap;
  }

  .auth-footer {
    padding-inline: 8px;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 24px 16px 20px;
  }

  .auth-brand {
    font-size: 20px;
  }

  .auth-brand svg {
    width: 24px;
    height: 24px;
  }

  .auth-title {
    font-size: 22px;
  }

  .captcha-image {
    width: 104px;
  }

  .control-captcha {
    font-size: 15px;
  }
}

/* =========================================================
   Reduced motion
   ========================================================= */

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