* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
body {
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #bae6fd 0%, #7dd3fc 35%, #38bdf8 75%, #0ea5e9 100%);
  color: #0f172a;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

/* ---- Install bar (PWA 安裝提示,只在瀏覽器分頁出現;裝了或按 ✕ 就消失) ---- */
#install-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: rgba(15,23,42,.78);
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
}
#install-bar[hidden] { display: none; }
#install-msg { flex: 1 1 auto; min-width: 0; }
#install-go {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 18px;
  border: none; cursor: pointer;
  border-radius: 10px;
  font-size: 16px; font-weight: 700;
  color: #0f172a;
  background: #fbbf24;
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
}
#install-go:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
#install-go[hidden] { display: none; }
#install-close {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  border-radius: 50%;
  font-size: 18px;
  color: #fff;
  background: rgba(255,255,255,.14);
}

/* ---- Board (fills the app; menu / HUD / game-over are all drawn in-canvas) ---- */
.board-wrap {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(6px, env(safe-area-inset-top)) 10px 14px;
  min-height: 0;
}
/* 不加 border-radius / box-shadow:Safari 對持續重繪的 canvas layer 做圓角裁切+陰影
   合成是每幀成本(iPhone 有感);遊戲畫面本來就滿版美術,不需要框飾。 */
#board {
  display: block;
  touch-action: none;
}

/* ---- Overlaid corner buttons (translucent, over the canvas) ----
   back = top-left (aligns with in-canvas pause art); mute = bottom-right
   (kept clear of the in-canvas score/clock slot at top-right). */
.corner-btn {
  position: absolute;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  line-height: 1;
  color: #fff;
  background: rgba(15,23,42,.32);
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
  z-index: 5;
}
.corner-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.corner-btn[hidden] { display: none; }
.back-btn { top: calc(10px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left)); font-size: 30px; font-weight: 900; }
.mute-btn { bottom: calc(14px + env(safe-area-inset-bottom)); right: calc(14px + env(safe-area-inset-right)); font-size: 22px; }
