:root {
  color: #20231f;
  background: #eceee9;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(59, 100, 91, 0.13), transparent 32rem),
    radial-gradient(circle at 85% 15%, rgba(155, 125, 70, 0.14), transparent 28rem),
    linear-gradient(145deg, #e8ece8 0%, #f2f1ed 52%, #e9e8e2 100%);
}

button,
input {
  font: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 38px 38px 34px;
  border: 1px solid rgba(72, 81, 74, 0.17);
  border-radius: 24px;
  background: rgba(250, 250, 247, 0.9);
  box-shadow: 0 24px 70px rgba(46, 54, 49, 0.14);
  backdrop-filter: blur(18px);
}

.auth-header {
  margin-bottom: 28px;
  text-align: center;
}

.auth-kicker {
  margin: 0 0 12px;
  color: #6b756d;
  font-size: 13px;
  letter-spacing: 0.18em;
}

.is-login-mode .auth-header {
  margin-bottom: 28px;
}

.is-login-mode .auth-kicker {
  margin: 0;
  color: #303630;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.14em;
}

.is-login-mode #authTitle,
.is-login-mode #authSubtitle {
  display: none;
}

h1 {
  margin: 0;
  color: #222722;
  font-family: "Songti SC", "STSong", serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.auth-subtitle {
  min-height: 22px;
  margin: 14px 0 0;
  color: #747b75;
  font-size: 14px;
  line-height: 1.55;
}

.auth-loading {
  padding: 34px 0;
  color: #7b827d;
  text-align: center;
}

.auth-content.is-hidden,
.auth-message.is-hidden,
.auth-loading.is-hidden {
  display: none;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field label {
  color: #4e5650;
  font-size: 13px;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd4cf;
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 253, 0.94);
  color: #1f241f;
  font-size: 17px;
  letter-spacing: 0.08em;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field input:focus {
  border-color: #526f67;
  box-shadow: 0 0 0 3px rgba(64, 102, 91, 0.12);
}

.auth-button {
  height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  background: #354d46;
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.08em;
  transition: background 160ms ease, transform 160ms ease;
}

.auth-button:hover {
  background: #2d433d;
}

.auth-button:active {
  transform: translateY(1px);
}

.auth-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (hover: none), (pointer: coarse) {
  .auth-button:hover {
    background: #354d46;
  }

  button:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
  }
}

.auth-message {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f5e6e4;
  color: #8a3d35;
  font-size: 13px;
  line-height: 1.55;
}

.setup-intro {
  margin: 0 0 18px;
  color: #555e57;
  font-size: 14px;
  line-height: 1.7;
}

.qr-panel {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid #d8dcd8;
  border-radius: 16px;
  background: #fff;
  text-align: center;
}

.qr-panel img {
  display: block;
  width: 210px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 12px;
}

.manual-secret {
  margin: 0;
  overflow-wrap: anywhere;
  color: #707770;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
}

.recovery-panel {
  color: #454d47;
  font-size: 14px;
  line-height: 1.65;
}

.recovery-panel h2 {
  margin: 0 0 10px;
  color: #222722;
  font-size: 20px;
}

.recovery-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 18px 0;
  padding: 16px;
  border-radius: 12px;
  background: #eceeea;
  color: #303832;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  list-style: none;
}

.secondary-button {
  width: 100%;
  height: 44px;
  margin-bottom: 10px;
  border: 1px solid #aeb7b0;
  border-radius: 11px;
  background: transparent;
  color: #3f514a;
  cursor: pointer;
}

.auth-note {
  margin: 16px 0 0;
  color: #858b86;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 520px) {
  .auth-shell {
    align-items: start;
    padding: 54px 16px 24px;
  }

  .auth-card {
    padding: 30px 22px 26px;
    border-radius: 20px;
  }

  h1 {
    font-size: 29px;
  }

  .recovery-codes {
    grid-template-columns: 1fr;
  }
}
