:root { --fg: #f4f7fb; --bg: rgba(12, 18, 28, .72); --acc: #4fa3ff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1220; color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.panel-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: radial-gradient(ellipse at top, #1f3b63 0%, #0b1220 70%); z-index: 10; overflow-y: auto; }
.panel-screen[hidden] { display: none; }
.panel-screen.overlay { background: rgba(5, 10, 18, .6); }
.card { width: 100%; max-width: 460px; background: var(--bg); border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 24px; backdrop-filter: blur(8px); }
h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: .5px; }
.sub { margin: 0 0 18px; opacity: .8; }
button { font: inherit; color: var(--fg); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:hover { background: rgba(255,255,255,.18); }
button.primary { width: 100%; background: var(--acc); border: 0; font-weight: 600; font-size: 16px; padding: 14px; color: #fff; }
.msg { min-height: 1.4em; margin: 8px 0; color: #ffcf6e; font-size: 13px; }
.or { text-align: center; opacity: .6; margin: 6px 0 10px; font-size: 13px; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; font: inherit; color: var(--fg); background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 10px 12px; outline: none; }
.search input:focus { border-color: var(--acc); }
.results { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.results button { text-align: left; font-size: 13px; padding: 8px 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.presets button { font-size: 13px; padding: 6px 10px; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud[hidden] { display: none; }
#info { position: absolute; top: 12px; left: 12px; background: var(--bg); padding: 8px 12px; border-radius: 10px;
  font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
#status { position: absolute; top: 12px; right: 12px; background: var(--bg); padding: 6px 10px; border-radius: 10px;
  font-size: 12px; max-width: 45vw; }
#status:empty { display: none; }
#compass { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 260px; max-width: 40vw; height: 28px;
  overflow: hidden; background: var(--bg); border-radius: 10px; }
#compass-strip { position: absolute; top: 0; left: 0; height: 100%; white-space: nowrap; font: 600 12px/28px system-ui; }
#compass-strip span { display: inline-block; width: 30px; text-align: center; opacity: .8; }
#compass-strip span.c { color: #ff6b6b; opacity: 1; }
#compass-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--acc); transform: translateX(-1px); }
#help { position: absolute; bottom: 12px; left: 12px; background: var(--bg); padding: 8px 12px; border-radius: 10px; font-size: 12px; }
#help.hidden { display: none; }
#attrib { position: absolute; bottom: 4px; right: 8px; font-size: 10px; opacity: .7; text-shadow: 0 0 3px #000; }
#loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--bg);
  padding: 12px 18px; border-radius: 12px; z-index: 6; }
#loading[hidden] { display: none; }

#touch { display: none; }
@media (pointer: coarse) {
  #touch { display: block; }
  #help { display: none; }
  #info { font-size: 10px; }
  #joy { position: absolute; left: 24px; bottom: 40px; width: 130px; height: 130px; border-radius: 50%;
    background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; }
  #joy-knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%;
    background: rgba(255,255,255,.4); }
  #touch-btns { position: absolute; right: 16px; bottom: 40px; display: grid; grid-template-columns: repeat(3, 52px); gap: 8px; pointer-events: auto; }
  #touch-btns button { width: 52px; height: 52px; padding: 0; font-size: 20px; border-radius: 50%; background: rgba(12,18,28,.55); }
}
