/* 登录：右上角入口 + 扫码/邀请码弹窗 + 受保护页面门禁 */

:root {
  --wechat-green: #07c160;
}

/* 未完成校验前先藏起正文，避免受保护页面闪一下才被拦 */
html.fw-auth-pending body > *:not(.fw-auth-mask) {
  visibility: hidden;
}

html.fw-auth-denied body > *:not(.fw-auth-mask) {
  visibility: hidden;
}

html.fw-auth-locked {
  overflow: hidden;
}

/* ---------- 右上角 ---------- */

.fw-auth-slot {
  display: inline-flex;
  align-items: center;
}

.fw-auth-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(7, 193, 96, 0.45);
  background: rgba(7, 193, 96, 0.12);
  color: #6ee7a8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.fw-auth-login-btn:hover {
  background: rgba(7, 193, 96, 0.2);
  border-color: rgba(7, 193, 96, 0.7);
}

/* 微信图标：纯 CSS 圆底 + 对话气泡，避免引入外部图片 */
.fw-wechat-mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wechat-green);
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}

.fw-wechat-mark::before,
.fw-wechat-mark::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.fw-wechat-mark::before {
  width: 3px;
  height: 3px;
  top: 5px;
  left: 4px;
}

.fw-wechat-mark::after {
  width: 3px;
  height: 3px;
  top: 5px;
  right: 4px;
}

.fw-wechat-mark.big {
  width: 44px;
  height: 44px;
}

.fw-wechat-mark.big::before,
.fw-wechat-mark.big::after {
  width: 7px;
  height: 7px;
  top: 15px;
}

.fw-wechat-mark.big::before {
  left: 11px;
}

.fw-wechat-mark.big::after {
  right: 11px;
}

.fw-auth-user {
  position: relative;
}

.fw-auth-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--flux-border);
  background: var(--flux-card);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  max-width: 190px;
}

.fw-auth-user-btn:hover {
  border-color: var(--flux-border-strong, rgba(255, 255, 255, 0.2));
}

.fw-auth-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.fw-auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.fw-auth-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--flux-border);
  background: #111114;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  z-index: 400;
}

.fw-auth-menu-who {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--flux-border);
  margin-bottom: 4px;
}

.fw-auth-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.fw-auth-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* 本机工作台顶栏更矮，按钮跟着缩 */
.local-health .fw-auth-login-btn {
  padding: 5px 12px;
  font-size: 12px;
}

.local-health .fw-auth-user-btn {
  padding: 3px 10px 3px 4px;
  font-size: 12px;
}

.local-health .fw-auth-avatar {
  width: 20px;
  height: 20px;
}

/* ---------- 弹窗 ---------- */

.fw-auth-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 6, 0.82);
  backdrop-filter: blur(6px);
  visibility: visible !important;
}

.fw-auth-mask.is-open {
  display: flex;
}

.fw-auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px 26px 24px;
  border-radius: 16px;
  border: 1px solid var(--flux-border);
  background: #0d0d10;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.fw-auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.fw-auth-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.fw-auth-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: #fff;
}

.fw-auth-sub {
  margin: 0 0 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.fw-auth-block h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

.fw-auth-block[hidden] {
  display: none;
}

.fw-auth-qr {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--flux-border);
  background: #08080a;
  overflow: hidden;
}

/* 微信 JS SDK 注入的是一个 iframe，给它留白底否则二维码看不清 */
.fw-auth-qr iframe {
  border: none;
  width: 100%;
  min-height: 300px;
  background: #fff;
  border-radius: 10px;
}

.fw-auth-qr-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 180px;
  opacity: 0.35;
}

.fw-auth-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.fw-auth-hint.is-error {
  color: #f87171;
}

.fw-auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.fw-auth-or[hidden] {
  display: none;
}

.fw-auth-or::before,
.fw-auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--flux-border);
}

.fw-auth-invite {
  display: flex;
  gap: 8px;
}

.fw-auth-invite input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--flux-border);
  background: #08080a;
  color: #fff;
  font-size: 13px;
}

.fw-auth-invite input:focus {
  outline: none;
  border-color: var(--flux-purple-bright, #7c3aed);
}

.fw-auth-submit {
  padding: 11px 18px;
  border-radius: 9px;
  border: none;
  background: var(--flux-purple-bright, #7c3aed);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.fw-auth-submit:hover {
  filter: brightness(1.1);
}

.fw-auth-submit:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 480px) {
  .fw-auth-card {
    padding: 24px 18px 20px;
  }
  .fw-auth-name {
    display: none;
  }
}
