| 12 | * Safe to call multiple times — only injects once. |
| 13 | */ |
| 14 | export function registerStyles() { |
| 15 | if (registered) { |
| 16 | return; |
| 17 | } |
| 18 | const style = document.createElement("style"); |
| 19 | style.textContent = ` |
| 20 | @font-face { font-family: "${FONT_NAME}"; src: url("${fontSource}") format("truetype"); } |
| 21 | |
| 22 | .dbg-wrap { |
| 23 | position: fixed; pointer-events: none; z-index: 9999; |
| 24 | } |
| 25 | |
| 26 | .dbg { |
| 27 | font-family: "${FONT_NAME}", monospace; font-size: 8px; color: #b0c4d8; |
| 28 | background: |
| 29 | repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px), |
| 30 | linear-gradient(180deg, rgba(6,8,18,0.94) 0%, rgba(10,14,28,0.92) 100%); |
| 31 | border-bottom: 2px solid #1a3050; |
| 32 | box-shadow: inset 0 0 0 1px rgba(40,80,140,0.3), 0 2px 8px rgba(0,0,0,0.5); |
| 33 | padding: 6px 10px 5px; pointer-events: none; |
| 34 | display: grid; grid-template-columns: repeat(6, auto 1fr); gap: 2px 0; |
| 35 | align-items: center; line-height: 1.7; |
| 36 | image-rendering: pixelated; |
| 37 | } |
| 38 | |
| 39 | /* labels: muted steel blue, right-aligned */ |
| 40 | .dbg .dim { |
| 41 | color: #4a6a88; text-align: right; padding-right: 6px; |
| 42 | white-space: nowrap; text-transform: lowercase; |
| 43 | } |
| 44 | |
| 45 | /* values: bright cyan */ |
| 46 | .dbg .val { |
| 47 | color: #00e0ff; white-space: nowrap; padding-right: 14px; |
| 48 | text-shadow: 0 0 6px rgba(0,224,255,0.2); |
| 49 | } |
| 50 | |
| 51 | /* fps: amber accent, bold presence */ |
| 52 | .dbg .fps-val { |
| 53 | color: #ffb800; text-shadow: 0 0 6px rgba(255,184,0,0.25); |
| 54 | justify-content: flex-end; white-space: nowrap; |
| 55 | } |
| 56 | |
| 57 | /* help text */ |
| 58 | .dbg .help { |
| 59 | color: #384858; justify-content: flex-end; |
| 60 | font-size: 7px; white-space: nowrap; |
| 61 | } |
| 62 | |
| 63 | /* checkbox labels */ |
| 64 | .dbg label { |
| 65 | cursor: pointer; white-space: nowrap; pointer-events: auto; |
| 66 | display: flex; align-items: center; gap: 5px; |
| 67 | color: #6888a8; transition: color 0.15s; |
| 68 | } |
| 69 | .dbg label:hover { color: #00e0ff; } |
| 70 | |
| 71 | /* pixel-art checkbox: NES-style toggle */ |