/* 首页的登录子页面（index.html 里的 <dialog id="auth">，逻辑在 login-dialog.js）。
   用 home.css 的配色变量，跟着首页的深浅色走。 */

.auth {
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  background: none;
  color: var(--fg);
}
.auth::backdrop { background: var(--dim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.auth[open] { animation: auth-pop .22s var(--ease); }
@keyframes auth-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

.auth-card {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 34px 30px 26px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
  perspective: 1400px;
}
.auth-x { position: absolute; top: 12px; right: 12px; }

/* 翻页：往前翻从右边那条边转进来，返回从左边转进来 */
.auth-page { display: grid; gap: 14px; transform-origin: left center; }
.auth-page.turn-in { animation: auth-turn .34s var(--ease); }
.auth-page.turn-back { transform-origin: right center; animation: auth-turn-back .34s var(--ease); }
/* 转的那 0.34 秒里透视会把这一页撑出卡片，别为此闪一下滚动条 */
.auth-card:has(> .turn-in, > .turn-back) { overflow: hidden; }
@keyframes auth-turn { from { opacity: 0; transform: rotateY(-38deg) translateX(18px); } }
@keyframes auth-turn-back { from { opacity: 0; transform: rotateY(38deg) translateX(-18px); } }
@media (prefers-reduced-motion: reduce) {
  .auth[open], .auth-page.turn-in, .auth-page.turn-back { animation: none; }
}

.auth-mark { width: 40px; height: 40px; margin: 0 auto 2px; color: var(--accent); }
.auth h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; }
.auth-page:not([data-auth-page="choose"]) h2 { text-align: left; }
.auth-sub { margin: -6px 0 4px; color: var(--muted); font-size: 14px; text-align: center; }
.auth-page:not([data-auth-page="choose"]) .auth-sub { text-align: left; margin-top: -4px; }

.auth-choices { display: grid; gap: 10px; margin-top: 6px; }
.auth-choice {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--bg-2); color: var(--fg);
  font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.auth-choice:hover { border-color: var(--accent); }
.auth-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auth-choice svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.auth-choice span { flex: 1; }
.auth-choice .auth-go { color: var(--faint); }
/* Google 的按钮自己画，这里只管它居中、和上下两颗一样宽 */
.auth-google { display: flex; justify-content: center; min-height: 44px; }

.auth-back {
  justify-self: start; display: inline-flex; align-items: center; gap: 4px;
  margin: -14px 0 -4px -6px; padding: 4px 8px 4px 2px;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.auth-back:hover { color: var(--fg); background: var(--hover); }
.auth-back svg { width: 18px; height: 18px; }

.auth form { display: grid; gap: 12px; }
.auth label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.auth input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.auth input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.auth form .btn { justify-content: center; width: 100%; }
.auth-hint { margin: -6px 0 0; color: var(--faint); font-size: 12.5px; }
.auth .msg { min-height: 1.3em; margin: 0; font-size: 13.5px; }
.auth .msg.err { color: #e5484d; }
#auth-google-msg:empty { display: none; }
.auth .msg.ok { color: var(--accent-ink); }
:root[data-theme="dark"] .auth .msg.err { color: #ff8a80; }

.auth-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 0; font-size: 14px; }
.auth-foot a, .auth-foot button { padding: 0; border: 0; background: none; color: var(--accent-ink); font: inherit; text-decoration: none; cursor: pointer; }
.auth-foot a:hover, .auth-foot button:hover { text-decoration: underline; }
.auth-legal { margin: 6px 0 0; color: var(--faint); font-size: 12.5px; text-align: center; }
.auth-legal a { color: var(--muted); }
