/* ============================================================
   PaiPai — Auth + Onboarding (standalone)
   Resend-style dark (default) / light theme via CSS variables.
   ============================================================ */

:root {
  /* palette — dark (default) */
  --page: #020304;
  --text: #ededed;
  --sec: #a3a3a3;
  --muted: #8c8c8c;
  --faint: #6b6b6b;
  --placeholder: #5c5c5c;
  --surface: rgba(255, 255, 255, 0.05);
  --hover: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.28);
  --focus-ring: rgba(255, 255, 255, 0.16);
  --danger: #f87171;
  --danger-ring: rgba(248, 113, 113, 0.14);
  --primary-bg: #f2f2f2;
  --primary-hover: #ffffff;
  --primary-border: #f2f2f2;
  --primary-text: #0a0a0a;
  --primary-disabled-bg: rgba(255, 255, 255, 0.10);
  --primary-disabled-border: rgba(255, 255, 255, 0.16);
  --primary-disabled-text: rgba(255, 255, 255, 0.50);
  --step-active-bg: #ffffff;
  --step-active-text: #000000;
  --step-done-bg: rgba(255, 255, 255, 0.1);
  --step-done-border: rgba(255, 255, 255, 0.38);
  --step-done-text: rgba(255, 255, 255, 0.82);
  --menu-bg: #161616;
  --success-fg: #6ee7b7;
  --success-border: rgba(52, 211, 153, 0.2);
  --success-bg: rgba(52, 211, 153, 0.07);

  /* silk backdrop — dark */
  --bd-base: #020304;
  --sheet0: #3a3a3a;
  --sheet1: #6e6e6e;
  --sheet2: #909090;
  --sheet3: #a4a4a4;
  --sheet4: #989898;
  --edge-a0: 0.55;
  --edge-a1: 0.18;
  --crease-dark: #000000;
  --crease-light: #ffffff;
  --facet-a0: #8f8f8f;
  --facet-a1: #3f3f3f;
  --facet-a2: #0a0a0a;
  --facet-b0: #333333;
  --facet-b1: #141414;
  --facet-b2: #000000;
  --crease: #cfcfcf;
  --vignette: #000000;
  --vignette-a0: 0.5;
  --vignette-a1: 0.22;
  --grain-o: 1;
  --halo-core: #020304;
  --halo-fade-1: rgba(2, 3, 4, 0.87);
  --halo-fade-2: rgba(2, 3, 4, 0.6);
  --halo-fade-3: rgba(2, 3, 4, 0.3);
  --halo-fade-4: rgba(2, 3, 4, 0.08);
  --halo-step-1: #0f1113;
  --halo-step-2: #2d3033;
  --halo-step-3: #74777b;
  --halo-edge: #b2b3b5;
}

[data-theme="light"] {
  --page: #f2f2f2;
  --text: #1a1a1a;
  --sec: #555555;
  --muted: #6f6f6f;
  --faint: #8a8a8a;
  --placeholder: #a0a0a0;
  --surface: rgba(0, 0, 0, 0.04);
  --hover: rgba(0, 0, 0, 0.08);
  --border: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.4);
  --focus-ring: rgba(0, 0, 0, 0.12);
  --danger: #b42318;
  --danger-ring: rgba(180, 35, 24, 0.12);
  --primary-bg: #1a1a1a;
  --primary-hover: #2d2d2d;
  --primary-border: #1a1a1a;
  --primary-text: #ffffff;
  --primary-disabled-bg: rgba(0, 0, 0, 0.08);
  --primary-disabled-border: rgba(0, 0, 0, 0.14);
  --primary-disabled-text: rgba(0, 0, 0, 0.46);
  --step-active-bg: #1a1a1a;
  --step-active-text: #ffffff;
  --step-done-bg: rgba(0, 0, 0, 0.07);
  --step-done-border: rgba(0, 0, 0, 0.28);
  --step-done-text: rgba(0, 0, 0, 0.72);
  --menu-bg: #ffffff;
  --success-fg: #047857;
  --success-border: rgba(4, 120, 87, 0.25);
  --success-bg: rgba(4, 120, 87, 0.07);

  --bd-base: #f4f4f4;
  --sheet0: #e6e6e6;
  --sheet1: #dcdcdc;
  --sheet2: #d2d2d2;
  --sheet3: #cbcbcb;
  --sheet4: #d0d0d0;
  --edge-a0: 0.1;
  --edge-a1: 0.04;
  --crease-dark: #9a9a9a;
  --crease-light: #ffffff;
  --facet-a0: #d0d0d0;
  --facet-a1: #e0e0e0;
  --facet-a2: #efefef;
  --facet-b0: #d8d8d8;
  --facet-b1: #e8e8e8;
  --facet-b2: #f4f4f4;
  --crease: #ffffff;
  --vignette: #ffffff;
  --vignette-a0: 0.45;
  --vignette-a1: 0.2;
  --grain-o: 0.7;
  --halo-core: #f2f2f2;
  --halo-fade-1: rgba(242, 242, 242, 0.87);
  --halo-fade-2: rgba(242, 242, 242, 0.6);
  --halo-fade-3: rgba(242, 242, 242, 0.3);
  --halo-fade-4: rgba(242, 242, 242, 0.08);
  --halo-step-1: #eceeef;
  --halo-step-2: #d9dde0;
  --halo-step-3: #c3c9ce;
  --halo-edge: #a9b0b6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ----------------------------- backdrop ----------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle 72vw at 50% 8%, var(--halo-core) 0%, var(--halo-core) 52%, var(--halo-fade-1) 65%, var(--halo-fade-2) 76%, var(--halo-fade-3) 88%, var(--halo-fade-4) 96%, transparent 100%),
    linear-gradient(180deg, var(--halo-core) 0%, var(--halo-core) 46%, var(--halo-step-1) 58%, var(--halo-step-2) 72%, var(--halo-step-3) 87%, var(--halo-edge) 100%);
}

.backdrop::before {
  content: "";
  position: absolute;
  left: clamp(-300px, -18vw, -180px);
  bottom: clamp(-340px, -26vh, -180px);
  width: clamp(520px, 48vw, 760px);
  height: clamp(620px, 78vh, 900px);
  background: url("assets/light-rib-pattern-v2.png") center bottom / cover no-repeat;
  filter: contrast(1.03) drop-shadow(20px 18px 38px rgba(20, 20, 18, 0.1));
  mix-blend-mode: multiply;
  opacity: 0;
  transform: rotate(9deg);
  transform-origin: 48% 60%;
  -webkit-mask-image: linear-gradient(36deg, #000 0 48%, rgba(0, 0, 0, 0.72) 62%, transparent 82%);
  mask-image: linear-gradient(36deg, #000 0 48%, rgba(0, 0, 0, 0.72) 62%, transparent 82%);
}

.backdrop::after {
  content: "";
  position: absolute;
  top: clamp(-360px, -28vh, -190px);
  right: clamp(-300px, -18vw, -170px);
  width: clamp(520px, 48vw, 760px);
  height: clamp(620px, 78vh, 900px);
  background: url("assets/light-rib-pattern-v2.png") center top / cover no-repeat;
  filter: contrast(1.04) drop-shadow(-20px 22px 40px rgba(20, 20, 18, 0.11));
  mix-blend-mode: multiply;
  opacity: 0;
  transform: rotate(-9deg);
  transform-origin: 52% 40%;
  -webkit-mask-image: linear-gradient(216deg, #000 0 48%, rgba(0, 0, 0, 0.72) 62%, transparent 82%);
  mask-image: linear-gradient(216deg, #000 0 48%, rgba(0, 0, 0, 0.72) 62%, transparent 82%);
}

.backdrop svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.backdrop .bd-base { fill: var(--bd-base); }
.backdrop .s0 { stop-color: var(--sheet0); }
.backdrop .s1 { stop-color: var(--sheet1); }
.backdrop .s2 { stop-color: var(--sheet2); }
.backdrop .s3 { stop-color: var(--sheet3); }
.backdrop .s4 { stop-color: var(--sheet4); }
.backdrop .e0 { stop-color: #000; stop-opacity: var(--edge-a0); }
.backdrop .e1 { stop-color: #000; stop-opacity: var(--edge-a1); }
.backdrop .fa0 { stop-color: var(--facet-a0); }
.backdrop .fa1 { stop-color: var(--facet-a1); }
.backdrop .fa2 { stop-color: var(--facet-a2); }
.backdrop .fb0 { stop-color: var(--facet-b0); }
.backdrop .fb1 { stop-color: var(--facet-b1); }
.backdrop .fb2 { stop-color: var(--facet-b2); }
.backdrop .v0 { stop-color: var(--vignette); stop-opacity: var(--vignette-a0); }
.backdrop .v1 { stop-color: var(--vignette); stop-opacity: var(--vignette-a1); }
.backdrop .crease-dark { fill: var(--crease-dark); }
.backdrop .crease-light { fill: var(--crease-light); }
.backdrop .crease { fill: var(--crease); }
.backdrop .grain { opacity: var(--grain-o); }

@media (max-width: 720px) {
  .backdrop {
    background:
      radial-gradient(circle 150vw at 50% 45%, var(--halo-core) 0%, var(--halo-core) 52%, var(--halo-fade-1) 70%, var(--halo-fade-2) 82%, var(--halo-fade-3) 92%, var(--halo-fade-4) 98%, transparent 100%),
      linear-gradient(180deg, var(--halo-core) 0%, var(--halo-core) 58%, var(--halo-step-1) 68%, var(--halo-step-2) 80%, var(--halo-step-3) 92%, var(--halo-edge) 100%);
  }

  .backdrop::before {
    left: -250px;
    bottom: -250px;
    width: 480px;
    height: 620px;
  }

  .backdrop::after {
    top: -250px;
    right: -250px;
    width: 480px;
    height: 620px;
  }

}

/* ------------------------------ layout ------------------------------ */

.stage {
  position: relative;
  z-index: 10;
  flex: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(32px, 6vh, 64px) 20px;
}

.card-col {
  width: min(100%, 380px);
  margin: auto;
}

/* logo tile */
.logo-tile-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 3px;
}

.logo-tile {
  width: 108px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-tile img {
  display: block;
  width: 108px;
  height: 108px;
  object-fit: contain;
}

[data-theme="light"] .logo-tile img {
  filter: invert(1);
}

/* ------------------------------- type ------------------------------- */

.title {
  text-align: center;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.subtitle {
  margin: 5px 0 24px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.subtitle strong {
  color: var(--text);
  font-weight: 600;
}

.account-route {
  font-size: 12px;
  color: var(--sec);
  font-weight: 400;
}

.account-route .link-btn {
  color: var(--text);
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  text-underline-offset: 3px;
}

.link-btn:hover,
.link-btn:focus-visible {
  text-decoration: underline;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 3px;
}

.quiet-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  padding: 0;
}

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

/* ------------------------------ forms ------------------------------ */

.field {
  position: relative;
  margin-bottom: 14px;
}

.form-row > div {
  position: relative;
}

.example-tip {
  position: absolute;
  left: clamp(8px, 18%, 72px);
  top: calc(100% + 7px);
  z-index: 40;
  max-width: calc(100% - 16px);
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  color: #252525;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: none;
}

.example-tip::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #ffffff;
  transform: rotate(45deg);
}

.example-tip span {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field:focus-within > .example-tip,
.form-row > div:focus-within > .example-tip {
  display: block;
}

.example-tip:hover {
  background: #f2f2f2;
}

.example-tip:hover::before {
  background: #f2f2f2;
}

.example-tip.is-used {
  display: none !important;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--sec);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

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

.input:hover:not(:focus):not(.is-invalid) {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.065);
}

[data-theme="light"] .input:hover:not(:focus):not(.is-invalid) {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.055);
}

.input:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--hover);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input.has-value:not(.is-invalid):not(:focus) {
  border-color: rgba(255, 255, 255, 0.17);
}

[data-theme="light"] .input.has-value:not(.is-invalid):not(:focus) {
  border-color: rgba(0, 0, 0, 0.18);
}

.input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-ring);
}

.pw-wrap {
  position: relative;
}

.pw-wrap .input {
  padding-right: 44px;
}

.pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  display: flex;
}

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

.pw-toggle[aria-pressed="true"] {
  color: var(--text);
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.hint strong {
  color: var(--text);
  font-weight: 600;
}

.field-error {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--danger);
}

.field-help {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--faint);
  text-wrap: pretty;
}

/* buttons */
.btn-primary {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--primary-border);
  background: var(--primary-bg);
  color: var(--primary-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s, box-shadow 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.995);
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: var(--primary-disabled-text);
  border-color: var(--primary-disabled-border);
  background: var(--primary-disabled-bg);
}

.btn-ghost {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--sec);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:active {
  transform: scale(0.995);
}

.social-row {
  display: flex;
  gap: 12px;
}

.btn-social {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.btn-social:hover {
  background: var(--hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-social {
  background: #ffffff;
}

[data-theme="light"] .btn-social:hover {
  background: #f8f8f8;
}

.btn-social:active {
  transform: translateY(0) scale(0.995);
}

/* divider */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  font-size: 12px;
  color: var(--faint);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* terms footer */
.terms {
  width: 100%;
  max-width: 380px;
  margin: 18px auto 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--faint);
  white-space: normal;
  overflow-wrap: break-word;
}

#view-signup .terms {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  width: max-content;
  max-width: calc(100vw - 48px);
  margin: 0;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}

.terms a {
  color: inherit;
  text-decoration: underline;
}

.terms a:hover {
  color: var(--sec);
}

.right-row {
  text-align: right;
  margin-bottom: 18px;
}

.right-row a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.right-row a:hover {
  color: var(--text);
}

/* verification code */
.code-row {
  display: flex;
  justify-content: center;
  width: 100%;
  gap: 10px;
  margin-bottom: 14px;
}

.code-digit {
  flex: 1;
  min-width: 0;
  width: 44px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.code-digit:focus {
  outline: none;
  border-color: var(--border-strong);
  background: var(--hover);
}

.resend-row {
  margin-bottom: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

.center-row {
  margin-top: 16px;
  text-align: center;
}

/* custom select */
.select {
  position: relative;
}

.select-trigger {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.select-trigger:hover {
  border-color: var(--border-strong);
  background: var(--hover);
}

.select-trigger:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.select.open .select-trigger {
  border-color: var(--border-strong);
  background: var(--hover);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.select-trigger .select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-trigger.placeholder .select-value {
  color: var(--placeholder);
}

.select-trigger svg {
  flex-shrink: 0;
  color: var(--faint);
  transition: transform 0.15s;
}

.select.open .select-trigger svg {
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  padding: 6px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--menu-bg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.select-menu button {
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--sec);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: background 0.12s;
}

.select-menu button:hover {
  background: var(--hover);
}

.select-menu button.selected {
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
}

.select-menu button.selected::after {
  content: "✓";
  color: var(--text);
}

/* upload area */
.upload-area {
  margin-bottom: 24px;
  padding: 28px 24px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--border-strong);
  background: var(--hover);
}

.upload-area svg {
  color: var(--muted);
  margin-bottom: 12px;
}

.upload-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.upload-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--faint);
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.file-preview img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  margin-top: 2px;
  font-size: 11px;
  color: var(--faint);
}

.file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  display: flex;
}

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

/* status blocks */
.status-processing {
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--sec);
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-success {
  margin-bottom: 16px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  font-size: 12px;
  color: var(--success-fg);
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  animation: spin 0.8s linear infinite;
}

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

/* two-column row */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stack {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-back {
  margin-top: 10px;
}

.secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

#reviewForm .field {
  margin-bottom: 12px !important;
}

.prefs-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

/* complete view */
.complete-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* bottom-right controls */
.corner-controls {
  position: fixed;
  right: 24px;
  top: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  color: var(--faint);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}

.ctrl-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.ctrl-btn:active {
  background: var(--hover);
  transform: scale(0.96);
}

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

@media (max-height: 900px) {
  .stage {
    padding: 24px 20px;
  }

  .logo-tile-wrap {
    margin-bottom: 0;
  }

  .logo-tile,
  .logo-tile img {
    width: 90px;
    height: 90px;
  }

  .title {
    font-size: 24px;
    line-height: 1.15;
  }

  .subtitle {
    margin-top: 4px;
    margin-bottom: 16px;
    line-height: 1.45;
  }

  .field {
    margin-bottom: 10px;
  }

  .label {
    margin-bottom: 4px;
  }

  .input,
  .select-trigger {
    height: 36px;
    border-radius: 10px;
  }

  .btn-primary,
  .btn-ghost {
    height: 38px;
    border-radius: 10px;
  }

  .btn-social {
    height: 44px;
    border-radius: 10px;
  }

  .divider {
    margin: 22px 0;
  }

  .terms {
    margin-top: 14px;
    line-height: 1.45;
  }

  .right-row {
    margin-bottom: 14px;
  }

  .code-digit {
    height: 44px;
  }

  .resend-row {
    margin-bottom: 14px;
  }

  .center-row {
    margin-top: 12px;
  }

  .upload-area {
    padding: 20px 20px;
  }

  .upload-area svg {
    margin-bottom: 8px;
  }

  .status-success {
    margin-bottom: 10px;
    padding: 7px 12px;
  }

  #reviewForm .field {
    margin-bottom: 8px !important;
  }

  .form-row {
    margin-bottom: 8px;
  }

  .stack {
    margin-top: 12px;
    gap: 6px;
  }

  .prefs-actions {
    margin-top: 14px;
  }
}

@media (max-height: 680px) {
  body {
    height: auto;
    min-height: 100vh;
  }

  .stage {
    align-items: flex-start;
    padding-top: 48px;
    padding-bottom: 20px;
  }
}

@media (max-width: 600px) {
  #view-signup .terms {
    bottom: 14px;
    width: calc(100vw - 32px);
    max-width: none;
    white-space: normal;
  }

  .terms {
    width: auto;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    white-space: normal;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
  .social-row {
    flex-direction: column;
  }
}

#view-signup .btn-social,
#view-signup .input,
#view-signup .btn-primary {
  height: 44px;
  min-height: 44px;
}

/* Auth heading rhythm */
.logo-tile-wrap {
  margin-bottom: 14px;
}

#view-signup .account-route,
#view-login .account-route {
  margin-top: 10px;
  margin-bottom: 30px;
}

/* Shared vertical rhythm for form-oriented views. */
:root {
  --form-logo-title-gap: 14px;
  --form-title-subtitle-gap: 5px;
  --form-subtitle-content-gap: 24px;
}

.logo-tile-wrap {
  margin-bottom: var(--form-logo-title-gap);
}

:is(#view-signup, #view-verify, #view-login, #view-identity, #view-prefs).form-view > .title {
  margin: 0;
}

:is(#view-signup, #view-verify, #view-login, #view-identity, #view-prefs).form-view > .title + :is(.subtitle, .compact-tagline) {
  margin: var(--form-title-subtitle-gap) 0 var(--form-subtitle-content-gap);
}

/* ======================== split illustration layout ======================== */

.layout-split {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 32px;
  overflow: hidden;
}

.layout-split .backdrop {
  display: none;
}

.split-shell {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(1440px, calc(100vw - 64px));
  height: min(900px, calc(100dvh - 64px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--page);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}

.split-form-panel {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  background: var(--page);
  scrollbar-gutter: stable;
}

.layout-split .stage {
  min-height: 100%;
  padding: 48px 32px;
}

.layout-split #view-signup .terms {
  position: static;
  left: auto;
  bottom: auto;
  width: 100%;
  max-width: 380px;
  margin: 18px auto 0;
  transform: none;
  line-height: 1.5;
  white-space: normal;
}

.layout-split .corner-controls {
  position: absolute;
  top: 20px;
  right: 20px;
}

.split-art-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: #020305;
}

.split-art-panel img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 54% 50%;
}

.split-art-image {
  transform: scale(1.035);
  transform-origin: 54% 50%;
  animation: split-art-drift 18s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
  will-change: transform;
}

.split-particle-canvas,
.split-art-glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.split-particle-canvas {
  z-index: 1;
  opacity: 0.78;
  mix-blend-mode: screen;
}

.split-art-glow {
  z-index: 2;
  background: radial-gradient(circle at 46% 43%, rgba(207, 227, 255, 0.19), transparent 9%);
  animation: split-art-glow 6.5s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
  will-change: opacity, transform;
}

.split-art-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.24), transparent 18%),
    radial-gradient(circle at 50% 48%, transparent 42%, rgba(0, 0, 0, 0.24) 100%);
}

.split-art-panel.is-motion-paused .split-art-image,
.split-art-panel.is-motion-paused .split-art-glow {
  animation-play-state: paused;
}

@keyframes split-art-drift {
  from {
    transform: scale(1.035) translate3d(-0.5%, 0.2%, 0);
  }

  to {
    transform: scale(1.075) translate3d(0.8%, -0.65%, 0);
  }
}

@keyframes split-art-glow {
  from {
    opacity: 0.32;
    transform: scale(0.94);
  }

  to {
    opacity: 0.78;
    transform: scale(1.08);
  }
}

@media (max-width: 959px) {
  .layout-split {
    display: block;
    min-height: 100dvh;
    padding: 0;
    overflow: auto;
  }

  .split-shell {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .split-form-panel {
    min-height: 100dvh;
    overflow: visible;
  }

  .split-art-panel {
    display: none;
  }

  .layout-split .stage {
    min-height: 100dvh;
    padding: 40px 20px;
  }

  .layout-split .corner-controls {
    position: fixed;
    top: 20px;
    right: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .split-art-image,
  .split-art-glow {
    animation: none;
  }

  .split-art-image {
    transform: none;
  }

  .split-particle-canvas {
    display: none;
  }
}
