/* AURA RUN — 嚴格 3 色：背景 / 深炭灰 / 唯一主色 */
:root {
  --bg: #F7F7F5;
  --fg: #222226;
  --accent: #FF6B35;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "PingFang SC", "Noto Sans TC", "Noto Sans SC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font-family: var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------------- HUD ---------------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  pointer-events: none; z-index: 5;
}
.hud-left { margin-top: 10px; width: max-content; pointer-events: auto; }
.hud-level { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.hud-level b { font-size: 22px; letter-spacing: 0; opacity: 1; color: var(--fg); margin-left: 2px; }
.bar { width: 180px; height: 4px; background: rgba(34,34,38,.1); border-radius: 2px; margin: 6px 0; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; }
.hud-meta { font-size: 12px; opacity: .65; }
.hud-meta b { font-weight: 600; }
.hud-meta .dot { margin: 0 4px; }

.icon {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid rgba(34,34,38,.16); background: rgba(247,247,245,.8);
  transition: border-color .15s, transform .1s;
}
.icon:hover { border-color: var(--fg); }
.icon:active { transform: scale(.94); }
.icon svg { width: 20px; height: 20px; fill: none; stroke: var(--fg); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon svg .fill { fill: var(--fg); }
.icon.off { opacity: .55; }
.icon:disabled { opacity: .3; cursor: default; }
.icon:disabled:hover { border-color: rgba(34,34,38,.16); }
.badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--fg); color: var(--bg); font-size: 10px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.lang-wrap { position: relative; }
.lang-menu {
  position: absolute; right: 0; top: 48px; min-width: 130px; padding: 6px;
  background: var(--bg); border: 1.5px solid rgba(34,34,38,.14); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(34,34,38,.08);
}
.lang-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.lang-menu button:hover { background: rgba(34,34,38,.06); }
.lang-menu button.active { color: var(--accent); font-weight: 600; }

/* ---------------- 覆蓋層 ---------------- */
.overlay {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center;
  background: rgba(247,247,245,.72);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.card { width: min(420px, 90vw); text-align: center; padding: 24px; }
.title { font-size: 56px; font-weight: 800; letter-spacing: .08em; line-height: 1; display: flex; align-items: center; justify-content: center; gap: 14px; }
.title.small { font-size: 40px; letter-spacing: .02em; }
.accent-dot { width: 16px; height: 16px; background: var(--accent); display: inline-block; transform: rotate(45deg); }
.subtitle { margin: 14px 0 26px; opacity: .65; font-size: 15px; }

.level-select { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 22px; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(34,34,38,.2); font-size: 24px; line-height: 1; }
.round:disabled { opacity: .25; cursor: default; }
.level-num { min-width: 84px; }
.level-num small { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .55; }
.level-num b { font-size: 44px; font-weight: 800; color: var(--accent); }

.primary {
  display: inline-block; min-width: 200px; padding: 14px 28px; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-size: 17px; font-weight: 700; letter-spacing: .06em;
  transition: transform .1s, box-shadow .15s;
  box-shadow: 0 0 0 0 var(--accent);
}
.primary:hover { box-shadow: 0 0 0 4px var(--accent); }
.primary:active { transform: scale(.97); }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.ghost { padding: 10px 20px; border-radius: 999px; border: 1.5px solid rgba(34,34,38,.2); font-size: 14px; }
.ghost:hover { border-color: var(--fg); }

.controls { list-style: none; margin-top: 28px; font-size: 13px; text-align: left; border-top: 1px solid rgba(34,34,38,.1); padding-top: 14px; }
.controls li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; opacity: .75; }
.controls kbd { font-family: inherit; font-size: 12px; opacity: .75; text-align: right; }

/* ---------------- 觸控 ---------------- */
#touchControls { display: none; }
body.touch #touchControls {
  display: flex; justify-content: space-between; position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 0 max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.touch-btn {
  pointer-events: auto; width: 72px; height: 72px; border-radius: 50%;
  background: rgba(247,247,245,.85); border: 2px solid rgba(34,34,38,.2);
  font-size: 13px; font-weight: 600; touch-action: none;
}
.touch-btn:active { background: var(--fg); color: var(--bg); }
#btnFocus { border-color: var(--accent); color: var(--accent); }
#btnFocus.used { opacity: .35; }
body.touch .controls { display: none; }

/* ---------------- Toast ---------------- */
#toast {
  position: absolute; left: 50%; top: max(78px, calc(env(safe-area-inset-top) + 64px)); transform: translate(-50%, -12px); z-index: 6;
  max-width: 90vw; text-align: center;
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 窄螢幕：按鈕縮小（返回按鈕與標題由 shared/header.js 處理） */
@media (max-width: 560px) {
  .icon { width: 34px; height: 34px; }
  .icon svg { width: 17px; height: 17px; }
}

@media (max-height: 500px) {
  .title { font-size: 40px; }
  .controls { display: none; }
  .subtitle { margin: 8px 0 14px; }
  .level-select { margin-bottom: 12px; }
}
