/* ===== 进页面强制鉴权闸门 auth-gate ===== */

/* 防闪：未登录时先隐藏正文（闸门本身靠 visibility:visible 重新显示） */
html.pre-auth-lock body {
  visibility: hidden;
}

/* 闸门显示时锁滚动 */
body.auth-locked {
  overflow: hidden;
}

#authGate {
  visibility: visible !important;
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #FEF9F0;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", sans-serif;
}

.ag-card {
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 滚动只发生在 .ag-body 内，tabs 固定不动 */
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  padding: 22px 24px 0;
}

.ag-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid #f0e4d4;
}
.ag-tab {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0;
  font-size: 1rem;
  color: #999;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ag-tab.active {
  color: #e8860a;
  border-bottom-color: #f5a623;
  font-weight: 600;
}

/* 内容滚动区（tabs 之外的部分） */
.ag-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 26px 0;
  scrollbar-width: thin;              /* Firefox */
  scrollbar-color: #ecd3ae transparent;
}
.ag-body::-webkit-scrollbar {
  width: 6px;
}
.ag-body::-webkit-scrollbar-track {
  background: transparent;
}
.ag-body::-webkit-scrollbar-thumb {
  background: #ecd3ae;
  border-radius: 3px;
}
.ag-body::-webkit-scrollbar-thumb:hover {
  background: #e0bf85;
}

.ag-panel {
  display: none;
}
.ag-panel.active {
  display: block;
}

.ag-title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: #333;
}
.ag-sub {
  margin: 0 0 16px;
  font-size: .82rem;
  color: #999;
}

.ag-row {
  display: flex;
  gap: 12px;
}
.ag-row .ag-group {
  flex: 1;
}

.ag-group {
  margin-bottom: 14px;
}
.ag-group label {
  display: block;
  margin-bottom: 6px;
  font-size: .82rem;
  color: #666;
}
.ag-group input,
.ag-group select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: .92rem;
  color: #333;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s;
  background: #fff;
}
.ag-group input:focus,
.ag-group select:focus {
  border-color: #f5a623;
}

.ag-code-row {
  display: flex;
  gap: 8px;
}
.ag-code-row input {
  flex: 1;
}
.ag-code-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0 12px;
  height: 42px;
  border: 1px solid #f5a623;
  background: #fff5e0;
  color: #e8860a;
  border-radius: 8px;
  font-size: .82rem;
  cursor: pointer;
}
.ag-code-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.ag-hint {
  margin: -4px 0 10px;
  font-size: .82rem;
  color: #e8860a;
}
.ag-hint:empty {
  display: none;
}
.ag-hint a {
  color: #e8860a;
  text-decoration: underline;
  font-weight: 600;
}
.ag-error {
  margin-bottom: 10px;
  font-size: .82rem;
  color: #d4380d;
}
.ag-error:empty {
  display: none;
  margin: 0;
}
.ag-ok {
  min-height: 18px;
  margin-bottom: 10px;
  font-size: .82rem;
  color: #389e0d;
}

.ag-submit {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff9a2e, #f5c842);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.ag-submit:hover {
  opacity: .92;
}
.ag-submit:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.ag-switch {
  margin: 14px 0 0;
  text-align: center;
  font-size: .84rem;
  color: #999;
}
.ag-switch a {
  color: #e8860a;
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 480px) {
  .ag-row {
    flex-direction: column;
    gap: 0;
  }
  .ag-card {
    padding: 18px 16px 0;
  }
}

/* ===== 手机号已注册确认弹窗 ===== */
@keyframes agFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.ag-dialog-mask {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .4);
  animation: agFade .18s ease;
}
.ag-dialog {
  width: 100%;
  max-width: 320px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .22);
  padding: 22px 20px 18px;
  text-align: center;
}
.ag-dialog-text {
  margin: 0 0 18px;
  font-size: .98rem;
  color: #333;
  line-height: 1.6;
}
.ag-dialog-btns {
  display: flex;
  gap: 12px;
}
.ag-dialog-btn {
  flex: 1;
  height: 42px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
}
.ag-dialog-btn.primary {
  border: none;
  background: linear-gradient(135deg, #ff9a2e, #f5c842);
  color: #fff;
  font-weight: 600;
}
.ag-dialog-btn:hover {
  opacity: .9;
}
