:root {
  color-scheme: light;
  --canvas: #edf3f1;
  --surface: #ffffff;
  --surface-soft: #e7f0ed;
  --ink: #17262b;
  --muted: #617078;
  --line: #cfdbd7;
  --teal: #176f68;
  --teal-dark: #105650;
  --deep: #15343a;
  --coral: #cf5b46;
  --gold: #e1ad38;
  --blue: #3977a8;
  --red: #b9423c;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
}

.login-intro {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  background: var(--deep);
  color: #f5fbf9;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #20343a;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  font-size: 18px;
  font-weight: 500;
}

.login-brand div > span {
  margin-top: 3px;
  color: #bcd0cd;
  font-size: 13px;
}

.math-preview {
  width: min(100%, 430px);
  margin: 48px auto;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(4, 24, 28, 0.24);
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.preview-meta strong {
  color: #a63d2f;
  font-weight: 500;
}

.preview-equation {
  margin: 28px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
}

.quarter-strip {
  display: grid;
  height: 34px;
  overflow: hidden;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 2px solid var(--ink);
  border-radius: 6px;
}

.quarter-strip span + span {
  border-left: 2px solid var(--ink);
}

.quarter-strip span:nth-child(1) {
  background: #80b6ac;
}

.quarter-strip span:nth-child(2) {
  background: #e58a76;
}

.quarter-strip span:nth-child(3) {
  background: #efc966;
}

.quarter-strip span:nth-child(4) {
  background: #80a8c6;
}

.preview-insight {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--teal-dark);
  font-size: 14px;
}

.preview-insight svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--gold);
}

.intro-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #bcd0cd;
  font-size: 12px;
}

.intro-footer svg {
  width: 15px;
  height: 15px;
}

.login-panel {
  display: grid;
  min-width: 0;
  place-items: center;
  padding: 40px;
}

.login-card {
  width: min(100%, 410px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(31, 58, 61, 0.12);
}

.form-heading {
  margin-bottom: 28px;
}

.form-heading h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 500;
  line-height: 1.3;
}

.form-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 20px;
  padding: 11px 12px;
  border: 1px solid #e6b3ad;
  border-radius: 6px;
  background: #fff1ef;
  color: #8f302b;
  font-size: 14px;
  line-height: 1.55;
}

.login-alert svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 2px;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: #33484d;
  font-size: 14px;
  font-weight: 500;
}

.input-wrap {
  position: relative;
  display: block;
}

.input-wrap > svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #7a898e;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  min-height: 46px;
  padding: 10px 44px 10px 42px;
  border: 1px solid #bdcbc7;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.input-wrap input:hover {
  border-color: #8fa49e;
}

.input-wrap input:focus {
  border-color: var(--teal);
}

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

.password-toggle {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #617078;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--surface-soft);
  color: var(--teal-dark);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.login-button {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 8px;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 500;
  cursor: pointer;
}

.login-button:hover {
  background: var(--teal-dark);
}

.login-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.login-button svg {
  width: 18px;
  height: 18px;
}

.access-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.access-note svg {
  width: 14px;
  height: 14px;
}

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

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: auto;
    padding: 24px;
  }

  .math-preview {
    width: min(100%, 520px);
    margin: 28px auto 20px;
    padding: 20px;
  }

  .preview-equation {
    margin: 20px 0 17px;
    font-size: 32px;
  }

  .intro-footer {
    display: none;
  }

  .login-panel {
    padding: 28px 20px 40px;
  }
}

@media (max-width: 420px) {
  .login-intro {
    padding: 20px;
  }

  .login-brand strong {
    font-size: 16px;
  }

  .math-preview {
    margin-top: 22px;
    padding: 17px;
  }

  .preview-insight {
    align-items: flex-start;
  }

  .login-panel {
    padding: 24px 14px 34px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .form-heading h1 {
    font-size: 24px;
  }
}

@media (max-width: 560px) {
  .math-preview {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
