/* NovaSearch v3 — единый стиль, светлая и тёмная темы */

:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --text: #1a1d27;
  --text-soft: #5b6171;
  --text-faint: #8a90a3;
  --border: #e4e7ef;
  --accent: #4a5cf0;
  --accent-soft: #eceeff;
  --accent-text: #3947c4;
  --warn-bg: #fff7e8;
  --warn-border: #f2d9a4;
  --tip-bg: #e9f8ef;
  --tip-border: #bfe6cd;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .06);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11131a;
    --card: #1a1d27;
    --text: #e8eaf2;
    --text-soft: #a6abbd;
    --text-faint: #6e7488;
    --border: #2a2e3d;
    --accent: #7b8aff;
    --accent-soft: #232847;
    --accent-text: #a3adff;
    --warn-bg: #2a2415;
    --warn-border: #4d4022;
    --tip-bg: #16271d;
    --tip-border: #2a4a36;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── top bar ─────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}

.mode-results .topbar { border-bottom-color: var(--border); }
.mode-home .topbar .logo, .mode-home .topbar .searchbox { visibility: hidden; }

.logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }

.logo-mark {
  background: linear-gradient(135deg, #6a5cff, #38b6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 22px;
}
.logo-mark.big { font-size: 44px; }

.searchbox {
  flex: 1;
  max-width: 640px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 9px 9px 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s;
}
.searchbox:focus-within { border-color: var(--accent); }
.searchbox-icon { color: var(--text-faint); flex-shrink: 0; }

.searchbox input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  min-width: 0;
}
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }

.searchbox-go {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
.searchbox-go:hover { filter: brightness(1.08); }

/* ── home hero ───────────────────────────────────────── */

.home-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8vh 20px 14vh;
  text-align: center;
}
.mode-results .home-hero { display: none; }

.hero-logo { font-size: 52px; font-weight: 800; letter-spacing: -.03em; margin: 0 0 24px; }
.hero-sub { color: var(--text-soft); margin: 0 0 30px; font-size: 17px; }

.home-hero .hero-search {
  width: min(640px, 92vw);
  margin-bottom: 26px;
}

.hero-chips { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; max-width: 640px; }

.chip {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }

/* ── results layout ──────────────────────────────────── */

.results { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 18px 22px 40px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 26px; align-items: start; }
.main-col { min-width: 0; }

.rail-sticky { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 16px; }
.rail-inline { display: none; }

/* progress */

.progress { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 2px 2px 14px; min-height: 20px; align-items: center; }

.progress-step { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-faint); }
.progress-step.active { color: var(--accent-text); }
.progress-step.done { color: var(--text-soft); }

.progress-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor;
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}
.progress-step.active .progress-dot { animation: pulse 1.2s ease-in-out infinite; }
.progress-step.done .progress-dot::after {
  content: "✓"; position: absolute; inset: -3px 0 0 1px; font-size: 10px; font-weight: 700;
}
@keyframes pulse { 50% { opacity: .35; } }

.progress-detail {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--text-faint);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* activity feed: живой ход поиска, после ответа — сворачивается */

.activity-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}

.activity-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  border: 0; background: none; cursor: pointer;
  padding: 11px 18px;
  font: inherit; color: var(--text-soft);
  font-size: 13px; font-weight: 600;
  text-align: left;
}
.activity-head:hover { color: var(--text); }
.activity-chevron { transition: transform .15s; color: var(--text-faint); }
.activity-card.collapsed .activity-chevron { transform: rotate(-90deg); }

.activity-body {
  max-height: 210px;
  overflow-y: auto;
  padding: 2px 18px 12px;
  scrollbar-width: thin;
}
.activity-card.collapsed .activity-body { display: none; }

.act-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-soft);
  animation: actIn .18s ease;
}
@keyframes actIn { from { opacity: 0; transform: translateY(3px); } }

.act-time { flex-shrink: 0; width: 38px; text-align: right; color: var(--text-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.act-ico { flex-shrink: 0; width: 16px; text-align: center; font-size: 12px; }
.act-fav { flex-shrink: 0; width: 14px; height: 14px; border-radius: 3px; align-self: center; }
.act-text { min-width: 0; }
.act-text b { color: var(--text); font-weight: 600; }
.act-text a { color: var(--text); }
.act-text a:hover { color: var(--accent-text); }
.act-dim { color: var(--text-faint); }
.act-gist {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* предварительный ответ */

.preview-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  color: var(--text-soft);
  text-transform: none; letter-spacing: 0;
  margin-left: 6px;
}
.preview-text { opacity: .85; margin-bottom: 10px; }

/* answer card */

.answer-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  font-size: 16px;
  line-height: 1.65;
}
.answer-card:empty { display: none; }

.answer-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent-text); margin-bottom: 10px;
}

/* skeleton */

.skeleton-line {
  height: 13px; border-radius: 7px; margin: 12px 0;
  background: linear-gradient(90deg, var(--border) 25%, color-mix(in srgb, var(--border) 40%, var(--card)) 50%, var(--border) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: 600px 0; } }

.skeleton-note { font-size: 13px; color: var(--text-faint); margin-top: 14px; }

/* image strip */

.image-strip-wrap { margin-top: 18px; }
.image-strip {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.image-item {
  flex: 0 0 auto; scroll-snap-align: start;
  width: 168px; height: 124px;
  border-radius: 12px; overflow: hidden; position: relative;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: zoom-in;
}
.image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-item .image-cap {
  position: absolute; inset: auto 0 0 0;
  padding: 14px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,.72));
  color: #fff; font-size: 11px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* generic content cards */

.content-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-top: 18px;
}
.content-card h2 { font-size: 17px; margin: 0 0 10px; letter-spacing: -.01em; }

.content-card p { margin: 0 0 10px; }
.content-card p:last-child { margin-bottom: 0; }
.content-card ul { margin: 6px 0 10px; padding-left: 22px; }
.content-card li { margin: 4px 0; }
.content-card::after { content: ""; display: block; clear: both; }

/* inline image inside a section */

.section-img {
  float: right;
  width: min(300px, 42%);
  margin: 2px 0 12px 18px;
  cursor: zoom-in;
}
.section-img img {
  width: 100%;
  border-radius: 10px;
  display: block;
  border: 1px solid var(--border);
}
.section-img figcaption { font-size: 11px; color: var(--text-faint); margin-top: 5px; line-height: 1.35; }
@media (max-width: 600px) {
  .section-img { float: none; width: 100%; margin: 0 0 12px; }
}

/* facts: тихие строки «лейбл → значение» вместо коробок — смысл первичен,
   рамки и воздух не должны съедать внимание при однострочных значениях */

.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 32px; }
.fact {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.fact-label { flex: 0 0 118px; font-size: 13px; color: var(--text-faint); }
.fact-value { flex: 1; font-size: 14.5px; font-weight: 550; min-width: 0; }
@media (max-width: 600px) {
  .facts-grid { grid-template-columns: 1fr; }
}

/* table */

.table-wrap { overflow-x: auto; }
table.nv { border-collapse: collapse; width: 100%; font-size: 14px; }
table.nv th, table.nv td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.nv th { color: var(--text-soft); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
table.nv tr:last-child td { border-bottom: 0; }

/* steps */

.step { display: flex; gap: 13px; margin: 13px 0; }
.step-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.step-body b { display: block; margin-bottom: 2px; }

/* callout */

.callout { border-radius: var(--radius); padding: 13px 17px; margin-top: 18px; font-size: 14.5px; border: 1px solid; }
.callout.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.callout.warning { background: var(--warn-bg); border-color: var(--warn-border); }
.callout.tip { background: var(--tip-bg); border-color: var(--tip-border); }

/* object cards */

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 18px; }
.obj-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.obj-card-media { position: relative; height: 140px; background: var(--bg); flex-shrink: 0; }
.obj-card-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* плейсхолдер: мягкий градиент по названию + иконка типа сущности */
.obj-card-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.obj-card-ph span { font-size: 34px; opacity: .55; filter: saturate(.8); }
.grad-0 { background: linear-gradient(135deg, rgba(106, 92, 255, .28), rgba(56, 182, 255, .16)); }
.grad-1 { background: linear-gradient(135deg, rgba(56, 182, 255, .26), rgba(52, 211, 153, .15)); }
.grad-2 { background: linear-gradient(135deg, rgba(244, 114, 182, .24), rgba(129, 140, 248, .16)); }
.grad-3 { background: linear-gradient(135deg, rgba(251, 191, 36, .22), rgba(248, 113, 113, .14)); }
.grad-4 { background: linear-gradient(135deg, rgba(52, 211, 153, .24), rgba(56, 189, 248, .14)); }
.grad-5 { background: linear-gradient(135deg, rgba(129, 140, 248, .26), rgba(244, 114, 182, .14)); }
.obj-card-body { padding: 13px 16px 15px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.obj-card-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.obj-card-title a { color: var(--text); }
.obj-card-title a:hover { color: var(--accent-text); }
.obj-card-sub { font-size: 12.5px; color: var(--text-faint); }
.obj-card-text { font-size: 13.5px; color: var(--text-soft); flex: 1; }
.obj-card-price { font-size: 14px; font-weight: 700; color: var(--accent-text); }

/* видео */

.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.video-card { display: block; color: var(--text); }
.video-card:hover { text-decoration: none; }
.video-card:hover .video-title { color: var(--accent-text); }
.video-thumb {
  position: relative; height: 118px;
  border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, rgba(106, 92, 255, .25), rgba(56, 182, 255, .12));
  border: 1px solid var(--border);
}
.video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(10, 12, 18, .72); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; padding-left: 3px;
}
.video-title { font-size: 13px; font-weight: 600; line-height: 1.35; margin-top: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-domain { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* мета-чипы карточек */

.obj-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0; }
.obj-card-meta span {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-soft);
}

/* faq */

details.faq-item { border-bottom: 1px solid var(--border); padding: 4px 0; }
details.faq-item:last-child { border-bottom: 0; }
details.faq-item summary {
  cursor: pointer; font-weight: 600; padding: 9px 0; list-style: none;
  display: flex; justify-content: space-between; gap: 10px;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; color: var(--text-faint); font-size: 17px; }
details.faq-item[open] summary::after { content: "–"; }
.faq-a { padding: 0 0 12px; color: var(--text-soft); }

/* related */

.related-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }

/* update-available banner */

.update-banner {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 80;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: 600 13.5px/1 inherit;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(20, 24, 40, .28);
  cursor: pointer;
  animation: bannerIn .25s ease;
}
.update-banner:hover { filter: brightness(1.08); }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* inline code */

code {
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* clarify chips + live link */

.clarify-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-faint);
  margin-bottom: 12px;
}
.chip-sm { padding: 4px 12px; font-size: 12.5px; }

.live-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-size: 13.5px; font-weight: 600;
}
.live-link:hover { text-decoration: none; filter: brightness(1.08); }

/* map widget */

.map-card { padding-bottom: 14px; }
.map-frame {
  width: 100%; height: 340px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
}

/* shop chips on cards */

.shop-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.shop-chips a {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.shop-chips a:hover { text-decoration: none; filter: brightness(.95); }

/* citations: host pills with favicon */

.cite {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 7px 0 4px;
  border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 10.5px; font-weight: 600;
  vertical-align: 2px;
  margin: 0 2px;
  max-width: 170px;
}
.cite img { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.cite .cite-host { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite:hover { text-decoration: none; filter: brightness(.94); }

/* web results rail */

.rail-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 17px;
}
.rail-section h3 { margin: 0 0 11px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }

.web-result { padding: 8px 0; border-bottom: 1px solid var(--border); }
.web-result:last-child { border-bottom: 0; }
.web-result-head { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.web-result-head img { width: 16px; height: 16px; border-radius: 4px; }
.web-result-domain { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-result-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; display: block; }
.web-result-snippet {
  font-size: 12px; color: var(--text-soft); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* sources list inside answer flow */

.sources-list { display: flex; flex-direction: column; gap: 6px; }
.source-row { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.source-row img { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; }
.source-row a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.source-row .src-host { color: var(--text-faint); font-size: 11px; flex-shrink: 0; }

/* error notice */

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 16px;
  font-size: 14.5px;
}

/* lightbox */

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 9, 14, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 30px;
}
.lightbox img { max-width: 92vw; max-height: 78vh; border-radius: 10px; }
.lightbox a { color: #cdd3ff; font-size: 14px; }
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer;
}

/* footer */

.footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  padding: 18px 20px 22px;
}

/* responsive */

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .rail-inline { display: block; margin-top: 18px; }
  .results { padding: 12px 14px 30px; }
  .topbar { padding: 10px 14px; }
  .searchbox-go { display: none; }
  .hero-logo { font-size: 42px; }
}
