/* ===== Я живу в… — web / Telegram Mini App ===== */
:root {
  --brand: #1f7a5c;
  --brand-2: #2ea77d;
  --brand-ink: #0f4535;
  --accent: #f5a524;      /* stars / highlights */
  --accent-soft: #fff2d6;
  --paper: #f6f4ef;       /* warm background */
  --surface: #ffffff;
  --surface-2: #f1efe8;
  --ink: #1c2422;
  --muted: #6a7570;
  --line: #e7e3d9;
  --danger: #d1495b;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 22px rgba(31, 122, 92, .08);
  --shadow-lg: 0 14px 40px rgba(20, 40, 33, .16);
  --maxw: 680px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10130f;
    --surface: #191d18;
    --surface-2: #21261f;
    --ink: #eef1ea;
    --muted: #9aa69f;
    --line: #2b312a;
    --brand: #37b085;
    --brand-2: #45c496;
    --accent: #ffbb3d;
    --accent-soft: #33280f;
    --shadow: 0 6px 22px rgba(0,0,0,.35);
    --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea { font-family: inherit; }
a { color: var(--brand); text-decoration: none; }

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
}
.topbar__back {
  background: rgba(255,255,255,.16); color:#fff; border:0;
  width: 34px; height: 34px; border-radius: 10px; font-size: 22px; line-height: 1;
  cursor: pointer; flex: none;
}
.topbar__brand { display:flex; align-items:center; gap:8px; cursor:pointer; }
.topbar__logo { font-size: 22px; }
.topbar__title { font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.region-chip {
  margin-left: auto; background: rgba(255,255,255,.18); color:#fff;
  border: 0; border-radius: 999px; padding: 8px 13px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 46%;
  overflow: hidden; text-overflow: ellipsis;
}
.region-chip:active { transform: scale(.97); }

/* ===== Search ===== */
.searchbar {
  position: sticky; top: 0; z-index: 15;
  padding: 12px 16px 6px;
  background: var(--paper);
}
.searchbar__form {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow);
}
.searchbar__icon { font-size: 16px; opacity: .7; }
.searchbar__input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink);
  font-size: 16px; padding: 8px 2px;
}
.searchbar__btn {
  border: 0; background: var(--brand); color: #fff; font-weight: 700;
  border-radius: 999px; padding: 9px 16px; cursor: pointer; font-size: 14px;
}
.searchbar__btn:active { transform: scale(.97); }

/* ===== View / layout ===== */
.view { flex: 1; padding: 8px 16px 26px; }
.section-title {
  font-size: 15px; font-weight: 800; color: var(--ink);
  margin: 18px 2px 10px; display:flex; align-items:center; gap:8px;
}
.section-title .count { color: var(--muted); font-weight: 600; font-size: 13px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, rgba(46,167,125,.12), rgba(245,165,36,.10));
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 18px; margin-top: 6px;
}
.hero h1 { font-size: 20px; margin: 0 0 4px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.hero__stats { display:flex; gap: 18px; margin-top: 12px; }
.hero__stat b { font-size: 18px; color: var(--brand); }
.hero__stat span { display:block; font-size: 12px; color: var(--muted); }

/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 460px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
.cat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 8px 12px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.cat-card:active { transform: translateY(1px) scale(.98); }
.cat-card:hover { box-shadow: var(--shadow); }
.cat-card__emoji { font-size: 26px; line-height: 1; }
.cat-card__label { font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.cat-card__count { font-size: 11px; color: var(--muted); }

/* Entry list */
.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow .12s ease, transform .12s ease;
}
.entry:hover { box-shadow: var(--shadow); }
.entry:active { transform: scale(.995); }
.entry__ava {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface-2); display: grid; place-items: center; font-size: 22px;
}
.entry__body { flex: 1; min-width: 0; }
.entry__name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.entry__name span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry__meta { font-size: 12.5px; color: var(--muted); margin-top: 3px;
  display:flex; flex-wrap: wrap; gap: 4px 10px; }
.entry__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
  font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); display:inline-flex; gap:4px; align-items:center;
}
.badge--star { background: var(--accent-soft); color: #9a6b00; }
.badge--google { background: rgba(66,133,244,.12); color: #2f6adb; }
.badge--medal { background: rgba(245,165,36,.14); color: #a6741a; }

/* Stars */
.stars { display: inline-flex; letter-spacing: 1px; font-size: 14px; }
.stars i { color: var(--line); font-style: normal; }
.stars i.on { color: var(--accent); }

/* Entry detail */
.detail-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.detail-head { display:flex; gap: 14px; align-items: flex-start; }
.detail-ava {
  width: 60px; height: 60px; border-radius: 16px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 30px; flex: none;
}
.detail-name { font-size: 20px; font-weight: 800; margin: 0; }
.detail-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.rating-row { display:flex; align-items:center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.rating-big { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1; }
.rating-row .muted { color: var(--muted); font-size: 13px; }
.contact-row { display:flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.contact-btn {
  display:flex; align-items:center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 14.5px;
}
.contact-btn .ico { font-size: 18px; }

.reviews { margin-top: 8px; display:flex; flex-direction: column; gap: 10px; }
.review {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.review__top { display:flex; justify-content: space-between; align-items:center; }
.review__date { font-size: 12px; color: var(--muted); }
.review__text { font-size: 14px; margin-top: 6px; }

/* Search results */
.ai-card {
  background: linear-gradient(135deg, rgba(46,167,125,.14), rgba(46,167,125,.04));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 14px;
}
.ai-card h3 { margin: 0 0 6px; font-size: 14px; color: var(--brand); display:flex; gap:6px; align-items:center;}
.ai-card p { margin: 0; font-size: 14.5px; white-space: pre-wrap; }
.msg {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; margin-bottom: 8px;
}
.msg__head { font-size: 12px; color: var(--muted); display:flex; gap:8px; align-items:center; }
.msg__text { font-size: 14px; margin-top: 4px; }
.pin { color: var(--brand); font-weight: 700; }

/* Buttons */
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 700; font-size: 15px;
  cursor: pointer; display: inline-flex; align-items:center; justify-content:center; gap:8px;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:disabled { opacity: .5; }
.btn--ghost { background: var(--surface-2); color: var(--ink); }
.btn--wide { width: 100%; margin-top: 12px; }
.btn:active { transform: scale(.98); }

.filters { display:flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display:none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip--active { background: var(--brand); color:#fff; border-color: var(--brand); }

/* Empty / states */
.empty { text-align:center; color: var(--muted); padding: 40px 20px; }
.empty .em { font-size: 40px; display:block; margin-bottom: 10px; }
.load-more { text-align:center; margin: 14px 0; }

/* Skeleton */
.skel { background: var(--surface); border:1px solid var(--line); border-radius: var(--radius-sm);
  height: 70px; margin-bottom: 10px; position: relative; overflow: hidden; }
.skel::after { content:""; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: translateX(-100%); animation: sh 1.2s infinite; }
@media (prefers-color-scheme: dark){ .skel::after{ background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);} }
@keyframes sh { 100% { transform: translateX(100%); } }

/* Search hint */
.search-hint { margin: 8px 6px 0; font-size: 12.5px; color: var(--muted); line-height: 1.35; }

/* Top / leaders */
.rank { flex: none; width: 26px; text-align: center; font-size: 18px; font-weight: 800; color: var(--muted); align-self: center; }
.rank--medal { font-size: 22px; }
.top-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.top-scroll::-webkit-scrollbar { display: none; }
.top-card {
  flex: 0 0 200px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
}
.top-card:hover { box-shadow: var(--shadow); }
.top-card__rank { font-size: 20px; }
.top-card__name { font-weight: 700; font-size: 14px; margin: 4px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top-card__meta { font-size: 12px; color: var(--muted); }

/* Community block on home */
.community { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.community__btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.community__btn:active { transform: scale(.98); }
.community__btn b { font-size: 14px; }
.community__btn span { font-size: 12px; color: var(--muted); }
.community__btn .em { font-size: 22px; margin-bottom: 2px; }

/* Suggestions */
.sug {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px;
}
.sug__vote {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px;
  padding: 6px 10px; cursor: pointer; min-width: 52px;
}
.sug__vote.voted { background: var(--brand); border-color: var(--brand); color: #fff; }
.sug__vote .arw { font-size: 14px; line-height: 1; }
.sug__vote .num { font-weight: 800; font-size: 15px; }
.sug__body { flex: 1; min-width: 0; }
.sug__text { font-size: 14.5px; }
.sug__meta { font-size: 12px; color: var(--muted); margin-top: 5px; }
.sug__status { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: #9a6b00; }

/* Notify button */
.notify-card {
  background: var(--surface); border: 1px dashed var(--brand); border-radius: var(--radius);
  padding: 15px 16px; margin: 14px 0; text-align: center;
}
.notify-card p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }

/* Subscriptions */
.sub {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px;
}
.sub__kw { font-weight: 700; font-size: 14.5px; flex: 1; }
.sub__del { border: 0; background: var(--surface-2); color: var(--danger); border-radius: 10px;
  width: 34px; height: 34px; cursor: pointer; font-size: 15px; flex: none; }

/* Bottom nav */
.botnav {
  position: sticky; bottom: 0; z-index: 25; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.botnav__item {
  flex: 1; border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 9px 4px; font-size: 11.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.botnav__item span { font-size: 20px; line-height: 1; }
.botnav__item.is-active { color: var(--brand); }

/* Install (PWA) banner */
.install-banner {
  display: flex; align-items: center; gap: 10px; margin: 0 16px 6px;
  background: linear-gradient(135deg, rgba(46,167,125,.16), rgba(245,165,36,.12));
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
.install-banner[hidden] { display: none; }
.install-banner__ico { font-size: 22px; flex: none; }
.install-banner__txt { flex: 1; font-size: 12.5px; color: var(--ink); line-height: 1.3; }
.install-banner__btn {
  flex: none; border: 0; background: var(--brand); color: #fff; font-weight: 700;
  border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.install-banner__x { flex: none; border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px; }

/* Featured community banner (moms chat etc.) */
.featured {
  display: flex; align-items: center; gap: 12px; margin: 12px 0 4px;
  background: linear-gradient(135deg, rgba(245,165,36,.16), rgba(46,167,125,.10));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  color: var(--ink); cursor: pointer;
}
.featured:active { transform: scale(.99); }
.featured__emoji { font-size: 32px; flex: none; }
.featured__body { flex: 1; min-width: 0; }
.featured__body b { font-size: 15px; display: block; }
.featured__body span { font-size: 12.5px; color: var(--muted); }
.featured__cta { flex: none; font-size: 13px; font-weight: 700; color: var(--brand); white-space: nowrap; }

/* Stat tiles (admin) */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 460px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 10px; text-align: center;
}
.stat-tile b { font-size: 22px; color: var(--brand); display: block; }
.stat-tile span { font-size: 11.5px; color: var(--muted); }

/* Mentions (who & where) */
.mention-chats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chat-pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px;
}

/* Info pages */
.info-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 6px;
}
.info-card p { margin: 0 0 10px; font-size: 14.5px; }
.info-card p:last-child { margin-bottom: 0; }
.info-card h3 { margin: 0 0 8px; font-size: 15px; }
.info-list { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.info-list li { font-size: 14px; }

/* Footer */
.foot { text-align:center; color: var(--muted); font-size: 12px; padding: 16px; }
.foot-links { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.foot-links a { color: var(--brand); font-weight: 600; }
.foot-links span { color: var(--line); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10,20,16,.5); }
.modal__card {
  position: relative; width: 100%; max-width: var(--maxw);
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 20px);
  box-shadow: var(--shadow-lg); animation: up .22s ease;
}
@media (min-width: 700px){ .modal { align-items:center; } .modal__card{ border-radius: 22px; margin: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity:.6 } to { transform:none; opacity:1 } }
.modal__head { display:flex; justify-content: space-between; align-items:center; margin-bottom: 4px; }
.modal__head h3 { margin: 0; font-size: 17px; }
.modal__x { border:0; background: var(--surface-2); width:32px; height:32px; border-radius:10px; cursor:pointer; font-size:15px; color:var(--muted); }
.modal__hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.country-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap:8px; max-height: 46vh; overflow:auto; }
.country-opt {
  display:flex; align-items:center; gap:8px; padding:10px 12px; border:1px solid var(--line);
  border-radius: 12px; background: var(--surface); cursor:pointer; font-size:14px; font-weight:600;
}
.country-opt .cnt { margin-left:auto; color: var(--muted); font-size:12px; font-weight:600; }
.country-opt--active { border-color: var(--brand); background: rgba(46,167,125,.08); }

/* Rate stars input */
.rate-stars { display:flex; justify-content:center; gap: 6px; margin: 10px 0 12px; }
.rate-stars button {
  background: none; border: 0; font-size: 40px; line-height: 1; color: var(--line); cursor: pointer; padding: 0 2px;
}
.rate-stars button.on { color: var(--accent); }
.rate-text {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 14.5px; resize: vertical; background: var(--surface); color: var(--ink);
}
.rate-authhint { background: var(--accent-soft); color:#8a5c00; border-radius:12px; padding:10px 12px; font-size:13px; margin-top:10px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; z-index: 90; box-shadow: var(--shadow-lg); max-width: 90%;
}
.toast[hidden]{ display:none; }
