@font-face {
  font-family: "Geist";
  src: url("assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: #fafafc;
  color: #191c23;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input {
  font: inherit;
}

.page {
  /* Viewport-adaptive unit: ~1px at 1280w, ~1.36px at 1920w, capped at 1.5px above 2560w */
  --u: clamp(1px, 0.056vw + 0.28px, 1.5px);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: #191c23;
  background: #fafafc;
  min-height: 100svh;
  display: grid;
  grid-template-columns: 57% 43%;
}

.art {
  position: relative;
  overflow: hidden;
  min-height: 100svh;
  background: radial-gradient(circle at 55% 52%, #3a2315 0%, #171311 45%, #11100f 100%);
}

.art-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
  display: block;
}

.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #080a0c10 65%, #06080945 100%);
  pointer-events: none;
}

.panel {
  position: relative;
  min-height: 100svh;
  padding: calc(124 * var(--u)) calc(56 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
}

.wordmark {
  position: absolute;
  top: calc(42 * var(--u));
  left: calc(48 * var(--u));
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  text-decoration: none;
  color: #191c23;
}

.wordmark img {
  width: calc(32 * var(--u));
  height: calc(32 * var(--u));
  object-fit: contain;
  display: block;
}

/* 中文时先隐藏表单区，app.js 换好文案后移除 data-i18n-pending */
html[data-i18n-pending] .panel,
html[data-i18n-pending] .modal-backdrop {
  visibility: hidden;
}

.lang-toggle {
  position: absolute;
  top: calc(44 * var(--u));
  right: calc(48 * var(--u));
  height: calc(28 * var(--u));
  min-width: calc(48 * var(--u));
  padding: 0 calc(12 * var(--u));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e1e4ea;
  border-radius: 999px;
  background: transparent;
  color: #4c5361;
  font-size: calc(12 * var(--u));
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lang-toggle:hover {
  background: #f0f1f5;
  border-color: #d5d9e0;
  color: #191c23;
}

.lang-toggle:focus-visible {
  outline: 2px solid #0073df;
  outline-offset: 2px;
}

.form {
  width: calc(344 * var(--u));
  max-width: 100%;
  margin-top: calc(-8 * var(--u));
}

.form h1 {
  font-weight: 640;
  font-size: calc(28 * var(--u));
  letter-spacing: -0.02em;
  margin: 0 0 calc(12 * var(--u));
  line-height: 1.4;
}

.intro {
  font-size: calc(13 * var(--u));
  line-height: 1.8;
  color: #5f6673;
  margin: 0 0 calc(40 * var(--u));
}

.field {
  margin-bottom: calc(21 * var(--u));
}

.field label {
  display: block;
  font-size: calc(12 * var(--u));
  font-weight: 500;
  color: #3c4250;
  margin-bottom: calc(10 * var(--u));
}

.field input {
  display: block;
  width: 100%;
  height: calc(46 * var(--u));
  padding: 0 calc(14 * var(--u));
  border: 1px solid #d0d5dd;
  border-radius: calc(8 * var(--u));
  background: #ffffff;
  color: #191c23;
  font-size: calc(13 * var(--u));
  outline: none;
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: #0073df;
  box-shadow: 0 0 0 3px rgb(0 115 223 / 12%);
}

.field input::placeholder {
  color: #858c98;
}

.agreement {
  margin: calc(25 * var(--u)) 0 calc(24 * var(--u));
  color: #5f6673;
  font-size: calc(12 * var(--u));
  line-height: 1.9;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: calc(8 * var(--u));
}

.consent-checkbox {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  margin: calc(4 * var(--u)) 0 0;
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
  border: 1px solid #c9ccd5;
  border-radius: calc(4 * var(--u));
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.consent-checkbox:focus-visible {
  outline: 2px solid #0073df;
  outline-offset: 2px;
}

.consent-checkbox:checked {
  border-color: #0073df;
  background: #0073df;
}

.consent-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: calc(4 * var(--u));
  height: calc(7.5 * var(--u));
  border: solid #ffffff;
  border-width: 0 calc(1.7 * var(--u)) calc(1.7 * var(--u)) 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.consent-text {
  min-width: 0;
  font-size: calc(12 * var(--u));
  line-height: 1.8;
  white-space: normal;
}

.consent-label {
  display: inline;
  cursor: pointer;
}

.agreement-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0073df;
  font-size: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-underline-offset: 4px;
}

.agreement-link:hover {
  text-decoration: underline;
}

.agreement-link:focus-visible {
  outline: 2px solid #0073df;
  outline-offset: 2px;
  border-radius: 3px;
}

.error {
  color: #b3261e;
  font-size: calc(12 * var(--u));
  line-height: 1.7;
  margin: 0 0 calc(16 * var(--u));
}

.submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--u));
  height: calc(45 * var(--u));
  width: 100%;
  border: 1px solid #0073df;
  border-radius: calc(8 * var(--u));
  background: #0073df;
  color: #ffffff;
  font-size: calc(13 * var(--u));
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.submit:hover:not(:disabled) {
  background: #0062bf;
  border-color: #0062bf;
}

.submit:focus-visible {
  outline: 2px solid #0073df;
  outline-offset: 2px;
}

.submit:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.spinner {
  width: calc(14 * var(--u));
  height: calc(14 * var(--u));
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #ffffff;
  border-radius: 9999px;
  animation: spin 0.7s linear infinite;
}

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

.bottom {
  position: absolute;
  left: calc(48 * var(--u));
  right: calc(48 * var(--u));
  bottom: calc(34 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4 * var(--u));
  justify-content: center;
  text-align: center;
  font-size: calc(11 * var(--u));
  color: #858c98;
  letter-spacing: 0.035em;
  line-height: 1.5;
}

.bottom-link {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
}

.bottom-link:hover {
  color: #5b6170;
  text-decoration: underline;
}

.bottom-link:focus-visible {
  outline: 2px solid #0073df;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Agreements modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(15 23 42 / 48%);
  backdrop-filter: blur(2px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 720px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #191c23;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgb(15 23 42 / 22%);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  overflow: hidden;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: #191c23;
}

.modal-version {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6b7280;
}

.modal-close-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.modal-close-icon:hover {
  background: #f3f4f6;
  color: #191c23;
}

.modal-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 0 24px;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
}

.modal-tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.modal-tab:hover {
  color: #191c23;
}

.modal-tab[aria-selected="true"] {
  border-bottom-color: #0073df;
  color: #191c23;
  font-weight: 500;
}

.modal-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.75;
  color: #374151;
}

.modal-body h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #191c23;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body p {
  margin: 0 0 12px;
}

.modal-status {
  color: #858c98;
}

.modal-retry {
  padding: 0;
  border: 0;
  background: transparent;
  color: #b3261e;
  font-size: inherit;
  cursor: pointer;
}

.modal-body ul {
  margin: 0 0 12px;
  padding-left: 20px;
}

.modal-body li {
  margin-bottom: 6px;
}

.modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fafafc;
}

.modal-btn-ghost,
.modal-btn-primary {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.modal-btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: #374151;
}

.modal-btn-ghost:hover {
  background: #eef0f4;
}

.modal-btn-primary {
  border: 1px solid #0073df;
  background: #0073df;
  color: #ffffff;
}

.modal-btn-primary:hover {
  background: #0062bf;
  border-color: #0062bf;
}

@media (max-width: 1050px) {
  .page {
    grid-template-columns: 50% 50%;
  }

  .panel {
    padding: calc(110 * var(--u)) calc(36 * var(--u));
  }

  .wordmark {
    left: calc(34 * var(--u));
  }

  .lang-toggle {
    right: calc(34 * var(--u));
  }

  .bottom {
    left: calc(34 * var(--u));
    right: calc(34 * var(--u));
  }
}

@media (max-width: 650px) {
  .page {
    display: flex;
    flex-direction: column;
  }

  .art {
    min-height: 24svh;
    height: 24svh;
  }

  .art-image {
    object-position: 50% 67%;
  }

  .panel {
    min-height: 0;
    flex: 1;
    align-items: flex-start;
    padding: calc(92 * var(--u)) calc(28 * var(--u)) calc(84 * var(--u) + env(safe-area-inset-bottom));
  }

  .wordmark {
    top: calc(33 * var(--u));
    left: calc(31 * var(--u));
  }

  .lang-toggle {
    top: calc(35 * var(--u));
    right: calc(31 * var(--u));
  }

  .form {
    width: 100%;
    max-width: calc(420 * var(--u));
    margin: 0;
  }

  .bottom {
    left: calc(32 * var(--u));
    right: calc(32 * var(--u));
    bottom: calc(28 * var(--u));
    font-size: calc(9 * var(--u));
  }
}
