/* 应用外壳：手机画幅、页面容器、底部导航、数字人入口、弹层与提示 */

/* ---------- 画幅 ---------- */
.stage { min-height: 100%; }
.app {
  position: relative;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--base);
}
@media (min-width: 640px) {
  .stage {
    display: grid; place-items: center; min-height: 100vh; padding: 24px;
    background: radial-gradient(120% 80% at 50% 0%, #24493f 0%, var(--ink) 70%);
  }
  .app {
    width: 400px; height: min(868px, calc(100vh - 48px));
    border-radius: 34px;
    box-shadow: 0 0 0 10px #0f2621, 0 30px 80px rgba(0, 0, 0, .45);
  }
}

.pages { position: relative; flex: 1; min-height: 0; }
.page {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: 96px;
  scrollbar-width: none;
}
.page::-webkit-scrollbar { display: none; }
.page[hidden] { display: none; }

/* ---------- 数字人入口 ---------- */
.fab {
  position: absolute; z-index: 20; right: 14px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px);
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 16px 0 6px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14.5px;
  box-shadow: 0 8px 22px rgba(15, 38, 33, .32);
}
.fab .face { width: 36px; height: 36px; border-radius: 50%; background: var(--pool); display: grid; place-items: center; color: var(--ink); }
.fab .face .i { width: 21px; height: 21px; }
/* 游览页：停在地图右下角，不压住面板分段与列表 */
.app[data-page="tour"] .fab { bottom: auto; top: calc((100% - var(--tab-h) - env(safe-area-inset-bottom)) * .44 - 84px); padding-right: 6px; }
.app[data-page="tour"] .fab .fab-text { display: none; }

/* ---------- 底部导航 ---------- */
.tabbar {
  flex: none; position: relative; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); box-shadow: 0 -1px 0 var(--line);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--ink-2); }
.tabbar button .pip { width: 46px; height: 30px; border-radius: 999px; display: grid; place-items: center; transition: background-color .2s; }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabbar button[aria-current="page"] .pip { background: rgba(76, 195, 194, .26); color: var(--deep); }

/* ---------- 弹层 ---------- */
.layer { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.layer[hidden] { display: none; }
.layer .scrim { position: absolute; inset: 0; background: rgba(15, 38, 33, .45); animation: fade .2s ease-out; }
.sheet {
  position: relative; max-height: 88%; display: flex; flex-direction: column;
  background: var(--base); border-radius: 24px 24px 0 0;
  animation: rise .26s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -10px 40px rgba(15, 38, 33, .2);
}
.sheet-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 14px 6px 20px; }
.sheet-top h2 { flex: 1; margin: 0; font: 600 19px/1.35 var(--serif); }
.sheet-top .icon-btn { width: 40px; height: 40px; background: rgba(23, 51, 45, .07); color: var(--ink); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 20px; }
.sheet-body p { margin: 0 0 10px; }
.sheet-body .lead { font: 500 16px/1.6 var(--serif); color: var(--ink); }
.sheet-body .kv b { color: var(--deep); font-weight: 600; }
.sheet-body .byline { font-size: 12.5px; color: var(--ink-2); }
.sheet-media { margin: 4px 0 14px; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--c); }
.sheet-media img, .sheet-media svg { width: 100%; height: 100%; object-fit: cover; }
.sheet-media.square { aspect-ratio: 4 / 3; background: var(--surface); }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--base); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .hint { flex: 1; align-self: center; font-size: 12.5px; color: var(--ink-2); }

/* ---------- 提示 ---------- */
.toast {
  position: absolute; z-index: 60; left: 16px; right: 16px; bottom: calc(var(--tab-h) + 14px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 16px;
  background: var(--ink); color: #fff; font-size: 14px;
  box-shadow: 0 10px 30px rgba(15, 38, 33, .35);
  animation: rise .22s ease-out;
}
.toast[hidden] { display: none; }
.toast span { flex: 1; }
.toast button { color: var(--pool); font-weight: 700; padding: 8px 10px; border-radius: 10px; }

@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
