.auth-modal {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 37, 29, .45);
}

.auth-modal.hidden {
  display: none;
}

.auth-card {
  position: relative;
  width: min(100%, 420px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(16, 37, 29, .22);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.auth-card h2 {
  margin-top: 0;
  font-size: 25px;
}

.auth-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #e9ece5;
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
}

#authForm label {
  display: block;
  margin-top: 14px;
  color: #425347;
  font-size: 13px;
  font-weight: 700;
}

#authForm .hidden {
  display: none;
}

#authForm input {
  height: 44px;
  margin-top: 7px;
  border-radius: 10px;
  background: white;
}

#authForm input.match-error {
  border-color: #d6735d;
  background: #fff7f3;
}

#authForm input.match-success {
  border-color: #8baa75;
  background: #f7fbf2;
}

.auth-help,
.auth-error,
.auth-email,
.account-notice {
  margin: 10px 0 0;
  font-size: 12px;
}

.auth-help,
.auth-email {
  color: var(--muted);
}

.auth-error {
  color: #aa4a31;
}

.password-match {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
}

.password-match.hidden {
  display: none;
}

.password-match.match-error {
  color: #aa4a31;
}

.password-match.match-success {
  color: #547047;
}

.auth-submit {
  margin-top: 18px;
}

.auth-switch {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-switch button {
  margin-left: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #61753c;
  cursor: pointer;
  font: 700 12px inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-email {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account-email span,
.account-email strong {
  display: block;
}

.account-email strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.account-panel {
  display: grid;
  gap: 11px;
  margin-top: 12px;
}

.profile-form {
  margin-top: 14px;
}

.gender-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.gender-options input {
  display: none;
}

.account-form .gender-options label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #edf0e9;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.gender-options svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.gender-options input:checked + label {
  border-color: #8ca66d;
  background: #e3edda;
  color: #456237;
}

.profile-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
}

.profile-slider-head label {
  margin: 0;
}

.profile-slider-head strong {
  color: #547047;
  font: 700 12px "DM Mono", monospace;
}

.account-form .profile-slider {
  width: 100%;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 4px 0 0;
  accent-color: #7f9d5f;
  cursor: pointer;
}

.account-form .profile-slider:focus-visible {
  outline: 2px solid #91aa73;
  outline-offset: 3px;
}

.profile-weight-label {
  margin-top: 12px !important;
}

.account-form .profile-weight-input {
  margin-top: 6px;
}

.account-form .profile-slider:disabled {
  background: transparent;
  cursor: not-allowed;
  opacity: .65;
}

.account-form select {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font: 13px inherit;
}

.account-form input:disabled {
  color: #6e7b72;
  background: #edf0e9;
  cursor: not-allowed;
}

.profile-lock-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.onboarding .account-heading,
.onboarding #authMemberName,
.onboarding .account-email,
.onboarding .account-panel,
.onboarding .auth-logout {
  display: none;
}

.account-form {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcf9;
}

.account-form h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.account-form label {
  display: block;
  margin-top: 8px;
  color: #425347;
  font-size: 12px;
  font-weight: 700;
}

.account-form input {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  font: 13px inherit;
}

.account-save {
  margin-top: 10px;
  padding: 8px 11px;
  border: 1px solid #9bac98;
  border-radius: 9px;
  background: #e9ece5;
  color: var(--ink);
  cursor: pointer;
  font: 700 12px inherit;
}

.account-save:disabled {
  border-color: #d8ded4;
  background: #edf0e9;
  color: #9aa59c;
  cursor: not-allowed;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.profile-skip {
  margin-top: 10px;
  padding: 7px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 700 12px inherit;
}

.profile-skip:hover {
  color: #547047;
}

.account-notice {
  color: #547047;
}

.auth-logout {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: 1px solid #dfa996;
  border-radius: 12px;
  background: #fff3ee;
  color: #aa4a31;
  cursor: pointer;
  font: 700 14px inherit;
}

.avatar.logged-in {
  background: var(--lime);
  font-size: 13px;
}

/* 访客态显示“登录”时保持单行，避免在圆形账户入口内换行溢出。 */
.avatar {
  display: inline-grid;
  flex: 0 0 34px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1;
}

.birth-picker {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.birth-picker label {
  margin: 0;
}

.birth-picker select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  font: 13px inherit;
}

.profile-age-summary {
  margin: 2px 0 0;
  color: #547047;
  font: 700 11px "DM Mono", monospace;
}

/* Keep the management view compact while retaining enough touch space. */
.profile-form { margin-top: 10px; }
.account-panel { gap: 8px; margin-top: 9px; }
.account-form { padding: 10px; }
.account-form h3 { margin-bottom: 6px; }
.account-form label { margin-top: 6px; }
