:root {
  --google-blue: #1a73e8;
  --google-blue-pressed: #185abc;
  --google-blue-container: #e8f0fe;
  --google-green: #188038;
  --google-red: #d93025;
  --google-red-container: #fce8e6;
  --login-bg: #14162e;
  --login-bg-soft: #191b38;
  --login-field: #eaf1ff;
  --surface: #ffffff;
  --surface-subtle: #f8fafd;
  --surface-container: #f1f3f4;
  --outline: #dadce0;
  --outline-variant: #e8eaed;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --shadow: 0 2px 6px rgba(60, 64, 67, 0.16), 0 1px 2px rgba(60, 64, 67, 0.12);
  --focus-ring: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--login-bg);
  color: #ffffff;
  font-family:
    "Google Sans",
    Roboto,
    Arial,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 0;
  box-shadow: var(--focus-ring);
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 16% 40%, rgba(205, 151, 82, 0.24), transparent 18%),
    radial-gradient(ellipse at 55% 58%, rgba(66, 133, 244, 0.16), transparent 30%),
    var(--login-bg);
}

.login-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  flex-direction: column;
  padding: 28px clamp(20px, 4vw, 64px) 40px;
}

.login-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
}

.kanyun-logo-link {
  display: inline-flex;
  align-items: center;
  transform: translateY(30px);
}

.kanyun-logo {
  display: block;
  width: clamp(180px, 16.8vw, 238px);
  height: auto;
  filter: none;
}

.login-grid {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 430px);
  grid-template-areas:
    "copy form"
    "art form";
  flex: 1;
  align-items: center;
  gap: 28px clamp(28px, 5vw, 72px);
  padding: clamp(36px, 6vh, 72px) 0 24px;
}

.background-mark {
  position: absolute;
  left: 46%;
  top: 50%;
  z-index: 0;
  width: min(48vw, 560px);
  max-height: 72vh;
  opacity: 0.08;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.login-copy,
.character-wrap,
.form-column {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.login-copy {
  grid-area: copy;
  max-width: 640px;
}

.brand-kicker {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.login-copy h1 {
  margin: 22px 0 0;
  color: #ffffff;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 600;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.title-line {
  display: block;
  white-space: nowrap;
}

.title-line + .title-line {
  margin-top: 20px;
}

.login-copy p {
  max-width: 560px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.character-wrap {
  grid-area: art;
  justify-self: center;
  width: min(150%, 720px);
  margin: 0;
}

.character-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 46px rgba(4, 7, 24, 0.28));
}

.form-column {
  grid-area: form;
  width: 100%;
}

.login-form {
  display: grid;
  min-width: 0;
  gap: 18px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

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

.error-box {
  border: 1px solid #f4c7c3;
  border-radius: 12px;
  background: var(--google-red-container);
  padding: 12px 14px;
  color: var(--google-red);
  font-size: 14px;
  line-height: 1.45;
}

.error-box.success {
  border-color: #b7dfc4;
  background: #e6f4ea;
  color: var(--google-green);
}

.field {
  position: relative;
}

.field input,
.code-input {
  width: 100%;
  min-width: 0;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  outline: 0;
  background: var(--login-field);
  color: #10131f;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.field input {
  padding: 0 48px 0 16px;
  font-size: 16px;
  ime-mode: inactive;
}

.field input::placeholder,
.code-input::placeholder {
  color: #a6b0bf;
  opacity: 1;
}

.field input:hover,
.code-input:hover {
  border-color: rgba(255, 255, 255, 0.36);
}

.field input:focus,
.code-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.32);
}

.clear-mark {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 50%;
  display: grid;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  place-items: center;
  color: #4A67F6;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.clear-mark:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.clear-mark:focus-visible {
  outline: 3px solid rgba(74, 103, 246, 0.24);
  outline-offset: 4px;
}

.clear-mark::before {
  content: "→";
}

.clear-mark::after {
  content: none;
}

.code-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.code-fields {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(4, minmax(42px, 1fr));
  gap: 10px;
}

.code-input {
  padding: 0;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.code-button,
.submit-button {
  display: inline-flex;
  height: 56px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #4a67f5;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
}

.code-button {
  min-width: 118px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
}

.submit-button {
  width: 100%;
  gap: 8px;
  font-size: 16px;
}

.code-button:hover,
.submit-button:hover {
  background: #5a75ff;
  box-shadow: 0 14px 28px rgba(31, 73, 233, 0.28);
}

.code-button:disabled,
.submit-button:disabled {
  cursor: not-allowed;
  background: #bdc1c6;
  box-shadow: none;
  color: #ffffff;
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.is-submitting .spinner {
  display: inline-block;
}

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

@media (min-width: 1180px) {
  .login-grid {
    grid-template-columns: minmax(360px, 0.82fr) minmax(420px, 1fr) minmax(340px, 0.78fr);
    grid-template-areas: "copy art form";
  }
}

@media (max-width: 860px) {
  .login-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "form"
      "art";
    align-items: start;
  }

  .character-wrap {
    width: min(100%, 420px);
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .login-shell {
    padding: 22px 18px 30px;
  }

  .login-grid {
    gap: 24px;
    padding-top: 34px;
  }

  .kanyun-logo {
    width: min(52.8vw, 187px);
  }

  .login-form {
    border-radius: 18px;
    padding: 18px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .login-copy p {
    font-size: 16px;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .code-button {
    width: 100%;
  }
}
