* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #1b1d22;
  font-family: "Arial Black", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  color: #fff; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }
.hud-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 0;
}
#score { font-size: 30px; text-shadow: 0 2px 0 #000, 0 0 12px rgba(0,0,0,.4); }
#distance { font-size: 14px; opacity: .85; text-shadow: 0 1px 0 #000; }
#speed-lv { display: inline-block; margin-top: 3px; font-size: 13px; font-weight: 700; color: #7ff3ff; text-shadow: 0 1px 0 #000, 0 0 8px rgba(70,230,255,.6); }
#speed-lv.bump { animation: lv-bump .6s ease-out; }
@keyframes lv-bump { 0% { transform: scale(1.8); color: #fff; } 100% { transform: scale(1); } }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#stars { font-size: 20px; color: #ffd23f; letter-spacing: 2px; text-shadow: 0 2px 0 #000; }
.bar { width: 130px; height: 10px; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.8); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; width: 100%; transition: width .15s; }
.hp > div { background: linear-gradient(90deg, #4cd964, #b4f05a); }
.bust { opacity: 0; transition: opacity .2s; }
.bust.active { opacity: 1; }
.bust > div { background: repeating-linear-gradient(90deg, #ff2a2a 0 8px, #2a5cff 8px 16px); width: 0; }

#combo {
  position: absolute; top: calc(env(safe-area-inset-top) + 150px); left: 0; right: 0; text-align: center;
  font-size: 26px; color: #ffcf33; text-shadow: 0 3px 0 #a33a00, 0 0 18px rgba(255,140,0,.6);
}

#dash-btn {
  --charge: 1;
  position: absolute; right: 22px; bottom: calc(env(safe-area-inset-bottom) + 26px);
  width: 96px; height: 96px; border-radius: 50%; border: none; padding: 6px;
  pointer-events: auto; touch-action: none; cursor: pointer;
  background: conic-gradient(#ff8a1f calc(var(--charge) * 360deg), rgba(255,255,255,.18) 0);
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
#dash-btn span {
  display: flex; text-align: center; line-height: 1.1; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 50%; background: #2a2d34; color: #888; font-size: 17px; font-family: inherit;
}
#dash-btn.ready span { background: radial-gradient(circle at 40% 35%, #ffb347, #e8410f); color: #fff; }
#dash-btn.ready { animation: pulse 1s infinite; }
#dash-btn.active span { background: radial-gradient(circle, #bff4ff, #22b8e8); color: #fff; }
@keyframes pulse { 50% { transform: scale(1.06); } }

#banner {
  position: fixed; top: 32%; left: 0; right: 0; text-align: center; pointer-events: none;
  font-size: 30px; letter-spacing: 4px; opacity: 0; transform: translateY(10px);
  transition: opacity .4s, transform .4s; text-shadow: 0 3px 0 #000, 0 0 20px rgba(0,0,0,.5);
}
#banner.show { opacity: 1; transform: none; }

#popups { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.popup {
  position: absolute; transform: translate(-50%, -50%); font-size: 22px; color: #ffe14d;
  text-shadow: 0 2px 0 #8a2b00, 0 0 10px rgba(0,0,0,.4); animation: rise .9s ease-out forwards; white-space: nowrap;
}
.popup.big { font-size: 30px; color: #fff; }
@keyframes rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(1); }
}

#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; text-align: center; background: linear-gradient(180deg, rgba(15,17,22,.55), rgba(15,17,22,.85));
}
.screen h1 { font-size: clamp(34px, 10.5vw, 72px); line-height: 1.05; margin: 0; color: #ffcf33; text-shadow: 0 5px 0 #b13a0a, 0 0 30px rgba(255,120,0,.5); }
.screen h2 { font-size: clamp(28px, 8vw, 44px); margin: 0 0 12px; color: #ff5a3c; text-shadow: 0 4px 0 #000; }
.screen .sub { margin: 6px 0 18px; opacity: .85; letter-spacing: 3px; }
.help { list-style: none; padding: 0; margin: 0 0 24px; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; font-size: 15px; line-height: 1.9; opacity: .9; }
.help b { color: #ffcf33; }
.screen button, .modal-card button {
  font: inherit; font-size: 20px; padding: 14px 40px; border: none; border-radius: 40px; cursor: pointer;
  color: #fff; background: linear-gradient(180deg, #ff8a1f, #e8410f); box-shadow: 0 5px 0 #8f2406, 0 10px 20px rgba(0,0,0,.4);
}
.screen button:active, .modal-card button:active { transform: translateY(3px); box-shadow: 0 2px 0 #8f2406; }
#over-stats { font-family: system-ui, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; font-size: 17px; line-height: 1.7; }
#over-stats b { font-size: 26px; color: #ffcf33; }
#best { opacity: .7; margin-bottom: 22px; }

/* 語言切換按鈕（只在標題和結算畫面顯示） */
#lang-btn {
  position: fixed; z-index: 10; top: calc(env(safe-area-inset-top) + 14px); right: 16px;
  font: 15px/1 system-ui, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.75); border-radius: 20px;
  padding: 9px 16px; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
#lang-btn:hover { background: rgba(0,0,0,.6); }
#lang-btn:active { transform: scale(.96); }

/* 路障预警 */
#roadblock {
  position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 14px 10px; border-radius: 12px; background: rgba(120, 0, 0, .55);
  border: 2px solid #ff4a3a; box-shadow: 0 0 18px rgba(255, 40, 40, .5);
  animation: rbPulse .5s ease-in-out infinite alternate;
}
.rb-title { font-size: 17px; color: #fff; text-shadow: 0 2px 0 #600; white-space: nowrap; }
.rb-lanes { display: flex; gap: 5px; }
.rb-lanes .lane {
  width: 26px; height: 30px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font: 15px/1 system-ui, sans-serif; font-weight: 800;
}
.rb-lanes .closed { background: #ff3b30; color: #fff; }
.rb-lanes .open { background: #34c759; color: #fff; }
@keyframes rbPulse { from { opacity: .75; } to { opacity: 1; } }

/* 岔路选择 */
#junction {
  position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: auto;
  padding: 8px 12px 10px; border-radius: 14px; background: rgba(10, 30, 60, .6);
  border: 2px solid #4fc3f7; box-shadow: 0 0 18px rgba(79, 195, 247, .45);
}
.jn-title { font-size: 15px; white-space: nowrap; text-shadow: 0 2px 0 #000; }
.jn-options { display: flex; gap: 8px; }
.jn-opt {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px;
  padding: 6px 8px; border-radius: 10px; border: 2px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12); color: #fff; font: inherit; cursor: pointer; touch-action: none;
}
.jn-opt .arrow { font-size: 24px; line-height: 1; }
.jn-opt .name { font-size: 12px; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; font-weight: 700; white-space: nowrap; }
.jn-opt.selected { background: #ffb020; border-color: #fff; color: #2a1600; transform: scale(1.08); box-shadow: 0 0 14px rgba(255,176,32,.8); }

/* ---------- 模式 / 关卡 / 改装 / 过关 ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.screen button.alt { background: linear-gradient(180deg, #4a5160, #2d323c); box-shadow: 0 5px 0 #15181d, 0 10px 20px rgba(0,0,0,.4); }
.screen button.alt:active { box-shadow: 0 2px 0 #15181d; }

#level-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  width: min(760px, 100%); margin: 8px 0 22px; max-height: 60vh; overflow-y: auto; padding: 4px;
}
.screen button.level-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border-radius: 16px;
  font-size: 15px; background: linear-gradient(180deg, #ff8a1f, #c9370c); box-shadow: 0 5px 0 #7a1f05;
}
.level-card .lv-num { font-size: 13px; opacity: .9; }
.level-card .lv-name { font-size: 18px; }
.level-card .lv-meta { font: 13px system-ui, sans-serif; opacity: .85; }
.level-card .lv-stars { color: #ffe14d; letter-spacing: 2px; text-shadow: 0 2px 0 #6a2a00; }
.screen button.level-card.locked { background: #3a3f48; box-shadow: 0 5px 0 #1d2026; color: #9aa0a8; cursor: not-allowed; }

#upgrade { background: rgba(8, 14, 26, .78); }
#upgrade-cards { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; width: min(780px, 100%); }
.screen button.up-card {
  width: 210px; max-width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 14px; border-radius: 18px; font-size: 18px;
  background: linear-gradient(180deg, #2f6fd6, #1c3f8a); box-shadow: 0 6px 0 #0f2350, 0 0 0 2px rgba(255,255,255,.25) inset;
}
.screen button.up-card.evolve { background: linear-gradient(180deg, #ff9d2a, #d24a0f); box-shadow: 0 6px 0 #7a2405, 0 0 24px rgba(255,150,40,.6); }
.up-card .up-icon { font-size: 44px; line-height: 1; }
.up-card .up-desc { font: 14px/1.4 system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; opacity: .92; }
.up-card .up-level { font: 12px system-ui, sans-serif; opacity: .7; }

#complete-stars { font-size: 54px; letter-spacing: 8px; margin: 4px 0 8px; color: rgba(255,255,255,.2); }
#complete-stars .on { color: #ffd23f; text-shadow: 0 4px 0 #a35b00, 0 0 20px rgba(255,200,40,.6); }
#complete-goals { list-style: none; padding: 0; margin: 0 0 10px; font: 16px/1.9 system-ui, "PingFang TC", sans-serif; }
#complete-goals li { opacity: .55; }
#complete-goals li.done { opacity: 1; color: #8dff9b; }
#complete-stats { font-family: system-ui, sans-serif; margin-bottom: 20px; }
#complete-stats b { color: #ffcf33; font-size: 22px; }

/* ---------- HUD 新元素 ---------- */
#fire-btn {
  --charge: 1;
  position: absolute; right: 30px; bottom: calc(env(safe-area-inset-bottom) + 136px);
  width: 80px; height: 80px; border-radius: 50%; border: none; padding: 5px; pointer-events: auto; touch-action: none; cursor: pointer;
  background: conic-gradient(#ff3b30 calc(var(--charge) * 360deg), rgba(255,255,255,.18) 0);
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
#fire-btn span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
  background: #2a2d34; color: #999; font-size: 16px; font-family: inherit;
}
#fire-btn.ready span { background: radial-gradient(circle at 40% 35%, #ff6b5a, #b3150b); color: #fff; }
#progress { flex: 1; max-width: 220px; margin: 6px 12px 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pg-bar { width: 100%; height: 8px; border-radius: 5px; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.8); overflow: hidden; }
.pg-fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffcf33, #ff7a1a); transition: width .2s; }
.pg-text { font: 12px system-ui, "PingFang TC", sans-serif; font-weight: 700; text-shadow: 0 1px 0 #000; white-space: nowrap; }
#shields { font-size: 14px; min-height: 16px; letter-spacing: 1px; }

/* ---------- 金币 / 任务 / 暴走 / 车库 ---------- */
#coins { font-size: 15px; color: #ffd84a; text-shadow: 0 1px 0 #000; margin-top: 2px; }
#missions { list-style: none; margin: 6px 0 0; padding: 0; font: 11px/1.55 system-ui, "PingFang TC", sans-serif; font-weight: 700; text-shadow: 0 1px 2px #000; max-width: 46vw; }
#missions li { opacity: .9; }
#missions li b { color: #ffd84a; }
#missions li.done { color: #8dff9b; opacity: .7; }
.bar.fever { height: 7px; }
.fever > div { width: 0; background: linear-gradient(90deg, #ff4fd8, #ff9a3c); transition: width .15s; }
.bar.fever.full { box-shadow: 0 0 12px #ff4fd8; animation: rbPulse .25s infinite alternate; }
#rampage-fx {
  position: fixed; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 90px 20px rgba(255, 60, 200, .55);
  animation: rbPulse .3s ease-in-out infinite alternate;
}
#title-coins, #garage-coins { font-size: 20px; color: #ffd84a; margin: 14px 0 0; text-shadow: 0 2px 0 #000; }
#garage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; width: min(820px, 100%); margin: 12px 0 20px; max-height: 62vh; overflow-y: auto; padding: 4px; }
.g-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: 16px; background: linear-gradient(180deg, #2b3445, #1a202b); box-shadow: 0 0 0 2px rgba(255,255,255,.12) inset; }
.g-icon { font-size: 34px; }
.g-name { font-size: 16px; }
.g-desc { font: 13px system-ui, "PingFang TC", sans-serif; opacity: .85; }
.g-dots { color: #ffd84a; letter-spacing: 3px; }
.screen button.g-buy { font-size: 14px; padding: 8px 14px; }
.screen button.g-buy:disabled { background: #3a3f48; box-shadow: 0 3px 0 #1d2026; color: #8a9099; }
.coin-line { color: #ffd84a; font-family: system-ui, sans-serif; margin: 0 0 16px; }

/* ---------- 暂停 / 难度 ---------- */
#pause-btn {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: rgba(0,0,0,.4);
  color: #fff; font-size: 13px; letter-spacing: -2px; pointer-events: auto; cursor: pointer; z-index: 2;
}
#progress { margin-top: 48px; }
#pause { background: rgba(8, 10, 18, .72); }
.pause-list { display: flex; flex-direction: column; gap: 12px; width: min(320px, 90%); }
.pause-list button { width: 100%; }
#difficulty-row { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 0 18px; }
.diff-label { font-size: 14px; opacity: .8; }
.diff-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.screen button.diff-chip { font-size: 15px; padding: 8px 16px; border-radius: 20px; background: rgba(255,255,255,.12); box-shadow: none; border: 2px solid rgba(255,255,255,.25); }
.screen button.diff-chip.on.easy { background: #2ecc71; border-color: #fff; }
.screen button.diff-chip.on.normal { background: #2f8cff; border-color: #fff; }
.screen button.diff-chip.on.hard { background: #ff8a1f; border-color: #fff; }
.screen button.diff-chip.on.insane { background: #e8213a; border-color: #fff; box-shadow: 0 0 16px rgba(255,40,60,.7); }
.diff-hint { font: 13px system-ui, "PingFang TC", sans-serif; opacity: .85; }

/* 安装成 App */
.screen button.install {
  margin-top: 14px; font-size: 16px; padding: 10px 22px;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.55); box-shadow: none;
}
.modal {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(5,4,12,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal.hidden { display: none; }
.modal-card {
  font-family: system-ui, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  max-width: 360px; width: 100%; padding: 22px 22px 18px; border-radius: 18px; color: #fff; text-align: left;
  background: linear-gradient(180deg, #232036, #15131f); border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.modal-card h3 { margin: 0 0 12px; font-size: 21px; text-align: center; }
.modal-card ol { margin: 0 0 18px; padding-left: 22px; line-height: 1.6; font-size: 15px; }
.modal-card li { margin-bottom: 6px; }
.modal-card button { display: block; width: 100%; }

/* ---------------- 双人对战 ---------------- */
.screen button.versus-btn {
  margin-top: 14px; background: linear-gradient(90deg, #16b8e8, #7a4dff 50%, #ff8a1f);
  box-shadow: 0 5px 0 #3a1f7a, 0 10px 24px rgba(122,77,255,.45);
}
.screen button.versus-btn:active { box-shadow: 0 2px 0 #3a1f7a; }
#vs-hud { position: fixed; inset: 0; pointer-events: none; }
.vs-divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: linear-gradient(180deg, #16b8e8, #ff8a1f); box-shadow: 0 0 12px rgba(0,0,0,.6); }
.vs-panel { position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 14px; display: flex; flex-direction: column; gap: 5px; }
.vs-panel.right { left: calc(50% + 14px); }
.vs-head { display: flex; align-items: center; gap: 8px; }
.vs-tag { font-size: 14px; padding: 2px 8px; border-radius: 8px; color: #fff; }
.vs-tag.p1 { background: #16b8e8; }
.vs-tag.p2 { background: #ff8a1f; }
.vs-score { font-size: 24px; text-shadow: 0 2px 0 #000; }
.vs-meta { font-size: 12px; opacity: .9; text-shadow: 0 1px 0 #000; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; font-weight: 700; }
.vs-panel .bar { width: 120px; }
.vs-shields { font-size: 13px; min-height: 14px; }
#vs-pause {
  position: absolute; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); background: rgba(0,0,0,.5);
  color: #fff; font-size: 14px; pointer-events: auto; cursor: pointer;
}
.vs-dash, .vs-fire {
  --charge: 1;
  position: absolute; bottom: calc(env(safe-area-inset-bottom) + 18px); width: 78px; height: 78px; border-radius: 50%; border: none; padding: 5px;
  pointer-events: auto; touch-action: none; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.45);
  background: conic-gradient(var(--c) calc(var(--charge) * 360deg), rgba(255,255,255,.18) 0);
}
.vs-dash.left { left: 18px; --c: #16b8e8; }
.vs-dash.right { right: 18px; --c: #ff8a1f; }
.vs-fire.left { left: 104px; --c: #ffd23a; }
.vs-fire.right { right: 104px; --c: #ffd23a; }
.vs-dash span, .vs-fire span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
  background: #2a2d34; color: #888; font-size: 15px; font-family: inherit;
}
.vs-dash.ready span { background: radial-gradient(circle at 40% 35%, #fff6, var(--c)); color: #fff; }
.vs-dash.active span { background: radial-gradient(circle, #fff, var(--c)); color: #fff; }
.vs-fire.ready span { background: radial-gradient(circle at 40% 35%, #ffe28a, #e8a00f); color: #2a1a00; }
#countdown {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font-size: 120px; color: #fff; text-shadow: 0 6px 0 #000, 0 0 40px rgba(255,140,0,.7);
}
#countdown.pop { animation: cd-pop .9s ease-out; }
@keyframes cd-pop { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }
.vs-rules { text-align: left; max-width: 520px; margin: 4px 0 14px; padding-left: 22px; line-height: 1.7; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; font-size: 15px; }
.vs-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.vs-ctrl { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 14px; background: rgba(255,255,255,.08); min-width: 220px; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; font-size: 14px; line-height: 1.5; }
.vs-ctrl.p1 { border: 2px solid #16b8e8; }
.vs-ctrl.p2 { border: 2px solid #ff8a1f; }
.vs-ctrl b { font-size: 18px; }
.vs-rotate { color: #ffd23a; font-size: 15px; display: none; }
@media (orientation: portrait) and (max-width: 700px) { .vs-rotate { display: block; } }
#vs-winner { font-size: 40px; margin-bottom: 4px; }
#vs-reason { opacity: .85; margin: 0 0 14px; }
#vs-results { display: flex; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; justify-content: center; }
.vs-res { padding: 12px 18px; border-radius: 14px; background: rgba(255,255,255,.08); min-width: 170px; font-family: system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; line-height: 1.6; }
.vs-res.win { background: rgba(255,210,58,.18); border: 2px solid #ffd23a; }
.vs-res b { font-size: 20px; }

/* 视角快速切换（游戏中，暂停键右边） */
.cam-btn {
  position: absolute; top: calc(env(safe-area-inset-top) + 12px); left: calc(50% + 28px);
  height: 36px; padding: 0 12px; border-radius: 18px; border: 2px solid rgba(255,255,255,.7); background: rgba(0,0,0,.45);
  color: #fff; font: 700 13px/1 system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif; white-space: nowrap;
  pointer-events: auto; cursor: pointer; z-index: 2; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.cam-btn:active { transform: scale(.95); }
#vs-cam { top: calc(env(safe-area-inset-top) + 56px); left: 50%; transform: translateX(-50%); }
#vs-cam:active { transform: translateX(-50%) scale(.95); }

/* 逆行来车预警（路障预警下面） */
#oncoming {
  position: absolute; top: calc(env(safe-area-inset-top) + 150px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 12px;
  background: rgba(120, 10, 10, .55); border: 2px solid #ff4a3a; animation: oc-blink .5s infinite alternate;
}
.oc-title { font-size: 15px; color: #fff; text-shadow: 0 2px 0 #000; }
#oncoming .lane.closed { color: #fff; background: #ff3b2a; }
@keyframes oc-blink { to { border-color: #ffd23a; } }

/* 速度线 + 低血量红色警示 */
#speedlines { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#low-hp {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 52%, rgba(190,0,0,.62) 100%);
}

/* 限时挑战：右上角面板（目标、进度、倒计时条） */
#challenge {
  position: absolute; right: 12px; top: calc(env(safe-area-inset-top) + 118px); width: 210px;
  padding: 8px 12px 10px; border-radius: 12px; background: rgba(40, 26, 0, .62);
  border: 2px solid #ffc83a; box-shadow: 0 0 16px rgba(255, 190, 40, .45);
  color: #fff; pointer-events: none; transition: transform .2s, opacity .3s;
}
#challenge.hidden { display: none; }
#challenge .ch-title { font-size: 16px; font-weight: 900; color: #ffd84a; text-shadow: 0 2px 0 #5a3a00; }
#challenge .ch-goal { font-size: 12px; line-height: 1.3; margin: 3px 0 6px; opacity: .92; }
#challenge .ch-row { display: flex; align-items: center; gap: 8px; }
#challenge .ch-count { font: 800 15px/1 system-ui, sans-serif; min-width: 46px; }
#challenge .ch-bar { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .2); overflow: hidden; }
#challenge .ch-fill { height: 100%; background: linear-gradient(90deg, #ff8a1f, #ffd84a); border-radius: 4px; }
#challenge.done { border-color: #46e68a; box-shadow: 0 0 22px rgba(70, 230, 138, .7); transform: scale(1.06); }
#challenge.done .ch-title { color: #7dffb0; }
#challenge.fail { opacity: .55; border-color: #888; box-shadow: none; }
@media (max-width: 560px) {
  #challenge { width: 170px; top: calc(env(safe-area-inset-top) + 104px); right: 8px; }
  #challenge .ch-goal { font-size: 11px; }
}

/* 横屏手机（高度很矮）：标题页的说明分两栏、字小一点，按钮不会被挤出屏幕 */
@media (max-height: 520px) {
  #title .help { columns: 2; column-gap: 26px; font-size: 12.5px; line-height: 1.6; margin-bottom: 8px; max-width: 820px; }
  #title .help li { break-inside: avoid; }
  #title h1 { font-size: clamp(26px, 7vh, 40px); margin: 0; }
  #title .sub { margin: 2px 0 6px; }
  #title { padding-top: 8px; padding-bottom: 8px; }
  #title #difficulty-row { margin-bottom: 8px; gap: 3px; }
  #title .diff-label { display: none; }
  #title button.diff-chip { padding: 5px 14px; font-size: 14px; }
}
