/* Vibe 2 — дизайн-токены (те же, что в VINE_DESIGN_CODE_GUIDE_RU.txt)
   Основной акцент #00BF8F, холст #E1E1D9, текст #222222, служебный #8C8C8C, div #D8D8D8.
   Dark/light theme, accessible contrast option (faithful mode).
*/

:root {
  /* ── Цвета ── */
  --green: #00BF8F;           /* основной акцент */
  --green-dark: #00B081;      /* законченная валидация на цвете */
  --white: #FFFFFF;           /* поверхности */
  --neutral: #E1E1D9;         /* тёплый бежевый холст */
  --text: #222222;            /* основной текст */
  --text-muted: #8C8C8C;      /* служебный, время, placeholder */
  --divider: #D8D8D8;         /* тонкие линии */
  --chrome-dark: #404040;     /* тёмный хром камеры */
  --messages-accent: #FF794C;/* оранжевый только в Messages */
  --disabled: #B0B0B0;       /* выключенный */

  /* ── Тема ── */
  --bg: var(--neutral);
  --fg: var(--text);
  --surface: var(--white);
  --surface-muted: #F0F0EE;
}

/* ── Dark theme ── */
[data-theme="dark"] {
  --bg: #1A1A1A;
  --fg: #E1E1D9;
  --surface: #2A2A2A;
  --surface-muted: #3A3A3A;
  --text: #E1E1D9;
  --text-muted: #8C8C8C;
  --divider: #3A3A3A;
}

@media (prefers-color-scheme: light) {
   :root {
     --bg: var(--white);
     --fg: var(--text);
   }
}

/* ── Размеры ── (16px = базовая сетка) */
:root {
  --grid: 4px;
  --gutter: 16px;       /* отступ текста */
  --navbar-height: 44px;
  --video-max: 480px;   /* сторона квадрата видео */
  --tab-height: 33px;   /* строка действий */
  --btn-height: 38px;   /* кнопка Share */
  --border-radius: 5px; /* скругление кнопок */
}

/* ── Типографика ── */
html {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
               Roboto, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Сброс ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100dvh; background: var(--bg); color: var(--fg);
        font-family: inherit; line-height: 1.4; text-rendering: optimizeLegibility; }
img, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; background: transparent;
        border: none; cursor: pointer; }

/* ── Доступность: контрастный режим ── */
[data-contrast="high"] {
  --green: #00BF8F;
}
[data-contrast="high"] .on-green,
[data-contrast="high"] .btn-primary { color: var(--text); }

/* ── Анимация ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Навбар ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--navbar-height); padding: env(safe-area-inset-top) 16px;
  background: var(--green); color: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  z-index: 100;
}
.navbar .brand { font-size: 17px; font-weight: 600; color: var(--white); }
.navbar button { color: var(--white); width: 30px; height: 30px; padding: 0; background: rgba(255,255,255,0.1); border-radius: var(--border-radius); }
.navbar button.theme-btn { background: rgba(255,255,255,0.2); }
.navbar .icon { width: 24px; height: 24px; opacity: 0.9; }

/* ── Кнопка камеры ── */
.camera-btn { width: 62px; height: 30px; font-size: 15px; border-radius: var(--border-radius); background: var(--green-dark); color: var(--white); }

/* ── Хедер карточки ── */
.card-head { display: flex; align-items: center; gap: 12px; }
.card-icon { width: 32px; height: 32px; flex-shrink: 0; }
.card-icon img { width: 100%; height: 100%; }
.card-name { font-weight: 600; font-size: 15px; }

/* ── Видео-карточка ── */
.post {
  margin-bottom: var(--gutter);
  background: var(--surface);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--divider);
}
.post video {
  width: 100%; height: auto;
  aspect-ratio: var(--video-max) / var(--video-max);
  background: #000;
}
.post__details {
  padding: var(--gutter) var(--gutter) 8px;
  background: var(--surface);
}
.post__header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.post__author { font-weight: 600; font-size: 15px; color: var(--green); }
.post__meta { font-size: 11px; color: var(--text-muted); }
.post__caption { font-size: 15px; color: var(--fg); margin: 8px 0; }
.post__tags a { color: var(--green); }
.post__time { font-size: 11px; color: var(--text-muted); }

/* ── Строка действий ── */
.actions { display: flex; gap: 8px; padding: 8px var(--gutter); }
.actions .btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--border-radius);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.actions .count {
  font-size: 11px; margin-left: 4px; color: var(--text-muted);
}
.btn--primary { color: var(--green); }
.btn--primary.active { fill: var(--white); background: var(--green); }
.btn--cond { display: flex; align-items: center; justify-content: center; }

/* ── Лайк ── */
.like-btn .liked::after {
  content: ' ';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  background: var(--green);
  clip-path: polygon(50% 0%, 0% 22%, 62% 38%, 38% 62%, 100% 78%, 50% 100%);
}

/* ── Камера (черный экран) ── */
.camera {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--chrome-dark);
  display: flex; flex-direction: column;
  color: var(--white);
  z-index: 200;
}
.camera--hidden .camera-preview { display: none; }

/* Превью камеры */
.camera-preview {
  flex: 1;
  list-style: none;
  display: flex; align-items: center; justify-content: center;
}
.camera-preview video { width: 100%; height: 100%; object-fit: contain; }

/* Сетка 3x3 */
.grid-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}
.grid-overlay::before, .grid-overlay::after {
  content: '';
  position: absolute;
  border-top: 1px solid var(--white);
  border-left: 1px solid var(--white);
  width: 33.333%; height: 33.333%;
}
.grid-overlay::before { border-right: 1px solid var(--white); border-bottom: 1px solid var(--white); }
.grid-overlay::after { left: 66.667%; top: 0; border-top: 1px solid var(--white); }

/* Прогресс записи */
.record-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px; background: var(--green); transform: scaleX(0);
  transform-origin: left;
}

/* Инструменты камеры */
.tools {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 56px;
}
.tool { width: 24px; height: 24px; opacity: 0.8; cursor: pointer; }
.tool--active { opacity: 1; }

/* ── Overlayы и модалы ── */
.overlay-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.overlay-close {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; opacity: 0.9;
}

/* ── Пустое состояние ── */
.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty svg { width: 48px; height: 48px; opacity: 0.5; margin-bottom: 16px; }

/* ── Заглушка ленты ── */
.feed-placeholder {
  padding: 80px 24px;
  text-align: center;
}
.feed-placeholder p { margin: 8px 0; }

/* ── Сетка приложений ── */
.grid {
  display: grid;
  gap: 16px; padding: 16px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* ── Карточка приложения ── */
.card {
  display: block;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-decoration: none;
}
.card:hover { transform: translateY(-2px); }
.card img { width: 48px; height: 48px; margin-bottom: 12px; }
.card-name { font-weight: 600; font-size: 16px; margin-bottom: 8px; }

/* ── Иконки (конурные) ── */
.icon { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.5; }

/* ── Состояния загрузки ── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { to { background-position: -200%; } }

/* ── Feedback при удержании ── */
.hold-indicator {
  position: fixed; top: 50%; left: 50%;
  translate: -50% -50%;
  width: 200px; height: 200px;
  border-radius: 50%;
  border: 3px solid var(--green);
  animation: pulse 1s infinite;
  pointer-events: none;
}
@keyframes pulse { 50% { opacity: 0.3; } }

/* ── Профиль ── */
.profile-page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--gutter);
}
.profile-header {
  display: flex; align-items: center; gap: var(--gutter);
  margin-bottom: var(--gutter);
}
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600;
}
.profile-info h1 { font-size: 20px; font-weight: 600; margin-bottom: 4px; color: var(--fg); }
.profile-info p { color: var(--text-muted); margin-bottom: 4px; font-size: 14px; }
.profile-posts h3 { font-size: 18px; font-weight: 600; margin: var(--gutter) 0; color: var(--fg); }
.profile-posts-list { display: flex; flex-direction: column; gap: 16px; }