/* ============================================================
   星屿小镇 · 页面外壳样式
   职责只有三件事：
   1) 让画布铺满整屏（含刘海屏安全区）
   2) 彻底禁掉页面滚动 / 双指缩放 / 长按选中
   3) 提供加载、竖屏提示、报错三个覆盖层
   —— 游戏内的 UI 全部由 Canvas 绘制，不在这里写
   ============================================================ */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --bg-deep: #0d1620;
  --ink: #e8f1f8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;                 /* 禁止页面滚动 */
  overscroll-behavior: none;        /* 禁止下拉刷新 / 橡皮筋 */
  background: var(--bg-deep);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;               /* 关键：禁掉浏览器手势，交给游戏处理 */
}

#game-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

#game-root canvas {
  display: block;
  touch-action: none;
}

/* ---------- 覆盖层通用 ---------- */
#boot-overlay,
#rotate-overlay,
#fatal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 50;
  padding: 24px;
}

/* ---------- 启动遮罩 ---------- */
#boot-overlay {
  display: flex;
  background: radial-gradient(120% 90% at 50% 20%, #1d3350 0%, #0d1620 70%);
  transition: opacity .45s ease;
}
#boot-overlay.is-hidden { opacity: 0; pointer-events: none; }

.boot-title {
  font-size: 34px;
  letter-spacing: 8px;
  font-weight: 700;
  color: #eaf6ff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
  margin-bottom: 6px;
}
.boot-sub {
  font-size: 13px;
  letter-spacing: 4px;
  color: #7fa6c8;
  text-transform: uppercase;
  margin-bottom: 26px;
}
.boot-bar {
  width: min(300px, 62vw);
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
  margin: 0 auto 14px;
}
.boot-bar > i {
  display: block;
  height: 100%;
  width: 8%;
  border-radius: 99px;
  background: linear-gradient(90deg, #57d3a0, #7fd6ff);
  transition: width .25s ease;
}
.boot-hint { font-size: 13px; color: #8fb3cf; }

/* ---------- 竖屏提示 ---------- */
#rotate-overlay { background: #0d1620; }
#rotate-overlay.is-on { display: flex; }
.rotate-phone {
  font-size: 56px;
  animation: rotate-tip 2.2s ease-in-out infinite;
  margin-bottom: 14px;
}
@keyframes rotate-tip {
  0%, 40% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
.rotate-text { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.rotate-sub { font-size: 13px; line-height: 1.8; color: #8fb3cf; }

/* ---------- 报错层 ---------- */
#fatal-overlay.is-on { display: flex; background: rgba(10, 16, 22, .96); }
.fatal-box { max-width: 620px; width: 100%; }
.fatal-title { font-size: 20px; font-weight: 700; margin-bottom: 14px; color: #ff9d9d; }
#fatal-msg {
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  color: #ffd9d9;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 120, 120, .25);
  border-radius: 10px;
  padding: 14px;
  max-height: 44vh;
  overflow: auto;
}
.fatal-hint { font-size: 13px; color: #8fb3cf; margin-top: 14px; }

/* ---------- 窄屏 / 矮屏时，启动页字号收一收 ---------- */
@media (max-height: 420px) {
  .boot-title { font-size: 24px; letter-spacing: 6px; }
  .boot-sub { margin-bottom: 16px; }
  .rotate-phone { font-size: 40px; }
  .rotate-text { font-size: 17px; }
  .rotate-sub { margin-bottom: 14px; }
}
