:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --card: rgba(17, 22, 34, 0.82);
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef2fb;
  --muted: #8d98b3;
  --accent: #4f7cff;
  --accent-hover: #6a90ff;
  --ok: #7fd8a8;
  --err: #ff8f8f;
  --radius: 14px;
  font-family: -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
}

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
canvas { display: block; touch-action: none; }

#hud {
  position: fixed; top: 16px; left: 16px; z-index: 10;
  width: min(300px, calc(100vw - 32px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  font-size: 13px; line-height: 1.6;
}
body.in-xr #hud { display: none; }

.hud-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; }
.hud-head h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.02em; }
.badge {
  font-size: 11px; font-weight: 600; color: var(--accent-hover);
  background: rgba(79, 124, 255, 0.16); padding: 2px 8px; border-radius: 999px;
}
.hud-head .icon { margin-left: auto; }
#hud.collapsed .hud-body { display: none; }
#hud.collapsed #collapse { transform: rotate(-90deg); }

.hud-body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.xr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

button {
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  transition: background 0.12s, border-color 0.12s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); }
button:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: rgba(255, 255, 255, 0.18); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { color: var(--text); }
button.wide { width: 100%; }
button.icon { padding: 4px 10px; background: transparent; border-color: transparent; color: var(--muted); }

p { margin: 0; }
.lead { color: var(--muted); }
.lead b { color: var(--text); }
.note { color: var(--err); font-size: 12px; }

details { border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; color: var(--muted); font-weight: 600; }
summary:hover { color: var(--text); }
dl { margin: 8px 0 0; }
dt { font-weight: 600; margin-top: 6px; }
dd { margin: 2px 0 0; color: var(--muted); }
kbd {
  font: inherit; font-size: 11px; padding: 0 5px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line);
}

#status { font-size: 12px; color: var(--ok); min-height: 1.4em; }
#status.err { color: var(--err); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
