:root {
  color-scheme: light;
  --auth-bg: #f8f9fa;
  --auth-surface: #ffffff;
  --auth-fg: #212529;
  --auth-title: #212529;
  --auth-muted: #6c757d;
  --auth-border: #ced4da;
  --auth-accent: #0d6efd;
  --auth-accent-hover: #0b5ed7;
  --auth-danger: #b02a37;
  --auth-font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body.auth-body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: var(--auth-bg);
  color: var(--auth-fg);
  font-family: var(--auth-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-page {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px 24px;
}

.auth-card {
  width: min(100%, 380px);
  padding: 16px;
  border: 0;
  background: transparent;
}

.auth-head { margin-bottom: 24px; text-align: center; }
.auth-logo { display: block; width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 14px; }
.auth-title { margin: 0; color: var(--auth-title); font-size: 30px; font-weight: 500; line-height: 1.2; letter-spacing: -.02em; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form#register-details-form:not([hidden]) { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--auth-border); }
.label { display: block; margin-bottom: 6px; color: var(--auth-title); font-size: 14px; font-weight: 400; }

.input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--auth-border);
  border-radius: 6px;
  outline: 0;
  background: var(--auth-surface);
  color: var(--auth-fg);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input::placeholder { color: #8b949e; }
.input:focus { border-color: #86b7fe; box-shadow: 0 0 0 3px rgba(13, 110, 253, .15); }
.input:read-only { background: #e9ecef; color: var(--auth-muted); }

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--auth-fg);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn:focus-visible,
.auth-link-btn:focus-visible,
.auth-links a:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(13, 110, 253, .2); }
.btn-primary { border-color: var(--auth-accent); background: var(--auth-accent); color: #fff; }
.btn-primary:hover { border-color: var(--auth-accent-hover); background: var(--auth-accent-hover); }
.btn-outline { border-color: var(--auth-accent); background: var(--auth-surface); color: var(--auth-accent); }
.btn-outline:hover { border-color: var(--auth-accent-hover); background: #e7f1ff; color: var(--auth-accent-hover); }
.btn:disabled { cursor: default; opacity: .65; }
.auth-submit, .auth-wide { width: 100%; }

.auth-error,
.auth-notice { margin: 0; padding: 10px 12px; border-radius: 6px; font-size: 14px; }
.auth-error { background: #f8d7da; color: #842029; }
.auth-notice { background: #d1e7dd; color: #0f5132; }
.auth-footer { margin: 6px 0 0; color: var(--auth-muted); font-size: 12px; line-height: 1.6; }

.auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; color: var(--auth-muted); font-size: 14px; }
.auth-links a, .auth-link-accent, .auth-link-btn { color: var(--auth-accent); text-decoration: none; }
.auth-links a:hover, .auth-link-accent:hover, .auth-link-btn:hover { text-decoration: underline; }
.auth-center { justify-content: center; }
.auth-link-btn { margin-left: 4px; padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.auth-link-btn:disabled { color: var(--auth-muted); cursor: default; text-decoration: none; }
.auth-row { display: flex; gap: 8px; }
.auth-flex { min-width: 0; flex: 1; }
.auth-send-btn { flex: 0 0 auto; min-height: 44px; padding-right: 13px; padding-left: 13px; white-space: nowrap; }
.auth-code { width: min(176px, 100%); }
.auth-closed { display: flex; flex-direction: column; gap: 16px; text-align: center; }
.auth-closed p { margin: 0; color: var(--auth-muted); font-size: 15px; }
.auth-footer { margin-top: 20px; text-align: center; }

@media (max-width: 420px) {
  .auth-page { padding-right: 8px; padding-left: 8px; }
  .auth-card { padding-right: 8px; padding-left: 8px; }
}
