/* BASA — рабочий инструмент. 18.11 Даниил: без скруглений и рамок, тонкие линии-сетка; компоновка карточки бота,
   оформление «по-вебному». Золото — акцент (логотип, шкалы, ссылки). Тема — по настройке телефона. */
:root {
  --bg: #fafaf8; --ink: #121212; --muted: #77746e; --line: #e7e4de; --soft: #f1efea;
  --gold: #a87a00; --gold-hi: #c99100; --on-photo: #ffffff;
  --logo: linear-gradient(180deg, #ffe58a 0%, #f5c21b 45%, #c99100 100%);
  --pad: 16px; --kb: 0px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0b0c; --ink: #f3f1ec; --muted: #8e8b85; --line: #232326; --soft: #151517; --gold: #e8b931; --gold-hi: #f5c21b; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-radius: 0; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font);
             -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: var(--gold); text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mut { color: var(--muted); }
.doubt { font-style: italic; }

#app { position: fixed; inset: 0; bottom: var(--kb); display: flex; flex-direction: column; max-width: 560px; margin: 0 auto;
       border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
@media (max-width: 560px) { #app { border: 0; } }

/* Шапка */
#top { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line);
       padding: calc(env(safe-area-inset-top) + 6px) var(--pad) 6px; min-height: 46px; }
.logo { font-weight: 900; letter-spacing: .1em; font-size: 17px; background: var(--logo);
        -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: light) { #top .logo { background: none; color: var(--ink); } }
#top .logo-slot { opacity: 0; transition: opacity .2s; }
body.has-cards #top .logo-slot { opacity: 1; }
body:not(.has-cards) #top { border-bottom-color: transparent; }
.ghost { color: var(--muted); font-size: 13px; min-height: 40px; }

/* Лента */
#feed { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
#list { margin-top: auto; display: flex; flex-direction: column; }
#empty { margin: auto 0; text-align: center; color: var(--muted); padding: 24px var(--pad); }
.logo-slot.big img { display: block; width: min(70%, 300px); height: auto; margin: 0 auto; }
#empty p { margin: 16px 0 0; font-size: 14px; }
#empty p span { font-size: 12.5px; }
body.has-cards #empty { display: none; }

/* Фото с подписью поверх (мини-карточка и шапка страницы) */
.ph, .hero { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--soft); overflow: hidden; }
.ph img, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.ph img.ok, .hero img.ok { opacity: 1; }
.ph::after, .top:not(.nophoto)::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0) 38%, rgba(0,0,0,.38) 62%, rgba(0,0,0,.82) 100%); }
.ov { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 var(--pad) 12px; color: var(--on-photo);
      text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.ov h1, .ov h2 { margin: 2px 0 0; font-weight: 800; letter-spacing: -.015em; line-height: 1.1; }
.ov h2 { font-size: 22px; padding-right: 40px; }
.ov h1 { font-size: 28px; }
.dev { font-size: 14px; font-weight: 500; margin-top: 3px; opacity: .9; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
       background: var(--gold-hi); color: #111; padding: 3px 6px; margin-bottom: 6px; text-shadow: none; }
/* без фото — подпись обычным текстом */
.nophoto .ph, .hero.nophoto { aspect-ratio: auto; background: none; }
.nophoto .ph::after { display: none; }
.nophoto .ov, .top.nophoto .ov { position: static; color: var(--ink); text-shadow: none; padding-top: 14px; }
/* район · до пляжа · значок карты */
.locr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 var(--pad) 10px;
        font-size: 14px; font-weight: 600; }
.mapb { flex: none; width: 40px; height: 40px; display: grid; place-items: center; color: var(--gold); border: 1px solid var(--line); }
.mapb svg { width: 22px; height: 22px; }
.locr { padding-top: 10px; }
.mini .locr { padding-bottom: 0; }
.mini .mapb { width: 36px; height: 36px; }

/* Мини-карточка */
.mini .ph { aspect-ratio: 2 / 1; }
.mini .band { padding: 9px var(--pad); }
.mini .band .pr b { font-size: 22px; }
.mini .scs div { padding: 7px var(--pad) 9px; }
.mini { position: relative; display: block; width: 100%; border-top: 1px solid var(--line); background: var(--bg);
        will-change: transform; cursor: pointer; }
.mini .del { position: absolute; top: 0; right: 0; width: 44px; height: 44px; display: grid; place-items: center; z-index: 2;
             color: #fff; background: rgba(0,0,0,.28); }
.mini .del svg { width: 16px; height: 16px; }
.mini.nophoto .del { color: var(--muted); background: none; }
.mini.skel .band b { color: transparent; background: var(--soft); }

/* Полоса «цена от / сдача» */
.band { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px var(--pad) 12px; }
.lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
/* главная цена — одной строкой: «КОНДО ОТ $243K  800 юнитов · 40% продано» */
.band .pr { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.band .pr .lbl { font-size: 12px; white-space: nowrap; }
.band .pr b { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.band .sub { font-size: 12.5px; line-height: 1.3; color: var(--muted); margin-left: auto; text-align: right; white-space: nowrap; }
.mini .band .pr { gap: 8px; }

.band .du { text-align: right; }
.band .du b { display: block; font-size: 18px; font-weight: 750; line-height: 1.3; }

/* Оценки: число, подпись, шкала */
.scs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.scs div { padding: 10px 12px 11px; border-left: 1px solid var(--line); text-align: center; }
.scs div:first-child { border-left: 0; }
.scs b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.scs span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.scs i { display: block; height: 2px; margin-top: 8px; background: linear-gradient(90deg, var(--gold) var(--v), var(--line) var(--v)); }
.mini .scs b { font-size: 22px; }

/* Строка поиска */
#bar { position: relative; border-top: 1px solid var(--line); padding: 0 0 env(safe-area-inset-bottom); background: var(--bg); }
body.kb-open #bar { padding-bottom: 0; }
.field { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 var(--pad); height: 56px; }
.field svg { color: var(--muted); flex: none; }
#q { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: 17px var(--font); height: 100%;
     -webkit-appearance: none; appearance: none; }
#q::placeholder { color: var(--muted); }
#q::-webkit-search-cancel-button { display: none; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); flex: none; }
#sugg { list-style: none; margin: 0; padding: 0; position: absolute; left: 0; right: 0; bottom: 100%; background: var(--bg);
        border-top: 1px solid var(--line); max-height: 50vh; overflow-y: auto; box-shadow: 0 -12px 30px rgba(0,0,0,.12); }
#sugg li { padding: 9px var(--pad); min-height: 52px; display: flex; flex-direction: column; justify-content: center;
           border-bottom: 1px solid var(--line); cursor: pointer; }
#sugg li:last-child { border-bottom: 0; }
#sugg li[aria-selected="true"], #sugg li:active { background: var(--soft); }
#sugg li b { font-size: 16px; font-weight: 700; }
#sugg li span { font-size: 12px; color: var(--muted); }
#sugg li.none { color: var(--muted); cursor: default; }

/* Полная карточка */
#page { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; }
#page .wrap { max-width: 560px; margin: 0 auto; min-height: 100%; padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
              border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
@media (max-width: 560px) { #page .wrap { border: 0; } }
.top { position: relative; }
/* назад — в углу фото */
.back { position: absolute; top: env(safe-area-inset-top); left: 0; z-index: 4; width: 48px; height: 48px;
        display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.35);
        -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.back svg { width: 22px; height: 22px; stroke-width: 2.2; }
.top.nophoto .back { position: static; color: var(--ink); background: none; margin-top: env(safe-area-inset-top); }
.top.nophoto .ov { padding-top: 0; }
.hero { aspect-ratio: 4 / 3; }
.phead { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none; }
.top.nophoto .phead { position: static; }
.hero .cnt { position: absolute; top: 10px; right: 10px; z-index: 3; display: flex; align-items: center; gap: 5px;
             background: rgba(0,0,0,.5); color: #fff; font-size: 12.5px; font-weight: 600; padding: 5px 8px;
             -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.hero .cnt svg { width: 15px; height: 15px; }
#page .band { border-top: 1px solid var(--line); padding-top: 10px; padding-bottom: 8px; }
.sec { border-top: 1px solid var(--line); padding: 14px var(--pad) 14px; }
.sh { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.sh h3 { margin: 0; font-size: 12px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.sh .mut { font-size: 12.5px; }
.dl { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 650; }
.dl svg { width: 16px; height: 16px; }
.units .ur { display: grid; grid-template-columns: 70px 1fr auto; align-items: baseline; gap: 8px; padding: 7px 0;
             border-top: 1px solid var(--line); }
.units .ur:first-child { border-top: 0; padding-top: 2px; }
.ur .bd { font-weight: 750; font-size: 15px; }
.ur .ar { color: var(--muted); font-size: 13px; }
.ur .pp { text-align: right; }
.ur .pp b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.ur .pp small { display: block; font-size: 12px; color: var(--muted); }
.note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
/* таблица цен: тип · площадь · баты · доллары */
.ps { padding-top: 10px; padding-bottom: 10px; }
.ps .sh { margin-bottom: 2px; }
.pt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pt th { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
         text-align: left; padding: 4px 0 3px; }
.pt td { padding: 5px 0; border-top: 1px solid var(--line); line-height: 1.25; }
.pt th:nth-child(n+3), .pt td:nth-child(n+3) { text-align: right; padding-left: 10px; }
.pt .bd { font-weight: 750; }
.pt .ar { color: var(--muted); font-size: 12.5px; }
.pt .th { font-size: 14px; color: var(--muted); }
.pt .us { font-size: 15.5px; font-weight: 800; }
.pt i { font-weight: 600; }
/* сроки — вплотную к фото */
.tl { padding: 10px var(--pad) 10px; }
.top.nophoto + .tl { border-top: 1px solid var(--line); }
.tlb { height: 4px; background: var(--line); margin: 0 0 7px; }
.tlb i { display: block; height: 100%; background: var(--gold); }
.tll { display: flex; justify-content: space-between; gap: 8px; }
.tll span { display: flex; flex-direction: column; }
.tll span:nth-child(2) { text-align: center; }
.tll span:last-child { text-align: right; }
.tll small { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tll b { color: var(--ink); font-size: 20px; font-weight: 800; line-height: 1.2; }
/* факты — сетка тонкими линиями */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); margin: -14px calc(-1 * var(--pad)); }
.facts div { background: var(--bg); padding: 11px var(--pad); min-width: 0; }
.facts span { display: block; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.facts b { display: block; font-size: 15px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.facts div:last-child:nth-child(odd) { grid-column: span 2; }
/* о проекте */
.about p { margin: 0 0 10px; white-space: pre-line; line-height: 1.5; font-size: 15px; }
.about p:last-child { margin-bottom: 0; }
.about.cut p:nth-of-type(n+2) { display: none; }
.about.cut p:first-child { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.more { margin-top: 8px; color: var(--gold); font-size: 14px; font-weight: 650; min-height: 36px; }
/* ссылки — плитки сеткой */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tile { background: var(--bg); display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 62px; color: var(--ink); min-width: 0; }
.tile:active { background: var(--soft); }
.tile svg { color: var(--gold); flex: none; width: 22px; height: 22px; }
.tile span { min-width: 0; font-size: 14px; font-weight: 650; }
.tile small { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tiles .tile:last-child:nth-child(odd) { grid-column: span 2; }

/* контакты менеджера */
.show-c { width: 100%; min-height: 48px; border: 1px solid var(--gold); color: var(--gold); font-weight: 700; text-align: center; }
.cr { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cr:first-child { border-top: 0; padding-top: 2px; }
.cn { min-width: 0; }
.cn b { display: block; font-size: 15px; font-weight: 700; }
.cn span { font-size: 13px; color: var(--muted); }
.ca { display: flex; gap: 1px; background: var(--line); flex: none; }
.ca a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 72px; height: 54px;
        background: var(--soft); color: var(--ink); font-size: 11px; font-weight: 600; }
.ca a svg { color: var(--gold); }
.ca a:active { background: var(--line); }

/* Просмотр фото */
#viewer { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; overflow-x: auto;
          scroll-snap-type: x mandatory; scrollbar-width: none; }
#viewer::-webkit-scrollbar { display: none; }
#viewer figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; }
#viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
#viewer .close, #viewer .vc { position: fixed; top: env(safe-area-inset-top); color: #fff; z-index: 2; }
#viewer .close { right: 0; width: 52px; height: 52px; display: grid; place-items: center; background: rgba(0,0,0,.4); }
#viewer .vc { left: 16px; line-height: 52px; font-size: 13px; opacity: .8; }

#toast { position: fixed; left: 0; right: 0; bottom: calc(var(--kb) + 57px + env(safe-area-inset-bottom)); z-index: 30;
         max-width: 560px; margin: 0 auto; background: var(--ink); color: var(--bg); padding: 12px var(--pad); font-size: 14px;
         display: flex; justify-content: space-between; align-items: center; }
#toast button { color: var(--gold-hi); font-weight: 700; }

/* Раскрытие: карточка растёт в страницу (View Transitions), иначе — мягкое появление */
::view-transition-group(hero) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
#page.fade { animation: pin .2s ease-out; }
@keyframes pin { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
