/* ============================================================
   登录门 + 云端实时同步
   ============================================================ */
#authGate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 620px at 22% 18%, var(--auth-a), transparent 62%),
    radial-gradient(820px 560px at 78% 78%, var(--auth-b), transparent 60%),
    var(--bg);
  animation: gateIn .45s var(--ease-out);
}
#authGate[hidden] { display: none; }
/* 登录门还在时别让空的应用壳露出来 */
body.gating #app { visibility: hidden; }
body.gating { overflow: hidden; }
:root { --auth-a: rgba(91,140,255,.20); --auth-b: rgba(139,107,255,.16); }
[data-theme="light"] { --auth-a: rgba(47,107,255,.16); --auth-b: rgba(123,75,255,.13); }

@keyframes gateIn { from { opacity: 0 } to { opacity: 1 } }

.auth-card {
  position: relative;
  width: min(430px, 100%);
  padding: 34px 30px 26px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-2);
  background: var(--panel);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  box-shadow: var(--shadow);
  animation: cardUp .5s var(--ease-out) both;
}
@keyframes cardUp { from { opacity: 0; transform: translateY(14px) scale(.985) } to { opacity: 1; transform: none } }

.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 6px; }
.auth-brand .logo { width: 46px; height: 46px; font-size: 17px; border-radius: 14px; }
.auth-brand h2 { margin: 0; font-size: 19px; letter-spacing: .2px; }
.auth-brand p { margin: 3px 0 0; font-size: 12.5px; color: var(--fg-mute); }

.auth-sub { margin: 18px 0 20px; font-size: 13px; color: var(--fg-dim); line-height: 1.65; }

.auth-field { margin-bottom: 13px; }
.auth-field label { display: block; font-size: 12px; color: var(--fg-mute); margin-bottom: 6px; letter-spacing: .3px; }
.auth-field input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  background: rgba(127,127,160,.09);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.auth-field input:focus {
  border-color: var(--accent);
  background: rgba(127,127,160,.05);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .4px;
  color: #fff;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px var(--accent-glow);
  transition: transform .16s var(--ease), filter .18s, box-shadow .18s;
}
.auth-btn:hover { filter: brightness(1.07); box-shadow: 0 14px 32px var(--accent-glow); }
.auth-btn:active { transform: scale(.985); }
.auth-btn[disabled] { opacity: .6; cursor: default; transform: none; }

.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--fg-mute);
}
.auth-switch button {
  background: none;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 12.5px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-msg {
  min-height: 19px;
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--warn);
}
.auth-msg.ok { color: var(--ok); }

/* 右上角账号区 */
#acctBox {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  font-size: 12px;
  color: var(--fg-dim);
  animation: cardUp .5s var(--ease-out) both;
}
#acctBox[hidden] { display: none; }
/* 应用加载后嵌进左侧栏页脚，避免浮在右下角挡住侧记面板 */
#acctBox.in-foot {
  position: static;
  width: 100%;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 6px 8px;
  justify-content: space-between;
  animation: none;
  background: rgba(127,127,160,.08);
  box-shadow: none;
}
#acctAvatar {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 11.5px; font-weight: 700; color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  flex: none;
}
#acctName { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-weight: 600; }
#syncDot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--fg-mute);
  flex: none;
  transition: background .2s, box-shadow .2s;
}
#syncDot.live { background: var(--ok); box-shadow: 0 0 0 3px rgba(51,214,159,.18); }
#syncDot.busy { background: var(--warn); animation: dotPulse .9s ease-in-out infinite; }
#syncDot.off { background: #e5544b; }
@keyframes dotPulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
#acctOut {
  border: 0; background: none;
  font: inherit; font-size: 11.5px;
  color: var(--fg-mute);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 6px;
}
#acctOut:hover { color: var(--fg); background: rgba(127,127,160,.14); }

/* 账号弹层 */
#acctOverlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
#acctOverlay[hidden] { display: none; }
.acct-panel {
  width: min(400px, 100%);
  padding: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  animation: cardUp .3s var(--ease-out) both;
}
.acct-panel h3 { margin: 0 0 4px; font-size: 16px; }
.acct-panel .muted { margin: 0 0 18px; font-size: 12px; color: var(--fg-mute); line-height: 1.6; }
.acct-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 12.5px; color: var(--fg-dim); border-bottom: 1px solid var(--line); }
.acct-row b { color: var(--fg); font-weight: 600; }
