/* Shared polish: mobile nav + accessible focus + responsive shell */

:root {
  --focus: rgba(249, 115, 22, 0.95);
  --focus-soft: rgba(249, 115, 22, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

/* Telegram Login Widget: не вылезает за край на узких экранах */
.tg-widget-wrap {
  min-width: 0;
  max-width: min(100%, 300px);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.tg-widget-wrap iframe {
  max-width: 100% !important;
}

.oauth-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 420px) {
  .oauth-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }
}

.page-safe-x {
  padding-left: max(1rem, var(--safe-left));
  padding-right: max(1rem, var(--safe-right));
}

/* Prefer keyboard focus rings without changing mouse-heavy visuals too much */
:where(a, button, input, textarea, select, summary):focus {
  outline: none;
}

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--focus-soft);
}

.site-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 60;
}

.site-nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.site-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(360px, 92vw);
  transform: translateX(104%);
  transition: transform 220ms ease;
  z-index: 70;
  padding: 88px 16px 16px;
  pointer-events: none;
  visibility: hidden;
  will-change: transform;
}

.site-nav-drawer[hidden],
.site-nav-overlay[hidden] {
  display: none !important;
}

.site-nav-drawer.is-open {
  transform: translateX(0);
  pointer-events: auto;
  visibility: visible;
}

body.site-nav-open {
  overflow: hidden;
}

/* On desktop/tablet widths keep only inline nav, never off-canvas drawer */
@media (min-width: 768px) {
  .site-nav-overlay,
  .site-nav-drawer {
    display: none !important;
  }

  html,
  body {
    overscroll-behavior-x: auto;
    overscroll-behavior-y: auto;
  }

  body.site-nav-open {
    overflow: auto;
  }

  body {
    overflow-y: auto;
  }
}

.field-error {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(248, 113, 113, 0.95);
}

.input-invalid {
  border-color: rgba(248, 113, 113, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12) !important;
}



/* Фиксированная шапка — одинаково на всех страницах */
:root {
  --site-header-h: 4rem;
  --site-header-offset: calc(var(--site-header-h) + env(safe-area-inset-top, 0px));
}

.site-header,
header.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  width: 100%;
  padding-top: env(safe-area-inset-top, 0px);
}

body.has-site-header {
  padding-top: var(--site-header-offset);
}

.site-header .glass {
  min-height: var(--site-header-h);
}

@media (max-width: 767px) {
  #auth-bar {
    display: none !important;
  }
}

.js-drawer-auth-user.hidden {
  display: none !important;
}
body.auth-user .js-drawer-auth-user:not(.hidden) {
  display: flex !important;
  flex-direction: column;
}

/* Прозрачная шапка — не выбивается из фона */
header .glass {
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.42), rgba(8, 10, 18, 0.28));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

@media (min-width: 1024px) {
  header .glass {
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    background: rgba(8, 10, 18, 0.36) !important;
  }
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(249, 115, 22, 0.38);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.btn-back-home:hover {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.55);
  color: #fff;
  transform: translateY(-1px);
}
.btn-back-home svg { opacity: 0.85; }
