/* ============================================================
   基础样式 + 应用外壳
   ============================================================ */
* { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'JDNoto',
               'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  color: var(--c-text);
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #fff;
  padding-top: env(safe-area-inset-top, 0px);
  transition: background .2s ease;
}

/* 屏幕：375 逻辑宽度，等比缩放铺满 */
#screen-root {
  position: relative;
  transform-origin: top center;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .22s cubic-bezier(.22, .61, .36, 1);
}
/* 转场：前进从右滑入，返回从左滑回 */
#screen-root.slide-in  { transform: translateX(26px) scale(var(--fit, 1)); opacity: .6; }
#screen-root.slide-back { transform: translateX(-26px) scale(var(--fit, 1)); opacity: .6; }

/* 每个页面 = 一屏 */
.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
}
.screen > .body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* 可滚动区域 */
.scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }

/* 返回按钮（页面无自带返回箭头时显示） */
#back {
  position: fixed;
  left: 5px;
  top: calc(5px + env(safe-area-inset-top, 0px));
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .22);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  z-index: 80;
  user-select: none;
  cursor: pointer;
}
#back.on { display: flex; }

/* 轻提示 */
#toast {
  position: fixed;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: rgba(20, 24, 32, .88);
  color: #fff;
  font-size: var(--fs-13);
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 弹层（规格选择 / 确认框） */
#sheet {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}
#sheet.on { display: block; }
#sheet .mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  animation: fade .18s ease;
}
#sheet .panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78%;
  background: #fff;
  border-radius: var(--r-14) var(--r-14) 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: rise .22s cubic-bezier(.22, .61, .36, 1);
  display: flex;
  flex-direction: column;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(100%) } to { transform: translateY(0) } }
