/* ==========================================================================
   base.css — 舞台 / 手机壳 / 状态栏 / 页面骨架 / 排版基线
   与 prototypes/restaurant/assets/css/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(1200px 600px at 15% 0%, var(--c-stage-1) 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 100%, var(--c-stage-2) 0%, transparent 55%),
    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; }
/* em / i 在本原型里只当语义壳（角标数字、单位、小注、图表数值），**一律不斜体**：
   这两族没有斜体字面，浏览器会做「合成倾斜」——数字被拉斜后看着像换了种字体。 */
em, i { font-style: normal; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-style: normal; }
/* 页内的数字（一律写成 <b class="num">）不许吃浏览器默认的 bold(700)：
   700 摆在中文字（400）旁边像换了一种字体——「待审 3」「共 97 条」就是这么变粗的。
   统一中黑 500；真要重的地方由组件自己写（金额 / 统计值 / 步骤编号是 600）。 */
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-16);
  padding: var(--sp-32) var(--sp-16);
  width: 100%; overflow-x: hidden;
}
.stage__brand { display: flex; align-items: center; gap: var(--sp-10); }
/* 返回原型展厅：桌面舞台常驻左上；手机全屏落在底栏上方，任何页面都能直接回去 */
.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-10);
  background: linear-gradient(140deg, var(--c-brand) 0%, var(--c-brand-strong) 100%);
  color: var(--c-on-brand); display: grid; place-items: center;
  box-shadow: var(--sh-brand);
}
.stage__title { display: block; font-size: var(--fs-16); font-weight: var(--fw-s); letter-spacing: -.01em; }
.stage__sub { display: block; font-size: var(--fs-12); color: var(--c-text-3); }
/* 舞台右上角：去 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 11px var(--c-device-frame),
    0 0 0 13px var(--c-device-edge),
    var(--sh-device);
  overflow: hidden;
  isolation: isolate;
}
.device__notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 30px; background: var(--c-device-frame); border-radius: var(--r-99);
  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-24) 0 var(--sp-32);
  font-size: var(--fs-14); font-weight: var(--fw-s);
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  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: 5px; }
.statusbar--light { color: var(--c-on-brand); }

/* home indicator */
.homebar {
  position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: var(--r-99);
  background: var(--c-text-1); opacity: .28; z-index: 58; pointer-events: none;
}
.homebar--light { background: var(--c-card); opacity: .7; }

/* ---------- 页面容器 ---------- */
.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%) scale(1); }
.page--behind.page--anim { transition: transform var(--t-page) var(--ease-out), filter var(--t-page); filter: brightness(.94); }
/* tab 切换：淡入 + 轻微上浮 */
.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-12); gap: var(--sp-4);
}
.navbar__title {
  flex: 1; min-width: 0;
  font-size: var(--fs-17); 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-4); }
.navbar__sub { display: block; font-size: var(--fs-11); font-weight: var(--fw-r); color: var(--c-text-3); margin-top: 1px; }
.navbar__btn {
  flex: 0 0 auto; min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-99); color: var(--c-text-1);
  transition: background var(--t-fast), transform var(--t-fast);
}
.navbar__btn:active { background: var(--c-fill); transform: scale(.94); }
.navbar__btn--text { padding: 0 var(--sp-8); font-size: var(--fs-14); color: var(--c-brand); font-weight: var(--fw-m); }
.navbar__side { flex: 0 0 auto; display: flex; align-items: center; gap: var(--sp-2); min-width: 32px; justify-content: flex-end; }
/* 透明导航（沉浸式头图页） */
.navbar--ghost { background: transparent; }
.navbar--ghost .navbar__title { color: var(--c-on-brand); }
.navbar--ghost .navbar__btn { color: var(--c-on-brand); background: var(--c-image-btn); backdrop-filter: blur(6px); }

/* 页面滚动区 */
.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-24); }
.page__body--tabbed { padding-bottom: calc(var(--h-tab) + var(--h-home) + var(--sp-8)); }

/* 底部 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-3); font-size: var(--fs-11);
  transition: color var(--t-fast);
  position: relative;
}
.tabbar__item:active { transform: scale(.94); }
.tabbar__item--on { color: var(--c-brand); font-weight: var(--fw-m); }
/* 数字角标：整体贴在图标（23px）右上角外侧——宁可悬空，不许压图标。
   压上去会把「我的申请」图标啃掉一角，跟铃铛被角标压成闹钟是同一个病。 */
.tabbar__badge {
  position: absolute; top: 2px; left: 50%; margin-left: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-99); background: var(--c-danger); color: var(--c-on-brand);
  font-size: var(--fs-11); line-height: 16px; text-align: center; font-weight: var(--fw-m);
  /* 底栏角标同样是数字：数字族 + 等宽，避免 1→8 时角标宽度跳变 */
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  /* 角标元素是 <span>，但这里仍写死正体：MiSans 没有斜体文件，合成斜体会把数字拉歪 */
  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-3); }
.t-cap { font-size: var(--fs-11); color: var(--c-text-3); }
.t-price { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--c-accent); font-weight: var(--fw-s); }
.t-num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: var(--fw-s); }

/* ---------- 通用工具 ---------- */
.row { display: flex; align-items: center; }
.row--between { justify-content: space-between; }
.row--top { align-items: flex-start; }
.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; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gap4 { gap: var(--sp-4); } .gap6 { gap: var(--sp-6); } .gap8 { gap: var(--sp-8); }
.gap12 { gap: var(--sp-12); } .gap16 { gap: var(--sp-16); }
.mt4 { margin-top: var(--sp-4); } .mt8 { margin-top: var(--sp-8); }
.mt12 { margin-top: var(--sp-12); } .mt16 { margin-top: var(--sp-16); } .mt24 { margin-top: var(--sp-24); }
.hide { display: none !important; }
.tap { transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast); }
.tap:active { transform: scale(.975); opacity: .88; }

/* 页面入场时子元素错峰浮现（.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; }

/* ---------- 手机窄屏：机身铺满视口，手机打开就是「真的小程序」 ----------
   为什么要有：原型按 390×844 设计，桌面上靠品牌头说明「这是什么」；
   手机上那层纯属占地（约 120px），还会把机身顶出首屏。所以手机上：
   收掉品牌头和说明、去掉机身圆角/边框/投影与所有假装饰（灵动岛、状态栏、home bar），
   并让 .device 以 fixed 铺满 100vw × 100dvh。
   注意：内部布局全是绝对定位 + 固定 px，**不能改 390×844 这个设计尺寸**；
   手机竖屏由这里全屏铺满（index.html 的 fit() 不再缩放），
   其余窗口（平板 / 桌面 / 横屏）仍由 fit() 整体缩放。 */
@media (max-width: 480px) {
  html, body { height: 100%; overflow: hidden; }
  .stage { padding: 0; gap: 0; min-height: 100%; display: block; }
  .stage__brand, .stage__link { display: none !important; }
  /* 机身铺满视口：手机上是"这就是 App"，不是"浏览器里套了个小手机" */
  .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; }
  /* 状态栏与 home indicator 区不存在了，导航栏/底栏不再为它们留白 */
  :root { --h-status: 0px; --h-home: 0px; }
}

/* ---------- 舞台顶部保护（全局标准，见 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; }
