/* 工作台 chrome（控制面板 + 预览舞台 + 设备外壳）。
   注意：.screen 内部页面样式不在此处，全部由各 page 组件按溯源表自绘。 */
body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-text);
  background: #1d1d20;
  color: #e7e7ea;
}

/* ===== 控制面板 ===== */
.panel {
  width: 332px;
  flex: 0 0 332px;
  height: 100%;
  overflow-y: auto;
  background: #232327;
  border-right: 1px solid #34343a;
  padding: 16px 16px 64px;
  font-size: 13px;
}
.panel h1 { font-size: 15px; font-weight: 700; margin-bottom: 2px; color: #fff; }
.panel .sub { font-size: 11px; color: #9a9aa2; margin-bottom: 14px; line-height: 1.4; }
.panel .group { margin-bottom: 16px; border-top: 1px solid #34343a; padding-top: 12px; }
.panel .group:first-of-type { border-top: none; padding-top: 0; }
.panel .group > .glabel { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #8a8a92; margin-bottom: 8px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row label { flex: 0 0 92px; color: #b9b9c0; font-size: 12px; }
.row .ctl { flex: 1; min-width: 0; }
.field { margin-bottom: 10px; }
.field > .flabel { display: block; font-size: 11px; color: #9a9aa2; margin-bottom: 4px; }
.field .src { color: #6f6f77; font-size: 10px; }

select, input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: #161619;
  border: 1px solid #3a3a41;
  border-radius: 6px;
  color: #ededf0;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--font-text);
}
textarea { resize: vertical; min-height: 52px; line-height: 1.4; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: #4c8dff; }
input[type="color"] { width: 38px; height: 26px; padding: 0; border: 1px solid #3a3a41; border-radius: 5px; background: none; }
select { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 12px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: #34343c; color: #fff; border: 1px solid #45454e;
}
.btn:hover { background: #3d3d46; }
.btn.primary { background: #2f6bff; border-color: #2f6bff; }
.btn.primary:hover { background: #4079ff; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.hint { font-size: 10px; color: #6f6f77; margin-top: 6px; line-height: 1.4; }

/* ===== 预览舞台 ===== */
.stage {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 50% 0%, #303036 0%, #1b1b1e 70%);
}
/* 工作台尺寸角标。用独立类名（非 .badge）避免泄漏到页面内同名元素 */
.dim-badge {
  align-self: center;
  flex: none;
  margin: 14px auto 4px;
  background: rgba(0,0,0,.55);
  color: #fff; font-size: 11px; padding: 5px 11px; border-radius: 20px;
  font-variant-numeric: tabular-nums; letter-spacing: .02em; z-index: 50;
  backdrop-filter: blur(6px);
}
.dim-badge b { color: #6fd0ff; font-weight: 600; }

/* 设备居中画布（与 badge 分离，避免遮挡状态栏） */
.canvas {
  flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.device-fit { transform-origin: center center; }

/* 设备外壳（可选） */
.device-frame { position: relative; }
.device-frame.shell {
  padding: 14px;
  background: #1c1c1e;
  border-radius: 66px;
  box-shadow: 0 0 0 2px #2c2c2e, 0 30px 70px rgba(0,0,0,.55), inset 0 0 2px rgba(255,255,255,.18);
}

/* 渲染根（导出目标） */
.screen {
  position: relative;
  overflow: hidden;
  background: var(--page-bg, #FFFFFF);
  --page-bg: #FFFFFF;
}
.device-frame.shell .screen { border-radius: 52px; }

/* 页面内容层 */
.page-root { position: absolute; inset: 0; z-index: 1; font-family: var(--font-text); color: var(--c-label); }

/* ===== 状态栏 / 灵动岛 / Home Indicator（叠加在内容之上，随导出）===== */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--safe-top);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px 0 28px;
  z-index: 30; pointer-events: none;
  color: var(--sb-fg, #000);
}
/* align-items:center 已让内容居中于 safe-top 带（中心≈29.5px@6.9″=灵动岛中线），无需额外下压 */
.statusbar.dynamic { padding-top: 0; }
.statusbar.notch { padding-top: 0; }
.sb-time { font-family: var(--font-text); font-size: 17px; font-weight: 600; letter-spacing: .01em; font-variant-numeric: tabular-nums; padding-left: 4px; }
.sb-right { display: flex; align-items: center; gap: 7px; }
.sb-right svg { display: block; }

.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 125px; height: 37px; background: #000; border-radius: 20px; z-index: 31; pointer-events: none;
}
.notch {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 162px; height: 34px; background: #000; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; z-index: 31; pointer-events: none;
}
.home-indicator {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 8px; width: 144px; height: 5px; border-radius: 3px;
  background: var(--hi-bg, rgba(0,0,0,.9)); z-index: 30; pointer-events: none;
}
.show-home-indicator .home-indicator { display: block; }
.hide-home-indicator .home-indicator { display: none; }

/* ===== 移动端适配 ===== */
/* 窄屏（手机/竖屏平板）：上下堆叠，预览在上、控制面板在下可滚动；设备预览自动 fit。 */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .stage { order: -1; flex: 0 0 50vh; height: 50vh; min-height: 320px; }
  .panel {
    width: 100%; flex: 1 1 auto; height: auto; min-height: 0;
    border-right: none; border-top: 1px solid #34343a;
    padding-bottom: 40px;
    -webkit-overflow-scrolling: touch;
  }
  .badge, .dim-badge { margin-top: 8px; }
}
/* 极窄屏：控制项标签换行更紧凑 */
@media (max-width: 480px) {
  .row { flex-wrap: wrap; }
  .row label { flex-basis: 100%; margin-bottom: 2px; }
  .stage { flex-basis: 46vh; height: 46vh; }
}
/* 触屏：放大可点区域 */
@media (pointer: coarse) {
  select, input[type="text"], input[type="number"], textarea { padding: 9px 10px; font-size: 14px; }
  .btn { padding: 11px 12px; }
}
