@font-face {
  font-family: "Lexend";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/lexend-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans SC UI Subset";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/noto-sans-sc-ui-8e4f6eaa.woff2") format("woff2");
}

:root {
  --font-ui-cjk: "Noto Sans SC UI Subset";
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --ring: 221.2 83.2% 53.3%;
}

.dark {
  --background: 223 33% 7%;
  --foreground: 210 33% 98%;
  --card: 222 28% 10.5%;
  --card-foreground: 210 33% 98%;
  --primary: 199 96% 68%;
  --primary-foreground: 222 46% 11%;
  --muted: 222 21% 14%;
  --muted-foreground: 214 19% 70%;
  --border: 217 23% 20%;
  --accent: 220 22% 16%;
  --accent-foreground: 210 33% 98%;
  --ring: 199 96% 68%;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family:
    "Lexend", var(--font-ui-cjk), "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "Segoe UI",
    system-ui, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

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

.auth-bg {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 4rem 1.25rem;
  background: linear-gradient(
    135deg,
    hsl(var(--background)) 0%,
    hsl(221 83% 96%) 24%,
    hsl(210 80% 93%) 48%,
    hsl(250 70% 96%) 72%,
    hsl(var(--background)) 100%
  );
  background-size: 400% 400%;
  animation: gradient-shift 15s ease infinite;
}

.auth-bg::before {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 80% at 20% 20%, hsl(221 83% 53% / 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 60% at 80% 80%, hsl(250 70% 60% / 0.06) 0%, transparent 50%);
  content: "";
  pointer-events: none;
}

.dark .auth-bg {
  background: linear-gradient(
    135deg,
    hsl(223 33% 8%) 0%,
    hsl(222 32% 9.5%) 22%,
    hsl(219 31% 11%) 52%,
    hsl(228 30% 9%) 78%,
    hsl(223 34% 6.5%) 100%
  );
}

.dark .auth-bg::before {
  background:
    radial-gradient(ellipse 80% 80% at 18% 18%, hsl(199 96% 68% / 0.14) 0%, transparent 52%),
    radial-gradient(ellipse 64% 64% at 84% 84%, hsl(169 76% 56% / 0.12) 0%, transparent 55%),
    linear-gradient(120deg, transparent 0%, hsl(199 96% 68% / 0.03) 48%, transparent 100%);
}

.glass-card {
  border: 1px solid hsl(var(--border) / 0.58);
  background: hsl(var(--card) / 0.72);
  box-shadow:
    0 8px 32px hsl(221 83% 53% / 0.08),
    0 2px 8px hsl(0 0% 0% / 0.04);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.dark .glass-card {
  border-color: hsl(210 40% 98% / 0.1);
  background: linear-gradient(
    180deg,
    hsl(var(--card) / 0.9) 0%,
    hsl(var(--card) / 0.78) 100%
  );
  box-shadow:
    0 24px 56px hsl(0 0% 0% / 0.45),
    0 0 0 1px hsl(199 96% 68% / 0.08),
    inset 0 1px 0 hsl(210 40% 98% / 0.05);
}

.migration-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 34rem;
  min-width: 0;
  justify-self: center;
  padding: 2rem;
  border-radius: 1.25rem;
  animation: card-enter 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.8rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 12px 24px -16px hsl(var(--primary) / 0.8);
}

.brand-mark svg {
  width: 1.4rem;
  height: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-name,
.lead,
h1 {
  margin: 0;
}

.brand-name {
  color: hsl(var(--card-foreground));
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.content {
  margin-top: 2.5rem;
}

h1 {
  color: hsl(var(--card-foreground));
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.lead {
  margin-top: 1rem;
  color: hsl(var(--card-foreground));
  font-size: 1.05rem;
  line-height: 1.7;
}

.lead a {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: none;
}

.lead a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.endpoint-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding: 0.9rem;
  border: 1px solid hsl(var(--border) / 0.8);
  border-radius: 0.85rem;
  background: hsl(var(--background) / 0.58);
}

.endpoint {
  min-width: 0;
}

.endpoint span {
  display: block;
  margin-bottom: 0.3rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.7rem;
}

.endpoint code {
  display: block;
  overflow: hidden;
  color: hsl(var(--card-foreground));
  font-family: "Lexend", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  font-size: 0.77rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-old code {
  color: hsl(var(--muted-foreground));
  text-decoration: line-through;
}

.endpoint-new code {
  color: hsl(var(--primary));
}

.arrow {
  width: 1rem;
  color: hsl(var(--muted-foreground));
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.25rem;
  border-radius: 0.65rem;
  background: hsl(var(--primary));
  box-shadow: 0 12px 26px -16px hsl(var(--primary) / 0.95);
  color: hsl(var(--primary-foreground));
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.primary-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px -16px hsl(var(--primary) / 1);
}

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

.primary-button:focus-visible,
.theme-toggle:focus-visible,
.lead a:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 3px;
}

.primary-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-toggle {
  position: fixed;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid hsl(var(--border) / 0.75);
  border-radius: 0.65rem;
  background: hsl(var(--background) / 0.7);
  color: hsl(var(--foreground));
  cursor: pointer;
  box-shadow: 0 8px 24px hsl(0 0% 0% / 0.05);
  backdrop-filter: blur(16px);
  transition: background-color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover {
  background: hsl(var(--accent));
  transform: translateY(-1px);
}

.theme-icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-icon-sun,
.dark .theme-icon-moon {
  display: none;
}

.dark .theme-icon-sun {
  display: block;
}

html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 100% 0%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 0% 100%; }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 540px) {
  .auth-bg {
    align-items: center;
    padding: 4.5rem 0.9rem 2rem;
  }

  .migration-card {
    padding: 1.4rem;
    border-radius: 1rem;
  }

  .endpoint-change {
    grid-template-columns: 1fr;
  }

  .arrow {
    margin: -0.2rem 0;
    transform: rotate(90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg,
  .migration-card {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
