/**
 * App Shell · Runtime Root 架构
 *
 * DOM 层级（移动端 = PC 端，结构完全一致）：
 *   body
 *   └── .pc-device-frame                  → PC 端 430×932 外壳，移动端全屏
 *       └── #app-runtime                  → containing block，所有 overlay 相对它定位
 *           ├── #app                      → 业务壳（page-root + nav-root）
 *           ├── #overlay-root             → splash / popup / toast / banner
 *           ├── #modal-root               → signin / VIP / 抽奖
 *           └── #boot-loading             → 启动加载（V2Media.mount 注入内容）
 *
 * 铁律：
 *   - 任何模块不允许 position:fixed（fixed 会逃出 .pc-device-frame）
 *   - 任何模块禁止 document.body.appendChild
 *   - 所有 overlay/modal 都是 position:absolute inset:0，相对 #app-runtime
 */

/* ════════ Body / Frame / Runtime Root ════════ */

body{
  margin: 0;
  background: linear-gradient(180deg, #3a2a4a 0%, #1e2440 33%, #2a141c 66%, #08080c 100%);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.pc-device-frame{
  position: relative;
  width: 100%;
  height: var(--app-height, 100vh);
  overflow: hidden;
  background: linear-gradient(180deg, #3a2a4a 0%, #1e2440 33%, #2a141c 66%, #08080c 100%);
}

#app-runtime{
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ════════ App / Layers (全部 absolute，相对 #app-runtime) ════════ */

#app{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* background: transparent 让 #app-runtime 的主题渐变透到整个 viewport */
  background: transparent;
  z-index: var(--z-base);
}

/* 删除 #app::before radial 装饰（移除"廉价霓虹"叠加） */

#page-root{
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  position: relative;
  z-index: var(--z-base);
  background: transparent;
}
#page-root::-webkit-scrollbar{ display: none; }

.rt-page{ display: none; min-height: 100%; }
.rt-page.active{ display: block; }

#nav-root{
  flex-shrink: 0;
  box-sizing: content-box;
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, #2a141c 0%, #08080c 100%);
  display: flex;
  flex-direction: column;
  z-index: var(--z-base);
}

#overlay-root{
  position: absolute;
  inset: 0;
  z-index: var(--z-popup);
  pointer-events: none;
}
#overlay-root > *{ pointer-events: auto; }

#modal-root{
  position: absolute;
  inset: 0;
  z-index: var(--z-signin);
  pointer-events: none;
}
#modal-root > *{ pointer-events: auto; }

/* ════════ PC 模式：.pc-device-frame 430×932 居中 ════════ */

@media (min-width: 500px){
  html{ background: #000; height: 100%; }

  body{
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
  }

  .pc-device-frame{
    width: 430px;
    height: 932px;
    max-height: 100vh;
    border-radius: 32px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.7);
  }
}
