:root {
  color-scheme: dark;
  --auth-bg: #07111c;
  --auth-panel: rgba(14, 28, 43, 0.92);
  --auth-panel-soft: rgba(19, 38, 57, 0.72);
  --auth-line: rgba(220, 189, 117, 0.25);
  --auth-gold: #e5c77d;
  --auth-gold-strong: #ffd989;
  --auth-teal: #79c7bc;
  --auth-text: #f7f4eb;
  --auth-muted: #a9b6c2;
  --auth-danger: #ff9b8e;
  --auth-success: #91d8ad;
}

* { box-sizing: border-box; }

body.auth-page {
  min-height: 100vh;
  margin: 0;
  color: var(--auth-text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(229, 199, 125, 0.16), transparent 34rem),
    radial-gradient(circle at 82% 90%, rgba(45, 139, 132, 0.16), transparent 32rem),
    linear-gradient(150deg, #06101a 0%, #0c1b2b 52%, #07121e 100%);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(18rem, 0.9fr) minmax(22rem, 1.1fr);
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand::after {
  content: "宫";
  position: absolute;
  right: -0.06em;
  bottom: -0.2em;
  color: rgba(229, 199, 125, 0.055);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: min(58vw, 34rem);
  line-height: 1;
  pointer-events: none;
}

.auth-mark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--auth-text);
  text-decoration: none;
}

.auth-seal {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid rgba(255, 217, 137, 0.56);
  border-radius: 1rem;
  color: #102131;
  background: linear-gradient(145deg, #ffe4a1, #c49a4d);
  box-shadow: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.32);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.45rem;
  font-weight: 800;
}

.auth-mark strong { display: block; font-size: 1.05rem; letter-spacing: 0.04em; }
.auth-mark small { color: var(--auth-muted); font-size: 0.78rem; }

.auth-intro { position: relative; z-index: 1; max-width: 34rem; padding: 5rem 0; }
.auth-eyebrow { margin: 0 0 1rem; color: var(--auth-gold); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; }
.auth-intro h1 { margin: 0; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(2.7rem, 6vw, 5.7rem); font-weight: 800; line-height: 1.05; }
.auth-intro p { max-width: 31rem; margin: 1.4rem 0 0; color: #c0cbd4; font-size: 1.05rem; line-height: 1.9; }
.auth-footnote { position: relative; z-index: 1; color: #8697a6; font-size: 0.82rem; }

.auth-workspace {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(1.3rem, 5vw, 5rem);
}

.auth-card { width: min(100%, 34rem); padding: clamp(1.6rem, 5vw, 3rem); border: 1px solid var(--auth-line); border-radius: 1.75rem; background: var(--auth-panel); box-shadow: 0 2rem 7rem rgba(0, 0, 0, 0.34); backdrop-filter: blur(18px); }
.auth-card.wide { width: min(100%, 68rem); }
.auth-card h2 { margin: 0; font-family: "STKaiti", "KaiTi", serif; font-size: clamp(2rem, 4vw, 3rem); }
.auth-card > p { margin: 0.7rem 0 1.7rem; color: var(--auth-muted); line-height: 1.75; }

.auth-form { display: grid; gap: 1.15rem; }
.auth-field { display: grid; gap: 0.5rem; }
.auth-field span, .auth-label { color: #d8e0e7; font-size: 0.9rem; font-weight: 700; }
.auth-field small { color: #8294a3; line-height: 1.5; }
.auth-field input, .auth-field select {
  width: 100%;
  min-height: 3.1rem;
  padding: 0 0.95rem;
  border: 1px solid rgba(196, 213, 225, 0.2);
  border-radius: 0.9rem;
  outline: none;
  color: var(--auth-text);
  background: rgba(4, 13, 22, 0.72);
  font: inherit;
}
.auth-field input:focus, .auth-field select:focus { border-color: var(--auth-gold); box-shadow: 0 0 0 3px rgba(229, 199, 125, 0.12); }

.auth-button, .auth-button-secondary, .auth-link-button {
  min-height: 3.15rem;
  border: 0;
  border-radius: 0.95rem;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease;
}
.auth-button { color: #152231; background: linear-gradient(135deg, var(--auth-gold-strong), #caa052); box-shadow: 0 1rem 2.4rem rgba(202, 160, 82, 0.16); }
.auth-button-secondary, .auth-link-button { border: 1px solid rgba(229, 199, 125, 0.34); color: var(--auth-text); background: rgba(255, 255, 255, 0.035); }
.auth-button:hover, .auth-button-secondary:hover, .auth-link-button:hover { transform: translateY(-1px); filter: brightness(1.07); }
.auth-button:disabled, .auth-button-secondary:disabled { cursor: wait; opacity: 0.62; transform: none; }
.auth-link-button { display: inline-flex; align-items: center; justify-content: center; padding: 0 1rem; text-decoration: none; }

.auth-message { min-height: 1.5rem; margin: 0; color: var(--auth-muted); font-size: 0.9rem; line-height: 1.6; }
.auth-message.error { color: var(--auth-danger); }
.auth-message.success { color: var(--auth-success); }
.auth-switch { margin: 1.3rem 0 0; color: var(--auth-muted); text-align: center; }
.auth-switch a { color: var(--auth-gold-strong); font-weight: 800; text-decoration: none; }
.auth-callout { display: none; margin: 1.2rem 0 0; padding: 1rem; border: 1px solid rgba(121, 199, 188, 0.3); border-radius: 1rem; color: #c6e8e3; background: rgba(51, 132, 124, 0.11); line-height: 1.65; }
.auth-callout.show { display: block; }
.auth-callout a { color: #d6f6f1; font-weight: 800; }

.auth-profile { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: center; padding: 1.2rem; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 1.2rem; background: var(--auth-panel-soft); }
.auth-avatar { display: grid; place-items: center; width: 4.2rem; height: 4.2rem; border-radius: 1.3rem; color: #132332; background: linear-gradient(145deg, #ffe4a1, #c59949); font-family: "STKaiti", "KaiTi", serif; font-size: 1.8rem; font-weight: 900; }
.auth-profile h3 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.auth-profile p { margin: 0; color: var(--auth-muted); line-height: 1.6; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.35rem; }

.auth-admin-grid { display: grid; grid-template-columns: minmax(19rem, 0.8fr) minmax(22rem, 1.2fr); gap: 1.2rem; }
.auth-panel { min-width: 0; padding: 1.3rem; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 1.2rem; background: var(--auth-panel-soft); }
.auth-panel h3 { margin: 0 0 1rem; font-size: 1.15rem; }
.invite-result { display: none; margin-top: 1rem; padding: 1rem; border: 1px dashed rgba(255, 217, 137, 0.55); border-radius: 1rem; background: rgba(229, 199, 125, 0.08); }
.invite-result.show { display: block; }
.invite-code { display: block; margin: 0.5rem 0; color: var(--auth-gold-strong); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 1.35rem; font-weight: 900; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.auth-list { display: grid; gap: 0.7rem; max-height: 31rem; overflow: auto; }
.auth-list-item { display: grid; grid-template-columns: 1fr auto; gap: 0.8rem; align-items: center; padding: 0.85rem; border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 0.9rem; background: rgba(3, 11, 19, 0.42); }
.auth-list-item strong, .auth-list-item span { display: block; }
.auth-list-item small { display: block; margin-top: 0.2rem; color: var(--auth-muted); }
.auth-badge { padding: 0.3rem 0.55rem; border-radius: 999px; color: #ccebe6; background: rgba(82, 159, 148, 0.2); font-size: 0.76rem; white-space: nowrap; }

.account-chip { display: inline-flex; align-items: center; gap: 0.55rem; margin-left: 0.25rem; padding: 0.48rem 0.75rem; border: 1px solid rgba(220, 189, 117, 0.32); border-radius: 999px; color: inherit; background: rgba(9, 20, 31, 0.22); text-decoration: none; white-space: nowrap; }
.account-chip::before { content: ""; width: 0.48rem; height: 0.48rem; border-radius: 50%; background: #85d0a2; box-shadow: 0 0 0 3px rgba(133, 208, 162, 0.13); }

@media (max-width: 850px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 1.25rem; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
  .auth-intro { padding: 3.2rem 0 1.3rem; }
  .auth-intro h1 { font-size: clamp(2.4rem, 13vw, 4rem); }
  .auth-intro p { font-size: 0.98rem; }
  .auth-footnote { display: none; }
  .auth-workspace { padding: 1rem; }
  .auth-card { border-radius: 1.35rem; }
  .auth-admin-grid { grid-template-columns: 1fr; }
}

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