:root {
  --vasi-safe-top: env(safe-area-inset-top, 0px);
  --vasi-safe-right: env(safe-area-inset-right, 0px);
  --vasi-safe-bottom: env(safe-area-inset-bottom, 0px);
  --vasi-safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background: #050505;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/*
 * Default: document pages have one natural page scroller.
 * Full-screen working surfaces opt in with data-scroll-mode="viewport".
 */
body {
  width: 100%;
  min-height: 100%;
  min-height: 100svh;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-top: var(--vasi-safe-top);
  padding-right: var(--vasi-safe-right);
  padding-bottom: var(--vasi-safe-bottom);
  padding-left: var(--vasi-safe-left);
}

body > .app,
body > .wrap,
body > main {
  width: auto;
  min-width: 0;
  margin-inline: auto;
  min-height: calc(100vh - var(--vasi-safe-top) - var(--vasi-safe-bottom));
  min-height: calc(100svh - var(--vasi-safe-top) - var(--vasi-safe-bottom));
  overflow-x: hidden;
  overflow-x: clip;
}

body[data-scroll-mode="viewport"] {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body[data-scroll-mode="viewport"] > .app,
body[data-scroll-mode="viewport"] > main {
  position: relative;
  width: min(100%, 760px);
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  max-height: none;
  margin: 0 auto;
  overflow: hidden;
}

body[data-scroll-mode="viewport"] [data-scroll-region] {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

body[data-scroll-mode="viewport"] .chat {
  min-height: 0 !important;
  height: auto;
  overflow: hidden;
}

body[data-scroll-mode="viewport"] .messages[data-scroll-region] {
  max-height: none !important;
}

body[data-scroll-mode="viewport"] .payModal {
  overflow: hidden;
}

body[data-scroll-mode="viewport"] .payBox[data-scroll-region] {
  max-height: calc(100dvh - max(28px, var(--vasi-safe-top)) - max(28px, var(--vasi-safe-bottom)));
}

body > .app > *,
body > .wrap > *,
body > main > *,
.panel,
.map,
.types,
.paygrid,
.options,
.policy {
  min-width: 0;
  max-width: 100%;
}

.types,
.paygrid,
.options,
.policy {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.type,
.pay,
.option,
.field,
.stop,
.fareRow {
  min-width: 0;
  overflow-wrap: anywhere;
}

.map,
.leaflet-container {
  width: 100%;
  max-width: 100%;
  touch-action: none !important;
}

body > *,
body > .app > *,
body > .wrap > *,
body > main > * {
  max-inline-size: 100%;
}

.leaflet-control-attribution {
  max-width: calc(100% - 8px);
  white-space: normal;
  text-align: right;
  line-height: 1.15;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

.payModal {
  padding-top: max(14px, var(--vasi-safe-top)) !important;
  padding-right: max(14px, var(--vasi-safe-right)) !important;
  padding-bottom: max(14px, var(--vasi-safe-bottom)) !important;
  padding-left: max(14px, var(--vasi-safe-left)) !important;
}

@media (max-width: 768px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
    line-height: 1.25;
  }

  body:not([data-scroll-mode="viewport"]) {
    scroll-padding-bottom: 45vh;
  }
}

@media (max-width: 720px) {
  body {
    background: #050505;
  }
}

@media (max-width: 520px) {
  .top,
  header {
    width: 100%;
    max-width: 100%;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .top > *,
  header > * {
    min-width: 0;
  }

  .top-actions,
  .actions {
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .brand {
    flex: 0 0 auto;
  }

  .back,
  .iconbtn,
  .pill,
  .top-actions > *,
  .actions > * {
    min-width: 0;
    max-width: 100%;
  }

  .type strong,
  .type span,
  .type .price,
  .pay,
  .option {
    overflow-wrap: anywhere;
  }
}
