:root {
  --bg-primary: transparent;
  --bg-secondary: rgba(18, 18, 21, 0.4);
  --bg-card: rgba(26, 26, 31, 0.65);
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --accent-primary: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(139, 92, 246, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.2);
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Space Grotesk', system-ui, sans-serif;
}

body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(139, 92, 246, 0.5);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.1);
}
body.light-theme #space-bg { display: none; }
body.light-theme .header { background: rgba(255, 255, 255, 0.85); }
body.light-theme .mobile-nav { background: rgba(255, 255, 255, 0.9); }
body.light-theme .logo { color: #0f172a; }
body.light-theme .product-img-wrapper { background: #f1f5f9; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  width: 100%;
}

/* ─── HEADER ─── */
.header {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5em;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--accent-primary);
}

.search-bar-container {
  flex-grow: 1;
  max-width: 500px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95em;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
  background: var(--bg-secondary);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.tg-btn-header {
  background: linear-gradient(135deg, #0088cc, #00aaff);
  color: white !important;
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.tg-btn-header:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.4);
}

/* ─── LAYOUTS ─── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ─── INDEX GRID (Marketplace Style) ─── */
/* ─── COSMIC BACKGROUND ─── */
#space-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
}

  /* --- MAIN TABS --- */
  .main-tabs {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 0 16px;
    flex-wrap: wrap;
  }
  .main-tab {
    background: rgba(31, 31, 38, 0.7);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .main-tab:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
  }
  .main-tab.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(31, 31, 38, 0.8) 100%);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
  }

  .category-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
  margin-bottom: 32px;
  scrollbar-width: auto;
  scrollbar-color: var(--primary) var(--bg-card);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.category-chips:active {
  cursor: grabbing;
}
.category-chips::-webkit-scrollbar {
  height: 6px;
}
.category-chips::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}
.category-chips::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

.chip {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: 100px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.chip:hover, .chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.product-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: fadeInUp 0.6s ease-out forwards;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--accent-red);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75em;
  font-weight: 700;
  z-index: 10;
}

.product-img-wrapper {
  position: relative;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  background: white;
}

.product-img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain;
  padding: 24px;
  transition: transform 0.3s;
}

.product-card:hover .product-img {
  transform: scale(1.05);
}

.product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.product-price {
  font-family: var(--font-display);
  font-size: 1.4em;
  font-weight: 800;
  color: white;
}

.product-old-price {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-decoration: line-through;
}

.product-title {
  font-size: 0.95em;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 500;
  flex-grow: 1;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.star { color: #fbbf24; }

.btn-buy-grid {
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
  padding: 10px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
}

.btn-buy-grid:hover {
  background: var(--accent-hover);
}

/* ─── ARTICLE LAYOUT (2 Columns) ─── */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  align-items: start;
}

.article-content {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.article-sidebar {
  position: sticky;
  top: 100px;
}

/* Sidebar Card */
.sticky-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.sticky-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: white;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  padding: 16px;
}

.sticky-price {
  font-family: var(--font-display);
  font-size: 2em;
  font-weight: 800;
  margin-bottom: 4px;
  color: white;
}

.sticky-old-price {
  font-size: 1em;
  color: var(--text-secondary);
  text-decoration: line-through;
  margin-bottom: 16px;
  display: block;
}

.btn-buy-main {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: white;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1.1em;
  text-decoration: none;
  margin-bottom: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-buy-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.promo-box-main {
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed var(--accent-green);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  margin-bottom: 16px;
}

.promo-code {
  color: var(--accent-green);
  font-weight: 800;
  font-family: var(--font-mono);
}

/* Typography inside article */
.article-content h1 {
  font-family: var(--font-display);
  font-size: 2.2em;
  font-weight: 800;
  margin-bottom: 24px;
  line-height: 1.2;
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.6em;
  margin: 40px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-content p {
  margin-bottom: 20px;
  font-size: 1.05em;
  color: #d1d5db;
}

.article-content ul {
  margin-bottom: 20px;
  padding-left: 20px;
}

.article-content li {
  margin-bottom: 10px;
  color: #d1d5db;
}

.article-content img, 
.article-content iframe, 
.article-content video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.article-content pre, 
.article-content table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* AI Verdict Card */
.verdict-modern {
  background: rgba(31, 31, 38, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 40px 0;
  position: relative;
  overflow: hidden;
}

.verdict-modern::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), #3b82f6);
}

.verdict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.verdict-score {
  font-family: var(--font-display);
  font-size: 3em;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.verdict-score span {
  font-size: 0.4em;
  color: var(--text-secondary);
}

.verdict-badge-ai {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.85em;
  font-weight: 700;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.verdict-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.v-col h4 {
  font-size: 1.1em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.v-col.pros h4 { color: var(--accent-green); }
.v-col.cons h4 { color: var(--accent-red); }

.v-col ul { list-style: none; padding: 0; }
.v-col li {
  padding-left: 24px;
  position: relative;
  margin-bottom: 12px;
  font-size: 0.95em;
}
.v-col.pros li::before { content: '✓'; position: absolute; left: 0; color: var(--accent-green); font-weight: bold;}
.v-col.cons li::before { content: '×'; position: absolute; left: 0; color: var(--accent-red); font-weight: bold; font-size: 1.2em;}

/* Mobile Bottom Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(18, 18, 21, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  z-index: 1000;
}

.mobile-nav .nav-item {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75em;
  font-weight: 600;
}

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

/* Floating Telegram Widget */
.tg-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  background: linear-gradient(135deg, #0088cc, #00aaff);
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 136, 204, 0.4);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.3s, box-shadow 0.3s;
}
.tg-widget:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 136, 204, 0.6);
}
.tg-widget svg {
  stroke: white;
}

/* Responsive */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    position: static;
    margin-bottom: 32px;
  }
  .article-layout {
    display: flex;
    flex-direction: column-reverse;
  }
}

@media (max-width: 768px) {
  .header-container { 
    padding: 12px 16px; 
    gap: 12px; 
    flex-wrap: wrap; 
  }
  .search-bar-container { 
    display: flex; 
    width: 100%; 
    max-width: 100%;
    order: 3;
    margin-top: 8px;
  }
  .nav-links a.hide-mobile { display: none; }
  
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
  .product-card {
    border-radius: var(--radius-md);
  }
  .product-img {
    padding: 8px;
  }
  .product-info {
    padding: 12px;
  }
  .product-price {
    font-size: 1.1em;
  }
  .product-title {
    font-size: 0.85em;
    margin-bottom: 8px;
  }
  
  .article-content { 
    padding: 16px; 
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .article-content h1 {
    font-size: 1.4em;
    margin-bottom: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .article-content h2 {
    font-size: 1.2em;
    margin: 24px 0 16px;
  }
  .article-layout {
    gap: 24px;
  }
  
  .verdict-modern {
    padding: 16px;
    margin: 24px 0;
  }
  .verdict-score {
    font-size: 2.2em;
  }
  .verdict-columns { grid-template-columns: 1fr; gap: 16px; }
  
  .promo-box-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .promo-code {
    word-break: break-all;
  }
  .sticky-card {
    padding: 16px;
  }
  
  .mobile-nav {
    display: flex;
    justify-content: space-around;
  }
  body { padding-bottom: 70px; } /* Место под mobile nav */
}
