/* ══════════════════════════════════════════════
   Базовые стили — сброс и типографика
   ══════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-md);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-slow), color var(--transition-slow);
}

/* ── Лоадер ── */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition-slow);
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(135, 206, 235, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loader-text {
  font-size: var(--font-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Приложение ── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.screen-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Нижняя навигация ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-nav-bg);
  border-top: 1px solid var(--color-nav-border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  align-items: stretch;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-nav-inactive);
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition-fast), transform var(--transition-fast);
  padding: 8px 4px;
  -webkit-user-select: none;
  user-select: none;
}

.nav-item:active { transform: scale(0.92); }

.nav-item.active {
  color: var(--color-nav-active);
}

.nav-icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

/* SOS-кнопка */
.nav-sos {
  position: relative;
  color: var(--color-danger) !important;
}

.sos-label {
  width: 44px;
  height: 44px;
  background: var(--color-danger);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
  animation: sos-pulse 2.5s ease-in-out infinite;
  margin-bottom: 2px;
  flex-shrink: 0;
}

@keyframes sos-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4); }
  50% { box-shadow: 0 4px 28px rgba(255, 107, 107, 0.7); transform: scale(1.05); }
}

/* ── Скрытие/показ ── */
.hidden { display: none !important; }

/* ── Скролл ── */
::-webkit-scrollbar { width: 0; }
