/* 芯火村 · 登录弹窗 / 页面守卫 / 顶栏登录状态 */

/* ---------- 弹窗 ---------- */
.xh-auth-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.xh-auth-modal[hidden] { display: none; }

.xh-auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, .72);
  backdrop-filter: blur(6px);
}

.xh-auth-panel {
  position: relative;
  width: min(100%, 400px);
  padding: 38px 32px 26px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(255, 231, 166, .06), rgba(12, 14, 20, .9)),
    rgba(14, 16, 22, .96);
  border: 1px solid rgba(218, 156, 65, .35);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  animation: xh-auth-pop .28s cubic-bezier(.22, 1, .36, 1);
}

@keyframes xh-auth-pop {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.xh-auth-x {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  color: rgba(247, 229, 195, .5);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
}

.xh-auth-x:hover { color: rgba(247, 229, 195, .9); }

.xh-auth-eyebrow {
  margin-bottom: 12px;
  color: var(--xh-faint, rgba(247, 229, 195, .45));
  font-size: 11px;
  letter-spacing: 3px;
}

.xh-auth-title {
  margin: 0 0 6px;
  color: var(--xh-gold, #f4c879);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
}

.xh-auth-desc {
  margin: 0 0 22px;
  color: var(--xh-muted, rgba(247, 229, 195, .7));
  font-size: 13px;
}

.xh-auth-panel input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  margin-bottom: 12px;
  color: var(--xh-text, #f7e5c3);
  font: inherit;
  letter-spacing: 1px;
  text-align: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(218, 156, 65, .3);
  border-radius: 12px;
  box-sizing: border-box;
}

.xh-auth-panel input:focus {
  border-color: rgba(244, 200, 121, .6);
  outline: none;
}

.xh-auth-submit {
  width: 100%;
  min-height: 46px;
  color: var(--xh-on-gold, #2a1707);
  font: inherit;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  background: linear-gradient(135deg, #f4c879, #d7a95f);
  border: none;
  border-radius: 12px;
}

.xh-auth-submit:hover { filter: brightness(1.07); }
.xh-auth-submit:disabled { opacity: .55; cursor: wait; }

.xh-auth-hint {
  margin: 12px 0 0;
  color: var(--xh-faint, rgba(247, 229, 195, .45));
  font-size: 12px;
}

.xh-auth-hint.error { color: #ff8a3d; }

/* ---------- 页面守卫遮罩 ---------- */
.xh-auth-blocker {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 10, .66);
  backdrop-filter: blur(14px);
}

.xh-auth-blocker-panel {
  width: min(100%, 380px);
  padding: 40px 34px 34px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(255, 231, 166, .06), rgba(12, 14, 20, .88)),
    rgba(14, 16, 22, .94);
  border: 1px solid rgba(218, 156, 65, .32);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}

.xh-auth-lock {
  display: inline-block;
  width: 34px;
  height: 26px;
  margin-bottom: 16px;
  border: 2px solid rgba(244, 200, 121, .8);
  border-radius: 6px;
  position: relative;
}

.xh-auth-lock::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  width: 18px;
  height: 14px;
  border: 2px solid rgba(244, 200, 121, .8);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  transform: translateX(-50%);
}

.xh-auth-blocker-panel h2 {
  margin: 0 0 10px;
  color: var(--xh-gold, #f4c879);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 2px;
}

.xh-auth-blocker-panel p {
  margin: 0 0 24px;
  color: var(--xh-muted, rgba(247, 229, 195, .7));
  font-size: 13px;
  line-height: 1.8;
}

/* 未登录时锁住页面滚动 */
body.xh-auth-locked { overflow: hidden; }

/* ---------- 顶栏登录状态 ---------- */
.xh-auth-user {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.xh-auth-name {
  color: var(--xh-gold, #f4c879);
  font-size: 14px;
  letter-spacing: 1px;
}

.xh-auth-logout {
  padding: 6px 14px;
  color: rgba(247, 229, 195, .65);
  font-size: 12px;
  cursor: pointer;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(218, 156, 65, .3);
  border-radius: 999px;
}

.xh-auth-logout:hover {
  color: rgba(247, 229, 195, .95);
  border-color: rgba(244, 200, 121, .55);
}

button.login-button {
  font: inherit;
  cursor: pointer;
}

/* ---------- 注册 / 登录分离 ---------- */
.xh-auth-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.register-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 20px;
  white-space: nowrap;
  font-size: 14px;
  color: rgba(247, 229, 195, .8);
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(218, 156, 65, .32);
  border-radius: 999px;
  background: transparent;
  transition: all .2s ease;
}

.register-button:hover {
  color: #ffd98c;
  border-color: rgba(244, 200, 121, .55);
  background: rgba(200, 168, 75, .07);
}

/* 遮罩上的「返回首页」出口 */
.xh-auth-back-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  color: rgba(247, 229, 195, .7);
  font-size: 14px;
  text-decoration: none;
  border: 1px solid rgba(218, 156, 65, .3);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
  transition: all .2s ease;
  box-sizing: border-box;
}

.xh-auth-back-home:hover {
  color: #ffd98c;
  border-color: rgba(244, 200, 121, .55);
  background: rgba(200, 168, 75, .07);
}

.xh-auth-register {
  margin: 14px 0 0;
  color: var(--xh-faint, rgba(247, 229, 195, .45));
  font-size: 12.5px;
}

.xh-auth-register a {
  color: var(--xh-gold, #f4c879);
  text-decoration: none;
}

.xh-auth-register a:hover {
  text-decoration: underline;
}
