/* The page around the app: the theme's base color, and the app's box kept
   inside the safe area (Flutter on the web doesn't read it itself). The
   page never scrolls or bounces: the on-screen keyboard is an inset the app
   lays out above (phone/keyboard_web.dart), not a reason to move the page. */
html, body {
  margin: 0; height: 100%; background: #FFFFFF; overflow: hidden;
  overscroll-behavior: none;
}
@media (prefers-color-scheme: dark) { html, body { background: #1E1F22; } }
#app {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
}

/* iOS 26 and later blur the top of a Home Screen web app, the status bar
   and some way under it, unless a fixed box with a background of its own
   lies along the page's top edge (others' findings, not Apple's word: at
   least 6px high, most of the width, within 4px of the top). The app's
   own box is a canvas with no background, so this strip is that box: the
   status bar's height where the page reaches under it, else 6px over the
   app's top, in the page's color. Only there (-webkit-touch-callout is
   iOS's alone): elsewhere nothing blurs. The owner's iPhone showed the
   blur without it and none with it (2026-11-10). */
#top-edge { display: none; }
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) {
    #top-edge {
      display: block; position: fixed; z-index: 1; top: 0; right: 0; left: 0;
      height: max(6px, env(safe-area-inset-top, 0px)); background: #FFFFFF;
    }
  }
  @media (display-mode: standalone) and (prefers-color-scheme: dark) {
    #top-edge { background: #1E1F22; }
  }
}

/* Until the app draws: a spinner and a line, under #app (whose canvas
   covers it once drawn). */
#loading {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  font: 15px -apple-system, system-ui, sans-serif; color: #6B6F76;
  padding: 0 32px; text-align: center;
}
#loading .spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgba(127, 127, 127, 0.25); border-top-color: #4C8DF6;
  animation: spin 0.9s linear infinite;
}
#loading.failed .spinner { display: none; }
#loading.failed { color: #E5484D; }
@keyframes spin { to { transform: rotate(360deg); } }
