:root {
  --bg1: #0e1830; --bg2: #04070f;
  --panel: rgba(16, 26, 48, .78); --line: rgba(255, 255, 255, .12);
  --text: #e8eefc; --muted: #93a2c4; --accent: #4cc9f0; --warn: #ffd54a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text);
  background: radial-gradient(ellipse at 50% 40%, var(--bg1), var(--bg2) 75%);
  -webkit-user-select: none; user-select: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#c.dragging { cursor: grabbing; }
#c.hover { cursor: pointer; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#labels span {
  position: absolute; transform: translate(-50%, -50%); font-weight: 700; font-size: 13px;
  color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000; will-change: transform;
}
#tip {
  position: fixed; z-index: 5; pointer-events: none; padding: 4px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, .75); border: 1px solid var(--line); font-size: 12px; white-space: nowrap;
}
button {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, .06); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; transition: background .15s, border-color .15s;
}
button:hover { background: rgba(255, 255, 255, .14); }
button.on { background: rgba(76, 201, 240, .22); border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 10px 18px;
  align-items: center; padding: 10px 16px; pointer-events: none;
}
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .logo { font-size: 28px; color: var(--accent); }
.brand b { display: block; font-size: 16px; }
.brand small { color: var(--muted); }
.group { display: flex; gap: 6px; flex-wrap: wrap; }

#list {
  position: fixed; left: 16px; top: 76px; bottom: 56px; width: 190px; z-index: 3; display: flex;
  flex-direction: column; gap: 6px; overflow-y: auto; padding-right: 4px;
}
#list button { text-align: left; display: flex; align-items: baseline; gap: 8px; padding: 9px 12px; background: var(--panel); backdrop-filter: blur(6px); }
#list button .k { color: var(--muted); font-size: 11px; width: 10px; }
#list button b { font-weight: 600; flex: 1; }
#list button .f { color: var(--muted); font-size: 12px; }
#list button.on { background: rgba(76, 201, 240, .25); }

.panel { background: var(--panel); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
#info { position: fixed; right: 16px; top: 76px; width: 290px; z-index: 3; max-height: calc(100% - 140px); overflow-y: auto; }
#info h2 { margin: 0; font-size: 20px; }
.formula { font-size: 22px; font-weight: 700; color: var(--accent); margin: 2px 0 8px; }
#info p { margin: 0 0 10px; color: #c8d3ee; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; }
.sel { padding: 9px 11px; border-radius: 9px; background: rgba(255, 255, 255, .05); color: var(--muted); font-size: 13px; }
.sel.active { color: var(--text); border: 1px solid var(--warn); background: rgba(255, 213, 74, .08); }
.sel b { color: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, .4); }

#help {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 32px);
  padding: 7px 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font-size: 12px; color: var(--muted); text-align: center; pointer-events: none;
}
#help b { color: var(--text); font-weight: 600; }
#noGL { position: fixed; inset: 0; display: grid; place-items: center; z-index: 10; }

@media (max-width: 820px) {
  #list { top: auto; bottom: 48px; left: 0; right: 0; width: auto; flex-direction: row; padding: 0 12px; overflow-x: auto; overflow-y: hidden; }
  #list button { flex: none; }
  #list button .k, #list button .f { display: none; }
  #info { top: auto; bottom: 100px; left: 12px; right: 12px; width: auto; max-height: 34%; padding: 12px; }
  #info p, .legend { display: none; }
  #top { padding: 8px 12px; }
  .brand small { display: none; }
  #help { display: none; }
}
#noGL[hidden] { display: none; }
