/* Base site styles (restored)
   Note: smooth-theme.css overrides visuals to the dark glass theme. */

:root {
  --primary: #667eea;
  --primary-2: #764ba2;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --text: #111827;
  --muted: rgba(17, 24, 39, 0.70);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   ГЛОБАЛЬНЫЕ МОБИЛЬНЫЕ СТИЛИ - ПРЕДОТВРАЩЕНИЕ ГОРИЗОНТАЛЬНОГО СКРОЛЛА
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Запрещаем горизонтальный скролл */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}

/* Все изображения и медиа не должны вылазить */
img, video, iframe, embed, object, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Контейнеры не должны быть шире экрана */
.container,
.wrapper,
.section,
main,
header,
footer,
aside,
article {
  max-width: 100%;
  overflow-x: hidden;
}

/* Карточки и блоки */
.card,
.test-card,
.feature,
.specialty-item,
.specialty-card,
.bento-item,
.bento-grid > div,
.stat-block,
.app-card,
.quick-action,
.google-feature-item {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Flex-контейнеры должны переноситься */
.flex-row,
.test-list,
.stats-row,
.test-cards,
.bento-grid,
.quick-actions,
.google-stats-grid,
.google-features,
.google-visual-content {
  flex-wrap: wrap;
}

/* Таблицы и длинный текст */
table,
pre,
code {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

/* Hero и полноширинные секции */
.hero,
.banner,
.landing-hero,
.google-hero {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.55;
  color: var(--text);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
}

a {
  color: inherit;
}

/* Auth */
.auth-container {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 3000;
}

.auth-container.active {
  display: flex;
}

.auth-container.hidden {
  display: none;
}

.auth-form {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
  padding: 34px;
}

.auth-form h2 {
  margin: 0 0 18px;
  text-align: center;
  font-weight: 800;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 12px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  user-select: none;
  background: rgba(0, 0, 0, 0.05);
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.18), rgba(118, 75, 162, 0.16));
}

.auth-page {
  display: none;
}

.auth-page.active {
  display: block;
}

.input-group {
  position: relative;
  margin: 12px 0;
}

.input-group input {
  width: 100%;
  padding: 14px 42px 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.85);
  outline: none;
}

.input-group input:focus {
  border-color: rgba(102, 126, 234, 0.6);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(0, 0, 0, 0.45);
}

.auth-button {
  width: 100%;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

/* App */
.main-content {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  background: var(--bg);
}

.main-content.visible {
  display: block;
}

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

nav a {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

nav a.active,
nav a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.logout-btn {
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

section {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 16px;
}

section.visible {
  display: block !important;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px;
  margin: 18px 0;
}

/* Profile basics */
.profile-header {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-container {
  width: 120px;
  height: 120px;
  position: relative;
}

.avatar,
.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.avatar {
  object-fit: cover;
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 900;
  font-size: 42px;
}

.profile-info {
  flex: 1;
  min-width: 260px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ - АВТОМАТИЧЕСКАЯ
   ============================================================ */

/* Планшеты */
@media (max-width: 1024px) {
  section {
    padding: 28px 16px;
  }
  
  .card {
    padding: 22px;
    border-radius: 18px;
  }
  
  .auth-form {
    padding: 28px;
    border-radius: 20px;
  }
  
  .avatar-container {
    width: 100px;
    height: 100px;
  }
  
  .avatar-placeholder {
    font-size: 36px;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
}

/* Мобильные устройства */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  /* КРИТИЧНО: Секции должны быть видны когда активны */
  section {
    padding: 20px 14px;
    max-width: 100%;
  }
  
  section.visible {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* Главный контент на мобильных */
  .main-content.visible {
    display: flex !important;
    flex-direction: column !important;
  }
  
  .main-content.visible .app-content {
    display: block !important;
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  .card {
    padding: 18px;
    border-radius: 16px;
    margin: 14px 0;
  }
  
  .auth-form {
    padding: 24px 20px;
    border-radius: 18px;
    max-width: 100%;
  }
  
  .auth-form h2 {
    font-size: 1.4rem;
    margin-bottom: 14px;
  }
  
  .auth-tabs {
    gap: 6px;
  }
  
  .auth-tab {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  
  .avatar-container {
    width: 90px;
    height: 90px;
  }
  
  .avatar-placeholder {
    font-size: 32px;
  }
  
  .profile-info {
    min-width: 100%;
  }
  
  .profile-stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .stat-card {
    padding: 14px;
    border-radius: 14px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
}

/* Маленькие телефоны */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  section {
    padding: 16px 12px;
  }
  
  .card {
    padding: 16px;
    border-radius: 14px;
    margin: 12px 0;
  }
  
  .auth-form {
    padding: 20px 16px;
    border-radius: 16px;
  }
  
  .auth-form h2 {
    font-size: 1.25rem;
  }
  
  .auth-tab {
    padding: 9px 10px;
    font-size: 0.85rem;
  }
  
  .avatar-container {
    width: 80px;
    height: 80px;
  }
  
  .avatar-placeholder {
    font-size: 28px;
  }
  
  .profile-stats {
    grid-template-columns: 1fr;
  }
  
  .stat-value {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
/* ============================================================
   ДОПОЛНИТЕЛЬНЫЕ МОБИЛЬНЫЕ ФИКСЫ
   ============================================================ */

/* Фикс для элементов с position: absolute/fixed */
[style*="position: absolute"],
[style*="position: fixed"] {
  max-width: 100vw;
}

/* Фикс для inline-стилей с шириной */
[style*="width:"] {
  max-width: 100% !important;
}

/* Фикс для навигации */
.google-nav,
.landing-nav,
nav {
  max-width: 100%;
  width: 100%;
}

/* Фикс для сайдбара на мобильных */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -100%;
    width: 280px;
    max-width: 85vw;
    transition: left 0.3s ease;
    z-index: 1000;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .app-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 20px 16px !important;
  }
}

/* Фикс для grid на маленьких экранах */
@media (max-width: 768px) {
  .bento-grid,
  .test-cards,
  .google-features,
  .google-stats-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  .google-visual-content {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
  }
  
  .specialty-card {
    flex: 1 1 calc(50% - 12px) !important;
    min-width: 140px !important;
    max-width: calc(50% - 6px) !important;
  }
}

@media (max-width: 480px) {
  .specialty-card {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
  
  .google-hero,
  .landing-hero {
    padding: 80px 16px 40px !important;
  }
  
  .google-hero-title {
    font-size: 1.75rem !important;
  }
  
  .google-hero-subtitle {
    font-size: 0.95rem !important;
  }
  
  .google-btn-large {
    padding: 14px 24px !important;
    font-size: 0.9rem !important;
  }
}

/* Фикс для мобильной навигации */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  z-index: 999;
}

/* Безопасная зона для iPhone */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}