/* iPhone 17 Pro 设备外壳（包裹 402×874 屏幕区域） */
:root {
  --device-w: 402px;
  --device-h: 874px;
  --frame-pad-x: 12px;
  --frame-pad-y: 14px;
  --frame-outer-w: calc(var(--device-w) + var(--frame-pad-x) * 2);
  --frame-outer-h: calc(var(--device-h) + var(--frame-pad-y) * 2);
}

html {
  height: 100%;
}

body.device-preview {
  margin: 0;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #fff;
}

.iphone-17-pro {
  position: relative;
  width: var(--frame-outer-w);
  height: var(--frame-outer-h);
  padding: var(--frame-pad-y) var(--frame-pad-x);
  border-radius: 54px;
  background: #0a0a0a;
  box-shadow:
    0 0 0 1px #1c1c1e,
    0 20px 50px rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
  transform-origin: center center;
}

@media (max-height: 940px) {
  .iphone-17-pro {
    transform: scale(min(1, calc((100vh - 48px) / var(--frame-outer-h))));
  }
}

@media (max-width: 440px) {
  .iphone-17-pro {
    transform: scale(min(1, calc((100vw - 32px) / var(--frame-outer-w))));
  }
}

/* 侧边按键 */
.iphone-key {
  position: absolute;
  display: block;
  background: #1c1c1e;
  border-radius: 2px;
}

.iphone-key-action {
  left: -3px;
  top: 118px;
  width: 3px;
  height: 32px;
  border-radius: 2px 0 0 2px;
}

.iphone-key-vol-up {
  left: -3px;
  top: 168px;
  width: 3px;
  height: 58px;
  border-radius: 2px 0 0 2px;
}

.iphone-key-vol-down {
  left: -3px;
  top: 236px;
  width: 3px;
  height: 58px;
  border-radius: 2px 0 0 2px;
}

.iphone-key-power {
  right: -3px;
  top: 186px;
  width: 3px;
  height: 88px;
  border-radius: 0 2px 2px 0;
  background: #1c1c1e;
}

/* 屏幕边框 */
.iphone-bezel {
  position: relative;
  width: var(--device-w);
  height: var(--device-h);
  border-radius: 42px;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.85) inset,
    0 0 0 2px rgba(255, 255, 255, 0.06) inset;
}

/* 弹窗遮罩：限定在屏幕边框内，不溢出机身 */
.device-overlay-mask {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.45);
  align-items: flex-end;
  justify-content: center;
}

.device-overlay-mask.open {
  display: flex;
}

/* 白底页面顶部状态栏 */
.page-top-bar .ios-status-bar {
  background: #fff;
}

/* 渐变/透明顶栏上的状态栏 */
.status-bar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}

.status-bar-overlay .ios-status-bar {
  pointer-events: auto;
}

/* ── 统一筛选栏（下拉 + 高级筛选）── */
.mob-filter-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.mob-filter-bar--embedded {
  border-bottom: none;
  padding: 10px 12px 8px;
}

.mob-filter-drop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 38%;
  padding: 0;
  border: none;
  background: none;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}

.mob-filter-drop span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mob-filter-drop i {
  flex-shrink: 0;
  font-size: 10px;
  color: #c0c4cc;
}

.mob-filter-drop.on {
  color: #1890ff;
  font-weight: 500;
}

.mob-filter-drop.on i {
  color: #1890ff;
}

.mob-filter-more {
  margin-left: auto;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #666;
  font-size: 17px;
  cursor: pointer;
}

.mob-filter-sheet {
  width: 100%;
  max-width: 402px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mob-filter-sheet--picker {
  max-height: 52vh;
}

.mob-filter-sheet--advanced {
  max-height: 72vh;
}

.mob-filter-sheet-hd {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.mob-filter-sheet-hd .mob-filter-sheet-x {
  position: absolute;
  right: 4px;
  top: 0;
  width: 44px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #999;
  font-size: 18px;
}

.mob-filter-picker-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 0;
}

.mob-filter-picker-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  font-size: 15px;
  color: #333;
  text-align: left;
  cursor: pointer;
}

.mob-filter-picker-opt.on {
  color: #1890ff;
  font-weight: 500;
}

.mob-filter-advanced-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 8px;
}

.mob-filter-advanced-group {
  margin-bottom: 18px;
}

.mob-filter-advanced-group h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 400;
  color: #999;
}

.mob-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mob-filter-chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: none;
  background: #f5f5f5;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}

.mob-filter-chip.on {
  background: #e6f4ff;
  color: #1890ff;
  font-weight: 500;
}

.mob-filter-sheet-ft {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f0f0f0;
  background: #fff;
}

.mob-filter-sheet-ft button {
  flex: 1;
  height: 44px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
}

.mob-filter-btn-reset {
  background: #fff;
  border: 1px solid #e8ecf0;
  color: #666;
}

.mob-filter-btn-ok {
  border: none;
  background: #1890ff;
  color: #fff;
  font-weight: 500;
}

/* Dynamic Island — 始终置于最顶层 */
.iphone-island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 37px;
  background: #000;
  border-radius: 20px;
  z-index: 999;
  pointer-events: none;
}

.iphone-island::after {
  content: '';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1a2840, #06080c 70%);
}

/* 屏幕内应用容器 */
.iphone-bezel .device-shell {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

/* 底部 Home 指示条 */
.iphone-home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.28);
  z-index: 200;
  pointer-events: none;
}

.iphone-17-pro::after {
  content: 'iPhone 17 Pro';
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #aeaeb2;
  font-family: -apple-system, "SF Pro Text", "PingFang SC", sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

/* ── iOS 状态栏（时间 / 信号 / WiFi / 电量）── */
.ios-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 27px 4px;
  min-height: 47px;
  position: relative;
  z-index: 150;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ios-status-bar--dark {
  color: #000;
}

.ios-status-time {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 54px;
}

.ios-status-right {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 54px;
  height: 12px;
  justify-content: flex-end;
}

/* 蜂窝信号条 */
.ios-signal {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.8px;
  height: 12px;
  margin-right: 0;
}

.ios-signal i {
  display: block;
  width: 3.2px;
  background: currentColor;
  border-radius: 0.6px;
}

.ios-signal i:nth-child(1) { height: 4.5px; }
.ios-signal i:nth-child(2) { height: 6.5px; }
.ios-signal i:nth-child(3) { height: 8.5px; }
.ios-signal i:nth-child(4) { height: 12px; }

.ios-network {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-right: 1px;
}

/* 电池 */
.ios-battery {
  display: inline-flex;
  align-items: center;
  margin-left: 1px;
}

.ios-battery-body {
  position: relative;
  width: 25px;
  height: 12px;
  border: 1.2px solid currentColor;
  border-radius: 3.2px;
  padding: 1.4px;
  box-sizing: border-box;
  opacity: 0.88;
}

.ios-battery-fill {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: 1.4px;
  min-width: 2px;
}

.ios-battery-cap {
  width: 1.2px;
  height: 4.5px;
  margin-left: 1px;
  background: currentColor;
  border-radius: 0 1px 1px 0;
  opacity: 0.45;
}

/* 低电量 / 充电等状态（可选） */
.ios-battery.is-low .ios-battery-fill { background: #ffcc00; }
.ios-battery.is-low .ios-battery-body,
.ios-battery.is-low .ios-battery-cap { border-color: #ffcc00; color: #ffcc00; }

.ios-battery.is-charging .ios-battery-body::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-bottom: 5px solid rgba(0, 0, 0, 0.55);
  z-index: 1;
}

/* 全局 Toast（未实现入口提示等） */
.mob-toast,
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  max-width: calc(100% - 48px);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.mob-toast.show,
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
