:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: #20241f;
  background: #f4f1e9;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] { display: none !important; }
.auth-panel { padding: 24px 30px; }
.auth-panel h2 { margin-top: 0; font-size: 1.3rem; }
.auth-panel form { padding: 16px 0 0; }
.auth-panel small { display: block; margin-top: 8px; color: #58645c; line-height: 1.6; font-weight: 400; }
.auth-panel p, .setup-steps { line-height: 1.8; }
.setup-steps { padding-left: 22px; }
.auth-account { overflow-wrap: anywhere; font-weight: 700; }
#setupSecret { font-family: monospace; font-size: 0.95rem; line-height: 1.6; padding: 12px 15px; resize: none; overflow-wrap: anywhere; word-break: break-all; }
#factorCode { font-size: 1.6rem; letter-spacing: 0.3em; }
#registrationFields { display: grid; gap: 18px; }
.auth-status { margin: 0 24px 24px !important; }
.secondary-button { min-height: 44px; margin-top: 12px; padding: 9px 16px; border: 1px solid #d8d3c8; border-radius: 12px; background: #f8f5ee; cursor: pointer; }
.restart-login { display: block; margin: 0 24px 24px; color: #28533d; text-align: center; }
.recovery-codes { list-style: none; padding: 12px; background: #edf4ed; border-radius: 12px; font-family: monospace; text-align: center; line-height: 2; font-size: clamp(0.8rem, 3.4vw, 1rem); overflow-wrap: anywhere; }
.saved-confirmation { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0; line-height: 1.6; }
.saved-confirmation input { margin-top: 5px; min-width: 20px; min-height: 20px; }
.remember-login { display: flex; min-height: 44px; gap: 10px; align-items: flex-start; margin: 0 0 18px; cursor: pointer; font-size: 0.9rem; }
.remember-login input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: #28533d; }
.remember-login small { display: block; margin-top: 4px; color: #58645c; font-size: 0.78rem; line-height: 1.6; }
.remember-login input:focus-visible { outline: 3px solid #e5b76c; outline-offset: 3px; }
.auth-panel .login-button { width: 100%; }
button:focus-visible, a:focus-visible { outline: 3px solid #e5b76c; outline-offset: 3px; }

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

body {
  min-height: 100svh;
  background:
    radial-gradient(circle at 12% 10%, rgb(192 92 61 / 12%), transparent 30rem),
    radial-gradient(circle at 88% 90%, rgb(44 88 72 / 12%), transparent 32rem),
    #f4f1e9;
}

button,
input {
  font: inherit;
}

.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-card {
  width: min(100%, 520px);
  overflow: hidden;
  border: 1px solid rgb(32 36 31 / 12%);
  border-radius: 28px;
  background: #fffdf9;
  box-shadow: 0 24px 70px rgb(35 36 30 / 18%);
}

.login-card__header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 30px 30px 26px;
  border-bottom: 1px solid rgb(32 36 31 / 11%);
}

.brand-mark {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #e5b76c;
  background: #20241f;
}

.brand-mark svg {
  width: 36px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.login-card__header p {
  margin: 0 0 5px;
  color: #a1442e;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.login-card h1 {
  margin: 0;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  line-height: 1.2;
}

form {
  display: grid;
  gap: 20px;
  padding: 28px 30px 30px;
}

.field {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.field > span:first-child {
  font-size: 0.94rem;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 1px solid #d8d3c8;
  border-radius: 13px;
  outline: none;
  background: #f8f5ee;
  color: #20241f;
}

.field input:focus,
.field textarea:focus {
  border-color: #a1442e;
  box-shadow: 0 0 0 4px rgb(161 68 46 / 14%);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 76px;
}

.password-field button {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 60px;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  color: #35443c;
  background: #e9eee9;
  font-weight: 800;
  cursor: pointer;
}

.password-field button:focus-visible,
.login-button:focus-visible {
  outline: 3px solid #e5b76c;
  outline-offset: 3px;
}

.login-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 10px 13px;
  border-radius: 11px;
  background: #edf4ed;
  color: #28533d;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-status.is-error {
  background: #fae8e4;
  color: #8c2e20;
}

.login-button {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #20241f;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgb(32 36 31 / 16%);
}

.login-button:hover {
  background: #30372f;
}

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

@media (max-width: 560px) {
  .login-page {
    align-items: center;
    padding: 18px 14px;
  }

  .login-card {
    border-radius: 24px;
  }

  .login-card__header {
    gap: 14px;
    padding: 24px 20px 22px;
  }

  .brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  form {
    gap: 18px;
    padding: 24px 20px 25px;
  }

  .field input,
  .login-button {
    min-height: 58px;
  }

  .password-field button {
    top: 7px;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .login-card {
    animation: enter 260ms ease-out;
  }

  @keyframes enter {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }
}
