/* ============================================================
   基础排版与通用元件（按钮 / 输入 / 卡片 / 徽章 / 开关 / 工具类）
   依赖 variables.css 设计令牌。
   ============================================================ */

/* ---- 图标尺寸 ---- */
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }

/* ---- 标题 ---- */
h1, .h1 { font-size: var(--fs-3xl); line-height: 1.25; font-weight: 700; letter-spacing: 0.5px; }
h2, .h2 { font-size: var(--fs-2xl); line-height: 1.3; font-weight: 700; }
h3, .h3 { font-size: var(--fs-xl); line-height: 1.4; font-weight: 600; }
h4, .h4 { font-size: var(--fs-lg); font-weight: 600; }

.text-grad {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- 链接 ---- */
a.link, .link { color: var(--neon-cyan); transition: color var(--t-fast) var(--ease); }
a.link:hover, .link:hover { color: var(--neon-magenta); }

/* ---- 按钮体系 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 9px 18px; border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: 600; letter-spacing: 0.3px;
  color: var(--tx-1); border: 1px solid transparent; cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast);
  user-select: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--grad-brand); color: var(--tx-on-neon);
  box-shadow: var(--glow-brand);
}
.btn-primary:hover { box-shadow: 0 8px 34px rgba(79, 124, 255, 0.55); transform: translateY(-1px); }

.btn-ghost {
  background: var(--bg-glass); border-color: var(--line-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: var(--bg-3); border-color: var(--line-glow); }

.btn-danger {
  background: rgba(255, 93, 115, 0.12); color: var(--danger);
  border-color: rgba(255, 93, 115, 0.35);
}
.btn-danger:hover { background: rgba(255, 93, 115, 0.22); }

.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-md); flex: none;
  color: var(--tx-2); background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.btn-icon:hover { background: var(--bg-3); color: var(--tx-1); border-color: var(--line-1); }
.btn-icon.is-active { color: var(--neon-cyan); background: rgba(0, 229, 255, 0.1); border-color: var(--line-glow); }

/* ---- 输入体系 ---- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field[hidden] { display: none; } /* 类选择器的 display 会覆盖 hidden 的 UA 默认样式，须显式补回 */
.field-label { font-size: var(--fs-sm); color: var(--tx-2); font-weight: 500; }

.input, .textarea, .select {
  width: 100%; padding: 10px 14px;
  background: var(--bg-glass); border: 1px solid var(--line-1);
  border-radius: var(--r-md); color: var(--tx-1); font-size: var(--fs-md);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--tx-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--line-glow);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12), var(--glow-cyan);
  background: var(--bg-glass-strong);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.select { appearance: none; cursor: pointer; }
.select option { background: var(--bg-1); color: var(--tx-1); }

.input-group { position: relative; }
.input-group .input { padding-left: 40px; }
.input-group > .i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--tx-3); pointer-events: none;
}

/* ---- 卡片 ---- */
.card {
  background: var(--bg-2); border: 1px solid var(--line-1);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.glass {
  background: var(--bg-glass); border: 1px solid var(--line-1);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}

/* ---- 徽章 ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.4px;
  background: var(--bg-3); color: var(--tx-2); border: 1px solid var(--line-1);
}
.badge-vip {
  background: var(--grad-gold); color: #2a1a05; border: none;
  box-shadow: 0 0 14px rgba(255, 200, 87, 0.4);
}
.badge-free {
  background: rgba(52, 245, 197, 0.12); color: var(--neon-green);
  border-color: rgba(52, 245, 197, 0.35);
}

/* ---- 顶栏会员徽章：未开通灰显；档位从低到高渐显尊贵 ---- */
.badge-none {
  background: var(--bg-3); color: var(--tx-3);
  border: 1px dashed var(--line-2); box-shadow: none;
}
.badge-tier { border: none; color: #fff; position: relative; overflow: hidden; }
.badge-tier.tier-lite {
  background: linear-gradient(135deg, #2bb3c0, #5ce1e6); color: #06333a;
  box-shadow: 0 0 10px rgba(92, 225, 230, 0.35);
}
.badge-tier.tier-pro {
  background: linear-gradient(135deg, #4f7cff, #7aa2ff);
  box-shadow: 0 0 12px rgba(79, 124, 255, 0.45);
}
.badge-tier.tier-max {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  box-shadow: 0 0 14px rgba(155, 124, 255, 0.5);
}
.badge-tier.tier-ultra {
  background: linear-gradient(135deg, #f5a623, #ffc857); color: #2a1a05;
  box-shadow: 0 0 16px rgba(255, 200, 87, 0.55);
}
.badge-tier.tier-prestige {
  background: linear-gradient(135deg, #ff7ab8, #ffc857, #ff9a5c); color: #33110a;
  box-shadow: 0 0 20px rgba(255, 143, 184, 0.6);
}
.badge-tier.tier-prestige::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  transform: translateX(-120%); animation: badgeShine 2.6s ease-in-out infinite;
}
@keyframes badgeShine {
  0% { transform: translateX(-120%); }
  60%, 100% { transform: translateX(120%); }
}

/* ---- 开关 ---- */
.switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .sw-track {
  width: 100%; height: 100%; border-radius: var(--r-full);
  background: var(--bg-3); border: 1px solid var(--line-2);
  transition: background var(--t-mid) var(--ease), border-color var(--t-mid);
  position: relative;
}
.switch .sw-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--tx-2);
  transition: transform var(--t-mid) var(--ease), background var(--t-mid);
}
.switch input:checked + .sw-track {
  background: var(--grad-brand); border-color: transparent;
  box-shadow: var(--glow-cyan);
}
.switch input:checked + .sw-track::after { transform: translateX(18px); background: #fff; }

/* ---- 标签 ---- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--tx-2);
  background: var(--grad-brand-soft); border: 1px solid var(--line-1);
}

/* ---- 分隔线 ---- */
.divider, hr { border: none; height: 1px; background: var(--line-1); margin: var(--sp-4) 0; }

/* ---- 头像 ---- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 700; flex: none;
  background: var(--grad-brand); overflow: hidden; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-guest { background: rgba(148, 163, 184, .25); color: var(--tx-2); border: 1px dashed var(--line-2); }

/* ---- 系统通知弹窗 ---- */
.ntf-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.ntf-item {
  border: 1px solid var(--line-1); border-radius: 12px; padding: 12px 14px;
  background: rgba(10, 13, 31, .4); cursor: pointer; transition: border-color .2s ease;
}
.ntf-item:hover { border-color: var(--line-2); }
.ntf-item.unread { border-color: rgba(79, 124, 255, .45); background: rgba(79, 124, 255, .07); }
.ntf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ntf-title { font-weight: 600; font-size: 14px; }
.ntf-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neon-blue, #4f7cff); flex: none; box-shadow: 0 0 6px rgba(79, 124, 255, .8); }
.ntf-content { margin-top: 6px; font-size: 13px; color: var(--tx-2); white-space: pre-wrap; word-break: break-word; }
.ntf-foot { margin-top: 8px; display: flex; justify-content: space-between; font-size: 12px; color: var(--tx-3); }
.ntf-from { color: var(--neon-cyan, #00e5ff); }

/* ---- 通知赠品（任务9） ---- */
.ntf-gift {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px dashed rgba(255, 200, 87, .45); background: rgba(255, 200, 87, .06);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.ntf-gift-items { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--tx-2); }
.ntf-gift-items .gift-ic { color: var(--neon-amber, #ffc857); display: inline-flex; }
.ntf-gift-chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px;
  background: rgba(255, 200, 87, .12); border: 1px solid rgba(255, 200, 87, .3);
  color: var(--neon-amber, #ffc857); font-weight: 600;
}
.ntf-gift-btn { flex: none; }
.ntf-gift-done { font-size: 12px; color: var(--neon-green, #34f5c5); display: inline-flex; align-items: center; gap: 4px; }

/* ---- 工具类 ---- */
.flex { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--tx-3); font-size: var(--fs-sm); }

/* ---- 手机端防输入聚焦自动放大 ----
   iOS 10+ 忽略 user-scalable=no，可输入元素字号须 ≥16px 才能杜绝聚焦缩放 */
@media (max-width: 768px) {
  .input, .textarea, .select, input, textarea, select { font-size: 16px; }
}
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }

/* ---- 字号偏好（设置页可切换） ---- */
[data-font="small"] { --fs-md: 13px; --fs-sm: 12px; --fs-lg: 15px; }
[data-font="large"] { --fs-md: 15px; --fs-sm: 14px; --fs-lg: 17px; }
