@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/AlibabaPuHuiTi-Regular.subset.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Alibaba PuHuiTi";
  src: url("../fonts/AlibabaPuHuiTi-Bold.subset.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #080808;
  --muted: #737373;
  --placeholder: #aeb6c2;
  --line: #dbe2eb;
  --field: #f8fafc;
  --blue: #1683ff;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f8fafc;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Alibaba PuHuiTi", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background-color: #f8fafc;
  background-image: radial-gradient(circle, #dbe1e8 1px, transparent 1.15px);
  background-size: 20px 20px;
}

button,
input {
  font: inherit;
}

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

.language-switch {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 2;
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
  color: #a4aab2;
}

.language-switch a {
  color: #8a919b;
  text-decoration: none;
}

.language-switch a.active {
  color: #111;
  font-weight: 700;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(432px, 100%);
  padding: 25px 31px 29px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #e6e9ee;
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(30, 55, 80, 0.08);
}

.brand {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.brand-badge {
  padding: 4px 10px 5px;
  border-radius: 7px;
  color: #fff;
  background: #0b6df4;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.brand-name {
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

.brand-name span {
  color: #086df3;
}

.auth-panel {
  animation: panel-in 180ms ease-out;
}

.auth-panel h1 {
  margin: 0 0 7px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.4px;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.login-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 18px;
}

.login-tab {
  position: relative;
  padding: 0 0 9px;
  border: 0;
  color: #768092;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
}

.login-tab.active {
  color: #111;
  font-weight: 700;
}

.login-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: #111;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.register-form {
  gap: 14px;
}

.field {
  position: relative;
  display: block;
  height: 45px;
}

.field svg {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #aab3bf;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(-50%);
  pointer-events: none;
}

.field input {
  width: 100%;
  height: 100%;
  padding: 0 13px 0 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: #20242a;
  background: var(--field);
  font-size: 14px;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}

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

.field input:focus {
  border-color: #86b9f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 131, 255, 0.1);
}

.field input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.08);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 99px;
  gap: 8px;
}

.code-button {
  height: 45px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #9098a5;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: color 150ms, border-color 150ms, background 150ms;
}

.code-button:hover:not(:disabled) {
  color: var(--blue);
  border-color: #8fc1fa;
  background: #f7fbff;
}

.code-button:disabled {
  cursor: not-allowed;
  background: #f6f7f9;
}

.agreement-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #666d78;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.agreement-check input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: #111;
}

.agreement-check a,
.auth-footer a,
.auth-footer button {
  color: var(--blue);
  text-decoration: none;
}

.agreement-check a:hover,
.auth-footer a:hover,
.auth-footer button:hover {
  text-decoration: underline;
}

.form-message {
  min-height: 0;
  margin: -8px 0 -8px;
  color: var(--danger);
  font-size: 12px;
  line-height: 18px;
}

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

.primary-button {
  width: 100%;
  height: 55px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #050505;
  cursor: pointer;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: transform 150ms, box-shadow 150ms, background 150ms;
}

.primary-button:hover {
  background: #202020;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
}

.primary-button:active {
  box-shadow: none;
  transform: translateY(0);
}

.primary-button:disabled {
  opacity: 0.72;
  cursor: wait;
  box-shadow: none;
  transform: none;
}

.auth-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  color: #737373;
  font-size: 14px;
}

.auth-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.register-footer {
  justify-content: center;
}

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

[hidden] {
  display: none !important;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 520px) {
  .language-switch {
    top: 10px;
    right: 14px;
  }

  .auth-page {
    align-items: start;
    padding: 38px 8px 8px;
  }

  .auth-card {
    padding: 24px 24px 27px;
    border-radius: 18px;
  }

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

  .brand-name {
    font-size: 23px;
  }
}

@media (max-width: 370px) {
  .auth-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .auth-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .register-footer {
    align-items: center;
  }
}

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

/* Embedded variant used by the homepage modal. */
.embed,
.embed body {
  min-height: 0;
  background: transparent;
}

.embed body {
  overflow: hidden;
}

.embed .language-switch {
  display: none;
}

.embed .auth-page {
  min-height: 0;
  padding: 0;
}

.embed .auth-card {
  width: 100%;
  box-shadow: none;
}

@media (max-width: 520px) {
  .embed .auth-page {
    padding: 0;
  }
}
