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

html, body {
  width: 100%; height: 100%;
  overflow: hidden; background: #05060a;
  font-family: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  color: #d8f6ff;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#c { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; inset: 0; pointer-events: none;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

#hud .panel {
  position: absolute; top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left));
  min-width: 168px; padding: 12px 14px;
  border: 1px solid rgba(0, 229, 255, .18);
  border-radius: 4px;
  background: linear-gradient(160deg, rgba(6, 12, 20, .72), rgba(6, 10, 16, .38));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(0, 229, 255, .08) inset;
}

#hud .title {
  font-size: clamp(15px, 2.4vw, 19px); font-weight: 800; letter-spacing: .08em;
  color: #ecfeff; text-shadow: 0 0 18px rgba(0, 229, 255, .55);
  margin-bottom: 8px;
}
#hud .title small {
  display: block; font-size: 9px; font-weight: 500; letter-spacing: .22em;
  color: rgba(0, 229, 255, .55); margin-top: 3px;
}

#hud .row {
  display: flex; justify-content: space-between; gap: 14px;
  font-size: 11px; line-height: 1.9; color: rgba(216, 246, 255, .5);
  letter-spacing: .06em;
}
#hud .row b { color: #8ff; font-weight: 600; font-variant-numeric: tabular-nums; }

#prompt {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, 0);
  font-size: 12px; letter-spacing: .18em; color: #ffe9a8;
  text-shadow: 0 0 14px rgba(255, 200, 80, .6);
  opacity: 0; transition: opacity .25s ease;
}
#prompt.on { opacity: 1; }

#hint {
  position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 7px 14px; border-radius: 3px;
  font-size: clamp(9px, 1.6vw, 11px); letter-spacing: .14em;
  color: rgba(216, 246, 255, .5);
  background: rgba(4, 8, 14, .5); border: 1px solid rgba(0, 229, 255, .12);
  white-space: nowrap; transition: opacity .8s ease;
}
#hint.hide { opacity: 0; }
#hint kbd {
  display: inline-block; padding: 1px 5px; margin: 0 1px;
  border: 1px solid rgba(0, 229, 255, .35); border-radius: 2px;
  color: rgba(0, 229, 255, .85); font-size: .92em;
}

/* ---------------- 摇杆（仅触屏） ---------------- */
#stick {
  position: absolute; left: max(20px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 116px; height: 116px; border-radius: 50%;
  border: 1px solid rgba(0, 229, 255, .22);
  background: radial-gradient(circle, rgba(0, 229, 255, .07), rgba(0, 0, 0, .28));
  display: none; pointer-events: auto; touch-action: none;
}
#stick i {
  position: absolute; left: 50%; top: 50%;
  width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, .5), rgba(0, 229, 255, .12));
  box-shadow: 0 0 18px rgba(0, 229, 255, .45);
}
body.touch #stick { display: block; }
body.touch #hint { font-size: 9px; }

/* ---------------- 加载页 ---------------- */
#loading {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: #05060a; color: #8ff;
  transition: opacity .8s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#loading.done { opacity: 0; pointer-events: none; }
#loading .mark {
  font-size: clamp(46px, 9vw, 100px); font-weight: 900; letter-spacing: .18em;
  color: #eafcff; text-shadow: 0 0 30px rgba(0, 229, 255, .7), 0 0 90px rgba(255, 45, 149, .35);
}
#loading .sub { font-size: 11px; letter-spacing: .38em; color: rgba(0, 229, 255, .6); }
#loading .bar {
  width: min(300px, 62vw); height: 2px; background: rgba(0, 229, 255, .14); overflow: hidden;
}
#loading .bar i { display: block; width: 0%; height: 100%; background: #00e5ff; box-shadow: 0 0 12px #00e5ff; transition: width .3s ease; }
#loading .msg { font-size: 11px; letter-spacing: .16em; color: rgba(216, 246, 255, .45); text-align: center; max-width: 80vw; }
