/* GEORAMA — ui.css
 * Design language (CONTRACT §3 ui.js): dark glass panels, 1px cool borders,
 * radius 14px, accent cyan #7fd4ff, sun amber #ffc36b, text #e8f0fa,
 * system-ui, letter-spacing .01em. Nothing scrolls except panel interiors.
 * Safe-area insets respected; 390px portrait phone through desktop; XR
 * dom-overlay mode (.g-xr) bumps touch targets.
 */

.g-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
  color: #e8f0fa;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: .01em;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.g-root *, .g-root *::before, .g-root *::after { box-sizing: border-box; }
.g-hidden { display: none !important; }

/* ---------- glass panel ---------- */
.g-panel {
  background: rgba(10, 16, 28, .72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(140, 180, 255, .22);
  border-radius: 14px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, .35);
}

/* ---------- icons ---------- */
.g-ic { width: 22px; height: 22px; display: block; flex: 0 0 auto; }
.g-ic-accent { color: #7fd4ff; }
.g-ic-chev { transition: transform .18s ease; }
.g-open .g-ic-chev { transform: rotate(180deg); }

/* ---------- buttons ---------- */
.g-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(140, 180, 255, .22);
  background: rgba(10, 16, 28, .72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #e8f0fa;
  font: inherit;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.g-btn:hover { background: rgba(28, 40, 62, .78); border-color: rgba(140, 180, 255, .4); }
.g-btn:active { background: rgba(40, 56, 84, .82); }
.g-btn:disabled { opacity: .45; cursor: default; }
.g-btn-accent {
  color: #7fd4ff;
  border-color: rgba(127, 212, 255, .5);
  background: rgba(127, 212, 255, .13);
}
.g-btn-accent:hover { background: rgba(127, 212, 255, .22); border-color: rgba(127, 212, 255, .7); }
.g-btn-sm { min-height: 40px; padding: 8px 14px; font-size: 13px; }
.g-btn-wide { width: 100%; }
.g-btn.g-on { color: #7fd4ff; border-color: rgba(127, 212, 255, .55); background: rgba(127, 212, 255, .14); }

.g-icbtn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(140, 180, 255, .22);
  background: rgba(10, 16, 28, .72);
  color: rgba(232, 240, 250, .85);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.g-icbtn:hover { background: rgba(28, 40, 62, .8); color: #e8f0fa; }
.g-icbtn-plain { border: none; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------- landing overlay ---------- */
.g-landing {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(10, 18, 34, .38) 0%, rgba(4, 8, 16, .66) 70%, rgba(3, 6, 12, .8) 100%);
}
.g-landing-inner {
  width: min(440px, calc(100% - 32px));
  max-height: 100%;
  overflow-y: auto;              /* panel interior — the page itself never scrolls */
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding:
    calc(28px + env(safe-area-inset-top, 0px))
    calc(4px + env(safe-area-inset-right, 0px))
    calc(28px + env(safe-area-inset-bottom, 0px))
    calc(4px + env(safe-area-inset-left, 0px));
  scrollbar-width: none;
}
.g-landing-inner::-webkit-scrollbar { display: none; }

.g-hero { text-align: center; margin-bottom: 4px; }
.g-wordmark {
  font-size: clamp(30px, 7vw, 44px);
  font-weight: 600;
  letter-spacing: .34em;
  margin-right: -.34em;          /* re-center the tracked-out caps */
  color: #e8f0fa;
  text-shadow: 0 0 26px rgba(127, 212, 255, .35);
}
.g-tagline {
  margin-top: 6px;
  font-size: 13.5px;
  letter-spacing: .12em;
  color: rgba(232, 240, 250, .62);
}

.g-card { padding: 14px 16px; }
.g-loccard-head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.g-loccard-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-loccard-coords {
  margin: 6px 0 10px 32px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #7fd4ff;
}
.g-loccard-actions { display: flex; gap: 10px; margin-left: 32px; }

.g-enter-row { display: flex; gap: 10px; }
.g-btn-enter { flex: 1 1 0; flex-direction: column; gap: 4px; padding: 12px 8px; font-size: 13.5px; }
.g-btn-enter .g-ic { width: 26px; height: 26px; }

.g-about { display: flex; flex-direction: column; gap: 8px; }
.g-about-toggle {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: rgba(232, 240, 250, .65);
  font: inherit;
  font-size: 13px;
  letter-spacing: .08em;
  cursor: pointer;
}
.g-about-toggle:hover { color: #e8f0fa; }
.g-about-body { padding: 14px 16px; }
.g-about-body p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: rgba(232, 240, 250, .82); }
.g-about-body p:last-child { margin-bottom: 0; }

/* ---------- HUD ---------- */
.g-hud { position: absolute; inset: 0; pointer-events: none; }
.g-hud > * { pointer-events: auto; }

.g-chip {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(10px + env(safe-area-inset-left, 0px));
  max-width: min(62vw, 300px);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.45;
}
.g-chip-place { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-chip-row { display: flex; gap: 6px; align-items: baseline; font-variant-numeric: tabular-nums; color: rgba(232, 240, 250, .85); }
.g-chip-k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #7fd4ff; }
.g-chip-k.g-amber { color: #ffc36b; }

.g-topright {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(10px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
}

/* layer icon row — bottom center; its interior scrolls, the page doesn't */
.g-layerrow {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 6px;
  max-width: min(calc(100% - 24px), 720px);
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.g-layerrow::-webkit-scrollbar { display: none; }
.g-layerbtn { border: 1px solid transparent; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: rgba(232, 240, 250, .48); }
.g-layerbtn:hover { color: rgba(232, 240, 250, .85); background: rgba(140, 180, 255, .08); }
.g-layerbtn.g-on {
  color: #7fd4ff;
  background: rgba(127, 212, 255, .13);
  border-color: rgba(127, 212, 255, .4);
}

/* ---------- altitude slider (right edge, vertical, log scale) ---------- */
.g-alt {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.g-alt-read {
  min-width: 68px;
  padding: 6px 10px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: #7fd4ff;
  border-radius: 10px;
}
.g-alt-track {
  position: relative;
  width: 44px;
  height: min(38vh, 320px);
  cursor: pointer;
  touch-action: none;
}
.g-alt-rail {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 5px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: rgba(140, 180, 255, .22);
}
.g-alt-fill {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 5px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(to top, rgba(127, 212, 255, .85), rgba(127, 212, 255, .35));
}
.g-alt-thumb {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, 50%);
  border-radius: 50%;
  background: #7fd4ff;
  box-shadow: 0 0 10px rgba(127, 212, 255, .55);
  pointer-events: none;
}

/* ---------- modals ---------- */
.g-modalwrap {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    calc(14px + env(safe-area-inset-right, 0px))
    calc(14px + env(safe-area-inset-bottom, 0px))
    calc(14px + env(safe-area-inset-left, 0px));
}
.g-scrim { position: absolute; inset: 0; background: rgba(3, 6, 12, .5); }
.g-modal {
  position: relative;
  width: min(100%, 400px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.g-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px 10px 18px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .04em;
  border-bottom: 1px solid rgba(140, 180, 255, .14);
  flex: 0 0 auto;
}
.g-modal-body {
  padding: 14px 18px 18px;
  overflow-y: auto;              /* panel interior scroll */
  overscroll-behavior: contain;
}
.g-sub {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #7fd4ff;
  margin: 2px 0 10px;
}
.g-hint { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: rgba(232, 240, 250, .65); }
.g-divider { height: 1px; background: rgba(140, 180, 255, .14); margin: 16px 0; }
.g-row-end { display: flex; justify-content: flex-end; margin-top: 12px; }

.g-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; flex: 1 1 0; min-width: 0; }
.g-field > span { font-size: 11.5px; letter-spacing: .06em; color: rgba(232, 240, 250, .6); }
.g-field input {
  pointer-events: auto;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(140, 180, 255, .25);
  background: rgba(6, 10, 20, .6);
  color: #e8f0fa;
  font: inherit;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: text;
  user-select: text;
}
.g-field input:focus { outline: none; border-color: rgba(127, 212, 255, .65); }
.g-field-row { display: flex; gap: 10px; }

.g-msg { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: rgba(232, 240, 250, .75); }
.g-msg-err { color: #ffc36b; }

.g-presets { display: flex; flex-direction: column; gap: 6px; }
.g-preset {
  pointer-events: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(140, 180, 255, .16);
  background: rgba(140, 180, 255, .05);
  color: #e8f0fa;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.g-preset:hover { background: rgba(127, 212, 255, .1); border-color: rgba(127, 212, 255, .4); }
.g-preset-co { font-size: 11.5px; font-variant-numeric: tabular-nums; color: rgba(232, 240, 250, .5); white-space: nowrap; }

/* ---------- range sliders (settings) ---------- */
.g-slider-field { display: block; margin-bottom: 14px; }
.g-slider-label { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(232, 240, 250, .75); margin-bottom: 2px; }
.g-slider-label b { color: #7fd4ff; font-weight: 600; font-variant-numeric: tabular-nums; }
.g-slider-ends { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: .08em; color: rgba(232, 240, 250, .45); }
.g-slider-ends i { font-style: normal; }

.g-range {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.g-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(140, 180, 255, .25);
}
.g-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: none;
  border-radius: 50%;
  background: #7fd4ff;
  box-shadow: 0 0 8px rgba(127, 212, 255, .5);
}
.g-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(140, 180, 255, .25);
}
.g-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #7fd4ff;
  box-shadow: 0 0 8px rgba(127, 212, 255, .5);
}

.g-time-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.g-time-off { font-size: 13px; font-variant-numeric: tabular-nums; color: #7fd4ff; }
.g-speeds { display: flex; gap: 8px; margin-top: 8px; }
.g-speed { flex: 1 1 0; }

/* ---------- compass ring ---------- */
.g-ringbox { display: flex; justify-content: center; margin: 4px 0 8px; }
.g-ring {
  width: min(220px, 62vw);
  height: auto;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
.g-ring:active { cursor: grabbing; }
.g-ring-outer { fill: rgba(140, 180, 255, .04); stroke: rgba(140, 180, 255, .3); stroke-width: 1; }
.g-ring-tick { stroke: rgba(232, 240, 250, .35); stroke-width: 1.5; stroke-linecap: round; }
.g-ring-tick-major { stroke: rgba(232, 240, 250, .8); stroke-width: 2; }
.g-ring-card {
  fill: rgba(232, 240, 250, .75);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .05em;
  text-anchor: middle;
  dominant-baseline: central;
}
.g-ring-n { fill: #7fd4ff; font-size: 17px; }
.g-ring-marker { fill: #ffc36b; }
.g-ring-row { display: flex; align-items: center; justify-content: space-between; }
.g-ring-val { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; color: #7fd4ff; }

/* ---------- XR (dom-overlay) mode: compact HUD, big touch targets ---------- */
.g-xr { font-size: 15px; }
.g-xr .g-icbtn { width: 52px; height: 52px; }
.g-xr .g-ic { width: 26px; height: 26px; }
.g-xr .g-chip { font-size: 14px; padding: 10px 14px; }
.g-xr .g-chip-place { font-size: 15px; }
.g-xr .g-alt-track { width: 52px; }
.g-xr .g-alt-thumb { width: 24px; height: 24px; }
.g-xr .g-alt-read { font-size: 14px; }
.g-xr .g-layerrow { gap: 6px; }
.g-xr .g-btn { min-height: 52px; }

/* ---------- small screens (390px portrait) ---------- */
@media (max-width: 480px) {
  .g-enter-row { flex-direction: column; }
  .g-btn-enter { flex-direction: row; gap: 10px; }
  .g-chip { max-width: 56vw; }
  .g-layerrow { max-width: calc(100% - 20px); }
  .g-modal { width: 100%; }
}
@media (max-height: 480px) {
  .g-alt-track { height: 34vh; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .g-root *, .g-root *::before, .g-root *::after {
    transition: none !important;
    animation: none !important;
  }
}
