:root {
  --bg-color: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-elevated-hover: #f9fafb;
  --accent: #0ea5e9;
  --accent-soft: rgba(14, 165, 233, 0.08);
  --text-main: #111827;
  --text-muted: #6b7280;
  --border-subtle: #e5e7eb;
  --shadow-soft: 0 14px 35px rgba(15, 23, 42, 0.12);
  --radius-lg: 18px;
  --transition-fast: 180ms ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e5f3ff 0, #f3f4f6 40%, #e5e7eb 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 16px 40px;
}

.app-header {
  margin-bottom: 32px;
}

.cards-search {
  margin: 0 0 20px;
  display: flex;
  justify-content: center;
}

.cards-search-inner {
  position: relative;
  width: 100%;
  max-width: 420px;
}

.cards-search-input {
  width: 100%;
  padding: 9px 32px 9px 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.02);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition:
    border-color 140ms ease-out,
    box-shadow 140ms ease-out,
    background 140ms ease-out;
}

.cards-search-input::placeholder {
  color: var(--text-muted);
}

.cards-search-input:focus {
  border-color: rgba(59, 130, 246, 0.9);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
  background: rgba(15, 23, 42, 0.04);
}

.cards-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.cards-search-icon::before {
  content: "";
  position: absolute;
  inset: 2px 4px 4px 2px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.9);
}

.cards-search-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.9);
  transform: rotate(45deg);
}

.app-title-small {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.top-info-placeholder {
  width: 100%;
  min-height: 90px;
  margin-bottom: 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-subtle);
  background: #f9fafb;
  display: flex;
  align-items: center;
  padding: 12px 16px;
}

.top-info-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.top-info-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.top-info-content {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.top-info-tagline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.top-info-tg-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    transform 150ms ease-out,
    background 150ms ease-out;
}

.top-info-tg-link::before {
  content: "";
}

.top-info-tg-link:hover {
  transform: translateY(-1px);
}

.top-info-tg-icon {
  height: 26px;
  width: auto;
  display: block;
}

.app-title {
  margin: 0 0 8px;
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  letter-spacing: 0.02em;
}

.app-subtitle {
  margin: 0;
  max-width: 640px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* Для секции отопления фиксируем три колонки, чтобы ширина карточек совпадала с блоками вентиляции */
.section-heating .cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* В разделе «Полезное» фиксируем три колонки, как и в разделе отопления */
.section-video .cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* В разделе «Избранное» используем такую же сетку, как в отоплении и «Полезном» */
.section-favorites .cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section {
  margin-bottom: 32px;
}

.section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section-toggle {
  border: none;
  background: rgba(15, 23, 42, 0.02);
  width: 100%;
  min-height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-muted);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
  padding: 4px 10px 4px 14px;
  margin-bottom: 12px;
  transition:
    background 150ms ease-out,
    color 150ms ease-out,
    transform 150ms ease-out,
    box-shadow 150ms ease-out;
}

.section-toggle:hover {
  background: rgba(15, 23, 42, 0.05);
  transform: translateY(-1px);
}

/* Спойлер «Избранное» выделяем мягким жёлтым фоном */
.section-favorites .section-toggle {
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.6);
  color: #92400e;
}

.section-favorites .section-toggle:hover {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.section.is-collapsed .cards-grid {
  display: none;
}

.section.is-collapsed .section-toggle {
  margin-bottom: 4px;
}

.favorites-pin {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 6px;
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.6);
  background: rgba(254, 243, 199, 0.9);
  color: #92400e;
  cursor: pointer;
  font-size: 14px;
  transition:
    background 150ms ease-out,
    box-shadow 150ms ease-out,
    transform 150ms ease-out;
}

.favorites-pin::before {
  content: "📌";
}

.favorites-pin:hover {
  background: rgba(253, 230, 138, 0.95);
  transform: translateY(-1px);
}

.favorites-pin.is-active {
  background: rgba(250, 204, 21, 0.95);
  box-shadow: 0 0 0 1px rgba(161, 98, 7, 0.9);
}

.section-toggle-icon {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.02);
}

.section-toggle-icon::before {
  content: "▾";
  font-size: 20px;
}

.section.is-collapsed .section-toggle-icon::before {
  content: "▸";
}

.card {
  position: relative;
  padding: 20px 18px 18px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 0 0, var(--accent-soft), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(191, 219, 254, 0.5), transparent 55%),
    linear-gradient(135deg, var(--bg-elevated), var(--bg-elevated-hover));
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transform-origin: center;
  transform: translateY(0) scale(1);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 0 0, rgba(14, 165, 233, 0.18), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
}

.card:hover::before {
  opacity: 1;
}

.card-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.card-description {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  /* Чтобы тексты описаний в соседних карточках выравнивались по вертикали */
  min-height: 3.6em;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.card-badge--sim {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}

.card-badge--calc {
  background: rgba(34, 197, 94, 0.1);
  color: #15803d;
}

.card-badge--app {
  background: rgba(250, 204, 21, 0.16);
  color: #92400e;
}

.card-badge--anim {
  background: rgba(56, 189, 248, 0.14);
  color: #0369a1;
}

.card-badge--video {
  background: rgba(248, 113, 113, 0.14);
  color: #b91c1c;
}

.fav-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #9ca3af;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
  transition:
    background 150ms ease-out,
    box-shadow 150ms ease-out,
    color 150ms ease-out,
    transform 150ms ease-out;
}

.fav-toggle::before {
  content: "☆";
}

.fav-toggle:hover {
  background: rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.fav-toggle.is-active {
  background: rgba(250, 204, 21, 0.16);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.8);
  color: #facc15;
}

.fav-toggle.is-active::before {
  content: "★";
}

.pc-only {
  /* Бейдж о работе только на ПК, прижатый к низу карточки */
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #92400e;
  background: linear-gradient(135deg, #fffbeb, #fde68a);
  border: 1px solid #f97316;
}

.pc-only-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #f97316;
  background: linear-gradient(135deg, #fffbeb, #fed7aa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #9a3412;
}

@media (max-width: 600px) {
  .app {
    padding: 20px 12px 28px;
  }

  .app-header {
    margin-bottom: 24px;
  }

  .card {
    padding: 18px 16px 16px;
  }

  /* На мобильных карточки отопления отображаем так же, как в вентиляции (по одной в ряд) */
  .section-heating .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* В разделе «Полезное» на мобильных также показываем карточки по одной в ряд */
  .section-video .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* В разделе «Избранное» на мобильных также по одной карточке в строке */
  .section-favorites .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


