:root {
  --primary: #1677ff;
  --primary-hover: #0f62fe;
  --error: #f53f3f;
  --text: #1d2129;
  --muted: #86909c;
  --line: #e5e6eb;
  --bg: #f5f7fa;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  background: linear-gradient(145deg, #f5f7fa 0%, #eef2f7 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.login-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 18px;
  min-height: 100vh;
  padding: 100px 20px 24px;
}

.login-card {
  position: relative;
  width: 400px;
  height: fit-content;
  padding: 44px 40px 36px;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 44px rgba(29, 33, 41, 0.1);
}

.login-header {
  text-align: center;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 80px;
  margin-bottom: 14px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: #11110e;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-name {
  color: #11110e;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

.login-header p {
  margin: 12px 0 32px;
  color: var(--muted);
  font-size: 16px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

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

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

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

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.08);
}

.field.invalid input,
.field.invalid .password-wrap input {
  border-color: var(--error);
  box-shadow: none;
}

.field.invalid .password-toggle {
  color: var(--error);
}

.field-error {
  min-height: 16px;
  margin: 0;
  color: var(--error);
  font-size: 12px;
  line-height: 16px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .icon-eye-off,
.password-toggle.showing .icon-eye {
  display: none;
}

.password-toggle.showing .icon-eye-off {
  display: block;
}

.remember-line,
.assist-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 18px;
}

.remember-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.remember-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.assist-line a {
  font-size: 12px;
}

.captcha-area {
  display: grid;
  grid-template-columns: 60% 35%;
  gap: 5%;
  align-items: start;
}

.captcha-image {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #11110e;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  user-select: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.captcha-image.refreshing {
  opacity: 0.45;
  transform: scale(0.98);
}

.captcha-area.disabled {
  display: none;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--error);
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

.form-error.success-text {
  color: #00a870;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
  font-size: 16px;
  transition: background 0.16s ease, transform 0.08s ease;
}

.login-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.login-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.login-btn:disabled {
  color: rgba(255, 255, 255, 0.5);
  background: #c9d8f0;
  cursor: not-allowed;
}

.loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.login-btn.loading .loader {
  display: inline-block;
}

.register-tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.auth-icp-footer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.auth-icp-footer a {
  color: inherit;
  text-decoration: none;
}

.auth-icp-footer a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.auth-card .login-header p {
  margin-bottom: 28px;
}

.logged-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

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

.logged-box {
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(29, 33, 41, 0.12);
  text-align: center;
}

.logged-box p {
  margin: 0 0 18px;
  color: var(--text);
  font-size: 15px;
}

.logged-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-btn,
.secondary-btn {
  height: 38px;
  border-radius: 4px;
}

.primary-btn {
  color: #fff;
  background: var(--primary);
}

.secondary-btn {
  color: var(--text);
  background: #f2f3f5;
}

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

@media (max-width: 600px) {
  body {
    background: var(--bg);
  }

  .login-page {
    justify-items: stretch;
    padding: 20px 20px 14px;
  }

  .login-card {
    width: 100%;
    min-height: auto;
    padding: 36px 20px 28px;
    box-shadow: none;
  }

  .auth-icp-footer {
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 11px;
  }

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