/* Wellsame for iPhone: the page around the app's Android-style views. */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sbar: #16112f;
  --nbar: #16112f;
  --vvh: 100dvh;
  --vvtop: 0px;
  color-scheme: light dark;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--nbar);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  font-family: -apple-system, system-ui, "Helvetica Neue", Roboto, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#sbar, #nbar { position: fixed; left: 0; right: 0; z-index: 0; }
#sbar { top: 0; height: var(--sat); background: var(--sbar); }
#nbar { bottom: 0; height: var(--sab); background: var(--nbar); }

/* The app's windows sit between the notch and the home bar, and shrink for the keyboard. */
#app, #overlay {
  position: fixed;
  left: var(--sal);
  right: var(--sar);
  top: calc(var(--sat) + var(--vvtop));
  height: calc(var(--vvh) - var(--sat) - var(--sab));
  overflow: hidden;
}
#app { z-index: 1; background: var(--sbar); }
#overlay { z-index: 2; pointer-events: none; }

.win {
  position: absolute;
  inset: 0;
  overflow: hidden;
  contain: strict;
  will-change: transform;
}
.win.enter { transform: translate3d(100%, 0, 0); }
.win.enter.go { transform: none; transition: transform 340ms cubic-bezier(0.2, 0.9, 0.25, 1); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25); }
.win.under { transform: translate3d(-28%, 0, 0); transition: transform 340ms cubic-bezier(0.2, 0.9, 0.25, 1); }
.win.under.back { transform: translate3d(-28%, 0, 0); transition: none; }
.win.under.back.go { transform: none; transition: transform 320ms cubic-bezier(0.2, 0.9, 0.25, 1); }
.win.leave { transform: translate3d(100%, 0, 0); transition: transform 320ms cubic-bezier(0.2, 0.9, 0.25, 1); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25); z-index: 5; }
.win.hidden { visibility: hidden; }

.dlg {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0);
  transition: background 160ms ease;
}
.dlg.on { background: rgba(0, 0, 0, var(--dim, 0.6)); }
.dlg > .v { opacity: 0; transform: scale(0.96); transition: opacity 160ms ease, transform 160ms ease; }
.dlg.on > .v { opacity: 1; transform: none; }

/* Views: absolutely placed by Android's layout. */
.v {
  position: absolute;
  box-sizing: border-box;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
}
.v > .bg, .v > .cv { position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; pointer-events: none; }
.v > canvas.cv { width: auto; height: auto; }
.tx {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  pointer-events: none;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
.tx a { pointer-events: auto; color: inherit; }
.tx .rs canvas { display: block; }

.scroll-y { overflow-x: hidden !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none; }
.scroll-x { overflow-y: hidden !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; }
.scroll-y::-webkit-scrollbar, .scroll-x::-webkit-scrollbar { display: none; }
.sizer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; pointer-events: none; visibility: hidden; }

.et {
  position: absolute;
  box-sizing: border-box;
  border: 0;
  margin: 0;
  padding: 0;
  outline: none;
  background: transparent;
  resize: none;
  overflow: auto;
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
}
.et::placeholder { color: var(--ph, rgba(128, 128, 128, 0.7)); opacity: 1; }

.wv { position: absolute; left: 0; top: 0; border: 0; display: block; background: transparent; }

.native-input {
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  font: 17px -apple-system, system-ui, sans-serif;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(128, 128, 128, 0.4);
  background: rgba(128, 128, 128, 0.12);
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--sab) + 72px);
  transform: translate(-50%, 16px);
  max-width: min(86vw, 420px);
  padding: 12px 18px;
  border-radius: 22px;
  background: rgba(40, 40, 46, 0.94);
  color: #fff;
  font: 15px/1.35 -apple-system, system-ui, sans-serif;
  text-align: center;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

#cover { position: fixed; inset: 0; z-index: 200; background: #f2f2f7; }
@media (prefers-color-scheme: dark) { #cover { background: #000; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #2a2160, #16112f 70%);
  transition: opacity 350ms ease;
}
#splash.gone { opacity: 0; pointer-events: none; }
#splash .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7fe0d0;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(0.7); opacity: 0.5; } 50% { transform: scale(1.3); opacity: 1; } }
.fatal { color: #fff; font: 16px/1.5 -apple-system, system-ui, sans-serif; text-align: center; padding: 24px; }
.fatal small { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .win.enter.go, .win.under, .win.leave, .win.under.back.go, .dlg, .dlg > .v { transition: none !important; }
}
