:root {
  --msw-night: #17212b;
  --msw-panel: #202b36;
  --msw-tg: #2481cc;
  --msw-ember: #e8873a;
  --msw-signal: #f5d76e;
  --tg-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --msw-air-gap: 8px;
  --msw-vh: 100%;
}

html,
body,
#root {
  min-height: 100%;
  height: 100%;
  margin: 0;
  background: var(--msw-night);
  color: #ffffff;
}

html {
  color-scheme: dark;
}

body {
  font-family: Manrope, system-ui, sans-serif;
}

#root {
  display: flex;
  flex-direction: column;
}

/*
  Mini App sticky-viewport (канон Telegram):
  оболочка fixed, скролл только в .msw-scrollport.
  Нужно Android/Xiaomi WebView — body-scroll там часто мёртвый.
*/
html.msw-miniapp,
body.msw-miniapp {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  min-width: 100%;
  height: var(--msw-vh);
  max-height: var(--msw-vh);
  overflow: hidden;
  overscroll-behavior: none;
}

html.msw-miniapp #root {
  display: block;
  position: relative;
  width: 100%;
  max-width: none;
  min-width: 100%;
  height: 100%;
  overflow: hidden;
}

.msw-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #17212b;
}

.msw-scrollport {
  position: absolute;
  inset: 0;
  z-index: 10;
  width: 100%;
  max-width: none;
  overflow-x: auto;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

@keyframes msw-metatron-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(720deg);
  }
}

.msw-metatron-spin {
  animation: msw-metatron-spin 2.6s cubic-bezier(0.42, 0, 0.2, 1) both;
  transform-origin: 50% 50%;
}

@keyframes msw-pulse-blue {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(36, 129, 204, 0.75);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 18px 4px rgba(36, 129, 204, 0.95);
    filter: brightness(1.18);
  }
}

.msw-pulse-blue {
  animation: msw-pulse-blue 1.1s ease-in-out infinite;
}

/* UA disabled не должен обесцвечивать пульты казначея/архитектора */
button.msw-ctrl-btn:disabled {
  opacity: 1 !important;
  -webkit-text-fill-color: #ffffff;
}

.msw-weather-drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.msw-weather-drawer > * {
  overflow: hidden;
}

.msw-weather-drawer-open {
  grid-template-rows: 1fr;
}

/* Apple-style GPU accordion: transform/opacity + grid, без JS-tween */
.msw-apple-drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.msw-apple-drawer > * {
  overflow: hidden;
  min-height: 0;
}

.msw-apple-drawer-open {
  grid-template-rows: 1fr;
}

.msw-apple-fade {
  opacity: 0;
  transform: translate3d(0, -8px, 0);
  transition:
    opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.msw-apple-drawer-open .msw-apple-fade {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* VIP супер-кнопка [ GO ] — Cupertino blue + teal neon */
.msw-go-btn {
  background: rgba(36, 129, 204, 0.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(20, 184, 166, 0.9);
  box-shadow:
    inset 0 0 28px rgba(245, 215, 110, 0.22),
    0 0 24px rgba(36, 129, 204, 0.55),
    0 0 18px rgba(20, 184, 166, 0.35);
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, box-shadow;
}

.msw-go-btn:active {
  transform: scale(1.03);
  box-shadow:
    inset 0 0 36px rgba(245, 215, 110, 0.4),
    0 0 36px rgba(36, 129, 204, 0.7),
    0 0 28px rgba(20, 184, 166, 0.5);
}

.msw-mini-chat {
  -webkit-overflow-scrolling: touch;
}

.msw-tg-header {
  position: relative;
  z-index: 60;
  padding-top: calc(
    var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) +
    var(--tg-content-safe-area-inset-top, 0px) +
    var(--msw-air-gap, 8px)
  );
}

/* Погода: fixed-flyout поверх синего блока (CDN Tailwind не видит z-[9999] из JS). */
.msw-weather-root {
  position: relative;
  z-index: 70;
}

.msw-weather-flyout {
  position: fixed;
  z-index: 99999;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #202b36;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

/* V11.0 Tact1.1 — Turbo Telegram shell */
.msw-turbo-root {
  isolation: isolate;
}

.msw-turbo-root input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* V8.7: неоновый красный боевой вызов Конклава */
@keyframes msw-conclave-neon {
  0%,
  100% {
    box-shadow:
      0 0 8px rgba(239, 68, 68, 0.55),
      0 0 22px rgba(239, 68, 68, 0.85),
      inset 0 0 12px rgba(255, 80, 80, 0.35);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(255, 40, 40, 1),
      0 0 42px rgba(239, 68, 68, 1),
      inset 0 0 18px rgba(255, 120, 120, 0.55);
    filter: brightness(1.35);
  }
}

.msw-conclave-ring {
  animation: msw-conclave-neon 0.55s ease-in-out infinite;
}

.msw-conclave-alert {
  border-color: rgba(239, 68, 68, 0.95) !important;
  background: rgba(127, 29, 29, 0.85) !important;
  animation: msw-conclave-neon 0.55s ease-in-out infinite;
}
