
/* Сайт = тот же UI, что Mini App. На широком экране — узкая колонка по центру. */

html.is-web-site {
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --site-frame-w: 480px;
}

html.is-web-site body {
  min-height: 100dvh;
  min-height: 100svh;
  background: var(--bg);
}

html.is-web-site .site-shell {
  width: 100%;
  max-width: var(--site-frame-w);
  min-height: 100dvh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

html.is-web-site #app {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

html.is-web-site .site-header {
  display: none;
}

html.is-web-site .site-header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

html.is-web-site .site-brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

html.is-web-site .site-tag {
  font-size: 13px;
  color: var(--muted);
}

html.is-web-site .site-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

html.is-web-site .site-web-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-border);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

html.is-web-site .site-tg-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-mid);
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

html.is-web-site #view.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.is-web-site body.tg-gate .site-tag {
  display: none;
}

html.is-web-site .web-login,
html.is-web-site .tg-gate-screen,
html.is-web-site .web-home {
  width: 100%;
  max-width: var(--site-frame-w);
  margin: 0 auto;
  padding: 0 16px 24px;
  box-sizing: border-box;
}

html.is-web-site #app.tg-gate-app #view {
  align-items: center;
  justify-content: center;
  padding: max(12px, var(--safe-t)) 16px 24px;
  overflow-y: auto;
}

html.is-web-site body.tg-gate #app {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* мобильный веб — как mini app, без обрезки */
@media (max-width: 767px) {
  html.is-web-site .site-tag {
    display: none;
  }

  html.is-web-site .site-brand {
    font-size: 18px;
  }

  html.is-web-site .site-tg-btn,
  html.is-web-site .site-web-btn {
    font-size: 12px;
    padding: 7px 10px;
  }

  html.is-web-site #app {
    padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

/* широкий экран — mini app по центру, не растягиваем */
@media (min-width: 768px) {
  html.is-web-site body {
    background:
      radial-gradient(ellipse 70% 45% at 50% -15%, rgba(10, 132, 255, 0.1) 0%, transparent 60%),
      #000000;
  }

  html.is-web-site .site-shell {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  html.is-web-site body.tg-gate .site-shell {
    padding-top: 24px;
  }

  html.is-web-site body:not(.tg-gate) #app {
    border-left: 1px solid var(--border-mid);
    border-right: 1px solid var(--border-mid);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.45);
  }

  html.is-web-site #app {
    padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }

  html.is-web-site .dock {
    max-width: var(--site-frame-w);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
  }

  html.is-web-site .sticky-foot {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--site-frame-w);
  }

  html.is-web-site .sticky-foot.sticky-show {
    transform: translateX(-50%) translate3d(0, 0, 0);
  }

  html.is-web-site .overlay .modal {
    max-width: calc(var(--site-frame-w) - 32px);
  }
}
