/* ==========================================================================
   h5/styles/base.css — reset + 全局排版 + 通用类
   全部颜色 / 间距 / 圆角 / 动效均取自 ../design/design-tokens.css，零硬编码色值
   ========================================================================== */

/* 安全区兜底：部分安卓微信 env() 返回 0，先写 constant() 再被 env() 覆盖 */
:root { --safe-area-bottom: constant(safe-area-inset-bottom, 0px); }
@supports (bottom: env(safe-area-inset-bottom)) {
  :root { --safe-area-bottom: env(safe-area-inset-bottom, 0px); }
}

/* 卡片布局双轨 Token（裁决 1）：已并入 design/design-tokens.css，
   其中 :root 与 [data-mode] 均已定义 youth 2 列 / parent 1 列，此处不再重复声明。
   --space-gap 为零引用遗留变量，已移除。 */

*, *::before, *::after { box-sizing: border-box; }

/* [hidden] 必须压住一切 display 声明。
   .app-header / .tabbar 都是 display:flex，与 [hidden] 特异性相同，
   后加载的样式表会把 display:none 覆盖掉 —— 结果身份页顶部仍露着身份切换器、
   底部仍露着 TabBar，而身份还没选，导航本来不成立。 */
[hidden] { display: none !important; }

/* 字体跟随系统（R3-4）：
   字号令牌已全部 rem 化，html 字号是全站文字的唯一缩放锚点。
   「跟随系统」= 不锁定 text-size-adjust，安卓 WebView / 部分浏览器会按系统字号放大；
   手动档位用 html[data-fs] 缩放（iOS 系统字号对网页生效有限，用档位补偿）。 */
html { font-size: 100%; -webkit-text-size-adjust: auto; text-size-adjust: auto; }
html[data-fs="std"] { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-fs="lg"] { font-size: 112.5%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-fs="xl"] { font-size: 125%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* v5.1 修正：整页红渐变导致非卡片内容的深色文字全部不可读（用户真机反馈）。
   红渐变只保留在顶栏与 hero 头图区（theme-festive），正文回归暖白底。 */
body {
  margin: 0;
  background: var(--color-canvas);
  color: var(--color-fg-body);
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-normal);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 {
  font-weight: var(--font-weight-semibold);
  color: var(--color-fg-strong);
  line-height: var(--line-height-snug);
}
h1 { font-size: var(--font-size-title-lg); letter-spacing: var(--letter-spacing-tight); }
h2 { font-size: var(--font-size-title); letter-spacing: var(--letter-spacing-tight); }
h3 { font-size: var(--font-size-title-sm); }
h4 { font-size: var(--font-size-lead); }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }

button { font: inherit; color: inherit; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--color-accent); text-decoration: none; }

/* 无障碍：禁止 outline:none 无替代 */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-accent);
  outline-offset: var(--focus-ring-offset);
}

/* 图标三档尺寸，颜色由 currentColor 继承 */
.icon { width: var(--size-icon-24); height: var(--size-icon-24); flex: none; display: inline-block; vertical-align: middle; }
.icon--16 { width: var(--size-icon-16); height: var(--size-icon-16); }
.icon--20 { width: var(--size-icon-20); height: var(--size-icon-20); }

/* ---------- 应用骨架：430px 上限居中，切换器 sticky，底部 TabBar sticky ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--layout-page-gutter);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-header__bell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--size-tap-min);
  min-height: var(--size-tap-min);
  color: var(--color-fg-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--easing-standard);
}
.app-header__bell:active { color: var(--color-accent); }

/* 首次进入的一次性提示条 */
.hint-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--layout-page-gutter);
  background: var(--color-info-soft);
  border-bottom: 1px solid var(--color-info-border);
  color: var(--color-info);
  font-size: var(--font-size-xs);
}
.hint-bar[hidden] { display: none; }
.hint-bar__text { flex: 1; }
.hint-bar__close {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--size-tap-min);
  min-height: var(--size-tap-min);
  color: var(--color-info);
}

.app-main { flex: 1; padding: var(--space-4) var(--layout-page-gutter); }
.view[hidden] { display: none; }

/* ---------- 通用类 ---------- */
.u-num { font-family: var(--font-family-num); font-variant-numeric: tabular-nums; }
.u-caps { letter-spacing: var(--letter-spacing-caps); }
.u-muted { color: var(--color-fg-muted); }
.u-strong { color: var(--color-fg-strong); }
.u-sm { font-size: var(--font-size-sm); }
.u-xs { font-size: var(--font-size-xs); }
.u-row { display: flex; align-items: center; gap: var(--space-2); }
.u-stack { display: flex; flex-direction: column; gap: var(--space-2); }
.u-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.u-divider { height: 1px; background: var(--color-border); }
.u-tap { min-width: var(--size-tap-min); min-height: var(--size-tap-min); }
.u-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 用伪元素扩大视觉小按钮的热区，不改视觉尺寸（youth 44 / parent 60） */
.u-hit { position: relative; }
.u-hit::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: max(100%, var(--size-tap-min));
  height: max(100%, var(--size-tap-min));
  transform: translate(-50%, -50%);
}

/* 骨架屏微光：降低动效偏好下停止 */
@keyframes u-shimmer {
  from { background-position: -160px 0; }
  to { background-position: 160px 0; }
}
.u-skeleton {
  background-color: var(--color-surface-sunken);
  background-image: linear-gradient(90deg, var(--color-surface-sunken), var(--color-surface-2), var(--color-surface-sunken));
  background-size: 160px 100%;
  background-repeat: no-repeat;
  border-radius: var(--radius-sm);
  opacity: var(--opacity-skeleton);
  animation: u-shimmer 1200ms var(--easing-linear) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .u-skeleton { animation: none; }
}

/* 会员自助卡（我的页，server 模式渲染；样式挂在 base 供 07/07b 共用） */
/* 卡内行没有图标/箭头，不能沿用 .pf-row 的「20px 1fr auto 20px」栅格，
   否则文字会落进 20px 的图标列被挤成竖排。这里整体改回横排弹性布局。 */
.pf-member .pf-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: 10px var(--space-4); }
.pf-member .pf-row__label { flex: 1 1 auto; min-width: 0; }
.pf-member .pf-row > .u-sm.u-muted { flex: 0 0 auto; text-align: right; }
.pf-member .pf-row > .chip { flex: 0 0 auto; }
.pf-member__tabs { display: flex; gap: var(--space-2); padding: 10px var(--space-4) 0; }
.pf-member__form { display: flex; flex-direction: column; gap: 10px; padding: 4px var(--space-4) 12px; }
.pf-member__form .mmx-code-row { display: flex; gap: 8px; align-items: center; }
.pf-member__form .mmx-code-row .mmx-input { flex: 1; }
.pf-member__form .mmx-send { font-size: 12px; color: var(--color-fg-muted); white-space: nowrap; }
.pf-member__err { margin: 0; font-size: 13px; }
.pf-member__tip { display: flex; gap: 6px; align-items: flex-start; margin: 0; font-size: 12px; color: var(--color-fg-muted); }
.pf-member__pend { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 12px; }
.pf-member__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-member__field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.pf-member__field--wide { grid-column: 1 / -1; }
