/* Base, layout shell, responsive structure */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
/* Anything the app doesn't cover (e.g. under the bottom bar) matches the bottom bar, never white. */
html { background: var(--cream-2); overflow: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px rgba(58, 37, 80, 0.55); border-radius: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--cream); padding: 10px 16px; border-radius: 12px; font-weight: 800; }
.skip-link:focus { top: 12px; }

#app { display: grid; grid-template-rows: var(--hud-h) 1fr; grid-template-columns: minmax(0, 1fr); height: 100%; width: 100%; overflow: hidden; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); min-height: 0; gap: 0; }
.map-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.panel { min-height: 0; display: flex; flex-direction: column; padding: 10px 14px 14px 4px; }
.bottom-nav { display: none; }

.ic { flex: none; display: block; }

@media (max-width: 1100px) {
  :root { --panel-w: 340px; }
}

/* Tablet & phone: the panel becomes a sheet over the map. */
@media (max-width: 900px) {
  :root { --hud-h: 64px; }
  #app { grid-template-rows: var(--hud-h) 1fr auto; }
  .stage { grid-template-columns: minmax(0, 1fr); position: relative; }
  .panel {
    position: absolute; inset: auto 0 0 0; height: min(72%, 640px);
    padding: 8px 10px 10px; z-index: 20;
    transform: translateY(105%); transition: transform 0.3s var(--ease-pop);
    pointer-events: none;
  }
  .panel.is-open { transform: translateY(0); pointer-events: auto; }
  .bottom-nav { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  :root:not(.motion-on) *, :root:not(.motion-on) *::before, :root:not(.motion-on) *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important;
  }
}
:root.motion-off *, :root.motion-off *::before, :root.motion-off *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important;
}

/* Full-screen home-screen app on iPhone: keep the top bar clear of the notch / Dynamic Island. */
@supports (padding-top: env(safe-area-inset-top)) {
  :root { --safe-top: env(safe-area-inset-top, 0px); }
  #app { grid-template-rows: calc(var(--hud-h) + var(--safe-top)) 1fr; }
  .hud { padding-top: calc(var(--safe-top) + 8px) !important; }
  @media (max-width: 900px) { #app { grid-template-rows: calc(var(--hud-h) + var(--safe-top)) 1fr auto; } }
}

/* Home-screen app on iPhone: with the see-through status bar, iOS makes the page shorter than the
   screen by the status bar's height, leaving a strip at the bottom. Stretch it to the full screen. */
@media (display-mode: standalone) {
  html { height: 100vh; height: calc(100% + env(safe-area-inset-top, 0px)); }
  body { height: 100%; }
  #app { height: 100%; }
  .bottom-nav { padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
}
