:root {
  color-scheme: light;
  --brand: #ef1b13;
  --brand-deep: #d9140d;
  --brand-soft: rgba(239, 27, 19, 0.08);
  --text-primary: #111827;
  --text-secondary: #667085;
  --text-tertiary: #98a2b3;
  --border: #d0d5dd;
  --border-subtle: #eaecf0;
  --surface: rgba(255, 255, 255, 0.94);
  --shadow: 0 24px 70px rgba(17, 24, 39, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text-primary);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

body,
main,
section,
form,
label,
div {
  min-width: 0;
}

img,
input,
button {
  max-width: 100%;
}

.home-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #fff;
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0;
}

.home-page[hidden] {
  display: none;
}

.login-page {
  display: grid;
  width: 100%;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(239, 27, 19, 0.06) 0%, transparent 28%),
    radial-gradient(circle at 50% 0%, rgba(17, 24, 39, 0.05), transparent 36%),
    #f7f8fb;
}

.login-page[hidden] {
  display: none;
}

.login-card {
  width: min(430px, 100%);
  max-height: calc(100vh - 64px);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--surface);
  padding: 42px 40px 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.logo {
  display: block;
  width: 132px;
  height: auto;
  margin: 0 auto 28px;
  object-fit: contain;
}

h1 {
  margin: 0;
  text-align: center;
  font-size: 26px;
  line-height: 34px;
  font-weight: 750;
  letter-spacing: 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 34px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

input {
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 0 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

input::placeholder {
  color: var(--text-tertiary);
}

input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.code-field {
  display: flex;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.code-field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.code-field input {
  min-width: 0;
  flex: 1;
  height: 44px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.code-field input:focus {
  box-shadow: none;
}

.code-button {
  width: 104px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.code-button:hover {
  background: var(--brand-soft);
}

.code-button:disabled {
  background: #f9fafb;
  color: var(--text-tertiary);
}

.captcha-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  overflow: hidden;
}

.captcha-panel[hidden] {
  display: none;
}

#captcha-element {
  min-height: 40px;
}

.captcha-status {
  min-height: 18px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
}

.captcha-status.is-error {
  color: var(--brand-deep);
  font-weight: 700;
}

.captcha-status.is-success {
  color: #12805c;
  font-weight: 700;
}

a {
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

button {
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 12px 24px rgba(239, 27, 19, 0.22);
}

button:hover {
  background: var(--brand-deep);
}

button:disabled {
  cursor: default;
  opacity: 0.58;
}

.login-record {
  margin: 24px 0 0;
  color: var(--text-tertiary);
  text-align: center;
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
}

.login-record p {
  margin: 0;
}

.login-record a,
.login-record a:visited,
.login-record a:hover,
.login-record a:active {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: none;
}

@media (max-width: 480px) {
  html,
  body {
    width: 100%;
    height: 100svh;
    min-height: 100svh;
    height: 100dvh;
    min-height: 100dvh;
    max-width: 100vw;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    position: static;
    touch-action: manipulation;
  }

  .home-page,
  .login-page {
    min-width: 0;
    height: 100svh;
    min-height: 100svh;
    height: 100dvh;
    min-height: 100dvh;
  }

  .login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 0;
    overflow: hidden;
    padding:
      max(10px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .login-card {
    width: calc(100vw - 24px);
    max-width: 430px;
    max-height: calc(100svh - 20px);
    max-height: calc(100dvh - 20px);
    overflow-x: hidden;
    overflow-x: clip;
    overflow-y: auto;
    border-radius: 16px;
    padding: 20px 16px 18px;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .logo {
    width: 96px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 20px;
    line-height: 26px;
  }

  .form {
    gap: 12px;
    margin-top: 20px;
  }

  input,
  button,
  .code-field {
    height: 42px;
    font-size: 16px;
  }

  .code-field input,
  .code-button {
    height: 40px;
  }

  .code-button {
    width: 88px;
    padding: 0 6px;
    font-size: 13px;
    white-space: nowrap;
  }

  .captcha-panel,
  #captcha-element,
  #captcha-element iframe {
    max-width: 100%;
  }

  .captcha-status {
    min-height: 16px;
    font-size: 12px;
    line-height: 16px;
  }
}

@media (max-width: 360px) {
  .login-page {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  .login-card {
    width: calc(100vw - 16px);
    max-height: calc(100svh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 18px 12px 16px;
  }

  .code-button {
    width: 82px;
    font-size: 12px;
  }
}
