/* Telegram Mini App / fullscreen chrome for guest SSR themes */

:root {
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-safe-area-inset-left: 0px;
  --tg-safe-area-inset-right: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --tg-header-pad-x: 64px;
  --tg-header-height: max(
    calc(var(--tg-safe-area-inset-top) + var(--tg-content-safe-area-inset-top)),
    calc(env(safe-area-inset-top, 0px) + 48px)
  );
}

body.is-telegram-webapp {
  padding-left: var(--tg-safe-area-inset-left);
  padding-right: var(--tg-safe-area-inset-right);
}

/* Compact icon mobile bar (all themes / devices) */
.oazis-mobilebar a,
.guest-mobilebar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 6px 2px;
  text-decoration: none;
}

.oazis-mobilebar__icon,
.guest-mobilebar__icon {
  display: flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.oazis-mobilebar__icon svg,
.guest-mobilebar__icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.oazis-mobilebar__label,
.guest-mobilebar__label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.is-telegram-webapp .oazis-mobilebar,
body.is-telegram-webapp .guest-mobilebar {
  padding-bottom: calc(6px + max(var(--tg-safe-area-inset-bottom), env(safe-area-inset-bottom, 0px)));
}

body.is-telegram-webapp .oazis-layout {
  padding-bottom: calc(58px + max(var(--tg-safe-area-inset-bottom), env(safe-area-inset-bottom, 0px)));
}

body.is-telegram-webapp .guest-main {
  padding-bottom: calc(58px + max(var(--tg-safe-area-inset-bottom), env(safe-area-inset-bottom, 0px)));
}

/*
 * Mobile Telegram: brand title centered in the native header band
 * (between Close and the top-right Telegram controls).
 */
@media (max-width: 860px) {
  body.is-telegram-webapp .oazis-topbar,
  body.is-telegram-webapp .guest-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 80;
    box-sizing: border-box;
    height: var(--tg-header-height);
    min-height: 48px;
    padding: max(var(--tg-safe-area-inset-top), env(safe-area-inset-top, 0px))
      var(--tg-header-pad-x) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: transparent;
    border: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
  }

  body.is-telegram-webapp .oazis-logo,
  body.is-telegram-webapp .guest-logo {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: min(220px, calc(100vw - 2 * var(--tg-header-pad-x)));
    text-align: center;
  }

  body.is-telegram-webapp .oazis-logo__tag {
    display: none;
  }

  body.is-telegram-webapp .oazis-logo__name,
  body.is-telegram-webapp .guest-logo__text {
    font-size: 14px;
    line-height: 1.15;
    letter-spacing: 0.14em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  body.is-telegram-webapp .oazis-nav,
  body.is-telegram-webapp .oazis-topbar__cta,
  body.is-telegram-webapp .guest-nav,
  body.is-telegram-webapp .guest-topbar__cta {
    display: none !important;
  }

  body.is-telegram-webapp .oazis-layout,
  body.is-telegram-webapp .guest-layout {
    padding-top: var(--tg-header-height);
  }

  body.is-telegram-webapp .oazis-mobilebar,
  body.is-telegram-webapp .guest-mobilebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  }

  body.is-telegram-webapp .guest-mobilebar {
    display: flex;
  }
}
