:root {
  --void: #0a0a17;
  --panel: rgba(16, 16, 24, 0.82);
  --line: #3a3a48;
  --text: #ececec;
  --muted: #9a9aa6;
  --hover: #ffffa0;
  --ok: #80c71f;
  --font-hud: "Pixelify Sans", "Segoe UI", system-ui, sans-serif;
  --font-ui: system-ui, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--text); font-family: var(--font-ui); overflow: hidden; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }

.hud { position: fixed; z-index: 10; font-family: var(--font-hud); font-size: 15px; line-height: 1.3; }
.hud-tl { top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.hud-tr { top: 10px; right: 10px; display: flex; gap: 6px; }
.hud-bl { bottom: 10px; left: 10px; background: var(--panel); border: 1px solid var(--line); padding: 4px 8px; font-size: 16px; }
.hud-br { bottom: 10px; right: 10px; display: flex; align-items: center; gap: 6px; }
#zoom-label { background: var(--panel); border: 1px solid var(--line); padding: 4px 8px; min-width: 52px; text-align: right; }
.brand { font-weight: 600; font-size: 17px; text-shadow: 2px 2px 0 #000; letter-spacing: 0.3px; }
.row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.btn, .tog {
  font-family: var(--font-hud); font-size: 15px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); padding: 4px 10px; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.btn:hover, .tog:hover { color: var(--hover); border-color: #6a6a7a; }
.btn:focus-visible, .tog:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--hover); outline-offset: 1px; }
.btn-primary { border-color: var(--ok); }
.btn-icon { width: 30px; padding: 4px 0; text-align: center; }
.tog { opacity: 0.55; }
.tog.on { opacity: 1; border-color: #6a6a7a; }
.tog.on::before { content: "✓ "; color: var(--ok); }
#worlds .tog { text-transform: none; }
#worlds .tog.on { color: var(--hover); }

.panel { right: 10px; top: 46px; background: var(--panel); border: 1px solid var(--line); padding: 10px 12px; min-width: 240px; max-width: 340px; font-family: var(--font-ui); font-size: 14px; }
.panel-title { font-family: var(--font-hud); font-size: 17px; margin-bottom: 8px; }
.panel label { display: block; margin: 6px 0; }
.panel input, .modal-box input, .modal-box select { width: 100%; background: #0e0e18; color: var(--text); border: 1px solid var(--line); padding: 5px 7px; font: inherit; }
.muted { color: var(--muted); font-size: 13px; margin-top: 6px; }
#players-panel .p { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; cursor: pointer; }
#players-panel .p:hover { color: var(--hover); }
#players-panel .p span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

.ctx { position: fixed; z-index: 30; background: var(--panel); border: 1px solid var(--line); min-width: 220px; font-family: var(--font-hud); font-size: 15px; }
.ctx .head { padding: 6px 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
.ctx .item { padding: 6px 10px; cursor: pointer; }
.ctx .item:hover { color: var(--hover); background: rgba(255,255,255,0.05); }

.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #14141f; border: 1px solid var(--line); padding: 18px 20px; max-width: 520px; width: 100%; font-size: 15px; line-height: 1.45; }
.modal-box p, .modal-box ol { margin: 8px 0; }
.modal-box ol { padding-left: 22px; }
.modal-box code { background: #0e0e18; padding: 1px 5px; border: 1px solid var(--line); font-size: 13px; }
.modal-box .row { margin-top: 12px; }
.modal-box label { display: block; margin: 8px 0; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 48px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; font-family: var(--font-hud); }

[hidden] { display: none !important; }
@media (max-width: 640px) {
  .hud { font-size: 14px; }
  .brand { display: none; }
  .hud-tr { right: 10px; top: 10px; }
  #btn-download { padding: 4px 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tog { transition: color .1s, border-color .1s; }
}
