/* ============================================================
 * 汉字睿训营 · 云端登录门禁样式
 * 独立命名空间 hcg-，避免与游戏内样式互相污染
 * ============================================================ */

#huer-cloud-gate {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  /* 不能用 align-items:center：内容高于视口时，flex 居中会把卡片顶部顶到滚动区之外，
     滚也滚不回来（矮窗口 / 横屏 / 放大字号时必现）。
     这里默认贴顶；卡片确实放得下时，脚本会加 .hcg-fit-cent 再居中（safe center 在
     flex 交叉轴上并不会因溢出退化，实测仍会裁掉顶部，只能靠 JS 判断）。 */
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(120% 120% at 50% 0%, #EEF2FF 0%, #F8FAFC 55%, #EEF2FF 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: opacity .38s ease, transform .38s ease;
  overflow-y: auto;
}

#huer-cloud-gate.hcg-fit-cent { align-items: center; }

#huer-cloud-gate.is-out {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

#huer-cloud-gate .hcg-card {
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border-radius: 28px;
  box-shadow: 0 24px 60px -18px rgba(30, 27, 75, .28), 0 2px 8px rgba(30, 27, 75, .06);
  padding: 28px 26px 24px;
  box-sizing: border-box;
}

#huer-cloud-gate .hcg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#huer-cloud-gate .hcg-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 15px;
  border: 0;
  background: #FFFFFF;
  color: #1E1B3A;
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "KaiTi", "STKaiti", serif;
  padding: 5px;
  box-sizing: border-box;
  box-shadow: 0 6px 16px -8px rgba(79, 70, 229, .45);
}

#huer-cloud-gate .hcg-title {
  font-size: 20px;
  font-weight: 800;
  color: #1E1B4B;
  letter-spacing: .5px;
  line-height: 1.2;
}

#huer-cloud-gate .hcg-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #94A3B8;
  letter-spacing: .2px;
}

#huer-cloud-gate .hcg-lead {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  color: #475569;
  background: #F8FAFC;
  border-radius: 14px;
  padding: 12px 14px;
}

#huer-cloud-gate .hcg-field {
  display: block;
  margin-bottom: 14px;
}

#huer-cloud-gate .hcg-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  margin-bottom: 7px;
  letter-spacing: .5px;
}

#huer-cloud-gate input {
  width: 100%;
  box-sizing: border-box;
  height: 50px;
  border-radius: 14px;
  border: 1.5px solid #E2E8F0;
  background: #F8FAFC;
  padding: 0 14px;
  font-size: 16px;
  color: #0F172A;
  outline: none;
  transition: border-color .18s, background .18s, box-shadow .18s;
  font-family: inherit;
}

#huer-cloud-gate input:focus {
  border-color: #6366F1;
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}

#huer-cloud-gate input::placeholder {
  color: #B6C2D2;
}

#huer-cloud-gate .hcg-code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

#huer-cloud-gate .hcg-code-row input {
  flex: 1 1 auto;
  min-width: 0;
}

#huer-cloud-gate button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

#huer-cloud-gate .hcg-btn-ghost {
  flex: 0 0 auto;
  height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  background: #EEF2FF;
  color: #4F46E5;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .18s, opacity .18s;
}

#huer-cloud-gate .hcg-btn-ghost:hover { background: #E0E7FF; }
#huer-cloud-gate .hcg-btn-ghost:disabled { opacity: .55; cursor: default; }

#huer-cloud-gate .hcg-btn {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, .8);
  transition: transform .16s, box-shadow .16s, opacity .16s;
}

#huer-cloud-gate .hcg-btn:hover { transform: translateY(-1px); }
#huer-cloud-gate .hcg-btn:active { transform: translateY(0); }
#huer-cloud-gate .hcg-btn:disabled { opacity: .6; cursor: default; transform: none; }

#huer-cloud-gate .hcg-btn-wechat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border-radius: 16px;
  background: #F0FDF4;
  border: 1.5px solid #BBF7D0;
  color: #15803D;
  font-size: 15px;
  font-weight: 700;
  transition: background .18s;
}

#huer-cloud-gate .hcg-btn-wechat:hover { background: #DCFCE7; }

#huer-cloud-gate .hcg-wx-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #22C55E;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#huer-cloud-gate .hcg-or {
  position: relative;
  text-align: center;
  margin: 16px 0 14px;
  color: #CBD5E1;
  font-size: 12px;
}

#huer-cloud-gate .hcg-or::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: #EEF2F7;
}

#huer-cloud-gate .hcg-or span {
  position: relative;
  background: #fff;
  padding: 0 10px;
}

#huer-cloud-gate .hcg-err {
  margin: 2px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #FFF1F2;
  border: 1px solid #FFE4E6;
  color: #BE123C;
  font-size: 13px;
  line-height: 1.6;
}

#huer-cloud-gate .hcg-tip {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: #94A3B8;
  text-align: center;
}

/* 云端连不上时的提示条：先让人能用，再解释原因 */
#huer-cloud-gate .hcg-hint {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
  word-break: break-all;
}

#huer-cloud-gate .hcg-stage[data-stage="error"] .hcg-btn { margin-bottom: 10px; }

#huer-cloud-gate .hcg-spin {
  width: 34px;
  height: 34px;
  margin: 14px auto 16px;
  border-radius: 50%;
  border: 3px solid #E0E7FF;
  border-top-color: #4F46E5;
  animation: hcg-spin .9s linear infinite;
}

@keyframes hcg-spin { to { transform: rotate(360deg); } }

#huer-cloud-gate .hcg-msg {
  text-align: center;
  font-size: 13.5px;
  color: #64748B;
  padding-bottom: 8px;
}

/* ---------------- 账号胶囊 ---------------- */
.hcg-account {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 2147482000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 11px;
  border: 2.5px solid #1E1B3A;
  border-radius: 999px;
  background: #fff;
  box-shadow: 3px 3px 0 rgba(30, 27, 58, .9);
  color: #1E1B3A;
  font-size: 12px;
  font-weight: 800;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}

.hcg-account:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(30, 27, 58, .9); }

.hcg-account[data-sync="同步失败"] { color: #BE123C; }
.hcg-account[data-sync="同步中"] { color: #B45309; }

.hcg-account-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}

.hcg-account[data-sync="同步失败"] .hcg-account-dot { background: #F43F5E; box-shadow: 0 0 0 3px rgba(244, 63, 94, .16); }
.hcg-account[data-sync="同步中"] .hcg-account-dot { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }

/* ---------------- 账号面板 ---------------- */
.hcg-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  background: rgba(15, 23, 42, .38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (min-width: 620px) {
  .hcg-sheet-mask { align-items: center; }
}

.hcg-sheet {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 24px;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 60px -18px rgba(15, 23, 42, .4);
  box-sizing: border-box;
}

.hcg-sheet-head {
  font-size: 16px;
  font-weight: 800;
  color: #1E1B4B;
  margin-bottom: 14px;
}

.hcg-sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 13.5px;
  color: #64748B;
}

.hcg-sheet-row b {
  color: #0F172A;
  font-weight: 700;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hcg-sheet .hcg-btn,
.hcg-sheet .hcg-btn-ghost {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.hcg-sheet .hcg-btn {
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  color: #fff;
}

.hcg-sheet .hcg-btn-ghost {
  background: #F8FAFC;
  color: #64748B;
  border: 1.5px solid #E2E8F0;
}

.hcg-sheet .hcg-tip {
  margin: 14px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: #94A3B8;
  text-align: center;
}

/* ---------------- 轻提示 ---------------- */
.hcg-toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  z-index: 2147483600;
  transform: translate(-50%, 12px);
  background: rgba(15, 23, 42, .9);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity .24s, transform .24s;
  pointer-events: none;
  max-width: 80vw;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hcg-toast.is-in { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 窄屏适配 ---------------- */
@media (max-width: 400px) {
  #huer-cloud-gate { padding: 14px; }
  #huer-cloud-gate .hcg-card { border-radius: 24px; padding: 22px 18px 18px; }
  #huer-cloud-gate .hcg-logo { width: 46px; height: 46px; flex-basis: 46px; padding: 4px; font-size: 23px; border-radius: 14px; }
  #huer-cloud-gate .hcg-title { font-size: 18px; }
  #huer-cloud-gate .hcg-btn-ghost { padding: 0 12px; font-size: 13px; }
  .hcg-account { left: 10px; bottom: 10px; height: 32px; font-size: 11.5px; }
}

@media (max-height: 620px) {
  #huer-cloud-gate { align-items: flex-start; }
  #huer-cloud-gate .hcg-card { margin: 10px 0; }
}

/* 手机 / 平板：底部 Tab 会盖住账号胶囊，抬到 Tab 之上并避开安全区 */
@media (max-width: 1023px) {
  .hcg-account { left: 10px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}

/* 桌面：侧栏底部是成长卡，胶囊改挂右下角，落在页面底部留白里 */
@media (min-width: 1024px) {
  .hcg-account { left: auto; right: 22px; bottom: 10px; height: 30px; font-size: 11.5px; }
}

#huer-cloud-gate .hcg-logo img {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
