/* Layout: the 3D view fills the screen; menus are printed field data cards laid over it;
   in play the HUD lives in the four corners so the scope picture stays clear. */
:root {
  --night: #0b0e0b;
  --paper: #d9cfb2;
  --paper-2: #cabf9e;
  --paper-edge: #9f9370;
  --ink: #1b2118;
  --ink-2: #4c5342;
  --rule: rgba(27, 33, 24, 0.26);
  --pencil: #b3311d;
  --olive: #3f4e31;
  --hud: #f2efe3;
  --hud-dim: rgba(242, 239, 227, 0.66);
  --amber: #f2b33d;
  --alert: #ff6247;
  --good: #4d6a35;
  --f-display: "Changa", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --f-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--night); color: var(--hud);
  font-family: var(--f-body); font-size: 15px; line-height: 1.55;
  overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
canvas#gl, canvas#reticle { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
canvas#gl { touch-action: none; }
canvas#reticle { pointer-events: none; }
button { font: inherit; color: inherit; }

/* buttons (menus and HUD panels) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 18px; cursor: pointer;
  background: transparent; color: var(--ink); border: 2px solid var(--ink); border-radius: 2px;
  font-family: var(--f-display); font-weight: 500; font-size: 16px;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--pencil); outline-offset: 2px; }
.title button:focus-visible { outline-color: var(--amber); }
.btn.primary { background: var(--pencil); border-color: var(--pencil); color: #fff7ee; }
.btn.primary:hover { background: #8f2413; border-color: #8f2413; }
.btn.ghost { border-color: var(--rule); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 11, 8, 0.9); z-index: 20; }
.loading-box { display: grid; justify-items: center; gap: 14px; font: 500 16px var(--f-display); color: var(--hud); }
.loading-box b { width: 46px; height: 46px; border: 2px solid var(--hud-dim); border-radius: 50%; position: relative; animation: spin 1.1s linear infinite; }
.loading-box b::before, .loading-box b::after { content: ""; position: absolute; background: var(--amber); }
.loading-box b::before { left: 50%; top: -6px; width: 2px; height: 16px; margin-left: -1px; }
.loading-box b::after { left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .loading-box b { animation-duration: 4s; }
}
