/* 3D Viewer styles. Ported from terrain/scripts/walk_viewer_template.html (everything scoped to #stage). */
#stage { margin: 0; height: 100%; overflow: hidden; background: #b9c7d3; font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; }
  #stage #gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
  #stage #gl.dragging { cursor: grabbing; }
  #stage .box { background: rgba(20, 26, 22, .78); border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
  #stage #panel { position: absolute; top: 10px; left: 10px; padding: 10px 12px; width: 230px; max-height: calc(100% - 40px); overflow: auto; }
  #stage #panel h1 { font-size: 16px; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
  #stage #panel h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #b8c4b9; margin: 10px 0 4px; font-weight: 600; }
  #stage #panel label { display: block; margin: 3px 0; cursor: pointer; }
  #stage #panel select { width: 100%; font: inherit; padding: 4px; border-radius: 6px; border: 0; }
  #stage #panel.closed .body { display: none; }
  #stage button { font: inherit; border: 0; border-radius: 6px; padding: 4px 9px; background: #e9efe9; color: #17201a; cursor: pointer; }
  #stage button:hover { background: #fff; }
  #stage #readout { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 7px 14px; white-space: nowrap; font-size: 15px; }
  #stage #map { position: absolute; right: 10px; bottom: 10px; padding: 6px; }
  #stage #map canvas { display: block; width: 160px; height: 240px; border-radius: 6px; cursor: crosshair; }
  #stage #map.big canvas { width: 300px; height: 450px; }
  #stage #map .row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 4px; gap: 6px; }
  #stage #help { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 16px 20px; width: min(420px, calc(100% - 60px)); }
  #stage #help h2 { margin: 0 0 8px; font-size: 18px; }
  #stage #help table { border-collapse: collapse; width: 100%; margin-bottom: 10px; }
  #stage #help td { padding: 3px 4px; vertical-align: top; }
  #stage #help td:first-child { white-space: nowrap; color: #ffd98a; padding-right: 12px; }
  #stage #help .touch { display: none; }
  #stage #loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #17201a; }
  #stage #loading[hidden], #stage #help[hidden] { display: none; }
  #stage #panel, #stage #readout, #stage #map, #stage #help, #stage #joy { z-index: 10; }
  #stage #help { z-index: 11; }
  #stage #joy { position: absolute; left: 24px; bottom: 70px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.15); border: 2px solid rgba(255,255,255,.45); display: none; touch-action: none; }
  #stage #joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(255,255,255,.7); }
  @media (pointer: coarse) {
    #stage #joy { display: block; }
    #stage #help .touch { display: table-row-group; } #stage #help .keys { display: none; }
    #stage #panel { width: 200px; }
    #stage #readout { bottom: auto; top: 62px; left: 10px; right: 10px; transform: none; font-size: 13px; white-space: normal; text-align: center; }
    #stage #panel:not(.closed) ~ #readout { display: none; }
    #stage #map .row span { display: none; }
    #stage #map canvas { width: 110px; height: 165px; }
    #stage #map.big canvas { width: 220px; height: 330px; }
    #stage #joy { bottom: 30px; }
  }

/* ---- site page layout (added by the port) ---- */
html, body { height: 100%; overflow: hidden; }
#page:not([hidden]) { display: flex; flex-direction: column; height: 100%; }
#page > .topnav { flex: none; }
#stage { position: relative; flex: 1 1 auto; height: auto; min-height: 0; }
#stage h1, #stage h2 { font-family: inherit; line-height: 1.2; letter-spacing: normal; }
#stage label { color: inherit; font-size: inherit; }
#stage button { display: inline-block; min-height: 0; font: inherit; line-height: 1.2; }
#stage select { min-height: 0; color: #17201a; background: #fff; flex: none; }
/* status line: above the panels so loading progress and errors are always visible */
#stage #loading { inset: auto; top: 12px; left: 50%; transform: translateX(-50%); z-index: 12; display: block;
  max-width: min(560px, calc(100% - 40px)); padding: 10px 16px; border-radius: 10px; text-align: center;
  background: rgba(20, 26, 22, .9); color: #fff; font-size: 15px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
#stage #loading.bad { background: rgba(140, 30, 20, .95); }
