/* ============================================================
   基础层：reset、页面背景、全屏外壳、页面容器、
   底部 Tab 栏
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }

/* hidden 属性必须压过组件自身的 display（如 .scan-result 的 flex），
   否则被 hidden 的元素仍会渲染（曾导致录入页默认书封显示为破图） */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background .3s ease;
}

/* ---------- 外壳：直接铺满屏幕，不再做手机壳 ---------- */
.phone {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background .3s ease;
}

/* ---------- 页面容器 ---------- */
.pages { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.page {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(18px + env(safe-area-inset-top)) 20px 28px;
  display: none;
}
.page.active { display: block; }
.page[data-page="talk"].active { display: flex; flex-direction: column; padding-bottom: 0; }
.page::-webkit-scrollbar { display: none; }

/* ---------- 底部 Tab ---------- */
.tab-bar {
  min-height: 64px; flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-muted); font-size: 11px; font-weight: 500;
  background: transparent; font-family: inherit;
}
.tab.active { color: var(--primary); }
.tab svg { width: 24px; height: 24px; }