/* =========================================
   HuiShao Subscribe Page (subscribe.css)
   目标：
   1) 不依赖 body.is-fullpage（避免被主题规则误伤）
   2) 桌面端：卡片居中、包裹感强、与主题共存但不被打散
   3) 移动端：彻底修复错位（label/输入/按钮/上传区），更紧凑更好看
   4) 黑夜模式：卡片/输入/按钮/提示/描边/阴影 全部适配
   5) 不改 HTML（仅通过 .hs-subscribe-page 系列类名控制）
   ========================================= */


/* =========================================================
   A) 主题色 Token（关键：把“颜色写死”改成变量）
   - 默认亮色
   - 黑夜模式：跟随 html[data-user-color-scheme="dark"]
   - 兜底：系统暗色 prefers-color-scheme: dark（可选）
   ========================================================= */

/* ---------- A1) 默认亮色变量 ---------- */
:root{
  /* 页面背景（订阅页外层背景色，一般透明交给主题） */
  --hs-page-bg: transparent;

  /* 卡片层 */
  --hs-card-bg: rgba(255, 255, 255, 0.94);
  --hs-card-border: rgba(61, 133, 198, 0.22);
  --hs-card-inner-border: rgba(61, 133, 198, 0.10);

  /* 文本颜色 */
  --hs-text: #1f3144;
  --hs-text-2: rgba(31, 49, 68, 0.82);
  --hs-text-3: rgba(31, 49, 68, 0.78);

  /* 分割线 */
  --hs-divider: rgba(61, 133, 198, 0.12);

  /* 上传区 */
  --hs-uploader-bg: rgba(255, 255, 255, 0.72);
  --hs-uploader-bg-hover: rgba(255, 255, 255, 0.82);
  --hs-uploader-border: rgba(61, 133, 198, 0.35);
  --hs-uploader-border-focus: rgba(61, 133, 198, 0.55);
  --hs-uploader-drag-border: rgba(255, 132, 183, 0.60);
  --hs-uploader-drag-bg: rgba(255, 255, 255, 0.88);

  /* 输入框 */
  --hs-input-bg: rgba(255, 255, 255, 0.86);
  --hs-input-border: rgba(61, 133, 198, 0.22);
  --hs-focus-border: rgba(61, 133, 198, 0.55);
  --hs-focus-ring: rgba(61, 133, 198, 0.12);

  /* 按钮 */
  --hs-btn-bg: rgba(255, 255, 255, 0.70);
  --hs-btn-bg-hover: rgba(255, 255, 255, 0.82);
  --hs-btn-border: rgba(61, 133, 198, 0.18);
  --hs-btn-border-hover: rgba(61, 133, 198, 0.26);

  /* 主按钮（保持你喜欢的蓝粉渐变） */
  --hs-btn-primary-bg: linear-gradient(90deg, rgba(61, 133, 198, 0.92), rgba(255, 132, 183, 0.82));
  --hs-btn-primary-border: rgba(255, 255, 255, 0.22);

  /* 提示条（默认信息） */
  --hs-tip-bg: rgba(61, 133, 198, 0.08);
  --hs-tip-border: rgba(61, 133, 198, 0.14);
  --hs-tip-ok-bg: rgba(46, 204, 113, 0.10);
  --hs-tip-ok-border: rgba(46, 204, 113, 0.25);
  --hs-tip-warn-bg: rgba(241, 196, 15, 0.10);
  --hs-tip-warn-border: rgba(241, 196, 15, 0.25);
  --hs-tip-err-bg: rgba(231, 76, 60, 0.10);
  --hs-tip-err-border: rgba(231, 76, 60, 0.25);

  /* 阴影（两层：外投影 + inset 高光） */
  --hs-card-shadow-outer: 0 22px 70px rgba(0, 0, 0, 0.16);
  --hs-card-shadow-inset: 0 1px 0 rgba(255, 255, 255, 0.65) inset;

  /* 上传区 hover 阴影 */
  --hs-soft-shadow: 0 12px 26px rgba(0, 0, 0, 0.10);
}

/* ---------- A2) 黑夜模式变量（跟随你的 darkmode 脚本） ----------
   你的脚本通常会给 <html> 打 data-user-color-scheme="dark"
   所以这里用它作为暗色入口
*/
html[data-user-color-scheme="dark"]{
  --hs-page-bg: transparent;

  /* 卡片：暗底 + 蓝系描边（不刺眼） */
  --hs-card-bg: rgba(20, 26, 34, 0.92);
  --hs-card-border: rgba(120, 170, 255, 0.20);
  --hs-card-inner-border: rgba(120, 170, 255, 0.12);

  /* 文本：亮字（别用纯白，柔一点更耐看） */
  --hs-text: rgba(235, 244, 255, 0.92);
  --hs-text-2: rgba(235, 244, 255, 0.72);
  --hs-text-3: rgba(235, 244, 255, 0.68);

  --hs-divider: rgba(120, 170, 255, 0.16);

  /* 上传区：暗底半透明 */
  --hs-uploader-bg: rgba(10, 14, 20, 0.45);
  --hs-uploader-bg-hover: rgba(10, 14, 20, 0.56);
  --hs-uploader-border: rgba(120, 170, 255, 0.22);
  --hs-uploader-border-focus: rgba(120, 170, 255, 0.45);
  --hs-uploader-drag-border: rgba(255, 132, 183, 0.55);
  --hs-uploader-drag-bg: rgba(10, 14, 20, 0.62);

  /* 输入框：暗底 + 轻描边 */
  --hs-input-bg: rgba(10, 14, 20, 0.55);
  --hs-input-border: rgba(120, 170, 255, 0.22);
  --hs-focus-border: rgba(120, 170, 255, 0.45);
  --hs-focus-ring: rgba(120, 170, 255, 0.14);

  /* 按钮：暗底按钮 */
  --hs-btn-bg: rgba(10, 14, 20, 0.52);
  --hs-btn-bg-hover: rgba(10, 14, 20, 0.62);
  --hs-btn-border: rgba(120, 170, 255, 0.18);
  --hs-btn-border-hover: rgba(120, 170, 255, 0.28);

  /* 提示条：暗色下略亮一点 */
  --hs-tip-bg: rgba(120, 170, 255, 0.10);
  --hs-tip-border: rgba(120, 170, 255, 0.18);

  /* 阴影：更深一些 */
  --hs-card-shadow-outer: 0 22px 70px rgba(0, 0, 0, 0.55);
  --hs-card-shadow-inset: 0 1px 0 rgba(255, 255, 255, 0.08) inset;

  --hs-soft-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

/* ---------- A3) 兜底：系统暗色（如果你不想要可删除） ----------
   场景：用户没点灯泡，但系统就是暗色
*/
@media (prefers-color-scheme: dark){
  html:not([data-user-color-scheme]){
    --hs-card-bg: rgba(20, 26, 34, 0.92);
    --hs-card-border: rgba(120, 170, 255, 0.20);
    --hs-card-inner-border: rgba(120, 170, 255, 0.12);

    --hs-text: rgba(235, 244, 255, 0.92);
    --hs-text-2: rgba(235, 244, 255, 0.72);
    --hs-text-3: rgba(235, 244, 255, 0.68);

    --hs-divider: rgba(120, 170, 255, 0.16);

    --hs-uploader-bg: rgba(10, 14, 20, 0.45);
    --hs-uploader-bg-hover: rgba(10, 14, 20, 0.56);
    --hs-uploader-border: rgba(120, 170, 255, 0.22);
    --hs-uploader-border-focus: rgba(120, 170, 255, 0.45);
    --hs-uploader-drag-border: rgba(255, 132, 183, 0.55);
    --hs-uploader-drag-bg: rgba(10, 14, 20, 0.62);

    --hs-input-bg: rgba(10, 14, 20, 0.55);
    --hs-input-border: rgba(120, 170, 255, 0.22);
    --hs-focus-border: rgba(120, 170, 255, 0.45);
    --hs-focus-ring: rgba(120, 170, 255, 0.14);

    --hs-btn-bg: rgba(10, 14, 20, 0.52);
    --hs-btn-bg-hover: rgba(10, 14, 20, 0.62);
    --hs-btn-border: rgba(120, 170, 255, 0.18);
    --hs-btn-border-hover: rgba(120, 170, 255, 0.28);

    --hs-tip-bg: rgba(120, 170, 255, 0.10);
    --hs-tip-border: rgba(120, 170, 255, 0.18);

    --hs-card-shadow-outer: 0 22px 70px rgba(0, 0, 0, 0.55);
    --hs-card-shadow-inset: 0 1px 0 rgba(255, 255, 255, 0.08) inset;

    --hs-soft-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  }
}


/* =========================================================
   B) 基础 Reset（只作用订阅页）
   ========================================================= */

.hs-subscribe-page,
.hs-subscribe-page *{
  box-sizing: border-box;
}

/* 输入/按钮：避免主题全局样式造成 “圆角、字体、line-height” 抖动 */
.hs-subscribe-page input,
.hs-subscribe-page button,
.hs-subscribe-page label{
  font-family: inherit;
  max-width: 100%;
}


/* =========================================================
   C) 页面布局：强制居中（不依赖主题结构）
   ========================================================= */

.hs-subscribe-page{
  width: 100% !important;
  padding: 26px 14px 80px !important;

  display: flex !important;
  justify-content: center !important;

  /* 页面背景一般给主题，这里只留接口 */
  background: var(--hs-page-bg);
}


/* =========================================================
   D) 卡片：真正的“框子”
   ========================================================= */

.hs-subscribe-page .hs-subscribe-card{
  width: 100% !important;
  max-width: 760px !important;  /* 桌面端宽度 */
  margin: 0 auto !important;

  position: relative !important;
  border-radius: 18px !important;
  padding: 22px 22px 26px !important;

  /* 关键：颜色全部走变量（才能暗色生效） */
  background: var(--hs-card-bg) !important;
  border: 1px solid var(--hs-card-border) !important;

  box-shadow: var(--hs-card-shadow-outer), var(--hs-card-shadow-inset) !important;
  overflow: hidden !important;
}

/* 卡片内框：更明显的包裹感 */
.hs-subscribe-page .hs-subscribe-card::before{
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px solid var(--hs-card-inner-border);
  pointer-events: none;
}


/* =========================================================
   E) 标题区
   ========================================================= */

.hs-subscribe-head{
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hs-divider);
}

.hs-subscribe-title{
  margin: 0 0 6px;
  font-size: 1.55rem;
  line-height: 1.25;
  color: var(--hs-text);
  font-weight: 900;
}

.hs-subscribe-subtitle{
  margin: 0;
  font-size: .95rem;
  line-height: 1.6;
  color: var(--hs-text-2);
}


/* =========================================================
   F) 区块标题
   ========================================================= */

.hs-subscribe-section{
  margin-top: 18px;
}

.hs-subscribe-label{
  margin: 0 0 10px;
  font-weight: 900;
  color: var(--hs-text);
}


/* =========================================================
   G) 头像上传区
   ========================================================= */

.hs-avatar-uploader{
  border-radius: 16px;
  border: 1px dashed var(--hs-uploader-border);
  background: var(--hs-uploader-bg);
  padding: 16px;
  cursor: pointer;
  outline: none;

  transition: transform .18s ease,
              background .18s ease,
              border-color .18s ease,
              box-shadow .18s ease;
}

.hs-avatar-uploader:hover{
  background: var(--hs-uploader-bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--hs-soft-shadow);
}

.hs-avatar-uploader:focus{
  border-color: var(--hs-uploader-border-focus);
  box-shadow: 0 0 0 3px var(--hs-focus-ring);
}

.hs-avatar-uploader.is-dragover{
  border-color: var(--hs-uploader-drag-border);
  background: var(--hs-uploader-drag-bg);
  box-shadow: 0 12px 28px rgba(255, 132, 183, 0.12);
}

.hs-avatar-preview{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 118px;
}

.hs-avatar-placeholder{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--hs-text);
}

/* 左侧渐变小块：暗色下也更协调 */
.hs-avatar-icon{
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(61, 133, 198, 0.20), rgba(255, 132, 183, 0.18));
  border: 1px solid var(--hs-card-inner-border);
}

/* 暗色下把渐变压暗一点（更耐看） */
html[data-user-color-scheme="dark"] .hs-avatar-icon{
  background: linear-gradient(90deg, rgba(120,170,255,0.18), rgba(255,132,183,0.14));
  border-color: rgba(120,170,255,0.16);
}

/* 文字提示 */
.hs-avatar-hint-title{
  font-weight: 900;
  margin-bottom: 3px;
  color: var(--hs-text);
}

.hs-avatar-hint-desc{
  font-size: .92rem;
  opacity: .82;
  color: var(--hs-text-2);
}

/* 已选头像 */
.hs-avatar-img{
  width: 108px;
  height: 108px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--hs-card-inner-border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.hs-avatar-tools{
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.hs-avatar-tip{
  font-size: .92rem;
  color: var(--hs-text-3);
}


/* =========================================================
   H) 表单行：桌面端保持横向对齐
   ========================================================= */

label.hs-input-row{
  display: flex !important;
  align-items: center;
  gap: 14px;
  margin: 12px 0 0;
  padding: 0;
}

.hs-input-label{
  flex: 0 0 120px;
  color: var(--hs-text);
  font-weight: 900;
  line-height: 1.2;
  margin: 0 !important;
}

/* 输入框：颜色全部走变量（暗色生效） */
.hs-input{
  flex: 1 1 auto;
  width: 100%;
  height: 44px;

  border-radius: 14px;
  border: 1px solid var(--hs-input-border);
  background: var(--hs-input-bg);

  padding: 10px 12px;
  outline: none;
  color: var(--hs-text);

  transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

/* placeholder 也要暗色适配 */
.hs-input::placeholder{
  color: var(--hs-text-2);
}

.hs-input:focus{
  border-color: var(--hs-focus-border);
  box-shadow: 0 0 0 3px var(--hs-focus-ring);
}


/* =========================================================
   I) 按钮：防止被主题变成“链接样式”
   ========================================================= */

.hs-btn{
  -webkit-appearance: none;
  appearance: none;

  border: 1px solid var(--hs-btn-border);
  background: var(--hs-btn-bg);
  color: var(--hs-text);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;

  transition: transform .18s ease,
              background .18s ease,
              box-shadow .18s ease,
              border-color .18s ease;
}

.hs-btn:hover{
  transform: translateY(-1px);
  background: var(--hs-btn-bg-hover);
  box-shadow: var(--hs-soft-shadow);
  border-color: var(--hs-btn-border-hover);
}

.hs-btn:active{
  transform: translateY(0);
}

.hs-btn-ghost{
  /* 轻按钮：亮色稍浅/暗色稍深都通过变量自动适配 */
  background: color-mix(in srgb, var(--hs-btn-bg) 85%, transparent 15%);
}

/* 主按钮：固定渐变 + 白字（暗色同样好看） */
.hs-btn-primary{
  border: 1px solid var(--hs-btn-primary-border);
  background: var(--hs-btn-primary-bg);
  color: #fff;
}


/* =========================================================
   J) 操作区 & 提示信息
   ========================================================= */

.hs-actions{
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 默认提示条 */
.hs-form-tip{
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--hs-tip-bg);
  border: 1px solid var(--hs-tip-border);
  color: var(--hs-text);
  font-size: .92rem;
}

/* 成功/警告/错误：保持你原来的风格 */
.hs-form-tip.is-ok{
  background: var(--hs-tip-ok-bg);
  border-color: var(--hs-tip-ok-border);
}

.hs-form-tip.is-warn{
  background: var(--hs-tip-warn-bg);
  border-color: var(--hs-tip-warn-border);
}

.hs-form-tip.is-err{
  background: var(--hs-tip-err-bg);
  border-color: var(--hs-tip-err-border);
}


/* =========================================================
   K) 移动端：彻底修复错位 + 更好看
   - 核心：label 行不要 flex，改成“标签在上，输入在下”
   - 按钮：两列栅格，主按钮全宽
   ========================================================= */

@media screen and (max-width: 640px){

  /* K1) 页面 padding：更舒展 */
  .hs-subscribe-page{
    padding: 14px 12px 60px !important;
  }

  /* K2) 卡片更贴合手机视觉 */
  .hs-subscribe-page .hs-subscribe-card{
    max-width: 520px !important;     /* 手机上别给到 760，视觉更集中 */
    width: 100% !important;
    padding: 18px 14px 18px !important;
    border-radius: 16px !important;
  }

  .hs-subscribe-page .hs-subscribe-card::before{
    inset: 8px;
    border-radius: 12px;
  }

  /* K3) 标题区更紧凑 */
  .hs-subscribe-head{
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .hs-subscribe-title{
    font-size: 1.28rem;
    line-height: 1.25;
  }

  .hs-subscribe-subtitle{
    font-size: .92rem;
  }

  /* K4) 上传区：减少空白、防换行错位 */
  .hs-avatar-uploader{
    padding: 14px;
    border-radius: 14px;
  }

  .hs-avatar-preview{
    min-height: 104px;
  }

  .hs-avatar-placeholder{
    gap: 12px;
  }

  .hs-avatar-icon{
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .hs-avatar-hint-title{
    font-size: .98rem;
  }

  .hs-avatar-hint-desc{
    font-size: .88rem;
  }

  /* 已选头像：缩小一些，避免挤压内容 */
  .hs-avatar-img{
    width: 88px;
    height: 88px;
    border-radius: 16px;
  }

  /* K5) 上传工具按钮：两列更整齐 */
  .hs-avatar-tools{
    gap: 10px;
    margin-top: 12px;
  }

  /* 让按钮变成半宽（两列） */
  .hs-avatar-tools .hs-btn{
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    height: 40px;
  }

  /* 提示文本独占一行 */
  .hs-avatar-tip{
    flex: 1 1 100%;
    font-size: .86rem;
    margin-top: 2px;
  }

  /* K6) 表单行：彻底改为块级（修复错位关键点） */
  label.hs-input-row{
    display: block !important;
    margin: 14px 0 0 !important;
  }

  .hs-input-label{
    display: block !important;
    width: 100% !important;
    flex: none !important;
    margin: 0 0 8px !important;
    font-size: .98rem;
  }

  .hs-input{
    display: block !important;
    width: 100% !important;
    flex: none !important;

    height: 46px;
    border-radius: 14px;
    padding: 12px 12px;

    /* 关键：iOS 防止输入框自动放大导致布局抖动 */
    font-size: 16px;
  }

  /* K7) 操作区：主按钮全宽 */
  .hs-actions{
    margin-top: 16px;
    gap: 10px;
  }

  .hs-actions .hs-btn-primary{
    width: 100%;
    height: 46px;
    border-radius: 14px;
    font-size: 1rem;
  }

  /* 提示条：全宽 + 更自然换行 */
  .hs-form-tip{
    width: 100%;
    font-size: .88rem;
    line-height: 1.5;
  }

  /* K8) 兜底：避免主题对 label / input 的奇怪 line-height/position */
  .hs-subscribe-page label{
    line-height: 1.2;
  }
}
