/* ==========================================================================
   base.css — 舞台 / 手机壳 / 状态栏 / 页面骨架 / 排版基线
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-body);
  color: var(--c-text-1);
  background:
    radial-gradient(1100px 580px at 18% 0%, var(--c-stage-1) 0%, transparent 62%),
    radial-gradient(900px 520px at 100% 100%, var(--c-stage-2) 0%, transparent 58%),
    var(--c-stage-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
::selection { background: var(--c-brand-ring); }
:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }
em, i { font-style: normal; }

/* 数字组件三写：数字族 / 等宽 / 正体。数字一律由 <span> 承载。 */
.num, .t-num, .t-price {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-style: normal;
}
b.num, strong.num { font-weight: var(--fw-m); }

/* ---------- 舞台 ---------- */
.stage {
  position: relative;   /* .stage__link 以舞台为锚，固定在右上角 */
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  width: 100%; overflow: hidden;
}
.stage__brand { display: flex; align-items: center; gap: var(--sp-3); }
/* 返回原型展厅：桌面舞台常驻左上；手机全屏落在底栏上方，任何页面都能直接回去 */
.stage__back {
  position: fixed; top: 16px; left: 16px; z-index: 600;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--c-line-2); border-radius: 980px;
  background: var(--c-glass); color: var(--c-text-1);
  font-size: 12px; font-weight: var(--fw-m); text-decoration: none;
  box-shadow: var(--sh-1);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.stage__back:hover { background: var(--c-brand-soft); color: var(--c-brand-ink); }
.stage__back:active { transform: scale(.97); }
@media (max-width: 480px) {
  .stage__back {
    top: auto; left: 12px; bottom: calc(66px + env(safe-area-inset-bottom));
    height: 30px; padding: 0 10px; font-size: 11px; opacity: .94;
  }
}
.stage__brand > span:last-child { display: flex; flex-direction: column; }
.stage__logo {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--c-brand);
  color: var(--c-on-brand); display: grid; place-items: center;
  box-shadow: var(--sh-brand);
}
.stage__title { display: block; font-size: var(--fs-15); font-weight: var(--fw-s); letter-spacing: -.01em; }
.stage__sub { display: block; font-size: var(--fs-12); color: var(--c-text-2); }
/* 舞台右上角：去 PC 后台（本页只放手机端，后台是另一个入口）。
   位置与外观以 docs/设计/01-视觉规范.md 4.9 为唯一基准，勿在别处再写布局覆盖。 */
.stage__link {
  position: absolute; top: var(--sp-16); right: var(--sp-16);
  display: inline-flex; align-items: center; gap: var(--sp-4);
  height: 32px; padding: 0 var(--sp-12);
  border-radius: var(--r-99); background: var(--c-card);
  color: var(--c-brand-ink); font-size: var(--fs-12); font-weight: var(--fw-m);
  box-shadow: var(--sh-1); border: 1px solid var(--c-line);
  transition: background var(--t-fast), transform var(--t-fast);
}
.stage__link:active { transform: scale(.97); background: var(--c-brand-soft); }

/* ---------- 手机壳 ---------- */
.device {
  position: relative;
  width: var(--w-device); height: var(--h-device);
  background: var(--c-bg);
  border-radius: var(--r-device);
  box-shadow:
    0 0 0 10px var(--c-device-frame),
    0 0 0 12px var(--c-device-edge),
    var(--sh-device);
  overflow: hidden;
  isolation: isolate;
  flex: 0 0 auto;
}
.device__notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 28px; background: var(--c-device-frame); border-radius: var(--r-pill);
  z-index: 60; pointer-events: none;
}
.screen { position: absolute; inset: 0; overflow: hidden; }

/* ---------- 状态栏 ---------- */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--h-status);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-6) 0 var(--sp-6);
  font-size: var(--fs-13); font-weight: var(--fw-s);
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal;
  color: var(--c-text-1); z-index: 55; pointer-events: none;
  transition: color var(--t-base) var(--ease-out);
}
.statusbar__right { display: flex; align-items: center; gap: var(--sp-1); }
.statusbar--light { color: var(--c-on-brand); }
.homebar {
  position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: var(--r-pill);
  background: var(--c-text-1); opacity: .28; z-index: 58; pointer-events: none;
}

/* ---------- 页面容器与转场 ---------- */
.page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--c-bg);
  will-change: transform, opacity;
  z-index: 10;
}
.page--active { transform: none; }
.page--enter-right { transform: translateX(100%); opacity: .96; }
.page--enter-right.page--anim { transform: none; opacity: 1; transition: transform var(--t-page) var(--ease-out), opacity var(--t-page) var(--ease-out); }
.page--leave-right { transform: none; }
.page--leave-right.page--anim { transform: translateX(100%); opacity: .96; transition: transform var(--t-page) var(--ease-out), opacity var(--t-page) var(--ease-out); }
.page--behind { transform: translateX(-22%); }
.page--behind.page--anim { transition: transform var(--t-page) var(--ease-out), opacity var(--t-page); opacity: .82; }
.page--fade { opacity: 0; transform: translateY(6px); }
.page--fade.page--anim { opacity: 1; transform: none; transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out); }

/* 导航栏 */
.navbar {
  position: relative; flex: 0 0 auto;
  padding-top: var(--h-status);
  background: var(--c-card);
  z-index: 20;
}
.navbar__in {
  height: var(--h-nav); display: flex; align-items: center;
  padding: 0 var(--sp-3); gap: var(--sp-2);
}
.navbar__title {
  flex: 1; min-width: 0;
  font-size: var(--fs-16); font-weight: var(--fw-s); letter-spacing: -.01em;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.navbar__title--left { text-align: left; padding-left: var(--sp-2); }
.navbar__sub { display: block; font-size: var(--fs-11); font-weight: var(--fw-r); color: var(--c-text-2); margin-top: 1px; }
.navbar__btn {
  flex: 0 0 auto; min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); color: var(--c-text-1);
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.navbar__btn:active { background: var(--c-fill); transform: scale(.94); }
.navbar__btn--text { padding: 0 var(--sp-4); font-size: var(--fs-13); color: var(--c-brand); font-weight: var(--fw-m); }
.navbar__side { flex: 0 0 auto; display: flex; align-items: center; gap: var(--sp-1); min-width: 34px; justify-content: flex-end; }
.navbar--brand { background: var(--c-brand); }
.navbar--brand .navbar__title, .navbar--brand .navbar__btn { color: var(--c-on-brand); }

/* 页面滚动区 */
.page__body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.page__body::-webkit-scrollbar { width: 0; height: 0; }
.page__body--pad { padding-bottom: var(--sp-8); }
.page__body--tabbed { padding-bottom: calc(var(--h-tab) + var(--h-home) + var(--sp-8)); }
.page__body--actionbar { padding-bottom: calc(var(--h-action) + var(--h-home) + var(--sp-6)); }
.page__body--tabbed.page__body--actionbar { padding-bottom: calc(var(--h-tab) + var(--h-home) + var(--h-action) + var(--sp-6)); }
.actionbar--tab { bottom: calc(var(--h-tab) + var(--h-home)); padding-bottom: var(--sp-3); }

/* 底部 tabbar */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--h-tab) + var(--h-home));
  padding-bottom: var(--h-home);
  display: flex; align-items: stretch;
  background: var(--c-glass);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--c-line);
  z-index: 30;
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--c-text-2); font-size: var(--fs-11);
  transition: color var(--t-fast), transform var(--t-fast);
  position: relative;
}
.tabbar__item:active { transform: scale(.94); }
.tabbar__item--on { color: var(--c-brand); font-weight: var(--fw-m); }
.tabbar__badge {
  position: absolute; top: 3px; left: 50%; margin-left: 8px;
  min-width: 16px; height: 16px; padding: 0 var(--sp-2);
  border-radius: var(--r-pill); background: var(--c-danger); color: var(--c-on-brand);
  font-size: var(--fs-10); line-height: 16px; text-align: center; font-weight: var(--fw-m);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-style: normal;
}

/* ---------- 排版基线 ---------- */
.t-h1 { font-size: var(--fs-20); font-weight: var(--fw-s); letter-spacing: -.015em; line-height: var(--lh-tight); }
.t-h2 { font-size: var(--fs-16); font-weight: var(--fw-s); letter-spacing: -.01em; line-height: var(--lh-tight); }
.t-h3 { font-size: var(--fs-15); font-weight: var(--fw-m); line-height: var(--lh-tight); }
.t-body { font-size: var(--fs-14); color: var(--c-text-2); }
.t-sub { font-size: var(--fs-12); color: var(--c-text-2); }
.t-cap { font-size: var(--fs-11); color: var(--c-text-2); line-height: var(--lh-snug); }
.t-price { color: var(--c-amount); font-weight: var(--fw-s); }

/* ---------- 通用工具 ---------- */
.row { display: flex; align-items: center; }
.row--between { justify-content: space-between; }
.row--top { align-items: flex-start; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hide { display: none !important; }
.tap { transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast); }
.tap:active { transform: scale(.975); opacity: .9; }
.gap1 { gap: var(--sp-1); } .gap2 { gap: var(--sp-2); } .gap3 { gap: var(--sp-3); }
.gap4 { gap: var(--sp-4); } .gap5 { gap: var(--sp-5); } .gap6 { gap: var(--sp-6); }
.gap8 { gap: var(--sp-8); } .gap10 { gap: var(--sp-10); } .gap12 { gap: var(--sp-12); }
.mt1 { margin-top: var(--sp-1); } .mt2 { margin-top: var(--sp-2); } .mt3 { margin-top: var(--sp-3); }
.mt4 { margin-top: var(--sp-4); } .mt5 { margin-top: var(--sp-5); } .mt6 { margin-top: var(--sp-6); }
.mt8 { margin-top: var(--sp-8); } .mt10 { margin-top: var(--sp-10); } .mt12 { margin-top: var(--sp-12); }
.mt14 { margin-top: var(--sp-14); } .mt16 { margin-top: var(--sp-16); }

/* 页面入场时子元素错峰浮现（.rise 由 JS 加） */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { opacity: 0; }
.rise--on { animation: rise 380ms var(--ease-out) forwards; }

/* 演示声明：每屏底部都有 */
.pz-foot {
  margin: var(--sp-6) var(--sp-8) var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--c-line);
  text-align: center;
  font-size: var(--fs-11);
  line-height: var(--lh-body);
  color: var(--c-text-2);
}
.pz-foot--flush { margin-left: var(--sp-8); margin-right: var(--sp-8); }

/* ---------- 手机竖屏：真机铺满，去掉全部机身装饰 ---------- */
@media (max-width: 480px) and (orientation: portrait) {
  html, body { height: 100%; overflow: hidden; }
  .stage { padding: 0; gap: 0; min-height: 100%; display: block; }
  .stage__brand, .stage__link { display: none !important; }
  .device {
    position: fixed; inset: 0;
    width: 100vw; height: 100dvh;
    border-radius: 0; box-shadow: none;
  }
  .device__notch { display: none; }
  .statusbar { display: none; }
  .homebar { display: none; }
  :root { --h-status: 0px; --h-home: 0px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .rise { opacity: 1; }
  .tap:active, .btn:active { transform: none !important; }
  .page--enter-right, .page--leave-right, .page--fade, .page--behind { transform: none !important; }
  .sheet { transform: none !important; }
  .dialog, .toast { transform: translate(-50%, -50%) !important; }
  .bubble-tip { transform: translateX(-50%) !important; }
}

/* ---------- 舞台顶部保护（全局标准，见 docs/设计/01-视觉规范.md 4.6） ----------
   品牌区两行封顶：标题、副标题各占一行，超长省略号，不换行去挤机身；
   机身缩放要扣掉这块高度，见 index.html 的 fit()。 */
.stage__brand { max-width: min(92vw, 560px); }
.stage__brand > span:last-child { min-width: 0; }
.stage__title, .stage__sub { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
