/* Bare full-screen surface: the page is the site, nothing else. */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
body {
  position: fixed;
  inset: 0;
  font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #5f6368;
}

/* The stage clips (and slides up when a phone keyboard would cover the focused field). */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #fff;
  touch-action: none;
}
#wrap {
  position: absolute;
  inset: 0;
}
#wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.18s ease;
  background: #fff;
}
#wrap iframe.on {
  opacity: 1;
}

/* While the window is being resized: the last frame, stretched to the window, until the new one is ready. */
#hold {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  transition: opacity 0.14s ease;
}
#hold.fade {
  opacity: 0;
}

/* Uploads: the file input that opens this device's own picker, and the one-tap sheet shown when the browser
   needs a fresh tap before it will open a picker (always on iPhone/iPad). */
.pick {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22);
  z-index: 20;
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.sheet button {
  font: inherit;
  border: 1px solid #dadce0;
  border-radius: 10px;
  padding: 10px 18px;
  background: #fff;
  color: #3c4043;
  cursor: pointer;
}
.sheet .sheet-main {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #fff;
}

/* Copy / Paste bubble (phones: long press or a selection; desktop: right-click), styled like the system's. */
.callout {
  position: fixed;
  z-index: 30;
  display: flex;
  overflow: hidden;
  border-radius: 10px;
  background: #2b2b2d;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  font: 15px/1.2 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.callout button {
  font: inherit;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 11px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.callout button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.callout button:active {
  background: rgba(255, 255, 255, 0.14);
}

/* Neutral loading indicator, like a page loading. */
#spinner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#spinner.gone {
  opacity: 0;
}
#spinner .ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(0, 0, 0, 0.45);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Phones only: brief keyboard shortcut after a tap, so text fields on the site can be typed into. */
#kbd {
  position: fixed;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(32, 33, 36, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
#kbd.show {
  opacity: 1;
  pointer-events: auto;
}
#kbd[hidden] {
  display: none;
}

.center {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: #fff;
}
.center[hidden] {
  display: none;
}
.center p {
  margin: 0;
}
.center button,
#code input {
  font: inherit;
  border-radius: 8px;
  padding: 9px 16px;
}
.center button {
  border: 1px solid #dadce0;
  background: #fff;
  color: #1a73e8;
  cursor: pointer;
}
#code input {
  border: 1px solid #dadce0;
  width: min(280px, 80vw);
  color: #202124;
}
#code-err {
  color: #d93025;
  font-size: 13px;
}

/* Dropdowns and date fields: this device's own native picker, invisible, laid exactly over the page's field. */
.picker {
  position: absolute;
  z-index: 5;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.picker[hidden] {
  display: none;
}

/* Demo notice strip (optional per link, see notice.js): see-through, over the page, never in its way. Above the
   page, its dropdown overlays and the keyboard button; below the Copy/Paste bubble and the upload sheet. */
#p1-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  padding: 5px 14px;
  background: rgba(17, 24, 39, 0.6);
  color: #fff;
  font: 600 13px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.01em;
  text-align: center;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
@media (max-width: 600px) {
  #p1-notice { font-size: 12px; padding: 4px 10px; white-space: normal; }
}
