.m-road { background: var(--cat-road); }
.m-podslushano { background: var(--cat-podslushano); }
.m-social { background: var(--cat-social); }
.m-commerce { background: var(--cat-commerce); }
:root {
      --bg: #ffffff;
      --text: #0f172a;
      --muted: #64748b;
      --panel: rgba(255,255,255,.92);
      --panel-blur: saturate(180%) blur(8px);
      --divider: rgba(2,6,23,.08);
      --accent: #2563eb;
      --accent-rgb: 37, 99, 235;

      --chip-bg: rgba(2,6,23,.05);

      --cat-complaint: #ef4444;
      --cat-idea: #f59e0b;
      --cat-event: #22c55e;
      --cat-lostfound: #0ea5e9;
      --cat-commerce: #6366f1;
      --cat-social: #ec4899;
      --cat-road: #ea580c;
      --cat-podslushano: #1a1a1a;
      --cat-commerce: #6366f1;

      --tag-hole: #7c3aed;
      --tag-trash: #16a34a;
      --tag-praise: #fbbf24;
      --tag-snow: #38bdf8;
      --tag-light: #f97316;
      --tag-yard: #6366f1;
      --tag-other: #94a3b8;
    
  --peek-height: 66px;

    --panel: #F9FAFB;
    --panel-blur: none;
  }
    .dark {
      --bg: #0b1117;
      --text: #e5e7eb;
      --muted: #94a3b8;
      --panel: rgba(13,18,24,.86);
      --divider: rgba(255,255,255,.08);
      --chip-bg: rgba(148, 163, 184, .18);
      --accent: #60a5fa;
      --accent-rgb: 96, 165, 250;
    }
    html,body,#app { height:100%; margin:0; background:var(--bg); color:var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
    #map { position:absolute; inset:0; contain: strict; }

    /* tabs bottom sheet */
    .sheet { position:absolute; left:0; right:0; z-index:30; background:#fff; border-top-left-radius:16px; border-top-right-radius:16px; border-top:1px solid var(--divider); box-shadow: 0 -10px 30px rgba(0,0,0,.14); }
    .grip { width:44px; height:4px; background:var(--divider); border-radius:99px; margin:8px auto; position:relative; z-index:12; }
    .tabs { display:flex; gap:8px; padding:0 12px 8px; position:relative; z-index:12; }
    /* tab */
    .tab-btn { 
      flex:1; 
      text-align:center; 
      padding:10px 0; 
      border-radius:10px 10px 0 0; 
      border:1px solid var(--divider); 
      background:var(--chip-bg); 
      font-weight:800; 
      cursor:pointer; 
      transition: all 0.2s ease;
    }
    .tab-btn:active { 
      transform: scale(0.98); 
    }
    .tab-btn.active { 
      background:var(--accent); 
      border-color:var(--accent); 
      color:#fff; 
    }
    .tab { display:none; overflow:auto; padding: 0; flex: 1; min-height: 0; }
    .tab.active { display:block; }

    .section-title { font-weight:800; margin:10px 0 6px; }

    .chips { display:flex; flex-wrap:wrap; gap:8px; }
    .chip { 
      display:inline-flex; 
      align-items:center; 
      gap:8px; 
      padding:8px 12px; 
      background:var(--chip-bg); 
      border:1px solid var(--divider); 
      border-radius:999px; 
      font-weight:700; 
      cursor:pointer; 
      transition: all 0.2s ease;
    }
    .chip:active { 
      transform: scale(0.98); 
    }
    .chip i { width:10px; height:10px; border-radius:50%; display:inline-block; }
    .chip.primary[data-k="COMPLAINT"] i { background: var(--cat-complaint); }
    .chip.primary[data-k="IDEA"] i { background: var(--cat-idea); }
    .chip.primary[data-k="EVENT"] i { background: var(--cat-event); }
    .chip.primary[data-k="LOSTFOUND"] i { background: var(--cat-lostfound); }
    .chip.primary[data-k="COMMERCE"] i { background: var(--cat-commerce); }
    .chip.primary[data-k="SOCIAL"] i { background: var(--cat-social); }
    .chip.primary[data-k="ROAD"] i { background: var(--cat-road); }
    .chip.primary[data-k="PODSLUSHANO"] i { background: var(--cat-podslushano); }
    .chip.active { 
      outline: 2px solid var(--accent); 
      background: rgba(37, 99, 235, 0.1);
      transform: scale(1.02);
    }
    .chip.tag[data-k="HOLE"] i { background: var(--tag-hole); }
    .chip.tag[data-k="TRASH"] i { background: var(--tag-trash); }
    .chip.tag[data-k="PRAISE"] i { background: var(--tag-praise); }
    .chip.tag[data-k="SNOW"] i { background: var(--tag-snow); }
    .chip.tag[data-k="LIGHT"] i { background: var(--tag-light); }
    .chip.tag[data-k="YARD"] i { background: var(--tag-yard); }
    .chip.tag[data-k="OTHER"] i { background: var(--tag-other); }

    .row { display:flex; gap:8px; align-items:center; }
    .field { display:flex; flex-direction:column; gap:6px; margin:10px 0; }
    select, input, textarea { width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--divider); background:rgba(0,0,0,.03); color:var(--text); }
    textarea { min-height:72px; resize:vertical; }
    .btn { border:1px solid var(--divider); background:var(--accent); color:#fff; border-radius:10px; padding:12px; cursor:pointer; font-weight:800; }
    .btn.secondary { background:transparent; color:var(--text); }
    .btn.block { width:100%; }

    /* fab */
    .fab { position:absolute; right:12px; bottom: 190px; z-index:20; display:flex; flex-direction:column; gap:8px; }
    .fab button { background:var(--panel); -webkit-backdrop-filter: var(--panel-blur); backdrop-filter: var(--panel-blur); border:1px solid var(--divider); border-radius:12px; padding:10px 12px; font-weight:700; cursor:pointer; }

    /* marker */
    .marker { width:24px; height:24px; border-radius:50%; display:grid; place-items:center; color:#fff; font-size:13px; font-weight:900; box-shadow: 0 0 0 2px #fff, 0 10px 16px rgba(0,0,0,.22); }
    .m-complaint { background: var(--cat-complaint); }
    .m-idea { background: var(--cat-idea); }
    .m-event { background: var(--cat-event); }
    .m-lost { background: var(--cat-lostfound); }
    .marker.pulse::after { content:""; position:absolute; inset:-6px; border:2px solid currentColor; border-radius:50%; opacity:.6; animation:pulse 1.2s ease-out infinite; }
    .marker.draft { background:#111827; color:#fff; }
    @keyframes pulse { 0% { transform: scale(.6); opacity:.8; } 100% { transform: scale(1.5); opacity:0; } }

    /* popup - bottom sheet style */
    .popup { 
      position: fixed; 
      left: 0; 
      right: 0; 
      bottom: 0; 
      z-index: 100; 
      background: #fff;
      border-radius: 20px 20px 0 0; 
      box-shadow: 0 -8px 40px rgba(2,6,23,.2); 
      transform: translateY(100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      max-height: calc(100vh - 60px);
      display: flex;
      flex-direction: column;
    }
    .popup.open { 
      transform: translateY(0); 
    }
    .popup .popup-grip {
      width: 36px;
      height: 4px;
      background: rgba(0,0,0,.15);
      border-radius: 2px;
      margin: 8px auto 4px;
      flex-shrink: 0;
    }
    .popup .popup-header {
      padding: 0 16px;
      flex-shrink: 0;
    }
    /* Изолируем marquee от transition изменений попапа */
    .popup .addr-rect,
    .popup .marquee-track {
      contain: layout style;
    }
    .popup .wrap { 
      padding: 0 12px;
      flex-shrink: 0;
      background: #fff;
    }
    
    /* === 3-блочный дизайн === */
    .popup-block-content {
      background: #f3f4f6;
      border-radius: 16px 16px 0 0;
      padding: 12px 14px;
      margin: 0 -12px 2px;
    }
    .popup-block-content .popup-meta {
      margin: 0;
    }
    .popup-block-content .clamp-toggle {
      margin: 8px auto 0;
      display: inline-flex;
    }
    .popup-block-content {
      text-align: center;
    }
    .popup-block-content .popup-meta {
      text-align: left;
    }
    
    .popup-block-media {
      background: #f3f4f6;
      margin: 0 -12px 2px;
    }
    .popup-block-media .popup-media-preview {
      margin: 0;
      padding: 0;
      border-radius: 0;
    }
    
    .popup .sticky-actions {
      padding: 0;
      margin: 0 -12px;
      flex-shrink: 0;
      background: transparent;
    }
    .popup::before{ display: none; }
    .icon-btn { position:absolute; top:8px; padding:6px 8px; border:none; background:transparent; cursor:pointer; }
    .meta-row { display:flex; align-items:center; gap:8px; margin:8px 0; }
    .badge.category { border-radius:8px; border:1px solid var(--divider); padding:6px 8px; background:rgba(0,0,0,.03); font-weight:800; }
    .author-link { display:inline-flex; align-items:center; gap:8px; text-decoration:none; color:var(--text); }
    .author-link .avatar { width:24px; height:24px; border-radius:50%; background:#e5e7eb; display:inline-flex; align-items:center; justify-content:center; font-weight:800; }
    .author-link img.avatar { width:24px; height:24px; border-radius:50%; object-fit:cover; display:inline-block; }
    .clamp[data-lines="10"]{ display:-webkit-box; -webkit-line-clamp:10; -webkit-box-orient:vertical; }
    .sticky-actions { position:sticky; bottom:0; padding-top:10px; margin-top:10px; background: linear-gradient(to top, var(--panel) 70%, rgba(0,0,0,0) 100%); }
    .reactions { display:flex; gap:8px; align-items:center; margin-top:8px; }
    .react-btn { border:none; background:transparent; border-radius:999px; padding:6px 12px; cursor:pointer; display:inline-flex; align-items:center; gap:4px; transition: all 0.2s ease; color: var(--muted); }
    .react-btn .ic { transition: filter 0.2s ease; opacity: 0.6; }
    .react-btn .cnt { font-weight:700; transition: color 0.2s ease; color: var(--muted); }
    /* Like button - has votes (others voted) */
    .react-btn[data-action="like"].has-votes { 
      background: rgba(8, 145, 178, 0.15);
      color: white;
    }
    .react-btn[data-action="like"].has-votes .ic {
      filter: brightness(0) invert(1);
      opacity: 1;
    }
    .react-btn[data-action="like"].has-votes .cnt {
      color: white;
    }
    /* Like button - active state (you voted) */
    .react-btn[data-action="like"].active { 
      background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
      color: white;
      box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
    }
    .react-btn[data-action="like"].active:hover {
      box-shadow: 0 3px 12px rgba(8, 145, 178, 0.4);
    }
    .react-btn[data-action="like"].active .ic {
      filter: brightness(0) invert(1);
      opacity: 1;
    }
    .react-btn[data-action="like"].active .cnt {
      color: white;
    }
    /* Dislike button - has votes (others voted) */
    .react-btn[data-action="dislike"].has-votes { 
      background: rgba(107, 114, 128, 0.15);
      color: var(--text);
    }
    .react-btn[data-action="dislike"].has-votes .ic {
      opacity: 0.8;
    }
    .react-btn[data-action="dislike"].has-votes .cnt {
      color: var(--text);
    }
    /* Dislike button - active state (you voted) */
    .react-btn[data-action="dislike"].active { 
      background: rgba(107, 114, 128, 0.9);
      color: white;
      box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
    }
    .react-btn[data-action="dislike"].active:hover {
      box-shadow: 0 3px 12px rgba(107, 114, 128, 0.4);
    }
    .react-btn[data-action="dislike"].active .ic {
      filter: brightness(0) invert(1);
      opacity: 1;
    }
    .react-btn[data-action="dislike"].active .cnt {
      color: white;
    }
    .re-mini { display:inline-flex; gap:8px; align-items:center; }
    .re-mini .cnt { font-style:normal; font-variant-numeric: tabular-nums; }
    .re-mini .react-btn { 
      display:inline-flex; 
      align-items:center; 
      gap:6px;
      padding: 8px 12px;
      min-height: 36px;
      border-radius: 999px;
      border: none;
      background: rgba(0, 0, 0, 0.05);
      cursor: pointer;
      transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
      font-size: 18px;
    }
    .re-mini .react-btn .cnt {
      font-size: 14px;
      font-weight: 600;
      color: var(--text);
    }
    .re-mini .react-btn:active {
      transform: scale(0.92);
    }
    /* Like button in re-mini - has votes */
    .re-mini .react-btn[data-action="like"].has-votes {
      background: rgba(8, 145, 178, 0.15);
    }
    .re-mini .react-btn[data-action="like"].has-votes .cnt {
      color: #0891b2;
    }
    /* Like button in re-mini - active state */
    .re-mini .react-btn[data-action="like"].active {
      background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
      color: white;
      box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
    }
    .re-mini .react-btn[data-action="like"].active:hover {
      box-shadow: 0 3px 12px rgba(8, 145, 178, 0.4);
    }
    .re-mini .react-btn[data-action="like"].active .cnt {
      color: white;
    }
    /* Dislike button in re-mini - has votes */
    .re-mini .react-btn[data-action="dislike"].has-votes {
      background: rgba(107, 114, 128, 0.12);
    }
    .re-mini .react-btn[data-action="dislike"].has-votes .cnt {
      color: #6b7280;
    }
    /* Dislike button in re-mini - active state */
    .re-mini .react-btn[data-action="dislike"].active {
      background: rgba(107, 114, 128, 0.9);
      color: white;
      box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
    }
    .re-mini .react-btn[data-action="dislike"].active:hover {
      box-shadow: 0 3px 12px rgba(107, 114, 128, 0.4);
    }
    .re-mini .react-btn[data-action="dislike"].active .cnt {
      color: white;
    }
    
    /* re-mini mobile styles */
    @media (max-width: 400px) {
      .re-mini .react-btn {
        padding: 6px 10px;
        min-height: 32px;
        font-size: 16px;
        gap: 5px;
      }
      .re-mini .react-btn .cnt {
        font-size: 13px;
      }
    }
    /* category colors */
    .category--complaint { background:#fee2e2; border-color:#fecaca; }
    .category--idea { background:#e0f2fe; border-color:#bae6fd; }
    .category--event { background:#dcfce7; border-color:#bbf7d0; }
    .category--lostfound { background:#ffedd5; border-color:#fed7aa; }
    /* modal light style */
    .modal .panel { background: var(--panel); }
    .carousel { background: var(--panel); }
    .carousel img, .carousel video { width:100%; height:100%; object-fit: contain; }
    .carousel .nav { pointer-events: auto; z-index: 3; }
    .carousel .nav button { pointer-events:auto; }
    .play-overlay{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:64px; opacity:.85; }
    .m-count { font-size:13px; color:var(--muted); margin-left:auto; margin-right:12px; }

    .addr-rect { display:inline-flex; align-items:center; gap:8px; padding:6px 10px; background:var(--chip-bg); border:1px solid var(--divider);  font-weight:800; margin-bottom:8px; }
    .text { white-space:pre-wrap; }
    .actions { margin-top:10px; display:flex; gap:8px; }
    .modal { position:fixed; inset:0; background:rgba(0,0,0,.6); display:none; align-items:center; justify-content:center; z-index:50; }
    .modal.open { display:flex; }
    .modal .panel { width:90vw; max-width:820px; height:70vh; background:var(--bg); border-radius:14px; overflow:hidden; display:flex; flex-direction:column; border:1px solid var(--divider); }
    .modal header { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-bottom:1px solid var(--divider); }
    .carousel { position:relative; flex:1; display:flex; align-items:center; justify-content:center; background:#000; }
    .carousel img, .carousel video { max-width:100%; max-height:100%; }
    .nav { position:absolute; top:50%; transform:translateY(-50%); width:100%; display:flex; justify-content:space-between; padding:0 12px; }
    .nav button { background:rgba(0,0,0,.45); color:#fff; border:none; padding:10px 12px; border-radius:10px; }

    /* feed */
    .feed { display:flex; flex-direction:column; gap:12px; }
    .card { 
      border:1px solid var(--divider); 
      border-radius:16px; 
      background:var(--panel); 
      -webkit-backdrop-filter: var(--panel-blur); 
      backdrop-filter: var(--panel-blur); 
      padding:16px; 
      box-shadow: 0 18px 40px rgba(2,6,23,.25), 0 2px 8px rgba(2,6,23,.12);
      transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      will-change: transform;
      /* GPU acceleration */
      transform: translateZ(0);
      -webkit-transform: translateZ(0);
    }
    .card:hover {
      transform: translateY(-4px);
      box-shadow: 0 24px 50px rgba(2,6,23,.3), 0 4px 12px rgba(2,6,23,.15);
    }
    /* Touch/tap active state for mobile */
    .card:active,
    .card.card-active {
      transform: translateY(-4px);
      box-shadow: 0 24px 50px rgba(2,6,23,.3), 0 4px 12px rgba(2,6,23,.15);
    }
    .card .row1 { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
    .badge { display:inline-flex; align-items:center; gap:8px; padding:6px 10px; background:var(--chip-bg); border:1px solid var(--divider); border-radius:999px; font-weight:800; }
    .statline { position:absolute; left:12px; right:12px; bottom: calc(100% + 8px); text-align:center; font-size:12px; color:var(--muted); }
  
    /* toast */
    .toast { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 100001;
             background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
             color: #1e293b; border-radius: 16px; padding: 16px 20px;
             box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
             font-weight: 600; opacity: 0; pointer-events: none;
             transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); max-width: 85vw; text-align: center;
             backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.8); 
             white-space: pre-line; line-height: 1.5; }
    .toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1.02); pointer-events: auto; }

    .text { white-space: pre-wrap; overflow-wrap:anywhere; word-break: break-word; }

    /* author link */
    .addr-rect a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

    /* feed meta */
    .card .text { white-space: pre-wrap; overflow-wrap:anywhere; word-break: break-word; color: #1a1a1a; }
    .meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
    .badge.small { font-size:12px; padding:6px 10px; }
    .badge.category { color:#111827; }
    .share { margin-left:auto; display:inline-flex; align-items:center; gap:6px; cursor:pointer; user-select:none; }
    .share svg { width:18px; height:18px; }

    /* Typography improvements */
    .card .meta .author-name { color: #374151; font-weight: 600; }
    .card .meta .author-time { color: #6b7280; font-weight: 500; }
    .card .addr-rect .marquee-item { color: #374151; }
    
    /* Clickable vs non-clickable author names */
    .card .meta a.author-link .author-name { 
      color: #2563eb; 
      transition: color 0.2s ease; 
    }
    .card .meta a.author-link:hover .author-name { 
      color: #1d4ed8; 
    }
    .card .meta .author-name:not(.author-link .author-name) { 
      color: #374151; 
      cursor: default; 
    }

    /* category colors */
    .category--complaint { background:#fee2e2; border-color:#fecaca; }
    .category--idea      { background:#dbeafe; border-color:#bfdbfe; }
    .category--event     { background:#dcfce7; border-color:#bbf7d0; }
    .category--lost      { background:#ffedd5; border-color:#fed7aa; }

    /* switch (tumbler) */
    .switch { display:flex; align-items:center; gap:10px; margin:10px 0; }
    .switch .track { width:46px; height:26px; border-radius:999px; border:1px solid var(--divider);
                     background: var(--chip-bg); position:relative; transition: background .2s; }
    .switch .knob { position:absolute; top:2px; left:2px; width:22px; height:22px; border-radius:50%;
                    background:#fff; box-shadow:0 2px 8px rgba(0,0,0,.15); transition: left .18s ease; }
    .switch.active .track { background: var(--accent); }
    .switch.active .knob { left:22px; }

  
/* THEME VARIABLES (overridable via Telegram themeParams) */
:root{
  --bg:#0b1220; --fg:#cbd5e1; --muted:#94a3b8;
  --accent:#22c55e; --chip-bg:rgba(255,255,255,.06); --divider:rgba(255,255,255,.12);

    --text: var(--fg);
    --panel: #F9FAFB;
    --panel-blur: none;
  }
.badge.category{ color:#111827; }
.category--complaint{ background:#fee2e2; border-color:#fecaca; }
.category--idea{      background:#dbeafe; border-color:#bfdbfe; }
.category--event{     background:#dcfce7; border-color:#bbf7d0; }
.category--lost{      background:#ffedd5; border-color:#fed7aa; }
.clamp{ position:relative; overflow:hidden; }
.clamp[data-lines="6"]{ display:-webkit-box; -webkit-line-clamp:6; -webkit-box-orient:vertical; }
.clamp[data-lines="4"]{ display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; }
.clamp.expanded{ -webkit-line-clamp:unset; max-height:none; }
.clamp-toggle{ margin-top:6px; font-size:13px; color:var(--muted); cursor:pointer; user-select:none; }
.marker-active{ animation:pulse 1.2s ease-out infinite; box-shadow:0 0 0 0 rgba(34,197,94,.4); }
@keyframes pulse{ 0%{transform:scale(1); box-shadow:0 0 0 0 rgba(34,197,94,.35);} 70%{transform:scale(1.05); box-shadow:0 0 0 12px rgba(34,197,94,0);} 100%{transform:scale(1);} }
.avatar{ width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
         font-weight:700; font-size:12px; color:#fff; background:#64748b; }
.meta .avatar{ margin-right:4px; }
.preview{ width:56px; height:56px; border-radius:10px; background:var(--chip-bg) center/cover no-repeat; flex:0 0 auto; }
.preview.fallback{ display:flex; align-items:center; justify-content:center; font-size:18px; color:var(--muted); }
.text, .card .text{ white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; }

  
/* --- FAB icon buttons (inline SVG, no external assets) --- */
:root { --icon-color: #1f2937; } /* slate-800 default */
.fab { display: flex; gap: 8px; }
.fab button { width:44px; height:44px; padding:0; display:grid; place-items:center; border-radius:12px; background: var(--panel, rgba(255,255,255,.92)); border: 1px solid rgba(15,23,42,.08); }
.fab button:active { transform: translateY(1px); }
.fab button svg { width:24px; height:24px; color: var(--icon-color); filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
@media (prefers-color-scheme: dark) {
  :root { --icon-color: #ffffff; }
  .fab button { background: color-mix(in oklab, #0b1220 70%, transparent); border-color: rgba(255,255,255,.08); }
}


/* --- Drawer peek/expand behavior --- */
:root { 
  --peek-height: 66px; 
  --safe-area-bottom: 0px;
  --blur-opacity: 1;
}
.sheet { 
  bottom: var(--safe-area-bottom) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Начальная позиция collapsed - JS потом уточнит */
  transform: translateY(calc(100% - var(--peek-height)));
  will-change: transform;
  touch-action: none; /* предотвращаем браузерные жесты */
  /* Fullscreen высота */
  height: calc(100vh - 44px);
  height: calc(100dvh - 44px);
  /* Скролл только внутри .tab */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* .sheet.open - transform управляется через JS */
/* Отключаем transition во время свайпа */
.sheet.swiping { transition: none !important; }


/* 3D toggle active state */
.fab button.active{ outline: 2px solid var(--accent); }


/* === Rect chips + welcome + polish === */
:root { --chip-height: 40px; --chip-radius: 12px; }
#chips-primary { gap:12px; }

.chip {
  display:inline-flex; align-items:center; justify-content:center;
  height: var(--chip-height); padding: 0 14px; box-sizing: border-box;
  border-radius: var(--chip-radius);
  background:#fff; border:1px solid #E5E7EB;
  box-shadow:0 1px 2px rgba(16,24,40,.06), 0 4px 10px rgba(16,24,40,.04);
  color:#111827; font-weight:600; line-height:1;
  transition:transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  user-select:none; cursor:pointer;
}
.chip.active { background:#fff; border-color:#6366f1; box-shadow:0 0 0 3px rgba(16,185,129,.14); }
#reset { background:#fff; border-color:#EF4444; color:#B91C1C; }
#reset:hover { background:#FEF2F2; }
*:focus { outline:none; } *:focus-visible{ outline:none; }
body { -webkit-tap-highlight-color: rgba(0,0,0,0); }

/* Welcome overlay */
#welcome{position:absolute; inset:0; display:none; align-items:center; justify-content:center; z-index:50; }
#welcome .card{ background:var(--panel); -webkit-backdrop-filter:var(--panel-blur); backdrop-filter:var(--panel-blur);
  border:1px solid var(--divider); border-radius:16px; padding:16px 18px; width:min(92vw, 380px); box-shadow: 0 18px 40px rgba(2,6,23,.25), 0 2px 8px rgba(2,6,23,.12); }
#welcome h3{ margin:0 0 8px; font-weight:800; }
#welcome p{ margin:0 0 12px; color:var(--muted); }
#welcome button{ display:inline-flex; align-items:center; gap:8px; background:#16A34A; color:#fff; border:none; padding:10px 14px; border-radius:12px; font-weight:700; cursor:pointer; }

/* avatar visuals */
.avatar{width:24px;height:24px;border-radius:50%;object-fit:cover;display:inline-block;margin-right:6px;vertical-align:middle;background:#E5E7EB;color:#111;text-align:center;line-height:24px;font-weight:600;}

/* author link clickable avatar+name */
.author-link{ display:inline-flex; align-items:center; gap:6px; text-decoration:none; color:var(--tg-theme-link-color, #0ea5e9); }
.author-link .avatar{ width:24px; height:24px; border-radius:50%; object-fit:cover; }
.author-link .author-name{ font-weight:500; }
@media (min-width:480px){ .author-link .avatar{ width:28px; height:28px; } }

/* author inline (popup) */
.author-link{ display:inline-flex; align-items:center; gap:6px; text-decoration:none; color:var(--tg-theme-link-color, #0ea5e9); }
.author-link .avatar{ width:24px; height:24px; border-radius:50%; object-fit:cover; vertical-align:middle; }
.author-link .author-name{ font-weight:600; }


/* --- Media Viewer: centered nav buttons, scrims, and hit areas --- */
.carousel { position:relative; }
.carousel #m-nav{
  position:absolute;
  left:0; right:0;
  top:calc(var(--media-center-y, 50%));
  transform:translateY(-50%);
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 10px;
  pointer-events:none;
  z-index:4;
}
#m-nav .nav-btn{
  pointer-events:auto;
  width:56px; height:56px;
  border-radius:16px;
  border:1px solid var(--divider);
  background: rgba(17,24,39,.72);
  color:#fff;
  display:grid; place-items:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  -webkit-tap-highlight-color: transparent;
  user-select:none;
}
#m-nav .nav-btn:active{ transform:scale(.98); }
#m-nav .nav-btn:disabled{ opacity:.4; }
#m-nav .nav-btn svg{ width:28px; height:28px; }

@media (max-width: 420px){
  #m-nav .nav-btn{ width:48px; height:48px; border-radius:14px; }
  #m-nav .nav-btn svg{ width:24px; height:24px; }
}

/* Click/tap hit areas for easy navigation */
.carousel .hit{
  position:absolute; top:0; bottom:0; width:22%;
  pointer-events:auto; z-index:3;
}
.carousel .hit.left{ left:0; }
.carousel .hit.right{ right:0; }

/* Edge scrims for better contrast */
.carousel .scrim{
  position:absolute; top:0; bottom:0; width:84px;
  pointer-events:none; z-index:2;
}
.carousel .scrim.left{ left:0; background:linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }
.carousel .scrim.right{ right:0; background:linear-gradient(270deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }

  
/* popup header grid and address marquee */
.popup .popup-header{ display:grid; grid-template-columns: 1fr 80px; align-items:center; column-gap:8px; margin-bottom:8px; }
.popup .hdr-actions{ display:flex; align-items:center; justify-content:flex-end; gap:6px; }
.popup .hdr-actions .icon-btn{ 
  position:static; 
  top:auto; 
  right:auto;
  padding: 0;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  transition: background-color 0.2s ease;
}
.popup .hdr-actions .icon-btn:hover {
  background: #e5e7eb;
}
.popup .hdr-actions .icon-btn:active {
  background: #d1d5db;
}
.popup .hdr-actions .icon-btn .ic {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.popup .hdr-actions .popup-subscribe {
  display: none;
}
.addr-rect{
  position:relative; display:flex; align-items:center; overflow:hidden;
  padding:6px 4px 6px 0; margin-bottom:6px; background:transparent; border:none;
}
.marquee-track{ display:flex; align-items:center; gap:32px; will-change: transform; }
.marquee-item{ flex:0 0 auto; white-space:nowrap; line-height:1.2; }
@keyframes addr-marquee-kf { 0%{ transform: translateX(0);} 100%{ transform: translateX(var(--addr-marquee-dist,-100%)); } }
.addr-rect.marquee-on .marquee-track{ animation-name: addr-marquee-kf; animation-timing-function: linear; animation-iteration-count: infinite; }
.sticky-actions{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.actions-right{ display:flex; align-items:center; gap:12px; margin-left:auto; }


/* === Feed actions cosmetics === */
.card .card-actions{ 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  margin-top:12px; 
  gap:12px; 
  min-height:32px;
  flex-shrink: 0;
}
.card .card-actions .left-actions{ display:flex; align-items:center; gap:10px; flex-wrap:nowrap; }
.media-chip{ display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius:999px; background:rgba(0,0,0,.06); border:none; cursor:pointer; white-space:nowrap; }
.media-chip .media-count{ font-weight:700; font-size:12px; line-height:1; }
.media-chip .media-ico{ display:inline-flex; }

/* Chat chip in feed */
.chat-chip{ 
  display:inline-flex; 
  align-items:center; 
  gap:6px; 
  padding:8px 12px; 
  border-radius:999px; 
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  border:none; 
  cursor:pointer; 
  white-space:nowrap;
  color: #fff;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chat-chip:active {
  transform: scale(0.96);
}
.chat-chip .chat-ico{ 
  width: 18px; 
  height: 18px; 
  stroke: #fff;
  flex-shrink: 0;
}
.chat-chip .chat-count{ 
  font-weight: 700; 
  font-size: 13px; 
  line-height: 1;
  min-width: 14px;
  text-align: center;
}

/* Geo button with label */
.icon-btn.map-btn{ 
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px; 
  border: none; 
  background: rgba(0,0,0,.06); 
  border-radius: 999px;
  cursor: pointer;
  color: #374151;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease;
}
.icon-btn.map-btn:active {
  background: rgba(0,0,0,.1);
}
.icon-btn.map-btn svg {
  width: 18px;
  height: 18px;
}
.icon-btn.map-btn .geo-label {
  font-size: 13px;
}

/* Card Media Preview Carousel */
.card-media-preview {
  position: relative;
  width: 100%;
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.04);
}
.card-media-preview .preview-skeleton {
  width: 100%;
  height: 200px;
  background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.1) 50%, rgba(0,0,0,.06) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.preview-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.preview-track {
  display: flex;
  transition: transform 0.3s ease;
}
.preview-slide {
  flex: 0 0 100%;
  position: relative;
}
.preview-slide img.preview-media {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.preview-slide video.preview-media {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #000;
  display: block;
}
.preview-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
  z-index: 5;
}
.preview-fullscreen-btn:hover {
  background: rgba(0,0,0,.8);
}

/* Views overlay (глазик + счётчик) */
.views-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0,0,0,.6);
  border-radius: 12px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  z-index: 5;
  pointer-events: none;
}
.views-overlay svg {
  flex-shrink: 0;
}
.views-overlay .views-count {
  min-width: 12px;
}

.preview-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}
.preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  transition: background 0.2s, transform 0.2s;
}
.preview-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* Popup Media Preview - компактные стили */
.popup-media-preview {
  margin: 8px 0 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.04);
}
.popup-media-preview .preview-skeleton {
  width: 100%;
  height: 200px;
  background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.1) 50%, rgba(0,0,0,.06) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}
.popup-media-preview .preview-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.popup-media-preview .preview-track {
  display: flex;
  transition: transform 0.3s ease;
}
.popup-media-preview .preview-slide {
  flex: 0 0 100%;
  position: relative;
}
.popup-media-preview .preview-slide img.preview-media {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.popup-media-preview .preview-slide video.preview-media {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #000;
  display: block;
}
.popup-media-preview .preview-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  z-index: 5;
}
.popup-media-preview .preview-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}
.popup-media-preview .preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
}
.popup-media-preview .preview-dot.active {
  background: #fff;
  transform: scale(1.3);
}


/* Ensure map icon in feed sits inline, not absolutely-positioned */
.card .left-actions .icon-btn,
.card .left-actions .map-btn{
  position: static !important;
  top: auto !important;
  right: auto !important;
  padding: 6px;
}


/* Feed header with marquee address and share */
.card .card-header{ display:grid; grid-template-columns: 1fr auto; align-items:center; column-gap:6px; margin-bottom:6px; }
.card .hdr-actions{ display:flex; justify-content:flex-end; gap:4px; align-items:center; }
.card .addr-rect{ overflow:hidden; padding-right:4px; background:transparent; position:relative; }
.card .addr-rect .marquee-track{ display:flex; align-items:center; gap:32px; will-change: transform; }
.card .addr-rect .marquee-item{ display:inline-block; white-space:nowrap; line-height:1.2; }
@keyframes card-addr-marquee { 0%{ transform: translateX(0);} 100%{ transform: translateX(var(--card-addr-dist,-100%)); } }
/* Анимация marquee только для видимых карточек */
.card .addr-rect.marquee-on .marquee-track{ animation: none; }
.card.in-view .addr-rect.marquee-on .marquee-track{ animation: card-addr-marquee var(--card-addr-dur,12s) linear infinite; }

/* Fade effect for marquee (only when running) */
.card .addr-rect.marquee-on::before,
.card .addr-rect.marquee-on::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 1;
}
.card .addr-rect.marquee-on::before {
  left: 0;
  background: linear-gradient(to right, var(--card-bg, #fff) 0%, transparent 100%);
}
.card .addr-rect.marquee-on::after {
  right: 0;
  background: linear-gradient(to left, var(--card-bg, #fff) 0%, transparent 100%);
}

/* Buttons in header actions */
.card .hdr-actions .icon-btn{ 
  position: static !important; 
  top: auto !important; 
  right: auto !important; 
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}
.card .hdr-actions .icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}
.card .hdr-actions .icon-btn:active {
  background: rgba(0, 0, 0, 0.1);
}
.card .hdr-actions .icon-btn .ic {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

/* Subscribe button - active (subscribed) state */
.card .hdr-actions .icon-btn.hdr-subscribe.subscribed{
  background: linear-gradient(135deg, #2EA3DB 0%, #229ED9 100%);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(34, 158, 217, 0.25);
  transition: all 0.2s ease;
}
.card .hdr-actions .icon-btn.hdr-subscribe.subscribed:hover{
  background: linear-gradient(135deg, #2EA3DB 0%, #229ED9 100%);
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.35);
}
.card .hdr-actions .icon-btn.hdr-subscribe.subscribed:active{
  transform: scale(0.96);
}
.card .hdr-actions .icon-btn.hdr-subscribe.subscribed .ic{
  filter: brightness(0) invert(1);
}

/* Subscribe button in popup - active (subscribed) state */
.popup .hdr-actions .popup-subscribe.subscribed{
  background: linear-gradient(135deg, #2EA3DB 0%, #229ED9 100%);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(34, 158, 217, 0.25);
  transition: all 0.2s ease;
}
.popup .hdr-actions .popup-subscribe.subscribed:hover{
  background: linear-gradient(135deg, #2EA3DB 0%, #229ED9 100%);
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.35);
}
.popup .hdr-actions .popup-subscribe.subscribed:active{
  transform: scale(0.96);
}
.popup .hdr-actions .popup-subscribe.subscribed .ic{
  filter: brightness(0) invert(1);
}

/* Ensure share button in feed header stays inline */
.card .hdr-actions .popup-share{ position: static !important; top:auto!important; right:auto!important; padding:6px; }


/* --- feed badge capsule --- */
.tabs .tab-btn{ position: relative; }
.badge-new{
  position:absolute; top:-6px; right:-6px;
  background:#ef4444; color:#fff;
  border-radius:9999px; padding:0 6px;
  font-weight:700; font-size:11px; line-height:16px;
  min-width:16px; text-align:center;
}
.badge-new.hidden{ display:none; }

/* === Colorful category pills (popup + feed) === */
.badge.category{
  color:#fff;
  border:1px solid var(--cat-border, transparent);
  border-radius:8px;
  padding:6px 8px;
  font-weight:800;
  background: linear-gradient(180deg, var(--cat-bg-top, #666) 0%, var(--cat-bg, #555) 100%);
  box-shadow: 0 1px 0 rgba(0,0,0,.06) inset;
}

/* Variants with accessible contrast */
.badge.category.category--complaint{
  --cat-bg:     #d73d3d; /* >=4.5 with white text */
  --cat-bg-top: #db5454;
  --cat-border: #b63333;
}
.badge.category.category--idea{
  --cat-bg:     #a46907;
  --cat-bg-top: #ae7b24;
  --cat-border: #8b5905;
}
.badge.category.category--event{
  --cat-bg:     #178740;
  --cat-bg-top: #329556;
  --cat-border: #137236;
}
.badge.category.category--lostfound{
  --cat-bg:     #0a7db1;
  --cat-bg-top: #278cba;
  --cat-border: #086a96;
}

/* === Add-tab plus white circle + spin 180deg === */
@keyframes plus-rotate-180 { from { transform: rotate(0deg); } to { transform: rotate(180deg); } }
.tabs .tab-btn[data-tab="add"] .plus-ico{
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; margin-left:4px;
  border-radius:999px; background:#fff; color: var(--add-plus-color, var(--cat-event));
  line-height:1; font-weight:900; box-shadow: 0 1px 0 rgba(0,0,0,.04);
  transform-origin:50% 50%; will-change: transform;
}
.tabs .tab-btn[data-tab="add"] .plus-ico.spin{ animation: plus-rotate-180 .22s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce){
  .tabs .tab-btn[data-tab="add"] .plus-ico.spin{ animation: none; }
}

/* === Tabs single-line fix === */
.tabs{ display:flex; flex-wrap:nowrap; }
.tabs .tab-btn{ flex:1 1 0; min-width:0; white-space:nowrap; justify-content:center; }

/* === Feed cards: Google-style flat cards === */
#tab-feed {
  background: #fff !important;
  padding: 0 !important;
}
#tab-feed .feed {
  flex: 1; /* растягиваем на всю высоту таба */
  gap: 8px;
  background: #f1f3f4; /* серый фон между карточками */
}
#tab-feed .card {
  border-radius: 0;
  border: none;
  box-shadow: none;
  margin: 0;
  background: #fff;
  /* Убираем тяжёлые свойства для производительности */
  transition: none;
  will-change: auto;
  transform: none;
  -webkit-transform: none;
}
/* Убираем hover/active эффекты подъёма */
#tab-feed .card:hover,
#tab-feed .card:active,
#tab-feed .card.card-active {
  transform: none;
  box-shadow: none;
}
/* Убираем цветную подсветку карточек */
#tab-feed .card.card--tinted,
#tab-feed .card.card--tinted:hover {
  box-shadow: none !important;
  border: none !important;
}

/* === News tab: Google-style === */
#tab-news {
  background: #fff !important;
  padding: 0 !important;
}
#tab-news .news-feed {
  flex: 1; /* растягиваем на всю высоту таба */
  gap: 8px;
  background: #f1f3f4; /* серый фон между карточками */
}
#tab-news .card {
  border-radius: 0;
  border: none;
  box-shadow: none;
  margin: 0;
  background: #fff;
}


/* ---- extracted from original inline <style> ---- */

/* ===== Fullscreen Telegram-like Viewer ===== */
#viewer{ position:fixed; inset:0; background:#000; z-index:9999; display:none; }
#viewer.open{ display:block; }
#viewer, #viewer *{ box-sizing:border-box; }
#v-top{ position:fixed; left:0; right:0; top:0; padding-top:env(safe-area-inset-top); height:56px; display:flex; align-items:center; justify-content:center; pointer-events:none; z-index:3; }
#v-counter{ color:#fff; font-weight:800; background:rgba(0,0,0,.35); border:1px solid rgba(255,255,255,.12); border-radius:999px; padding:6px 10px; font-size:13px; }
#v-close{ position:fixed; top:calc(8px + env(safe-area-inset-top)); right:8px; width:40px; height:40px; border-radius:12px; border:1px solid rgba(255,255,255,.12);
          background:rgba(17,24,39,.6); color:#fff; display:grid; place-items:center; pointer-events:auto; z-index:4; }
#v-close svg{ width:20px; height:20px; }
#v-track{ position:absolute; inset:0; display:flex; touch-action:none; will-change:transform; z-index:1; }
.v-slide{ flex:0 0 100%; display:grid; place-items:center; overflow:hidden; }
.v-box{ position:relative; width:100%; height:100%; display:grid; place-items:center; }
.v-media{ max-width:100%; max-height:100%; object-fit:contain; transform-origin:50% 50%; will-change:transform; }
.v-video{ width:100%; height:100%; object-fit:contain; }
.v-hint{ position:absolute; bottom:16px; left:50%; transform:translateX(-50%); color:#fff; font-size:12px; opacity:.6; }


/* ---- extracted from original inline <style> ---- */

/* ===== STYLE 2 (SOLID): stable sheet solid background + rectangular chips, NO GLASS ===== */
body #app .sheet{
  position: absolute; left:0; right:0; bottom:0; z-index:30;
  /* transform управляется через JS - не задаём здесь */
  background: #fff !important; /* белый фон для единой шапки */
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  border-top-left-radius: 16px; border-top-right-radius: 16px;
  border-top: 1px solid #E5E7EB;
  box-shadow: 0 -10px 30px rgba(0,0,0,.10);
  will-change: transform;
  touch-action: none;
  /* Fullscreen высота */
  height: calc(100vh - env(safe-area-inset-top, 0px) - 44px);
  height: calc(100dvh - env(safe-area-inset-top, 0px) - 44px);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* КРИТИЧНО - скролл только внутри .tab */
}

/* Sticky header: grip + tabs */
body #app .sheet .grip {
  flex-shrink: 0;
}

/* Скрываем неиспользуемый элемент */
body #app .sheet .sheet-blur {
  display: none !important;
}

body #app .sheet .tabs {
  flex-shrink: 0;
  z-index: 9999 !important;
  position: relative !important;
  background: #fff !important;
}

/* Контент вкладок - скроллится */
body #app .sheet .tab {
  flex: 1;
  min-height: 0; /* КРИТИЧНО для flex overflow */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: none !important;
  padding: 0 !important;
  display: none;
  background: #fff !important;
}
body #app .sheet .tab.active {
  display: block !important;
}

/* .sheet.open transform управляется через JS */
body #app .sheet::before, body #app .sheet::after{ content: none !important; }
body #app .tabs, body #app .filters-wrap, body #app .sheet .content{
  background: transparent !important;
}
:root { --chip-height: 40px; --chip-radius: 12px; }
body #app #chips-primary{ gap: 12px; }
body #app .chip{
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--chip-height); padding: 0 14px; gap: 8px;
  border-radius: var(--chip-radius);
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 10px rgba(16,24,40,.04);
  color: #111827; font-weight: 600; line-height: 1;
  user-select: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
body #app .chip.active{
  background: #F3F4F6; border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(16,185,129,.14);
}
body #app .chip i{ width:10px; height:10px; border-radius:50%; display:inline-block; }
body #app .chip.primary[data-k="COMPLAINT"] i { background: var(--cat-complaint); }
body #app .chip.primary[data-k="IDEA"] i      { background: var(--cat-idea); }
body #app .chip.primary[data-k="EVENT"] i     { background: var(--cat-event); }
body #app .chip.primary[data-k="LOSTANDFOUND"] i { background: var(--cat-lf); }
body #app .chip.tag[data-k="HOLE"] i      { background: var(--tag-hole); }
body #app .chip.tag[data-k="SNOW"] i      { background: var(--tag-snow); }
body #app .chip.tag[data-k="TRASH"] i     { background: var(--tag-trash); }
body #app .chip.tag[data-k="LIGHT"] i     { background: var(--tag-light); }
body #app .chip.tag[data-k="YARD"] i      { background: var(--tag-yard); }
body #app .chip.tag[data-k="OTHER"] i     { background: var(--tag-other); }
body #app .chip.tag[data-k="PET"] i       { background: var(--tag-pet); }
body #app .chip.tag[data-k="DOCUMENTS"] i { background: var(--tag-docs); }
body #app .chip.tag[data-k="ADVERT"] i    { background: var(--tag-ad); }
body #app #reset{ background:#FFFFFF; border-color:#EF4444; color:#B91C1C; }
body #app #reset:hover{ background:#FEF2F2; }

/* --- Media Viewer: centered nav buttons, scrims, and hit areas --- */
.carousel { position:relative; }
.carousel #m-nav{
  position:absolute;
  left:0; right:0;
  top:calc(var(--media-center-y, 50%));
  transform:translateY(-50%);
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 10px;
  pointer-events:none;
  z-index:4;
}
#m-nav .nav-btn{
  pointer-events:auto;
  width:56px; height:56px;
  border-radius:16px;
  border:1px solid var(--divider);
  background: rgba(17,24,39,.72);
  color:#fff;
  display:grid; place-items:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  -webkit-tap-highlight-color: transparent;
  user-select:none;
}
#m-nav .nav-btn:active{ transform:scale(.98); }
#m-nav .nav-btn:disabled{ opacity:.4; }
#m-nav .nav-btn svg{ width:28px; height:28px; }

@media (max-width: 420px){
  #m-nav .nav-btn{ width:48px; height:48px; border-radius:14px; }
  #m-nav .nav-btn svg{ width:24px; height:24px; }
}

/* Click/tap hit areas for easy navigation */
.carousel .hit{
  position:absolute; top:0; bottom:0; width:22%;
  pointer-events:auto; z-index:3;
}
.carousel .hit.left{ left:0; }
.carousel .hit.right{ right:0; }

/* Edge scrims for better contrast */
.carousel .scrim{
  position:absolute; top:0; bottom:0; width:84px;
  pointer-events:none; z-index:2;
}
.carousel .scrim.left{ left:0; background:linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }
.carousel .scrim.right{ right:0; background:linear-gradient(270deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }

  

/* ---- extracted from original inline <style> ---- */

/* === Modal media viewer overrides (fit-to-screen + zoom/pan + fixed nav) === */
.modal .carousel { position: relative; height: calc(100vh - 180px); }
.modal .carousel #m-slide { position: absolute; inset: 0; }
.modal .carousel .viewport {
  position: absolute; inset: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
}
.modal .carousel .content {
  position: absolute; top:0; left:0;
  will-change: transform;
  transform-origin: 0 0;
}
.modal .carousel .content img,
.modal .carousel .content video {
  display: block;
  width: auto; height: auto;
  max-width: none; max-height: none; /* disable implicit contain */
}
.modal .carousel .content video {
  background: #000;
  outline: none;
  /* allow interacting with controls */
  touch-action: auto;
}
/* Navigation overlay pinned to the stage, not the content */
.modal .carousel .nav {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  pointer-events: none; /* allow clicks to pass, except on buttons */
  z-index: 5;
}
.modal .carousel .nav button {
  pointer-events: auto;
  width: 44px; height: 44px; border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--panel);
  backdrop-filter: var(--panel-blur);
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.modal .carousel .nav button svg { width: 22px; height: 22px; }
.modal .carousel .nav #m-prev::before,
.modal .carousel .nav #m-next::before { content: ''; } /* hide text glyphs if any */

/* Counter bubble */
.modal .m-count {
  position:absolute; right: 12px; top: 12px;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  z-index: 6;
}

/* Prevent accidental text selection while panning */
.modal .carousel, .modal .carousel * { user-select: none; }

/* --- Media Viewer: centered nav buttons, scrims, and hit areas --- */
.carousel { position:relative; }
.carousel #m-nav{
  position:absolute;
  left:0; right:0;
  top:calc(var(--media-center-y, 50%));
  transform:translateY(-50%);
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 10px;
  pointer-events:none;
  z-index:4;
}
#m-nav .nav-btn{
  pointer-events:auto;
  width:56px; height:56px;
  border-radius:16px;
  border:1px solid var(--divider);
  background: rgba(17,24,39,.72);
  color:#fff;
  display:grid; place-items:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  -webkit-tap-highlight-color: transparent;
  user-select:none;
}
#m-nav .nav-btn:active{ transform:scale(.98); }
#m-nav .nav-btn:disabled{ opacity:.4; }
#m-nav .nav-btn svg{ width:28px; height:28px; }

@media (max-width: 420px){
  #m-nav .nav-btn{ width:48px; height:48px; border-radius:14px; }
  #m-nav .nav-btn svg{ width:24px; height:24px; }
}

/* Click/tap hit areas for easy navigation */
.carousel .hit{
  position:absolute; top:0; bottom:0; width:22%;
  pointer-events:auto; z-index:3;
}
.carousel .hit.left{ left:0; }
.carousel .hit.right{ right:0; }

/* Edge scrims for better contrast */
.carousel .scrim{
  position:absolute; top:0; bottom:0; width:84px;
  pointer-events:none; z-index:2;
}
.carousel .scrim.left{ left:0; background:linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }
.carousel .scrim.right{ right:0; background:linear-gradient(270deg, rgba(0,0,0,.45), rgba(0,0,0,0)); }

/* === Gear speed-dial & Profile button === */
.fab .fab-btn { width:44px; height:44px; border-radius:999px; display:grid; place-items:center; padding:0; }
.fab .gear-btn { 
  padding:2px; 
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}
.fab .gear-btn img,
.fab .gear-btn svg { 
  width:20px; 
  height:20px; 
  transition:transform .18s ease; 
  transform-origin:50% 50%;
  filter: brightness(0) invert(1); /* Делает иконку белой */
}

#btn-profile img { width:100%; height:100%; border-radius:999px; object-fit:cover; }

/* === Profile popover styles === */
.profile-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100vw - 32px);
  max-width: 400px;
  max-height: calc(100vh - 120px);
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(2,6,23,.35), 0 4px 12px rgba(2,6,23,.15);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  will-change: opacity, transform;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  overscroll-behavior: contain;
  overflow-y: auto;
}

.profile-popover[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.profile-popover > * {
  padding: 12px;
}

.pp-header { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 16px !important;
  flex-shrink: 0;
}

.pp-xp-section,
.pp-stats,
.pp-badges-section {
  padding: 12px 16px !important;
}

.pp-actions {
  padding: 12px 16px 16px 16px !important;
  flex-shrink: 0;
}

.pp-header { display:flex; align-items:center; gap:10px; }
.pp-avatar { width:56px; height:56px; border-radius:999px; object-fit:cover; }
.pp-user { display:flex; flex-direction:column; min-width:0; }
.pp-name { font-weight:800; font-size:18px; color:#000; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pp-username { color:#64748b; font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pp-close { margin-left:auto; width:32px; height:32px; border-radius:8px; display:grid; place-items:center; background:transparent; border:none; }
.pp-level-badge { position:absolute; bottom:-2px; right:-2px; background:#667eea; color:#fff; font-size:10px; font-weight:700; padding:2px 6px; border-radius:8px; }
.pp-xp-label { font-size:14px; color:#0f172a; font-weight:700; margin-bottom:6px; }
.pp-xp-label span { font-weight:800; color:#000; }
.pp-xp-hint { font-size:11px; color:#64748b; margin-top:4px; font-weight:600; }
.pp-section-title { font-size:15px; font-weight:800; color:#0f172a; margin-bottom:12px; }
.pp-badge-count { font-size:12px; color:#64748b; font-weight:600; }

.pp-actions { display:flex; gap:8px; margin-top:var(--arrow-top,12px); }

/* accessibility small screens */
@media (max-width: 360px){
  .profile-popover { width: calc(100vw - 24px); }
}

/* === Weather button & popover === */
.fab .weather-btn { 
  background: var(--panel) !important; 
  border: 1px solid var(--divider) !important; 
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  position: relative;
}
.weather-btn .weather-icon { 
  width: 44px; 
  height: 44px; 
  opacity: 0.35;
  position: absolute;
  top: 0;
  left: 0;
}
.weather-btn .weather-temp {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
  color: rgba(50, 50, 50, 0.85);
  line-height: 1;
  text-shadow: 
    0 0 3px rgba(255,255,255,0.8),
    0 0 5px rgba(255,255,255,0.6);
}
.weather-btn .weather-temp:empty {
  display: none;
}

.weather-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100vw - 32px);
  max-width: 400px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border: 1px solid var(--divider);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(2,6,23,.35), 0 4px 12px rgba(2,6,23,.15);
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background .6s ease;
  z-index: 100;
  will-change: opacity, transform, background;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

/* Animated backgrounds based on weather - solid gradients without transparency */
.weather-popover.weather-sunny { background: linear-gradient(135deg, rgb(255,245,235) 0%, rgb(255,255,255) 100%); }
.weather-popover.weather-cloudy { background: linear-gradient(135deg, rgb(245,245,245) 0%, rgb(255,255,255) 100%); }
.weather-popover.weather-rainy { background: linear-gradient(135deg, rgb(235,245,255) 0%, rgb(255,255,255) 100%); }
.weather-popover.weather-snowy { background: linear-gradient(135deg, rgb(240,248,255) 0%, rgb(255,255,255) 100%); }
.weather-popover.weather-night { background: linear-gradient(135deg, rgb(230,235,245) 0%, rgb(255,255,255) 100%); }

.weather-popover[aria-hidden="true"] { display: none !important; }
.weather-popover[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.wp-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.wp-title { font-weight:800; font-size:18px; color:#000; }
.wp-close { width:28px; height:28px; border-radius:8px; display:grid; place-items:center; background:transparent; border:1px solid var(--divider); cursor:pointer; }

/* City Tabs */
.wp-city-tabs { display:flex; gap:4px; margin-bottom:8px; padding:3px; background:var(--chip-bg); border-radius:8px; }
.wp-city-tab { flex:1; padding:6px 10px; border-radius:6px; border:none; background:transparent; color:#000; font-size:12px; font-weight:600; cursor:pointer; transition:all .2s ease; }
.wp-city-tab.active { background:var(--panel); color:#000; box-shadow: 0 4px 12px rgba(2,6,23,.25); }
.wp-city-tab:hover:not(.active) { background:rgba(2,6,23,.04); }

.wp-content { display:flex; flex-direction:column; gap:8px; }

.wp-current { display:flex; align-items:center; gap:10px; padding:10px; background:var(--chip-bg); border-radius:10px; position:relative; overflow:hidden; }
.wp-current-icon { flex-shrink:0; }
.wp-current-info { display:flex; flex-direction:column; gap:3px; }
.wp-temp { font-size:32px; font-weight:800; color:#000; line-height:1; }
.wp-desc { font-size:13px; color:var(--muted); font-weight:500; }

/* Hourly Forecast Section */
.wp-hourly-section { background:var(--chip-bg); border-radius:10px; padding:8px; }
.wp-section-title { font-size:12px; font-weight:700; color:#0f172a; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.wp-hourly-scroll { 
  position:relative; 
  overflow-x:auto; 
  overflow-y:hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
}
.wp-hourly-scroll::-webkit-scrollbar { display:none; }
.wp-hourly-track { display:flex; gap:6px; padding:0 6px; min-width:min-content; }
.wp-hourly-item { 
  display:flex; 
  flex-direction:column; 
  align-items:center; 
  gap:4px; 
  padding:8px 10px; 
  background:rgba(255,255,255,.5); 
  border-radius:8px; 
  min-width:60px;
  flex-shrink:0;
  border:1px solid var(--divider);
  transition: transform .2s ease;
}
.wp-hourly-item:hover { transform: translateY(-2px); }
.wp-hourly-time { font-size:11px; font-weight:700; color:#0f172a; }
.wp-hourly-icon { flex-shrink:0; }
.wp-hourly-temp { font-size:15px; font-weight:800; color:#000; }
.wp-hourly-rain { font-size:9px; color:#42a5f5; font-weight:600; }

.wp-details { display:grid; grid-template-columns:repeat(2, 1fr); gap:6px; }
.wp-detail-item { display:flex; flex-direction:column; align-items:center; gap:3px; padding:8px 6px; background:var(--chip-bg); border-radius:8px; }
.wp-detail-item svg { opacity:0.6; }
.wp-detail-label { font-size:10px; color:var(--muted); font-weight:500; }
.wp-detail-value { font-size:13px; font-weight:700; color:#0f172a; }

.wp-forecast { padding:10px; background:var(--chip-bg); border-radius:10px; }
.wp-forecast-title { font-size:12px; font-weight:700; color:#0f172a; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:6px; }
.wp-forecast-item { display:flex; align-items:center; gap:10px; }
.wp-forecast-item svg { flex-shrink:0; }
.wp-forecast-temp { font-size:20px; font-weight:800; color:#000; }
.wp-forecast-desc { font-size:12px; color:var(--muted); font-weight:500; }

@media (max-width: 360px){
  .weather-popover { right:52px; width:260px; }
}

/* === Filter button & popover === */
.fab .filter-btn { 
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  color: #fff;
  transition: all 0.2s ease;
  position: relative;
}

.filter-btn .filter-icon { 
  width: 22px; 
  height: 22px;
  transition: opacity 0.2s ease;
  stroke: #fff;
}

.filter-btn .filter-category-icon {
  width: 24px;
  height: 24px;
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.filter-btn.has-filter .filter-icon {
  opacity: 0;
}

.filter-btn.has-filter .filter-category-icon {
  opacity: 1;
}

/* === Transport Button === */
/* Кнопка транспорта - всегда бирюзовая */
.fab .transport-btn { 
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  border: none !important;
  padding: 5px 0 3px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
  height: auto !important;
  min-height: 44px;
}

/* 🔢 Барабанный счётчик транспорта */
.transport-counter {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: -0.5px;
  min-width: 20px;
}

.transport-counter .counter-digit {
  display: inline-block;
  width: 6px;
  text-align: center;
  transition: opacity 0.15s ease;
}

.transport-counter .counter-digit.rolling {
  animation: digitRoll 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes digitRoll {
  0% { 
    transform: translateY(-8px) scale(0.8); 
    opacity: 0; 
  }
  60% { 
    transform: translateY(1px) scale(1.05); 
    opacity: 1; 
  }
  100% { 
    transform: translateY(0) scale(1); 
    opacity: 1; 
  }
}

/* Скрываем ведущие нули */
.transport-counter .counter-digit.hidden {
  display: none;
}

.fab .transport-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.fab .transport-btn:active {
  transform: scale(0.95);
}

.transport-btn svg { 
  width: 24px; 
  height: 24px;
  fill: white;
  transition: all 0.3s ease;
}

.fab .transport-btn:hover svg {
  fill: white;
}

/* Кнопка транспорта - активное состояние (такое же как неактивное) */
.fab .transport-btn.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
  outline: none;
  border: none !important;
}

.fab .transport-btn.active svg {
  fill: white;
}

/* Убираем focus outline */
.fab .transport-btn:focus,
.fab .transport-btn:focus-visible {
  outline: none;
}

.filter-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100vw - 32px);
  max-width: 400px;
  max-height: 80vh;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(2,6,23,.35), 0 4px 12px rgba(2,6,23,.15);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.filter-popover[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.fp-title {
  font-weight: 800;
  font-size: 20px;
  color: #000;
}

.fp-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--divider);
  cursor: pointer;
  transition: background 0.2s ease;
}

.fp-close:hover {
  background: rgba(2,6,23,.06);
}

.fp-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.fp-category-group {
  margin-bottom: 20px;
}

.fp-category-group:last-child {
  margin-bottom: 0;
}

.fp-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.fp-category-indicator {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}

.fp-category-name {
  font-weight: 800;
  font-size: 13px;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fp-tags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.fp-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.fp-tag:hover:not(.active) {
  background: rgba(2,6,23,.08);
}

.fp-tag.active {
  background: transparent;
}

.fp-tag-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.fp-tag:hover:not(.active) .fp-tag-icon-box {
  transform: scale(1.05);
}

.fp-tag.active .fp-tag-icon-box {
  box-shadow: 0 0 0 4px var(--category-color);
  transform: scale(1.08);
}

.fp-tag-icon-box svg {
  width: 26px;
  height: 26px;
}

.fp-tag-label {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  line-height: 1.15;
  transition: all 0.2s ease;
}

.fp-tag.active .fp-tag-label {
  font-weight: 700;
  color: var(--category-color, #000);
}

.fp-tag-check {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--category-color);
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.fp-tag.active .fp-tag-check {
  opacity: 1;
  transform: scale(1);
}

/* Category colors for filter tag icons */
.fp-tag[data-cat="COMPLAINT"] { --category-color: #ef4444; }
.fp-tag[data-cat="IDEA"] { --category-color: #f59e0b; }
.fp-tag[data-cat="EVENT"] { --category-color: #22c55e; }
.fp-tag[data-cat="LOSTFOUND"] { --category-color: #0ea5e9; }
.fp-tag[data-cat="COMMERCE"] { --category-color: #6366f1; }
.fp-tag[data-cat="SOCIAL"] { --category-color: #ec4899; }
.fp-tag[data-cat="ROAD"] { --category-color: #ea580c; }
.fp-tag[data-cat="PODSLUSHANO"] { --category-color: #1a1a1a; }

.fp-tag-check svg {
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
}

.fp-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Filter toggles */
.fp-toggles {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  gap: 8px;
}

.fp-toggle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.fp-toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  text-align: center;
}

.fp-toggle-btn {
  position: relative;
  width: 48px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.fp-toggle-track {
  display: block;
  width: 48px;
  height: 28px;
  background: rgba(2,6,23,.12);
  border-radius: 14px;
  position: relative;
  transition: background 0.2s ease;
  border: 1px solid var(--divider);
}

.fp-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.fp-toggle-btn.active .fp-toggle-track {
  background: #3b82f6;
  border-color: #3b82f6;
}

.fp-toggle-btn.active .fp-toggle-thumb {
  transform: translateX(20px);
}

/* Reset button - red/accented */
.fp-reset {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.fp-reset:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.fp-reset:active {
  transform: scale(0.98) translateY(0);
}

/* Overlay для закрытия попапов по клику вне */
.popover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 99;
  touch-action: none;
  overscroll-behavior: contain;
}

.popover-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Предотвращение скролла body при открытом попапе */
body.popover-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  touch-action: none;
  overscroll-behavior: none;
}

/* Анимация скрытия FAB панели при открытии любого попапа */
.fab.popover-open {
  transform: translateX(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (max-width: 360px) {
  .filter-popover {
    width: calc(100vw - 24px);
    max-width: none;
  }
  
  .fp-tags {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .weather-popover {
    width: calc(100vw - 24px);
    max-width: none;
  }
  
  .profile-popover {
    width: calc(100vw - 24px);
    max-width: none;
  }
}

/* === Settings popover === */
.settings-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: calc(100vw - 32px);
  max-width: 360px;
  max-height: calc(100vh - 100px);
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(2,6,23,.35), 0 4px 12px rgba(2,6,23,.15);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.settings-popover[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.sp-title {
  font-weight: 800;
  font-size: 20px;
  color: #000;
}

.sp-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--divider);
  cursor: pointer;
  transition: background 0.2s ease;
}

.sp-close:hover {
  background: rgba(2,6,23,.06);
}

.sp-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.sp-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}

.sp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
}

.sp-item:last-child {
  border-bottom: none;
}

.sp-item-label {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

/* Settings dropdown */
.sp-dropdown {
  position: relative;
}

.sp-dd-head {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background: var(--chip-bg);
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-dd-head::after {
  content: '▾';
  font-size: 12px;
  opacity: 0.6;
}

.sp-dd-head:hover {
  background: rgba(2,6,23,.08);
}

.sp-dd-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--divider);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(2,6,23,.2);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.2s ease;
  z-index: 10;
}

.sp-dropdown.open .sp-dd-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sp-dd-option {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
}

.sp-dd-option:hover {
  background: rgba(2,6,23,.06);
}

.sp-dd-option.active {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  font-weight: 600;
}

/* Settings toggle (blue theme) */
.sp-toggle {
  cursor: pointer;
}

.sp-toggle-track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--chip-bg);
  transition: all 0.3s ease;
}

.sp-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.sp-toggle.active .sp-toggle-track {
  background: #3b82f6;
  border-color: #3b82f6;
}

.sp-toggle.active .sp-toggle-knob {
  left: 22px;
}

@media (max-width: 360px) {
  .settings-popover {
    width: calc(100vw - 24px);
    max-width: none;
  }
}

/* === TRANSPORT POPOVER === */
.transport-popover {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateY(100%);
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.transport-popover[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Ручка шторки */
.tp-grip {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}

.tp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 16px;
  flex-shrink: 0;
}

.tp-title {
  font-weight: 700;
  font-size: 18px;
  color: #1f2937;
}

.tp-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tp-close:active {
  background: #e5e7eb;
}

.tp-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 20px;
  -webkit-overflow-scrolling: touch;
}

/* Вкладки городов - современный стиль */
.tp-city-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
}

.tp-city-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tp-city-tab.active {
  background: #fff;
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tp-city-tab:active:not(.active) {
  background: rgba(0,0,0,0.04);
}

/* Онлайн статус - простая центрированная строка */
.tp-online-section {
  margin-bottom: 16px;
  text-align: center;
}

.tp-online-status {
  font-size: 15px;
  color: #374151;
  font-weight: 500;
}

.tp-online-count {
  color: #10b981;
  font-weight: 600;
}

.tp-online-status strong {
  font-weight: 700;
  display: inline-block;
  min-width: 24px;
}

/* Анимация барабана для счётчика */
.tp-counter {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.tp-counter-digit {
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tp-counter-digit.rolling {
  animation: digitRoll 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes digitRoll {
  0% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Тумблер отображения - современный стиль */
.tp-display-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f9fafb;
  border-radius: 14px;
  margin-bottom: 16px;
}

.tp-display-label {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
}

.tp-display-toggle {
  cursor: pointer;
  position: relative;
}

.tp-toggle-track {
  width: 52px;
  height: 32px;
  border-radius: 16px;
  background: #d1d5db;
  position: relative;
  transition: background 0.25s ease;
}

.tp-toggle-knob {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.25s ease;
}

.tp-display-toggle.active .tp-toggle-track {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.tp-display-toggle.active .tp-toggle-knob {
  transform: translateX(20px);
}

/* Секция маршрутов */
.tp-routes-section {
  margin-top: 0;
}

.tp-section-header {
  display: none;
}

/* Сетка маршрутов - 4 в ряд */
.tp-routes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* Карточка маршрута - квадратная */
.tp-route-card {
  aspect-ratio: 1;
  border-radius: 14px;
  padding: 8px 4px 6px;
  text-align: center;
  position: relative;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* Loading состояние плитки */
.tp-route-card.loading {
  pointer-events: none;
  opacity: 0.7;
}

.tp-route-card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: tp-spin 0.6s linear infinite;
}

@keyframes tp-spin {
  to { transform: rotate(360deg); }
}

.tp-route-card:active {
  transform: scale(0.95);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tp-route-number {
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.tp-route-type {
  font-size: 9px;
  color: rgba(255,255,255,0.9);
  text-transform: capitalize;
  font-weight: 500;
  line-height: 1.2;
}

/* Убираем индикатор онлайн */
.tp-route-online {
  display: none;
}

.tp-route-count {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  padding: 2px 6px;
  background: rgba(0,0,0,0.12);
  border-radius: 6px;
  line-height: 1;
}

/* Цветовая кодировка по типам транспорта */
.tp-route-bus {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.tp-route-shuttle_bus {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.tp-route-trolleybus {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.tp-route-tram {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.tp-route-suburban {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

/* Адаптивность */
@media (max-width: 340px) {
  .tp-routes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .tp-route-number {
    font-size: 18px;
  }
}

/* Hide MapLibre +/- zoom controls completely */
.maplibregl-ctrl-zoom{ display:none !important; }


/* === Popup compact footer === */
.popup .sticky-actions{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.popup .actions-left{ display:flex; align-items:center; gap:10px; flex-wrap:nowrap; }
.popup .media-chip{ display:inline-flex; align-items:center; gap:6px; height:36px; padding:6px 10px; border-radius:999px; background:var(--chip-bg); border:1px solid var(--divider); }
.popup .media-chip .media-ico svg{ width:18px; height:18px; }
.popup .media-chip .media-count{ font-size:12px; font-weight:600; }
.popup .chat-btn{ 
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px; 
  border: none; 
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.popup .chat-btn .ic{ width: 20px; height: 20px; }
.popup .chat-btn .re-mini{ 
  margin: 0; 
  color: #fff; 
  font-size: 13px;
}
.popup .chat-btn .re-mini .cnt{ font-weight: 700; }
.popup .chat-btn .badge-new{ position:absolute; top:-4px; right:-4px; background:#ef4444; color:#fff; border-radius:10px; font-size:10px; line-height:1; padding:2px 5px; }
.popup .chat-btn .badge-new.hidden{ display:none; }


/* ensure popup media chip looks identical to feed */
.sticky-actions .media-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  height:28px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--chip-bg);
  border:1px solid var(--divider);
}
.sticky-actions .media-chip .media-ico svg{ width:18px; height:18px; }
.sticky-actions .media-chip .media-count{ font-size:12px; font-weight:600; }


/* FORCE: popup media chip identical to feed chip */
.popup .media-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(0,0,0,.06);
  border:none;
}
.popup .media-chip .media-count{ font-weight:700; font-size:12px; line-height:1; }
.popup .media-chip .media-ico{ display:inline-flex; }


/* chat avatars */
.chat-item-row{ display:flex; gap:10px; align-items:flex-start; }
.chat-avatar{ width:28px; height:28px; min-width:28px; border-radius:50%; background:#e5e7eb; display:flex; align-items:center; justify-content:center; font-weight:600; font-size:12px; color:#374151; overflow:hidden; }
.chat-avatar-img{ width:100%; height:100%; object-fit:cover; display:block; }
.chat-avatar-initials{ line-height:28px; text-align:center; }
.hidden{ display:none !important; }
.chat-bubble{ flex:1; }

.ic{width:24px;height:24px;vertical-align:-2px}

.btn-icon{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:10px 12px}

.btn-strip{display:flex;align-items:center;border:1px solid var(--divider);border-radius:12px;overflow:hidden}
.btn-strip>*{padding:10px 12px;display:flex;align-items:center;gap:8px}
.btn-strip>*+*{border-left:1px solid var(--divider)}


/* === Feed: 3-part control strip ======================================= */
.feed-strip{
  display: flex;
  flex-direction: column;
  border: 1px solid var(--divider);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin-top: 10px;
}

/* Каждый ярус */
.feed-strip-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
}

/* Разделитель между ярусами */
.feed-strip-row + .feed-strip-row {
  border-top: 1px solid var(--divider);
}

/* ПЕРВЫЙ ЯРУС: действия (подписка, чат, гео) */
.feed-strip-actions {
  justify-content: center;
  gap: 8px;
}

/* Кнопка подписки в ленте - как social-notify-btn */
.feed-notify-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  height: 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.feed-notify-btn:active {
  transform: scale(0.96);
}
.feed-notify-btn .feed-notify-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  text-align: left;
}
.feed-notify-btn .feed-notify-text span {
  display: block;
  white-space: nowrap;
}
.feed-notify-btn .feed-notify-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentColor;
}
.feed-notify-btn.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}
.feed-notify-btn.active .feed-notify-icon {
  fill: #fff;
}

/* Кнопка чата в ленте - как social-chat-btn */
.feed-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  border-radius: 16px;
  background: #fff;
  border: none;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 36px;
  min-width: 50px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.feed-chat-btn:active {
  transform: scale(0.95);
}
.feed-chat-btn.has-messages {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}
.feed-chat-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Кнопка Гео в ленте - белая пилюля */
.feed-geo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  border-radius: 16px;
  background: #fff;
  border: none;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.feed-geo-btn:active {
  transform: scale(0.95);
  background: #f1f5f9;
}
.feed-geo-btn .ic {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Dark theme */
[data-theme="dark"] .feed-notify-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}
[data-theme="dark"] .feed-notify-btn.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
}
[data-theme="dark"] .feed-chat-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}
[data-theme="dark"] .feed-chat-btn.has-messages {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}
[data-theme="dark"] .feed-geo-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

/* Кнопка эмодзи-пикер с каруселью */
.feed-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f472b6 0%, #fb923c 50%, #facc15 100%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.4);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.feed-emoji-btn:active {
  transform: scale(0.92);
}
.feed-emoji-btn:hover {
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.5);
}

/* Карусель эмодзи */
.emoji-carousel {
  position: relative;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-carousel .emoji-slide {
  position: absolute;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.5);
}
/* Первый эмодзи виден по умолчанию когда нет анимации */
.emoji-carousel .emoji-slide:first-child {
  opacity: 1;
  transform: scale(1);
}
/* Анимация только для видимых карточек */
.in-view .emoji-carousel .emoji-slide {
  animation: emojiCarousel 12s infinite;
}
.in-view .emoji-carousel .emoji-slide:first-child {
  opacity: 0;
  transform: scale(0.5);
}
.in-view .emoji-carousel .emoji-slide:nth-child(1) { animation-delay: 0s; }
.in-view .emoji-carousel .emoji-slide:nth-child(2) { animation-delay: 2s; }
.in-view .emoji-carousel .emoji-slide:nth-child(3) { animation-delay: 4s; }
.in-view .emoji-carousel .emoji-slide:nth-child(4) { animation-delay: 6s; }
.in-view .emoji-carousel .emoji-slide:nth-child(5) { animation-delay: 8s; }
.in-view .emoji-carousel .emoji-slide:nth-child(6) { animation-delay: 10s; }

@keyframes emojiCarousel {
  0%, 13% { opacity: 0; transform: scale(0.5) rotate(-10deg); }
  16%, 30% { opacity: 1; transform: scale(1) rotate(0deg); }
  33%, 100% { opacity: 0; transform: scale(0.5) rotate(10deg); }
}

/* Dark theme */
[data-theme="dark"] .feed-emoji-btn {
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.3);
}

/* Кнопка эмодзи-пикер для шторки метки (social) */
.social-emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f472b6 0%, #fb923c 50%, #facc15 100%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.4);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.social-emoji-btn:active {
  transform: scale(0.92);
}
.social-emoji-btn:hover {
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.5);
}
.social-emoji-btn .emoji-carousel {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.social-emoji-btn .emoji-carousel .emoji-slide {
  position: absolute;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.5);
  animation: emojiCarousel 12s infinite;
}
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(1) { animation-delay: 0s; }
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(2) { animation-delay: 2s; }
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(3) { animation-delay: 4s; }
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(4) { animation-delay: 6s; }
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(5) { animation-delay: 8s; }
.social-emoji-btn .emoji-carousel .emoji-slide:nth-child(6) { animation-delay: 10s; }

[data-theme="dark"] .social-emoji-btn {
  box-shadow: 0 2px 8px rgba(244, 114, 182, 0.3);
}

/* ВТОРОЙ ЯРУС: реакции */
.feed-strip-reactions {
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
}

/* Reaction pills in feed - smaller size */
.feed-strip .reaction-pill {
  padding: 6px 10px;
  min-height: 34px;
  gap: 4px;
}
.feed-strip .reaction-pill .emoji {
  font-size: 18px;
}
.feed-strip .reaction-pill .count {
  font-size: 13px;
}
.feed-strip .reaction-add-btn {
  width: 34px;
  height: 34px;
  font-size: 18px;
}

.feed-strip .ic {
  width: 20px;
  height: 20px;
}

/* Убираем старые стили strip-cell */
.feed-strip .strip-cell {
  display: none;
}


/* popup control strip (reuses feed-strip style) */
.popup-strip{ margin-top:10px; }
.popup-strip .reacts-inner{ display:flex; align-items:center; gap:8px; }
.popup-strip .reacts-inner .react-btn{ 
  background:transparent; border:none; display:inline-flex; align-items:center; gap:6px; 
  font-weight:700; color:var(--text); padding:6px; cursor:pointer;
}
.popup-strip .reacts-inner .react-btn + .react-btn{ margin-left:8px; }
.popup-strip .reacts .sep{ display:none; }





/* === Popup control strip — spacing to match feed, no squashing ========== */
.popup .sticky-actions{ display:block; }
.popup .sticky-actions.has-popup-strip .actions-right{
  display:none !important; /* hide original actions-right to prevent margin auto shift */
}
.popup .popup-strip{
  width:auto;
  margin: 12px 16px 14px;          /* как у карточек в ленте */
}
.popup .popup-strip .strip-cell{
  min-width:0;
  padding: 10px 12px;
}
.popup .popup-strip .ic{ width:24px; height:24px; }
.popup .popup-strip .t, .popup .popup-strip .c{
  white-space:nowrap;
}
.popup .popup-strip .reacts{ justify-content:center; gap:16px; }
.popup .popup-strip .reacts .react{
  flex:0 0 auto;                   /* не сжимать лайк/дизлайк */
  display:inline-flex; align-items:center; gap:8px;
}
/* ======================================================================= */

/* === Popup strip: mirror feed margins and spacing (final) =============== */
.popup .sticky-actions{ display:block; }
.popup .popup-strip{
  margin: 10px 0 0; /* baseline; width will auto fit container */
}
/* Ensure inner spacing equals feed-strip cells */
.popup .popup-strip .strip-cell{
  min-width:0;
  padding: 8px 10px;
}
.popup .popup-strip .reacts{ justify-content:center; gap:12px; }
.popup .popup-strip .t, .popup .popup-strip .c{ white-space:nowrap; }
/* Ensure reaction count space for two-digit values in popup strip */
.popup .popup-strip .reacts .c{
  /* allocate extra space for two-digit numbers and prevent shifting */
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Popup strip reactions inside legacy p-reactions use .cnt class for counts */
.popup .popup-strip .reacts-inner .cnt{
  /* same width as feed/popup counters and tabular numbers */
  min-width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* ========================================================================= */

/* === Feed strip new layout is defined above ======================== */
.feed-strip .item[data-act="chat"] .ic{
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.feed-strip .item[data-act="chat"] .t{
  color: white;
  opacity: 0.9;
}
/* Chat button - has messages */
.feed-strip .item[data-act="chat"].has-messages{
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}
.feed-strip .item[data-act="chat"].has-messages:hover{
  box-shadow: 0 3px 10px rgba(8, 145, 178, 0.35);
}
.feed-strip .item[data-act="chat"].has-messages .ic{
  opacity: 1;
}
.feed-strip .item[data-act="chat"].has-messages .t{
  opacity: 1;
}

/* Like button - default (no votes) */
.feed-strip .item.like{
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s ease;
}
.feed-strip .item.like .ic{
  opacity: 0.6;
}
.feed-strip .item.like .c{
  color: var(--muted);
}
/* Like button - has votes (others voted) */
.feed-strip .item.like.has-votes{
  background: rgba(8, 145, 178, 0.15);
  color: white;
}
.feed-strip .item.like.has-votes .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.feed-strip .item.like.has-votes .c{
  color: white;
}
/* Like button - active state (you voted) */
.feed-strip .item.like.active{
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}
.feed-strip .item.like.active:hover{
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.4);
}
.feed-strip .item.like.active .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.feed-strip .item.like.active .c{
  color: white;
}

/* Dislike button - default (no votes) */
.feed-strip .item.dislike{
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s ease;
}
.feed-strip .item.dislike .ic{
  opacity: 0.6;
}
.feed-strip .item.dislike .c{
  color: var(--muted);
}
/* Dislike button - has votes (others voted) */
.feed-strip .item.dislike.has-votes{
  background: rgba(107, 114, 128, 0.15);
  color: var(--text);
}
.feed-strip .item.dislike.has-votes .ic{
  opacity: 0.8;
}
.feed-strip .item.dislike.has-votes .c{
  color: var(--text);
}
/* Dislike button - active state (you voted) */
.feed-strip .item.dislike.active{
  background: rgba(107, 114, 128, 0.9);
  color: white;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}
.feed-strip .item.dislike.active:hover{
  box-shadow: 0 3px 12px rgba(107, 114, 128, 0.4);
}
.feed-strip .item.dislike.active .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.feed-strip .item.dislike.active .c{
  color: white;
}

/* Popup: group-left (chat) and group-right (like/dislike) */
.popup .popup-strip .group-left{
  flex: 0 0 auto;
  justify-content: flex-start;
  gap: 12px;
}
.popup .popup-strip .group-right{
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 12px;
}
/* Items inside popup strip (chat) */
.popup .popup-strip .item{
  display:inline-flex; align-items:center; gap:4px;
  border:none; background:transparent; padding:0; cursor:pointer;
  font-weight:700; color: var(--text);
}
.popup .popup-strip .item .t{
  font-size:13px;
}
.popup .popup-strip .item .c{
  font-size:13px; font-weight:700;
  min-width: 20px; text-align:center;
  font-variant-numeric: tabular-nums;
}
/* Chat button in popup - default (no messages) */
.popup .popup-strip .item[data-act="chat"],
.popup .feed-strip .item[data-act="chat"]{
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(8, 145, 178, 0.15);
  color: white;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.popup .popup-strip .item[data-act="chat"]:active,
.popup .feed-strip .item[data-act="chat"]:active{
  transform: scale(0.96);
}
.popup .popup-strip .item[data-act="chat"] svg,
.popup .feed-strip .item[data-act="chat"] svg{
  width: 20px;
  height: 20px;
  stroke: white;
  flex-shrink: 0;
  opacity: 0.9;
}
.popup .popup-strip .item[data-act="chat"] .t,
.popup .feed-strip .item[data-act="chat"] .t{
  color: white;
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
}
/* Chat button in popup - has messages */
.popup .popup-strip .item[data-act="chat"].has-messages,
.popup .feed-strip .item[data-act="chat"].has-messages{
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.25);
}
.popup .popup-strip .item[data-act="chat"].has-messages svg,
.popup .feed-strip .item[data-act="chat"].has-messages svg{
  opacity: 1;
}
.popup .popup-strip .item[data-act="chat"].has-messages .t,
.popup .feed-strip .item[data-act="chat"].has-messages .t{
  opacity: 1;
}

/* Reaction buttons inside popup group-right */
.popup .popup-strip .group-right .react-btn{
  display:inline-flex; align-items:center; gap:4px;
  border:none; background:transparent; padding:6px 12px; cursor:pointer;
  font-weight:700; color: var(--muted);
  border-radius: 999px;
  transition: all 0.2s ease;
}
.popup .popup-strip .group-right .react-btn .ic{
  opacity: 0.6;
}
.popup .popup-strip .group-right .react-btn .cnt{
  font-size:13px; font-weight:700;
  min-width: 20px; text-align:center;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Like button in popup - has votes */
.popup .popup-strip .group-right .react-btn[data-action="like"].has-votes{
  background: rgba(8, 145, 178, 0.15);
  color: white;
}
.popup .popup-strip .group-right .react-btn[data-action="like"].has-votes .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.popup .popup-strip .group-right .react-btn[data-action="like"].has-votes .cnt{
  color: white;
}
/* Like button in popup - active state */
.popup .popup-strip .group-right .react-btn[data-action="like"].active{
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}
.popup .popup-strip .group-right .react-btn[data-action="like"].active:hover{
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.4);
}
.popup .popup-strip .group-right .react-btn[data-action="like"].active .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.popup .popup-strip .group-right .react-btn[data-action="like"].active .cnt{
  color: white;
}

/* Dislike button in popup - has votes */
.popup .popup-strip .group-right .react-btn[data-action="dislike"].has-votes{
  background: rgba(107, 114, 128, 0.15);
  color: var(--text);
}
.popup .popup-strip .group-right .react-btn[data-action="dislike"].has-votes .ic{
  opacity: 0.8;
}
.popup .popup-strip .group-right .react-btn[data-action="dislike"].has-votes .cnt{
  color: var(--text);
}
/* Dislike button in popup - active state */
.popup .popup-strip .group-right .react-btn[data-action="dislike"].active{
  background: rgba(107, 114, 128, 0.9);
  color: white;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}
.popup .popup-strip .group-right .react-btn[data-action="dislike"].active:hover{
  box-shadow: 0 3px 12px rgba(107, 114, 128, 0.4);
}
.popup .popup-strip .group-right .react-btn[data-action="dislike"].active .ic{
  filter: brightness(0) invert(1);
  opacity: 1;
}
.popup .popup-strip .group-right .react-btn[data-action="dislike"].active .cnt{
  color: white;
}

/* ============================================
   EMOJI REACTIONS SYSTEM
   ============================================ */

/* Reactions row container */
.reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

/* Reaction pill (emoji + count) */
.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 999px;
  border: none;
  background: rgba(6, 182, 212, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.reaction-pill .emoji {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reaction-pill .count {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  min-width: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.reaction-pill:active {
  transform: scale(0.92);
}

.reaction-pill:active .emoji {
  transform: scale(1.15);
}

/* Active state - user has this reaction */
.reaction-pill.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

.reaction-pill.active .count {
  color: white;
}

/* Dark theme for reaction pills */
[data-theme="dark"] .reaction-pill {
  background: rgba(6, 182, 212, 0.2);
}

[data-theme="dark"] .reaction-pill.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Pop animation for reaction - enhanced */
@keyframes reactionPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes emojiPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.reaction-pill.pop {
  animation: reactionPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reaction-pill.pop .emoji {
  animation: emojiPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Add reaction button (+) */
.reaction-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px dashed rgba(0, 0, 0, 0.2);
  background: transparent;
  font-size: 24px;
  font-weight: 300;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.reaction-add-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

.reaction-add-btn:active {
  transform: scale(0.9);
}

/* Reaction picker popup */
.reaction-picker-popup {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 12px;
  background: var(--panel);
  backdrop-filter: var(--panel-blur);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 280px;
  animation: pickerFadeIn 0.15s ease;
}

@keyframes pickerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.picker-emoji {
  font-size: 26px;
  padding: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

.picker-emoji:hover {
  background: rgba(0, 0, 0, 0.06);
}

.picker-emoji:active {
  transform: scale(1.3);
}

.picker-emoji.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  border-radius: 12px;
}

/* Flying emoji animation */
@keyframes flyUp {
  0% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
  100% { 
    opacity: 0; 
    transform: translateY(-60px) scale(1.5); 
  }
}

.flying-emoji {
  position: fixed;
  font-size: 32px;
  pointer-events: none;
  animation: flyUp 0.6s ease-out forwards;
  z-index: 10001;
  line-height: 1;
}

/* Popup reactions row */
.popup-reactions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .reaction-pill {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .picker-emoji:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* ============================================ */

/* === Tap pin marker (28px icon, 44px hit-area) === */
.tap-marker{ width:44px; height:44px; display:grid; align-items:end; justify-items:center; pointer-events:auto; line-height:0; }
.tap-marker img{ width:28px; height:28px; display:block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); margin:0; }


/* custom dropdown */
.field-label { font-size:12px; color:var(--muted); text-align:center; }
.dropdown { position:relative; width:100%; }
.dd-head { width:100%; padding:10px 12px; border:1px solid var(--divider); border-radius:12px; background:rgba(0,0,0,.03); color:var(--text); display:flex; align-items:center; justify-content:space-between; }
.dd-head:after { content:'▾'; opacity:.6; }
.dd-menu { position:absolute; left:0; right:0; top:calc(100% + 6px); background:var(--panel); backdrop-filter:var(--panel-blur); border:1px solid var(--divider); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,.12); max-height:260px; overflow:auto; display:none; }
.dd-item { padding:12px 14px; cursor:pointer; }
.dd-item:hover { background:var(--chip-bg); }
.dropdown.open .dd-menu { display:block; }


/* dropdown fixes v4 - improved z-index stacking */
.dropdown { position:relative; width:100%; }
.dropdown.open { z-index: 99999; position: relative; } /* Ensure open dropdown creates highest stacking context - higher than Telegram UI */
.dropdown.open .dd-head { /* Removed green outline */ }
.dd-menu { z-index: 100000; max-height: min(320px, 50vh); overflow:auto; } /* Very high z-index to be above Telegram chat cards */
@supports (height: 1dvh) {
  .dd-menu { max-height: min(320px, 50dvh); }
}

/* Card look for Add tab — same elevation as feed */
#tab-add .card{
  box-shadow: 0 18px 40px rgba(2,6,23,.25), 0 2px 8px rgba(2,6,23,.12);
  border-color: rgba(2,6,23,.06);
  margin: 16px 0; /* Increased from 10px for better visual separation */
  position: relative; /* Changed from static to relative for better positioning */
  z-index: 1; /* Base z-index for all cards */
}
#tab-add .card:first-child{ 
  margin-top:0;
  z-index: 10; /* Higher z-index so dropdown appears above other cards */
}
#tab-add .card:last-of-type{
  margin-bottom: 16px; /* Better bottom spacing */
}


/* === Fix: comment textarea stays inside the card and only grows vertically === */
#tab-add .card textarea,
#tab-add textarea#comment {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;          /* user can expand downwards */
  overflow: auto;            /* scroll if very long */
  margin: 0;                 /* no side overflow from margins */
}
/* Optional: prevent any accidental bleed from parent padding */


/* Keep dropdowns working inside cards with proper z-index hierarchy */
#tab-add .dropdown { position: relative; overflow: visible; }
#tab-add .dropdown.open { z-index: 99999; } /* Higher than Telegram UI */
#tab-add .dd-menu { position: absolute; z-index: 100000; }
#tab-add .card { overflow: visible; } /* allow menus to escape card bounds */


/* === Add tab: better readability and centered labels === */
#tab-add .dd-head{
  position: relative;
  justify-content: center;
  color: #111;               /* readable black */
  font-weight: 500;
  text-align: center;
  font-size: 15px;           /* Slightly larger for better readability */
  transition: background .15s ease, border-color .15s ease;
}
#tab-add .dd-head:hover {
  background: rgba(0,0,0,.05); /* Subtle hover effect */
  border-color: rgba(0,0,0,.15);
}
#tab-add .dd-head:after{
  position: absolute;
  right: 12px;               /* keep caret at the right while text is centered */
  transition: transform .20s ease;
}
#tab-add .dropdown.open .dd-head:after {
  transform: rotate(180deg); /* Rotate caret when open */
}

#tab-add .dd-menu{ 
  padding: 6px; /* Compact padding */
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
}

/* Dropdown items - compact with color indicator */
#tab-add .dd-item{
  color: #111;
  background: var(--chip-bg);
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
  margin: 3px 0;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, transform .1s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
#tab-add .dd-item .dd-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
#tab-add .dd-item:hover{ 
  background: rgba(0,0,0,.06);
  transform: scale(1.01);
}

/* Inputs: black text for address and comment with improved styling */
#tab-add input[type="text"],
#tab-add input[type="search"],
#tab-add input,
#tab-add textarea{
  color: #111 !important; /* Black text for good visibility */
  transition: border-color .20s ease, box-shadow .20s ease;
}
#tab-add input[type="text"]:focus,
#tab-add input[type="search"]:focus,
#tab-add input:focus,
#tab-add textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 158, 217, 0.1); /* Subtle focus ring */
  outline: none;
}
#tab-add input::placeholder,
#tab-add textarea::placeholder{
  color: var(--muted) !important;       /* keep placeholders muted */
}


/* === Add-tab labels: larger, black, bolder (City/Category/Tag/Address) === */
/* City & Category (have .field-label) */
#tab-add .card:first-of-type .field-label{
  color:#111 !important;
  font-weight:700 !important;
  font-size:21px !important; /* 12px × 1.75 */
  line-height:1.2;
  text-align:center;
}

/* Tag label */
#tab-add #add-tags-wrap > label{
  color:#111 !important;
  font-weight:700 !important;
  font-size:21px !important;
  line-height:1.2;
  margin-bottom:12px !important; /* extra gap before chips */
  display:block;
  text-align:center;
}

/* Address label: first field label inside the third card in Add tab */
#tab-add .card:nth-of-type(3) > .field:first-child > label{
  color:#111 !important;
  font-weight:700 !important;
  font-size:21px !important;
  line-height:1.2;
}

/* Comment label: second field label inside the third card in Add tab */
#tab-add .card:nth-of-type(3) > .field:nth-child(2) > label{
  color:#111 !important;
  font-weight:700 !important;
  font-size:21px !important;
  line-height:1.2;
  margin-bottom: 8px !important;
  display: block;
}

/* Better spacing for fields inside cards */
#tab-add .card .field {
  margin-bottom: 16px;
}
#tab-add .card .field:last-child {
  margin-bottom: 0;
}

/* Better spacing for row with two dropdowns (City & Category) */
#tab-add .card .row {
  display: flex;
  gap: 12px;
  margin-bottom: 0;
}
#tab-add .card .row .field {
  margin-bottom: 0;
}


/* Map tab: make 'Категория' and 'Период' centered, bold, and larger (match Add) */
#tab-map .section-title{
  text-align:center;
  color:#111 !important;
  font-weight:700 !important;
  font-size:21px !important;
  line-height:1.2;
}


/* Map tab cards — same elevation as feed/add */
#tab-map .card{
  box-shadow: 0 18px 40px rgba(2,6,23,.25), 0 2px 8px rgba(2,6,23,.12);
  border-color: rgba(2,6,23,.06);
  margin:10px 0;
}
#tab-map .card:first-child{ margin-top:0 }


/* === Header tabs — Variant A refined (no logic changes) =================== */
/* Place tabs at the very top: hide grip bar */
.grip{ 
  display: block !important;
  width: 36px; 
  height: 4px; 
  background: #dadce0; 
  border-radius: 2px; 
  margin: 10px auto 4px; /* уменьшил нижний отступ */
}

/* Google-style tabs - единый белый блок с grip */
.tabs{
  background: transparent; /* наследуем от sheet */
  border-radius: 0;
  padding: 0;
  gap: 0;
  align-items: stretch;
  box-shadow: none;
  border-bottom: 1px solid #e8e8e8;
}

/* Buttons - простой текст */
.tabs .tab-btn{
  flex: 1 1 0;
  color: #5f6368;
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  padding: 14px 0;
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: color 0.2s ease;
}

/* Убираем разделители */
.tabs .tab-btn + .tab-btn::before{
  display: none;
}

/* Активный таб - синий текст + линия снизу */
.tabs .tab-btn.active{
  color: #1a73e8 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Линия под активным табом */
.tabs .tab-btn.active::after{
  content: '';
  position: absolute;
  bottom: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  background: #1a73e8;
  border-radius: 3px 3px 0 0;
}

.tabs .tab-btn:active{
  background: transparent !important;
}

/* Убираем браузерный tap-highlight */
.tabs .tab-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Плюсик для "Добавить" */
.tabs .tab-btn[data-tab="add"] .plus-ico{
  width: auto; 
  height: auto; 
  margin-left: 4px;
  background: none !important;
  color: currentColor;
  border-radius: 0;
  box-shadow: none;
  display: inline;
}

/* Адаптив */
@media (max-width: 420px){
  .tabs .tab-btn{ padding: 12px 0; font-size: 13px; }
}
/* ======================================================================== */


/* === Tabs polish === */
.sheet .tabs{ margin-top: 0; }

/* Табы всегда показывают активный стиль */
.tabs .tab-btn + .tab-btn::before{ display:none !important; }


/* --- Add form: Ozon-style tag tiles --- */
.tag-tile{ 
  display: inline-flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: flex-start; 
  width: 84px; 
  margin: 6px 8px; 
  background: transparent; 
  border: 0; 
  padding: 0; 
  cursor: pointer;
  position: relative;
}
.tag-tile__box{
  width: 52px; height: 52px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}
.tag-tile__ico{ width: 26px; height: 26px; display:block; }
.tag-tile__label{ 
  font-size: 12px; line-height: 1.15; 
  text-align: center; margin-top: 6px; 
  max-width: 80px; 
  display:block; white-space: normal; word-break: break-word; overflow-wrap: anywhere; -webkit-hyphens:auto; hyphens:auto;
  transition: all 0.2s ease;
}

/* Галочка в правом верхнем углу box */
.tag-tile__check {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cat-color, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tag-tile__check svg {
  width: 12px;
  height: 12px;
}

/* Активное состояние */
.tag-tile[aria-pressed="true"] .tag-tile__box,
.tag-tile.active .tag-tile__box { 
  box-shadow: 0 0 0 4px var(--cat-color);
  transform: scale(1.08);
}

.tag-tile[aria-pressed="true"] .tag-tile__label,
.tag-tile.active .tag-tile__label {
  font-weight: 700;
  color: var(--cat-color, #000);
}

.tag-tile[aria-pressed="true"] .tag-tile__check,
.tag-tile.active .tag-tile__check {
  opacity: 1;
  transform: scale(1);
}
/* --- end tag tiles --- */


/* === Add: tag tiles grid (min 3 per row, centered) === */
#add-tags{
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr)); /* at least 3 columns */
  justify-items: center;
  align-items: start;
  column-gap: 12px; /* Increased from 10px */
  row-gap: 14px; /* Increased from 10px for better visual separation */
  padding-inline: 12px;
  padding-block: 8px; /* Added vertical padding */
}



/* ================================
   MAP TAB — Rows of subcategory tiles (horizontal)
   Applied only inside #tab-map .card:first-child
================================== */
#tab-map .tiles-wrap{ display:block; }
#tab-map .tiles-row{ 
  margin: 2px 0 4px; 
  position: relative;
}

/* Modern scroll container with fade effects */
#tab-map .tiles-row .tiles-scroll{
  display:flex; 
  gap:4px; 
  overflow-x:auto; 
  padding: 2px 6px 3px;
  -webkit-overflow-scrolling: touch; 
  scrollbar-width: none;
  scroll-behavior: smooth;
  position: relative;
}

/* Hide scrollbars completely for clean look */
#tab-map .tiles-row .tiles-scroll::-webkit-scrollbar { 
  display: none; 
}

/* Fade gradients on left and right */
#tab-map .tiles-row::before,
#tab-map .tiles-row::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 6px;
  width: 20px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

#tab-map .tiles-row::before {
  left: 0;
  background: linear-gradient(to right, var(--panel) 0%, transparent 100%);
}

#tab-map .tiles-row::after {
  right: 0;
  background: linear-gradient(to left, var(--panel) 0%, transparent 100%);
}

/* Show subtle scroll indicators */
#tab-map .tiles-row {
  background: linear-gradient(to right, 
    rgba(0,0,0,0.04) 0px, 
    transparent 4px, 
    transparent calc(100% - 4px), 
    rgba(0,0,0,0.04) 100%
  );
  border-radius: 12px;
  padding: 4px 0;
}
#tab-map .tile{
  flex: 0 0 auto;
  min-width: 88px; max-width: 120px;
  height: 72px;
  border-radius: 16px;
  background: var(--card); /* fallback; row color is implied by category via subtle outline */
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:8px 10px; text-align:center;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
/* Slight category tint via outline color */
#tab-map .tiles-row.cat-COMPLAINT .tile{ box-shadow: inset 0 0 0 2px var(--cat-complaint); }
#tab-map .tiles-row.cat-IDEA      .tile{ box-shadow: inset 0 0 0 2px var(--cat-idea); }
#tab-map .tiles-row.cat-EVENT     .tile{ box-shadow: inset 0 0 0 2px var(--cat-event); }
#tab-map .tiles-row.cat-LOSTFOUND .tile{ box-shadow: inset 0 0 0 2px var(--cat-lostfound); }
#tab-map .tiles-row.cat-COMMERCE  .tile{ box-shadow: inset 0 0 0 2px var(--cat-commerce); }
#tab-map .tiles-row.cat-SOCIAL    .tile{ box-shadow: inset 0 0 0 2px var(--cat-social); }
#tab-map .tiles-row.cat-ROAD      .tile{ box-shadow: inset 0 0 0 2px var(--cat-road); }
#tab-map .tiles-row.cat-PODSLUSHANO .tile{ box-shadow: inset 0 0 0 2px var(--cat-podslushano); }

#tab-map .tile .tile__ico{ line-height:0; }
#tab-map .tile .tile__ico .ico{ width:24px; height:24px; display:block; }
#tab-map .tile .tile__label{ margin-top:6px; font-size:12px; line-height:1.15; white-space:nowrap; text-overflow:ellipsis; max-width:100%; overflow:hidden; }

#tab-map .tile.is-active{
  transform: translateZ(0) scale(1.05);
  box-shadow: 
    0 2px 8px rgba(0,0,0,0.15),
    0 0 0 2px var(--accent), 
    0 0 0 4px rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.05);
}

#tab-map .tile.is-active .tile__ico {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#tab-map .tiles-reset{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 8px 0 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

#tab-map .tiles-reset:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

#tab-map .tiles-reset:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

#tab-map .tiles-reset::before {
  content: '✕';
  font-size: 16px;
  opacity: 0.9;
}
  border-radius: 12px; border: none;
  background: var(--btn-bg, rgba(0,0,0,.06));
  color: var(--fg, #111); font: inherit;
}
#tab-map .tiles-reset:active{ transform: translateY(1px); }

/* --- PROKIS: force-hide chips on Map tab (tiles-only UX) --- */
#tab-map #chips-primary,
#tab-map #chips-tags,
#tab-map .section-title[data-for="category"],
#tab-map .section-title[data-for="tag"]{
  display: none !important;
}

/* === PERIOD CARD: Modern design with icons === */
#tab-map .card .section-title {
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 12px 0;
  color: var(--text);
  text-align: center;
}

/* Period chips container */
#tab-map #chips-period {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

/* Modern period chip design */
#tab-map #chips-period .chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 20px;
  background: var(--chip-bg);
  border: 1px solid var(--divider);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: fit-content;
}

#tab-map #chips-period .chip:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

#tab-map #chips-period .chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(1.02);
}

/* Special chips (новые 24ч, рядом) */
#tab-map .card .chips:last-child {
  display: flex;
  gap: 8px;
  justify-content: center;
}

#tab-map #only-new,
#tab-map #only-near {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.2);
}

#tab-map #only-new:hover,
#tab-map #only-near:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

#tab-map #only-new:active,
#tab-map #only-near:active {
  transform: translateY(0);
}

/* Icons for period chips */
#tab-map #chips-period .chip::before {
  font-size: 14px;
  opacity: 0.8;
}

/* Add icons based on chip content */
#tab-map #chips-period .chip[data-period="today"]::before,
#tab-map .chip:contains("Сегодня")::before { content: "📅"; }

#tab-map #chips-period .chip[data-period="week"]::before,
#tab-map .chip:contains("Неделя")::before { content: "📊"; }

#tab-map #chips-period .chip[data-period="all"]::before,
#tab-map .chip:contains("Всё")::before { content: "🌐"; }

#tab-map #only-new::before { content: "🆕"; }
#tab-map #only-near::before { content: "📍"; }
#tab-map .tiles-row { display: flex; overflow-x: auto; gap: 6px; padding: 6px 8px; }
#tab-map .tiles-row::-webkit-scrollbar{ height: 6px; }
#tab-map .tiles-row .tag-tile{ margin: 6px 6px; } /* tighter spacing for horizontal rows */
#tab-map .tag-tile__box{ width:72px; height:56px; border-radius:16px; display:flex; align-items:center; justify-content:center; }
#tab-map .tag-tile__label{ -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  max-width: 80px; }


/* === MAP: tile visuals same as Add tag-tile === */
#tab-map .tile{
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 84px;
  min-width: 84px;
  margin: 6px 8px;
  background: transparent;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
#tab-map .tile .tile__ico{
  width: 72px; height: 56px; border-radius: 16px;
  display:flex; align-items:center; justify-content:center;
  background: var(--tile-bg, var(--card));
  box-shadow: inset 0 2px 6px rgba(0,0,0,.18);
}
#tab-map .tile .tile__label{
  font-size: 12px; line-height: 1.15;
  text-align: center; margin-top: 6px;
  max-width: 72px;
  display:block; white-space:normal; word-break:break-word; overflow-wrap:anywhere; -webkit-hyphens:auto; hyphens:auto;
}
#tab-map .tiles-row{ display:flex; overflow-x:auto; gap:6px; padding:6px 8px; }
#tab-map .tiles-row::-webkit-scrollbar{ height:6px; }

/* Category background colors from data-cat attribute */
#tab-map .tile[data-cat="COMPLAINT"] .tile__ico{ background: var(--cat-complaint, #ef4444); }
#tab-map .tile[data-cat="IDEA"] .tile__ico{ background: var(--cat-idea, #f59e0b); }
#tab-map .tile[data-cat="EVENT"] .tile__ico{ background: var(--cat-event, #22c55e); }
#tab-map .tile[data-cat="LOSTFOUND"] .tile__ico{ background: var(--cat-lostfound, #0ea5e9); }
#tab-map .tile[data-cat="COMMERCE"] .tile__ico{ background: var(--cat-commerce, #6366f1); }
#tab-map .tile[data-cat="SOCIAL"] .tile__ico{ background: var(--cat-social, #ec4899); }
#tab-map .tile[data-cat="ROAD"] .tile__ico{ background: var(--cat-road, #ea580c); }
#tab-map .tile[data-cat="PODSLUSHANO"] .tile__ico{ background: var(--cat-podslushano, #1a1a1a); }


/* === MAP: make tiles visually identical to Add tag tiles === */
/* Reset any previous Map-specific tile box styles */
#tab-map .tile { 
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 84px !important;
  min-width: 84px !important;
  height: auto !important;
  margin: 6px 8px !important;
  padding: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Remove category outline/shadows inherited from old Map styles */
#tab-map .tiles-row[class*="cat-"] .tile { box-shadow: none !important; }
#tab-map .tiles-row .tile { box-shadow: none !important; }

/* Icon box exactly like Add */
#tab-map .tile .tile__ico{
  width: 56px !important;
  height: 56px !important;
  border-radius: 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--tile-bg, var(--card)) !important;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.18) !important;
  padding: 0 !important;
}

/* SVG icon sizing (match Add proportions) */
#tab-map .tile .tile__ico svg{ width: 28px !important; height: 28px !important; display:block; }

/* Label like Add */
#tab-map .tile .tile__label{
  font-size: 12px !important;
  line-height: 1.15 !important;
  text-align: center !important;
  margin-top: 6px !important;
  max-width: 72px !important;
  display: block !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  -webkit-hyphens: auto !important;
  hyphens: auto !important;
}

/* Horizontal rows spacing/scroll */
#tab-map .tiles-row{ display:flex !important; overflow-x:auto !important; gap:10px !important; padding: 6px 8px !important; }
#tab-map .tiles-row::-webkit-scrollbar{ height: 6px; }

/* Category colors for background (same palette) */
#tab-map .tile[data-cat="COMPLAINT"] .tile__ico{ background: var(--cat-complaint, #ef4444) !important; }
#tab-map .tile[data-cat="IDEA"] .tile__ico{ background: var(--cat-idea, #f59e0b) !important; }
#tab-map .tile[data-cat="EVENT"] .tile__ico{ background: var(--cat-event, #22c55e) !important; }
#tab-map .tile[data-cat="LOSTFOUND"] .tile__ico{ background: var(--cat-lostfound, #0ea5e9) !important; }
#tab-map .tile[data-cat="COMMERCE"] .tile__ico{ background: var(--cat-commerce, #6366f1) !important; }
#tab-map .tile[data-cat="SOCIAL"] .tile__ico{ background: var(--cat-social, #ec4899) !important; }
#tab-map .tile[data-cat="ROAD"] .tile__ico{ background: var(--cat-road, #ea580c) !important; }
#tab-map .tile[data-cat="PODSLUSHANO"] .tile__ico{ background: var(--cat-podslushano, #1a1a1a) !important; }


/* === MAP: tiles identical to Add; chips hidden === */
#tab-map #chips-primary,
#tab-map #chips-tags,
#tab-map .section-title[data-for="category"],
#tab-map .section-title[data-for="tag"]{ display:none !important; }

#tab-map .tile{
  display:inline-flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:flex-start !important;
  width:84px !important;
  min-width:84px !important;
  height:auto !important;
  margin:6px 8px !important;
  padding:0 !important;
  background:transparent !important;
  border-radius:0 !important;
  box-shadow:none !important;
}

#tab-map .tiles-row[class*="cat-"] .tile{ box-shadow:none !important; }
#tab-map .tiles-row .tile{ box-shadow:none !important; }

#tab-map .tile .tile__ico{
  width:56px !important;
  height:56px !important;
  border-radius:16px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  background: var(--tile-bg, var(--card)) !important;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.18) !important;
  padding:0 !important;
}
#tab-map .tile .tile__ico svg{ width:28px !important; height:28px !important; display:block; }

#tab-map .tile .tile__label{
  font-size:12px !important; line-height:1.15 !important;
  text-align:center !important; margin-top:6px !important;
  max-width:72px !important; display:block !important;
  white-space:normal !important; word-break:break-word !important; overflow-wrap:anywhere !important;
  -webkit-hyphens:auto !important; hyphens:auto !important;
}

#tab-map .tiles-row{ display:flex !important; overflow-x:auto !important; gap:4px !important; padding: 2px 6px !important; }
#tab-map .tiles-row::-webkit-scrollbar{ height:6px; }

#tab-map .tile[data-cat="COMPLAINT"] .tile__ico{ background: var(--cat-complaint, #ef4444) !important; }
#tab-map .tile[data-cat="IDEA"] .tile__ico{ background: var(--cat-idea, #f59e0b) !important; }
#tab-map .tile[data-cat="EVENT"] .tile__ico{ background: var(--cat-event, #22c55e) !important; }
#tab-map .tile[data-cat="LOSTFOUND"] .tile__ico{ background: var(--cat-lostfound, #0ea5e9) !important; }
#tab-map .tile[data-cat="COMMERCE"] .tile__ico{ background: var(--cat-commerce, #6366f1) !important; }
#tab-map .tile[data-cat="SOCIAL"] .tile__ico{ background: var(--cat-social, #ec4899) !important; }
#tab-map .tile[data-cat="ROAD"] .tile__ico{ background: var(--cat-road, #ea580c) !important; }
#tab-map .tile[data-cat="PODSLUSHANO"] .tile__ico{ background: var(--cat-podslushano, #1a1a1a) !important; }


/* === MAP: Variant C – subtle appear + icon scale on hover, active label accent === */
@keyframes mapTileAppear {
  to { opacity: 1; transform: translateY(0); }
}
#tab-map .tiles-row .tile {
  opacity: 0;
  transform: translateY(4px);
  animation: mapTileAppear .30s ease forwards;
}
/* gentle stagger for the first few tiles */
#tab-map .tiles-row .tile:nth-child(2) { animation-delay: 40ms; }
#tab-map .tiles-row .tile:nth-child(3) { animation-delay: 80ms; }
#tab-map .tiles-row .tile:nth-child(4) { animation-delay: 120ms; }
#tab-map .tiles-row .tile:nth-child(5) { animation-delay: 160ms; }
#tab-map .tiles-row .tile:nth-child(6) { animation-delay: 200ms; }

/* Hover/press micro-interactions */
#tab-map .tile .tile__ico {
  transition: transform .18s ease, box-shadow .18s ease;
}
#tab-map .tile:hover .tile__ico {
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
#tab-map .tile:active .tile__ico {
  transform: translateY(1px) scale(1.02);
}

/* Improved tile interaction */
#tab-map .tile {
  cursor: pointer;
  transition: transform 0.2s ease;
}
#tab-map .tile:hover {
  transform: translateY(-1px);
}
#tab-map .tile:active {
  transform: translateY(0px) scale(0.98);
}

/* Active state: accent label color by category */
#tab-map .tile.is-active .tile__label { font-weight: 500; }
#tab-map .tile.is-active[data-cat="COMPLAINT"] .tile__label { color: #ef4444; }
#tab-map .tile.is-active[data-cat="IDEA"] .tile__label { color: #f59e0b; }
#tab-map .tile.is-active[data-cat="EVENT"] .tile__label { color: #22c55e; }
#tab-map .tile.is-active[data-cat="LOSTFOUND"] .tile__label { color: #0ea5e9; }
#tab-map .tile.is-active[data-cat="COMMERCE"] .tile__label { color: #6366f1; }
#tab-map .tile.is-active[data-cat="SOCIAL"] .tile__label { color: #ec4899; }
#tab-map .tile.is-active[data-cat="ROAD"] .tile__label { color: #ea580c; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #tab-map .tiles-row .tile { animation: none; opacity: 1; transform: none; }
  #tab-map .tile .tile__ico { transition: none; }
}


/* === ADD TAB: Variant C – appear animation + icon scale + active label accent === */
@keyframes addTileAppear {
  to { opacity: 1; transform: translateY(0); }
}
#tab-add .tag-tile {
  opacity: 0;
  transform: translateY(4px);
  animation: addTileAppear .30s ease forwards;
}
/* gentle stagger */
#tab-add .tag-tile:nth-child(2) { animation-delay: 40ms; }
#tab-add .tag-tile:nth-child(3) { animation-delay: 80ms; }
#tab-add .tag-tile:nth-child(4) { animation-delay: 120ms; }
#tab-add .tag-tile:nth-child(5) { animation-delay: 160ms; }
#tab-add .tag-tile:nth-child(6) { animation-delay: 200ms; }

/* Hover/press micro-interactions for the icon box */
#tab-add .tag-tile .tag-tile__box {
  transition: transform .20s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .20s cubic-bezier(0.4, 0, 0.2, 1), outline .20s ease;
}
#tab-add .tag-tile:hover:not([aria-pressed="true"]):not(.active) .tag-tile__box {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
#tab-add .tag-tile:active:not([aria-pressed="true"]):not(.active) .tag-tile__box {
  transform: translateY(1px) scale(1.03);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* Active state: accent label color by category (mirror Map tab behavior) */
#tab-add .tag-tile.is-active .tag-tile__label,
#tab-add .tag-tile.active .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  font-weight: 500; }

#tab-add .tag-tile.is-active[data-cat="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="COMPLAINT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ef4444; }

#tab-add .tag-tile.is-active[data-cat="IDEA"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="IDEA"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="IDEA"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #f59e0b; }

#tab-add .tag-tile.is-active[data-cat="EVENT"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="EVENT"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="EVENT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #22c55e; }

#tab-add .tag-tile.is-active[data-cat="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="LOSTFOUND"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #0ea5e9; }

#tab-add .tag-tile.is-active[data-cat="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="COMMERCE"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #6366f1; }

#tab-add .tag-tile.is-active[data-cat="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="SOCIAL"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ec4899; }

#tab-add .tag-tile.is-active[data-cat="ROAD"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="ROAD"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="ROAD"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ea580c; }

/* Fallback: if categories stored in data-category */
#tab-add .tag-tile.is-active[data-category="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="COMPLAINT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ef4444; }
#tab-add .tag-tile.is-active[data-category="IDEA"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="IDEA"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #f59e0b; }
#tab-add .tag-tile.is-active[data-category="EVENT"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="EVENT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #22c55e; }
#tab-add .tag-tile.is-active[data-category="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="LOSTFOUND"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #0ea5e9; }
#tab-add .tag-tile.is-active[data-category="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="COMMERCE"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #6366f1; }
#tab-add .tag-tile.is-active[data-category="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="SOCIAL"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ec4899; }
#tab-add .tag-tile.is-active[data-category="ROAD"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="ROAD"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ea580c; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #tab-add .tag-tile { animation: none; opacity: 1; transform: none; }
  #tab-add .tag-tile .tag-tile__box { transition: none; }
}


/* === ADD TAB: remove gray outline and mirror Map active label colors === */
#tab-add .tag-tile,
#tab-add .tag-tile .tag-tile__box {
  border: none !important;
  outline: none !important;
  box-shadow: none; /* keep it clean; hover/active effects still applied separately */
}

/* Ensure active label colors exactly mirror Map tab behavior */
#tab-add .tag-tile.is-active .tag-tile__label,
#tab-add .tag-tile.active .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  font-weight: 500; }

#tab-add .tag-tile.is-active[data-cat="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="COMPLAINT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ef4444; }

#tab-add .tag-tile.is-active[data-cat="IDEA"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="IDEA"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="IDEA"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #f59e0b; }

#tab-add .tag-tile.is-active[data-cat="EVENT"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="EVENT"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="EVENT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #22c55e; }

#tab-add .tag-tile.is-active[data-cat="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="LOSTFOUND"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #0ea5e9; }

#tab-add .tag-tile.is-active[data-cat="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="COMMERCE"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #6366f1; }

#tab-add .tag-tile.is-active[data-cat="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="SOCIAL"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ec4899; }

#tab-add .tag-tile.is-active[data-cat="ROAD"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="ROAD"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="ROAD"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ea580c; }
#tab-add .tag-tile.is-active[data-cat="PODSLUSHANO"] .tag-tile__label,
#tab-add .tag-tile.active[data-cat="PODSLUSHANO"] .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"][data-cat="PODSLUSHANO"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #1a1a1a; }

/* Fallback for data-category attribute */
#tab-add .tag-tile.is-active[data-category="COMPLAINT"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="COMPLAINT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ef4444; }
#tab-add .tag-tile.is-active[data-category="IDEA"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="IDEA"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #f59e0b; }
#tab-add .tag-tile.is-active[data-category="EVENT"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="EVENT"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #22c55e; }
#tab-add .tag-tile.is-active[data-category="LOSTFOUND"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="LOSTFOUND"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #0ea5e9; }
#tab-add .tag-tile.is-active[data-category="COMMERCE"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="COMMERCE"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #6366f1; }
#tab-add .tag-tile.is-active[data-category="SOCIAL"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="SOCIAL"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ec4899; }
#tab-add .tag-tile.is-active[data-category="ROAD"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="ROAD"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #ea580c; }
#tab-add .tag-tile.is-active[data-category="PODSLUSHANO"] .tag-tile__label,
#tab-add .tag-tile.active[data-category="PODSLUSHANO"] .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: #1a1a1a; }


/* === ADD TAB: ensure active label uses category color robustly === */
/* Map category → CSS var, regardless of where data-cat sits */
#tab-add .tag-tile[data-cat="COMPLAINT"],
#tab-add .tag-tile .tag-tile__box[data-cat="COMPLAINT"] { --cat-color: #ef4444; }
#tab-add .tag-tile[data-cat="IDEA"],
#tab-add .tag-tile .tag-tile__box[data-cat="IDEA"] { --cat-color: #f59e0b; }
#tab-add .tag-tile[data-cat="EVENT"],
#tab-add .tag-tile .tag-tile__box[data-cat="EVENT"] { --cat-color: #22c55e; }
#tab-add .tag-tile[data-cat="LOSTFOUND"],
#tab-add .tag-tile .tag-tile__box[data-cat="LOSTFOUND"] { --cat-color: #0ea5e9; }
#tab-add .tag-tile[data-cat="COMMERCE"],
#tab-add .tag-tile .tag-tile__box[data-cat="COMMERCE"] { --cat-color: #6366f1; }
#tab-add .tag-tile[data-cat="SOCIAL"],
#tab-add .tag-tile .tag-tile__box[data-cat="SOCIAL"] { --cat-color: #ec4899; }
#tab-add .tag-tile[data-cat="ROAD"],
#tab-add .tag-tile .tag-tile__box[data-cat="ROAD"] { --cat-color: #ea580c; }
#tab-add .tag-tile[data-cat="PODSLUSHANO"],
#tab-add .tag-tile .tag-tile__box[data-cat="PODSLUSHANO"] { --cat-color: #1a1a1a; }

/* Fallback if data-category is used */
#tab-add .tag-tile[data-category="COMPLAINT"],
#tab-add .tag-tile .tag-tile__box[data-category="COMPLAINT"] { --cat-color: #ef4444; }
#tab-add .tag-tile[data-category="IDEA"],
#tab-add .tag-tile .tag-tile__box[data-category="IDEA"] { --cat-color: #f59e0b; }
#tab-add .tag-tile[data-category="EVENT"],
#tab-add .tag-tile .tag-tile__box[data-category="EVENT"] { --cat-color: #22c55e; }
#tab-add .tag-tile[data-category="LOSTFOUND"],
#tab-add .tag-tile .tag-tile__box[data-category="LOSTFOUND"] { --cat-color: #0ea5e9; }
#tab-add .tag-tile[data-category="COMMERCE"],
#tab-add .tag-tile .tag-tile__box[data-category="COMMERCE"] { --cat-color: #6366f1; }
#tab-add .tag-tile[data-category="SOCIAL"],
#tab-add .tag-tile .tag-tile__box[data-category="SOCIAL"] { --cat-color: #ec4899; }
#tab-add .tag-tile[data-category="ROAD"],
#tab-add .tag-tile .tag-tile__box[data-category="ROAD"] { --cat-color: #ea580c; }
#tab-add .tag-tile[data-category="PODSLUSHANO"],
#tab-add .tag-tile .tag-tile__box[data-category="PODSLUSHANO"] { --cat-color: #1a1a1a; }

/* Apply color to label when active — cover multiple active-state patterns */
#tab-add .tag-tile.is-active .tag-tile__label,
#tab-add .tag-tile.active .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"] .tag-tile__label,
#tab-add .tag-tile[aria-selected="true"] .tag-tile__label,
#tab-add .tag-tile.selected .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal; 
  color: var(--cat-color, currentColor) !important;
  font-weight: 500;
}


/* === ADD TAB: force label to use category color (strong override) === */
/* Inherit color from tile when active */
#tab-add .tag-tile.is-active,
#tab-add .tag-tile.active,
#tab-add .tag-tile[aria-pressed="true"],
#tab-add .tag-tile[aria-selected="true"],
#tab-add .tag-tile.selected {
  color: var(--cat-color, inherit) !important;
}

/* Ensure the label and any nested spans pick it up */
#tab-add .tag-tile.is-active .tag-tile__label,
#tab-add .tag-tile.active .tag-tile__label,
#tab-add .tag-tile[aria-pressed="true"] .tag-tile__label,
#tab-add .tag-tile[aria-selected="true"] .tag-tile__label,
#tab-add .tag-tile.selected .tag-tile__label,
#tab-add .tag-tile.is-active .tag-tile__label *,
#tab-add .tag-tile.active .tag-tile__label *,
#tab-add .tag-tile[aria-pressed="true"] .tag-tile__label *,
#tab-add .tag-tile[aria-selected="true"] .tag-tile__label *,
#tab-add .tag-tile.selected .tag-tile__label * {
  color: var(--cat-color, currentColor) !important;
  font-weight: 600;
}

/* Set black color for inactive tag tiles */
#tab-add .tag-tile { color: #000; }

/* If some rule sets an explicit color on label, neutralize it first */
#tab-add .tag-tile .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: inherit !important; }


/* Feed header: subcategory tile instead of category badge */
.card .card-header .tag-tile { pointer-events: none; user-select: none; }
.card .card-header .tag-tile .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: var(--cat-color); font-weight: 600; }
.card .card-header { display: flex; align-items: center; gap: 10px; }

.card .card-header .hdr-actions{ margin-left:auto; }


/* Shift subcategory tile (and its avatar) 10px up and 10px left */
.card .meta .tag-tile{
  transform: translate(-10px, -10px);
}


/* === Avatar attached to subcategory tile === */
.card .meta .tag-tile,
.card .meta .tag-tile .tag-tile__box{ position: relative; }

.card .meta .tag-tile .avatar--over-tile{
  position: absolute;
  right: -8px;           /* overlap inward horizontally */
  bottom: -6px;          /* overlap inward vertically */
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 2;
  object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 22px; font-weight: 700; font-size: 11px;
  background: #E5E7EB; color: #111827; /* fallback for initials avatar */
  pointer-events: none; /* keep tile clickable */
}


/* === FEED: disable click on subcategory tile and paint label with category color === */
.card .meta .tag-tile { pointer-events: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.card .meta .tag-tile .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: var(--cat-color); font-weight: 600; }

/* === FEED: make sure --cat-color is set for tiles inside cards === */
.card .tag-tile[data-cat="COMPLAINT"],
.card .tag-tile .tag-tile__box[data-cat="COMPLAINT"] { --cat-color: #ef4444; }
.card .tag-tile[data-cat="IDEA"],
.card .tag-tile .tag-tile__box[data-cat="IDEA"] { --cat-color: #f59e0b; }
.card .tag-tile[data-cat="EVENT"],
.card .tag-tile .tag-tile__box[data-cat="EVENT"] { --cat-color: #22c55e; }
.card .tag-tile[data-cat="LOSTFOUND"],
.card .tag-tile .tag-tile__box[data-cat="LOSTFOUND"] { --cat-color: #0ea5e9; }
.card .tag-tile[data-cat="COMMERCE"],
.card .tag-tile .tag-tile__box[data-cat="COMMERCE"] { --cat-color: #6366f1; }
.card .tag-tile[data-cat="SOCIAL"],
.card .tag-tile .tag-tile__box[data-cat="SOCIAL"] { --cat-color: #ec4899; }
.card .tag-tile[data-cat="ROAD"],
.card .tag-tile .tag-tile__box[data-cat="ROAD"] { --cat-color: #ea580c; }
.card .tag-tile[data-cat="PODSLUSHANO"],
.card .tag-tile .tag-tile__box[data-cat="PODSLUSHANO"] { --cat-color: #1a1a1a; }

/* Keep header variant non-interactive and colored (already present, duplicated for safety) */
.card .card-header .tag-tile { pointer-events: none; user-select: none; }
.card .card-header .tag-tile .tag-tile__label { -webkit-hyphens:auto; hyphens:auto;  overflow-wrap: anywhere;  word-break: break-word;  white-space: normal;  color: var(--cat-color); font-weight: 600; }


/* FEED: neutralize hover/cursor on tiles inside cards */
.card .tag-tile { cursor: default; }
.card .tag-tile:hover, .card .tag-tile:active { transform: none; box-shadow: none; }



.card .meta { display: block; position: relative; }
/* Compensate tile's translate(-10px, -10px) so author sits on same top level */








.card .meta .tag-tile { 
  float: left;
  margin: 0 8px 0 0;
  transform: none;
  position: relative;
  z-index: 1;
}





/* === FEED: inline автор и текст обтекают плитку === */
.card .meta > .badge.small { 
  display: inline;
  margin: 0;
  padding: 0;
}
.card .meta > .badge.small .author-link { 
  display: inline;
  padding: 0;
  font-weight: 600;
}

/* time text next to author in feed */
.meta .author-time{
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* === ПРАВИЛЬНАЯ INLINE СТРУКТУРА === */
/* Текст как span внутри meta - продолжает поток после имени автора */
.card .meta .text {
  display: inline;
  white-space: pre-wrap;
  line-height: 1.5;
  word-wrap: break-word;
}

/* JS-обрезка - всегда inline для обтекания плитки */
.card .meta .text.clamp-text {
  display: inline;
  white-space: pre-wrap;
}

.card .meta .text.clamp-text.expanded {
  display: inline;
  white-space: pre-wrap;
}

/* Clearfix для корректного обтекания */
.card .meta::after {
  content: "";
  display: table;
  clear: both;
}

/* === ФИКСАЦИЯ НИЖНЕЙ ПАНЕЛИ === */
.card .card-actions{ 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  margin-top:12px; 
  gap:12px; 
  min-height:32px;
  flex-shrink: 0;
}

/* Кнопка toggle */
.clamp-toggle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* FIX: Avatar positioning in popup - same as in feed */

/* Make popup tile and tile__box relative for absolute positioning of avatar */
.popup .tag-tile,
.popup .tag-tile .tag-tile__box { 
  position: relative; 
}

/* Position avatar over tile in popup - EXACT same as feed */
.popup .tag-tile .avatar--over-tile {
  position: absolute;
  right: -8px;           /* overlap inward horizontally */
  bottom: -6px;          /* overlap inward vertically */
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 2;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 22px;
  font-weight: 700;
  font-size: 11px;
}

/* Ensure avatar doesn't interfere with tile interaction */
.popup .tag-tile .avatar--over-tile {
  pointer-events: none;
  user-select: none;
}

/* ========================================
   POPUP: Copy feed meta layout for tile + author
   ======================================== */

/* Create meta-like container structure in popup */
.popup .popup-meta {
  display: block;
  position: relative;
  margin-bottom: 6px;
}

/* Float tile left like in feed */
.popup .popup-meta .tag-tile {
  float: left;
  margin: 0 8px 0 0;
  transform: none;
  position: relative;
  z-index: 1;
}

/* Make tile box relative for avatar positioning */
.popup .popup-meta .tag-tile,
.popup .popup-meta .tag-tile .tag-tile__box {
  position: relative;
}

/* Avatar over tile - EXACT same as feed */
.popup .popup-meta .tag-tile .avatar--over-tile {
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  z-index: 2;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 22px;
  font-weight: 700;
  font-size: 11px;
  pointer-events: none;
  user-select: none;
}

/* Author badge inline to wrap around tile */
.popup .popup-meta > .badge.small {
  display: inline;
  margin: 0;
  padding: 0;
}

.popup .popup-meta > .badge.small .author-link {
  display: inline;
  padding: 0;
  font-weight: 600;
}

/* Time text styling */
.popup .popup-meta .author-time {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* Remove CSS clamp styles - JavaScript handles everything */

/* Clearfix for float */
.popup .popup-meta::after {
  content: "";
  display: table;
  clear: both;
}

/* Toggle button positioned by JavaScript */

/* Disable tile interactivity in popup */
.popup .popup-meta .tag-tile {
  pointer-events: none;
  cursor: default;
}

/* But allow author link to be clickable */
.popup .popup-meta .badge.small,
.popup .popup-meta .badge.small * {
  pointer-events: auto;
}

/* Text in popup-meta - block, обтекает float плитку */
.popup .popup-meta #p-text,
.popup .popup-meta .text {
  display: block;
  margin: 4px 0 0;
  padding: 0;
  white-space: pre-wrap;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
  color: #1a1a1a;
}

/* Popup typography improvements */
.popup .popup-meta .author-name { 
  color: #374151; 
  font-weight: 600; 
}
.popup .popup-meta .author-time { 
  color: #6b7280; 
  font-weight: 500; 
}

/* Clickable vs non-clickable author names in popup */
.popup .popup-meta a.author-link .author-name { 
  color: #2563eb; 
  transition: color 0.2s ease; 
}
.popup .popup-meta a.author-link:hover .author-name { 
  color: #1d4ed8; 
}
.popup .popup-meta .author-name:not(.author-link .author-name) { 
  color: #374151; 
  cursor: default; 
}

/* Thanks row - строка благодарностей */
.thanks-row {
  font-size: 12px;
  color: #6b7280;
  margin: 2px 0 4px;
  padding-left: 0;
}
/* В popup thanks-row block, но обтекает плитку */
.popup .popup-meta .thanks-row {
  display: block;
  margin: 4px 0;
}
.thanks-row .thanks-count {
  color: #6b7280;
}
.thanks-row .thanks-btn {
  color: #f97316;
  cursor: pointer;
  margin-left: 4px;
}
.thanks-row .thanks-btn:hover {
  text-decoration: underline;
}
.thanks-row .thanks-done {
  color: #10b981;
  margin-left: 4px;
}

/* Main popup text */
.popup .text,
.popup #p-text {
  color: #1a1a1a;
}

/* Popup address styling */
.popup .addr-rect .marquee-item,
.popup #p-addr {
  color: #374151;
}

/* Remove underlines from popup author links and time */
.popup .popup-meta a,
.popup .popup-meta a.author-link,
.popup .popup-meta .author-link,
.popup .popup-meta .author-time {
  text-decoration: none !important;
  text-underline-offset: 0 !important;
}
}

/* Remove duplicate clamp styles - JavaScript handles everything */


/* Chatfix v2: stronger underline overrides in popup */
.popup .popup-meta a,
.popup .badge.small a,
.popup a.author-link,
.popup .author-link,
.card .author-link { text-decoration: none !important; text-underline-offset: 0 !important; }


/* Chatfix v3: popup tile label uses category color */
.popup .tag-tile .tag-tile__label,
.popup .tag-tile__label {
  color: var(--cat-color) !important;
  font-weight: 600;
}


/* === Feed: tinted shadow by category (soft halo) === */
#tab-feed .card.card--tinted{
  box-shadow:
    0 18px 40px rgba(2,6,23,.2),
    0 2px 8px rgba(2,6,23,.1),
    0 0 0 2px rgba(var(--cat-rgb, 99,102,241), .24),
    0 12px 28px rgba(var(--cat-rgb, 99,102,241), .28);
  border-color: rgba(var(--cat-rgb, 99,102,241), .24);
}
#tab-feed .card.card--tinted:hover{
  box-shadow:
    0 24px 50px rgba(2,6,23,.25),
    0 4px 12px rgba(2,6,23,.12),
    0 0 0 2px rgba(var(--cat-rgb, 99,102,241), .34),
    0 16px 36px rgba(var(--cat-rgb, 99,102,241), .35);
  border-color: rgba(var(--cat-rgb, 99,102,241), .34);
}
@media (prefers-color-scheme: dark){
  #tab-feed .card.card--tinted{
    box-shadow:
      0 18px 40px rgba(0,0,0,.4),
      0 2px 8px rgba(0,0,0,.3),
      0 0 0 2px rgba(var(--cat-rgb, 99,102,241), .35),
      0 12px 28px rgba(var(--cat-rgb, 99,102,241), .50);
    border-color: rgba(var(--cat-rgb, 99,102,241), .35);
  }
}

/* ============================================
   GAMIFICATION STYLES - Profile with XP & Badges
   ============================================ */

.pp-avatar-wrapper {
  position: relative;
  display: inline-block;
}

.pp-level-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 1;
}

.pp-xp-section {
  padding: 16px;
  background: var(--card-bg);
  margin: 0 12px 12px;
  border-radius: 12px;
}

.pp-xp-label {
  font-size: 14px;
  color: #0f172a;
  margin-bottom: 8px;
  font-weight: 700;
  text-align: center;
}

.pp-xp-bar {
  height: 10px;
  background: var(--input-bg);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.pp-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  border-radius: 5px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.pp-xp-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  margin-top: 6px;
}

.pp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 12px 16px;
}

.pp-stat {
  background: var(--card-bg);
  padding: 14px 8px;
  border-radius: 12px;
  text-align: center;
}

.pp-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
  line-height: 1;
}

.pp-stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  font-weight: 600;
}

.pp-badges-section {
  padding: 0 12px 16px;
  max-height: 240px;
  overflow-y: auto;
}

.pp-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pp-badge-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.pp-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.pp-badge {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.pp-badge.earned {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.pp-badge.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.pp-badge:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.pp-badge-tier {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.pp-badge-tier.bronze { 
  background: linear-gradient(135deg, #CD7F32, #B87333);
  color: white; 
}

.pp-badge-tier.silver { 
  background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
  color: #333; 
}

.pp-badge-tier.gold { 
  background: linear-gradient(135deg, #FFD700, #FFC107);
  color: #333; 
}

.pp-actions {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.pp-btn {
  flex: 1;
  padding: 12px 16px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.pp-btn:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pp-btn:active,
.pp-btn:focus {
  outline: none;
}

.pp-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.pp-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pp-btn-full {
  width: 100%;
  margin-top: 4px;
}

/* Achievement Toast Notification */
.achievement-toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ach-icon {
  font-size: 36px;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.ach-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.ach-desc {
  font-size: 13px;
  color: #666;
}

/* Responsive adjustments */
@media (max-width: 380px) {
  .pp-badges {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .pp-badge {
    font-size: 28px;
  }
}

/* FIX: Ограничение высоты профиля */
.profile-popover {
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pp-header {
  flex-shrink: 0;
}

.pp-xp-section {
  flex-shrink: 0;
}

.pp-stats {
  flex-shrink: 0;
}

.pp-badges-section {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 280px;
  min-height: 100px;
  -webkit-overflow-scrolling: touch;
}

.pp-actions {
  flex-shrink: 0;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, rgba(240,242,245,0.8) 100%);
}

/* Убираем старый flex-direction: column */
.pp-actions button {
  margin: 0;
}

/* Уменьшаем высоту секции бейджей */
.pp-badges-section {
  max-height: 220px !important; /* Было 280px */
  overflow-y: auto !important;
}

/* Компактнее padding у секций */
.pp-xp-section {
  padding: 12px 16px !important; /* Было 16px */
  margin: 0 12px 10px !important; /* Было 12px */
}

.pp-stats {
  padding: 0 12px 12px !important; /* Было 16px */
}

.pp-header {
  padding-bottom: 8px !important;
}

/* На очень маленьких экранах */
@media (max-height: 700px) {
  .pp-badges-section {
    max-height: 180px !important;
  }
}

/* ============================================================
   NEWS STYLES - Стили для новостей (Вариант 1: Минималистичные карточки)
   ============================================================ */

.news-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
}

/* Карточка новости */
.news-card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Изображение новости */
.news-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--chip-bg);
  position: relative;
}

.news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Видео в новостях */
.news-video {
  width: 100%;
  background: #000;
  position: relative;
}

.news-video video {
  width: 100%;
  display: block;
  max-height: 400px;
}

/* Аудио в новостях */
.news-audio {
  padding: 0 16px 4px;
  background: var(--chip-bg);
}

.news-audio audio {
  width: 100%;
  height: 40px;
}

/* Контент новости */
.news-content {
  padding: 16px;
}

.news-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  color: #0f172a;
}

.news-text-container {
  position: relative;
}

.news-text {
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
}

.news-text-short {
  display: inline;
}

.news-text-full {
  display: none;
  animation: fadeInText 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-text-container.expanded .news-text-short {
  display: none;
}

.news-text-container.expanded .news-text-full {
  display: inline;
}

@keyframes fadeInText {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Кнопка "Показать полностью" - современный минималистичный стиль */
.news-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #2563eb;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Hover эффект - современный, не "колхозный" */
.news-expand-btn:hover {
  background: rgba(var(--accent-rgb, 0, 122, 255), 0.08);
  transform: translateY(-1px);
}

.news-expand-btn:active {
  transform: translateY(0);
  background: rgba(var(--accent-rgb, 0, 122, 255), 0.12);
}

/* Ripple эффект при клике */
.news-expand-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(var(--accent-rgb, 0, 122, 255), 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.news-expand-btn:active::before {
  width: 200px;
  height: 200px;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0.3s;
}

.news-expand-text {
  position: relative;
  z-index: 1;
}

.news-expand-icon {
  position: relative;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

/* Плавное вращение иконки */
.news-text-container.expanded .news-expand-icon {
  transform: rotate(180deg);
}

/* Метаданные */
.news-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.news-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.news-meta-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Футер с кнопками */
.news-footer {
  padding: 16px;
  background: var(--chip-bg);
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Анимированные кнопки с лапками */
.news-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.news-action-btn-primary {
  background: #f5f5f5;
  color: #1a73e8;
}

.news-action-btn-secondary {
  background: #f5f5f5;
  color: #5f6368;
}

.news-action-btn:hover {
  background: #e8e8e8;
}

.news-action-btn:active {
  transform: scale(0.98);
}

.news-action-btn svg {
  flex-shrink: 0;
}

/* Темная тема для кнопок */
.dark .news-action-btn-primary {
  background: rgba(255, 255, 255, 0.1);
  color: #8ab4f8;
}

.dark .news-action-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #9aa0a6;
}

.dark .news-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Пустое состояние */
.news-empty {
  text-align: center;
  padding: 60px 20px;
}

.news-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.news-empty-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.news-empty-hint {
  font-size: 14px;
  color: var(--muted);
}

/* Ошибка */
.news-error {
  text-align: center;
  padding: 40px 20px;
}

.news-error-icon {
  font-size: 36px;
  margin-bottom: 12px;
  color: #ef4444;
}

.news-error-text {
  font-size: 15px;
  color: var(--muted);
}

/* Индикатор загрузки */
.news-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.news-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================ */
/* IMPROVED CLAMP-TOGGLE STYLES (серая кнопка с анимациями) */
/* ============================================================ */

.clamp-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 8px auto 0;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease;
  user-select: none;
}

.clamp-toggle:hover {
  color: #475569;
}

.clamp-toggle:active {
  color: #334155;
}

/* Текст кнопки */
.clamp-toggle-text {
  position: relative;
}

/* Иконка стрелки */
.clamp-toggle::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6L8 10L12 6" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.clamp-toggle:hover::after {
  background-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6L8 10L12 6" stroke="%23475569" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

/* Вращение иконки при развернутом состоянии */
.clamp-text.expanded + .clamp-toggle::after,
.clamp.expanded + .clamp-toggle::after,
.clamp-toggle.expanded::after {
  transform: rotate(180deg);
}

/* Фикс для попапа - центрирование кнопки */
.popup .clamp-toggle[style*="display: none"] {
  display: none !important;
}

/* Темная тема */
.dark .clamp-toggle {
  color: #94a3b8;
}

.dark .clamp-toggle:hover {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
}

.dark .clamp-toggle::after {
  background-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6L8 10L12 6" stroke="%2394a3b8" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

.dark .clamp-toggle:hover::after {
  background-image: url('data:image/svg+xml,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6L8 10L12 6" stroke="%23cbd5e1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

/* Темная тема - адаптация типографики */
.dark .news-title {
  color: #f1f5f9;
}

.dark .news-text {
  color: #94a3b8;
}

.dark .news-expand-btn {
  color: #60a5fa;
}

.dark .news-footer-link {
  color: #60a5fa;
}

/* Адаптивность */
@media (max-width: 600px) {
  .news-card {
    border-radius: 10px;
  }
  
  .news-image {
    height: 180px;
  }
  
  .news-content {
    padding: 14px;
  }
  
  .news-title {
    font-size: 17px;
  }
  
  .news-text {
    font-size: 14px;
  }
  
  .news-meta {
    gap: 12px;
    font-size: 12px;
  }
}

/* ============================================================
   PROMO CARDS - Стили для промо-контента
   ============================================================ */

/* Базовые стили промо-карточек */
.promo-card {
  padding: 0 !important;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.promo-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 28px 60px rgba(2,6,23,.35), 0 6px 16px rgba(2,6,23,.18);
}

.promo-card.promo-active {
  box-shadow: 0 0 0 3px var(--accent, #6366f1);
}

/* Видео карточки */
.promo-video-card {
  background: #000;
}

.promo-video-container {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
}

.promo-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  background: #000;
}

/* Индикатор звука */
.promo-sound-indicator {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50%;
  color: #fff;
  transition: all 0.3s ease;
  pointer-events: none;
  width: 44px;
  height: 44px;
}

.promo-sound-indicator.active {
  background: rgba(99, 102, 241, 0.9);
}

.promo-sound-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.promo-sound-indicator.active .sound-waves {
  animation: soundWaves 1s ease-in-out infinite;
}

@keyframes soundWaves {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.promo-sound-text {
  white-space: nowrap;
  display: none; /* Скрываем текст, оставляем только иконку */
}

/* Картинка карточки */
.promo-image-card {
  background: var(--panel);
}

.promo-image-container {
  width: 100%;
  height: auto;
  display: block;
}

.promo-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
}

/* Адаптивность */
@media (max-width: 600px) {
  .promo-sound-indicator {
    bottom: 12px;
    right: 12px;
    padding: 8px;
    width: 40px;
    height: 40px;
  }
  
  .promo-sound-icon {
    width: 22px;
    height: 22px;
  }
}

/* Темная тема */
.dark .promo-image-card {
  background: var(--panel);
}

/* ============================================================
   MY MARKERS STYLES - Стили для "Моих меток"
   ============================================================ */

/* Контейнер для списка меток */
.pp-markers-container {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Заголовок с кнопкой "Назад" */
.pp-markers-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.pp-back-btn {
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.pp-back-btn:hover {
  background: var(--hover-bg);
  transform: translateX(-2px);
}

.pp-markers-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

/* Список меток */
.pp-markers-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* Карточка метки */
.pp-marker-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}

.pp-marker-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Заголовок карточки */
.pp-marker-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.pp-marker-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.pp-marker-info {
  flex: 1;
}

.pp-marker-category {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.pp-marker-date {
  font-size: 12px;
  color: var(--muted);
}

/* Текст метки */
.pp-marker-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 12px;
}

/* Статистика метки */
.pp-marker-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.stat-item {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Кнопки действий */
.pp-marker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.pp-marker-btn {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pp-marker-edit {
  background: var(--card-bg);
  color: var(--text);
}

.pp-marker-edit:hover {
  background: var(--hover-bg);
  transform: translateY(-1px);
}

.pp-marker-delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
}

.pp-marker-delete:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Состояния загрузки и ошибок */
.pp-markers-loading,
.pp-markers-error,
.pp-markers-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--divider);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.pp-markers-empty p {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.empty-hint {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
}

/* Confirmation Popup */
.pp-confirmation-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
}

.pp-confirmation-popup.show {
  opacity: 1;
}

.pp-confirmation-content {
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  max-width: 90%;
  width: 320px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.pp-confirmation-popup.show .pp-confirmation-content {
  transform: scale(1);
}

.pp-confirmation-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.pp-confirmation-content h3 {
  margin: 0 0 12px 0;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.pp-confirmation-content p {
  margin: 0 0 24px 0;
  font-size: 14px;
  line-height: 1.5;
  color: #4b5563;
}

.pp-confirmation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pp-btn-cancel {
  background: var(--card-bg) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  -webkit-tap-highlight-color: transparent;
}

.pp-btn-cancel:hover {
  background: var(--hover-bg) !important;
}

.pp-btn-cancel:active,
.pp-btn-cancel:focus {
  background: var(--hover-bg) !important;
  transform: scale(0.98);
  outline: none;
}

.pp-btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  border: none !important;
  -webkit-tap-highlight-color: transparent;
}

.pp-btn-danger:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.pp-btn-danger:active,
.pp-btn-danger:focus {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: white !important;
  transform: scale(0.98);
  outline: none;
}

.pp-btn-danger:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed;
}

/* Дополнительная защита от белого фона при нажатии (Telegram override) */
.pp-confirmation-actions .pp-btn-danger,
.pp-confirmation-actions .pp-btn-danger:active,
.pp-confirmation-actions .pp-btn-danger:focus,
.pp-confirmation-actions .pp-btn-danger:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
}

.pp-confirmation-actions .pp-btn-danger:active,
.pp-confirmation-actions .pp-btn-danger:focus {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}

/* Edit Popup */
.pp-edit-content {
  text-align: left;
  max-width: 90%;
  width: 400px;
}

.pp-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.pp-close-edit {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--card-bg);
  border-radius: 50%;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-close-edit:hover {
  background: var(--hover-bg);
  transform: rotate(90deg);
}

.pp-edit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pp-edit-form label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.pp-edit-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.pp-edit-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.pp-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

/* Адаптивность */
@media (max-width: 600px) {
  .pp-marker-card {
    padding: 14px;
  }
  
  .pp-marker-icon {
    font-size: 28px;
  }
  
  .pp-confirmation-content {
    width: 280px;
    padding: 20px;
  }
  
  .pp-edit-content {
    width: 90%;
    padding: 20px;
  }
}

/* ================================================
   НОВЫЕ СТИЛИ ДЛЯ "МОИ МЕТКИ" v2.0
   ================================================ */

/* Обновленный заголовок с счетчиком */
.pp-markers-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}

.pp-back-btn {
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pp-back-btn:hover {
  background: var(--hover-bg);
}

.pp-back-btn svg {
  flex-shrink: 0;
}

.pp-markers-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  flex: 1;
}

.pp-markers-count {
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}

/* Обновленный список меток */
.pp-markers-list-new {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

/* Новая карточка метки */
.pp-marker-card-new {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pp-marker-card-new:active {
  transform: scale(0.98);
}

/* Верхняя часть карточки */
.pp-marker-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* Иконка подкатегории в цветной плитке */
.pp-marker-icon-tile {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pp-subcategory-icon {
  width: 28px;
  height: 28px;
  fill: white;
}

.pp-subcategory-emoji {
  font-size: 24px;
  line-height: 1;
}

/* Основная информация */
.pp-marker-main {
  flex: 1;
  min-width: 0;
}

.pp-marker-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-marker-date {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

/* Описание метки */
.pp-marker-description {
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Адрес */
.pp-marker-address {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
}

.pp-marker-address svg {
  flex-shrink: 0;
  opacity: 0.8;
}

/* Действия с меткой */
.pp-marker-actions-new {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

.pp-marker-delete-btn {
  flex: 1;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pp-marker-delete-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.pp-marker-delete-btn:active {
  transform: translateY(0);
}

.pp-marker-delete-btn svg {
  flex-shrink: 0;
}

/* Адаптивность для новых карточек */
@media (max-width: 600px) {
  .pp-marker-card-new {
    padding: 12px;
  }
  
  .pp-marker-icon-tile {
    width: 44px;
    height: 44px;
  }
  
  .pp-subcategory-icon {
    width: 24px;
    height: 24px;
  }
  
  .pp-marker-title {
    font-size: 15px;
  }
  
  .pp-marker-description {
    font-size: 13px;
  }
}

/* ============================================ */
/* МОИ ПОДПИСКИ - Компонент                    */
/* ============================================ */

.pp-subscriptions-container {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Скролл-контейнер подписок */
.pp-subs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.pp-subs-hint {
  font-size: 13px;
  color: #6b7280;
  text-align: center;
  margin: 0 0 12px;
  padding: 0 4px;
}

/* Контент подписок */
.pp-subs-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Заголовок категории */
.pp-sub-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.pp-sub-category-indicator {
  width: 4px;
  height: 18px;
  border-radius: 2px;
}

.pp-sub-category-name {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Ряд плиток - 3 в ряд */
.pp-subs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

/* Плитка подкатегории - как в фильтрах, БЕЗ контейнера */
.pp-sub-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none !important;
  outline: none !important;
}

.pp-sub-tile:active {
  transform: scale(0.95);
}

/* Иконка подкатегории - как в фильтрах */
.pp-sub-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.pp-sub-icon-box svg {
  width: 24px;
  height: 24px;
}

/* Название подкатегории */
.pp-sub-name {
  font-size: 11px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
  line-height: 1.25;
  min-height: 26px;
  max-height: 26px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* Тумблер подписки - компактный */
.pp-sub-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.pp-sub-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pp-sub-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: .25s;
  border-radius: 22px;
}

.pp-sub-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .pp-sub-slider {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

input:checked + .pp-sub-slider:before {
  transform: translateX(16px);
}

/* Состояния загрузки и ошибок */
.pp-subs-loading,
.pp-subs-error,
.pp-subs-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.pp-subs-loading .spinner,
.pp-subs-error .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.pp-subs-loading p,
.pp-subs-error p,
.pp-subs-empty p {
  font-size: 14px;
  color: #6b7280;
  margin: 8px 0;
}

.pp-subs-error p {
  color: #ef4444;
}

/* Адаптивность - 2 в ряд на очень узких */
@media (max-width: 320px) {
  .pp-subs-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .pp-sub-icon-box {
    width: 44px;
    height: 44px;
  }
  
  .pp-sub-icon-box svg {
    width: 20px;
    height: 20px;
  }
  
  .pp-sub-name {
    font-size: 10px;
  }
}

/* ========================================
   TRANSPORT LAYER STYLES
   ======================================== */

/* Маркер транспорта */
.transport-marker {
  background: transparent !important;
  border: none !important;
}

.transport-icon {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  transition: transform 0.2s ease;
}

.transport-icon:hover {
  transform: scale(1.1);
}

.transport-route {
  position: absolute;
  top: -5px;
  background: white;
  color: #000;
  font-weight: bold;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Popup транспорта */
.transport-popup {
  min-width: 200px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
}

.transport-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.transport-popup-route {
  padding: 4px 10px;
  border-radius: 12px;
  color: white;
  font-weight: bold;
  font-size: 16px;
  min-width: 36px;
  text-align: center;
}

.transport-popup-type {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.transport-popup-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transport-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.transport-popup-label {
  color: #666;
}

.transport-popup-value {
  font-weight: 600;
  color: #000;
}

/* Кнопка переключения транспорта (добавить в UI) */
.transport-toggle-btn {
  position: absolute;
  top: 80px;
  right: 10px;
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s ease;
}

.transport-toggle-btn:hover {
  background: #f5f5f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.transport-toggle-btn.active {
  background: #007AFF;
  color: white;
}

.transport-toggle-btn svg {
  width: 24px;
  height: 24px;
}

/* Адаптация для темной темы */
@media (prefers-color-scheme: dark) {
  .transport-icon {
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
  }
  
  .transport-route {
    background: rgba(255, 255, 255, 0.95);
  }
  
  .transport-popup-header {
    border-bottom-color: #333;
  }
  
  .transport-popup-type {
    color: #999;
  }
  
  .transport-popup-label {
    color: #999;
  }
  
  .transport-popup-value {
    color: #fff;
  }
  
  .transport-toggle-btn {
    background: #1c1c1e;
    color: white;
  }
  
  .transport-toggle-btn:hover {
    background: #2c2c2e;
  }
}


/* ========== RELEVANCE PANEL (Актуальность) ========== */
.relevance-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  background: var(--card-bg, #f8f9fa);
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.relevance-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.relevance-buttons {
  display: flex;
  gap: 8px;
}

.relevance-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary, #333);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.relevance-btn:active {
  transform: scale(0.98);
}

.relevance-btn .cnt {
  font-size: 12px;
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
}

.relevance-btn[data-relevance="relevant"].active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.relevance-btn[data-relevance="relevant"].active .cnt {
  background: rgba(34, 197, 94, 0.2);
}

.relevance-btn[data-relevance="outdated"].active {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.relevance-btn[data-relevance="outdated"].active .cnt {
  background: rgba(239, 68, 68, 0.2);
}

.relevance-time {
  font-size: 11px;
  color: var(--text-tertiary, #999);
  text-align: center;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
  .relevance-panel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .relevance-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
  }
  
  .relevance-btn .cnt {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .relevance-btn[data-relevance="relevant"].active {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
  }
  
  .relevance-btn[data-relevance="outdated"].active {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
  }
}

/* === ROAD STRIP v2 — симметричная компоновка === */
.road-strip {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
  background: #f3f4f6;
  border-radius: 0 0 16px 16px;
}

/* Убираем padding у sticky-actions когда есть road-strip */
.popup .sticky-actions:has(.road-strip) {
  padding: 0;
  background: transparent;
}

/* Боковые колонки — РАВНОЙ ШИРИНЫ */
.road-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 120px;
  flex-shrink: 0;
}

.road-col-left {
  align-items: stretch;
}

.road-col-right {
  align-items: stretch;
}

/* Центральная колонка с таймером — ФИКСИРОВАННАЯ ШИРИНА */
.road-col-center {
  width: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Кнопка подписки на категорию === */
.road-notify-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.road-notify-btn:active {
  transform: scale(0.96);
}

.road-notify-btn.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.road-notify-btn .road-notify-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  text-align: center;
}

.road-notify-btn .road-notify-text span {
  display: block;
  text-align: center;
}

.road-notify-btn .road-notify-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

/* === Кнопка "Следующая" === */
.road-next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.road-next-btn:active {
  transform: scale(0.96);
}

.road-next-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* === Таймер с glow === */
.road-timer {
  position: relative;
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 0 10px var(--timer-glow, rgba(34, 197, 94, 0.5)));
}

.road-timer svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.road-timer-progress {
  transition: stroke-dashoffset 0.5s ease-out, stroke 0.3s ease;
}

.road-timer-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, 'SF Mono', 'Roboto Mono', monospace;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--timer-color, #22c55e);
  white-space: nowrap;
  text-align: center;
  line-height: 1;
}

.road-timer-text.pulse {
  animation: road-timer-pulse 1s ease-in-out infinite;
}

@keyframes road-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Кнопка "Актуально" === */
.road-bump-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  white-space: nowrap;
}

.road-bump-btn:active:not(.bumped) {
  transform: scale(0.96);
}

.road-bump-btn.bumped {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  font-weight: 700;
  cursor: default;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* === Кнопка чата === */
.road-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  white-space: nowrap;
}

.road-chat-btn.has-messages {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.road-chat-btn.has-messages svg {
  stroke: #fff;
}

.road-chat-btn:active {
  transform: scale(0.96);
}

.road-chat-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* === Мобильные стили === */
@media (max-width: 400px) {
  .road-strip {
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  
  .road-col {
    width: 110px;
  }
  
  .road-col-center {
    width: 60px;
  }
  
  .road-timer {
    width: 60px;
    height: 60px;
  }
  
  .road-timer-text {
    font-size: 14px;
  }
  
  .road-notify-btn {
    height: 38px;
    font-size: 10px;
    gap: 4px;
  }
  
  .road-notify-btn .road-notify-icon {
    width: 20px;
    height: 20px;
  }
  
  .road-next-btn,
  .road-bump-btn,
  .road-chat-btn {
    height: 38px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .road-col {
    width: 100px;
  }
  
  .road-col-center {
    width: 54px;
  }
  
  .road-timer {
    width: 54px;
    height: 54px;
  }
  
  .road-timer-text {
    font-size: 12px;
  }
  
  .road-notify-btn {
    height: 36px;
    font-size: 9px;
  }
  
  .road-notify-btn .road-notify-icon {
    width: 18px;
    height: 18px;
  }
  
  .road-next-btn,
  .road-bump-btn,
  .road-chat-btn {
    height: 36px;
    font-size: 11px;
  }
}

/* ============================================
   SOCIAL-STRIP — интерфейс для социальных категорий
   Двухрядная вёрстка: чат+следующая / реакции
   ============================================ */
.social-strip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  background: #f3f4f6;
  border-radius: 0 0 16px 16px;
}

.popup .sticky-actions:has(.social-strip) {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Верхний ряд: Подписка + Чат + Следующая */
.social-strip-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

/* === Кнопка подписки на подкатегорию === */
.social-notify-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 16px;
  border: none;
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  height: 40px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.social-notify-btn:active {
  transform: scale(0.96);
}

.social-notify-btn.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.social-notify-btn .social-notify-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.social-notify-btn .social-notify-text span {
  display: block;
  white-space: nowrap;
}

.social-notify-btn .social-notify-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

[data-theme="dark"] .social-notify-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

[data-theme="dark"] .social-notify-btn.active {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #fff;
}

/* Кнопка чата (компактная - иконка + счётчик) */
.social-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border-radius: 16px;
  background: #fff;
  border: none;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 40px;
  min-width: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.social-chat-btn:active {
  transform: scale(0.95);
}

.social-chat-btn.has-messages {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

.social-chat-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Кнопка "Следующая" */
.social-next-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 14px;
  border-radius: 16px;
  background: #fff;
  border: none;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 40px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.social-next-btn:active,
.social-next-btn.clicked {
  transform: scale(0.95);
  background: #f1f5f9;
}

.social-next-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Нижний ряд: Реакции с переносом */
.social-strip-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.social-strip-bottom .reaction-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.social-strip-bottom .reaction-pill .emoji {
  font-size: 24px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-strip-bottom .reaction-pill .count {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.social-strip-bottom .reaction-pill:active {
  transform: scale(0.92);
}

.social-strip-bottom .reaction-pill:active .emoji {
  transform: scale(1.15);
}

.social-strip-bottom .reaction-pill.active {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

.social-strip-bottom .reaction-pill.active .count {
  color: #fff;
}

.social-strip-bottom .reaction-pill.pop {
  animation: reactionPop 0.3s ease;
}

.social-strip-bottom .reaction-pill.pop .emoji {
  animation: reactionPop 0.3s ease;
}

.social-strip-bottom .reaction-add-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 2px dashed rgba(0, 0, 0, 0.2);
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.social-strip-bottom .reaction-add-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

.social-strip-bottom .reaction-add-btn:active {
  transform: scale(0.9);
}

/* Dark mode */
[data-theme="dark"] .social-strip {
  background: rgba(30, 30, 30, 0.95);
}

[data-theme="dark"] .social-chat-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

[data-theme="dark"] .social-chat-btn.has-messages {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

[data-theme="dark"] .social-next-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

[data-theme="dark"] .social-strip-bottom .reaction-pill {
  background: rgba(6, 182, 212, 0.2);
}

/* Мобильные стили */
@media (max-width: 400px) {
  .social-strip {
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }
  
  .social-strip-top {
    gap: 6px;
  }
  
  .social-notify-btn {
    padding: 0 10px;
    font-size: 10px;
    gap: 4px;
    height: 36px;
  }
  
  .social-notify-btn .social-notify-icon {
    width: 18px;
    height: 18px;
  }
  
  .social-chat-btn {
    padding: 0 10px;
    font-size: 13px;
    height: 36px;
    min-width: 50px;
  }
  
  .social-next-btn {
    padding: 0 12px;
    font-size: 11px;
    height: 36px;
  }
  
  .social-strip-bottom {
    gap: 8px;
  }
  
  .social-strip-bottom .reaction-pill {
    padding: 8px 12px;
    min-height: 38px;
  }
  
  .social-strip-bottom .reaction-pill .emoji {
    font-size: 20px;
  }
  
  .social-strip-bottom .reaction-pill .count {
    font-size: 14px;
  }
  
  .social-strip-bottom .reaction-add-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
}

/* ============================================
   ШКАЛА МАСШТАБА (как у Яндекса)
   ============================================ */
.map-scale {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 400;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.map-scale.hidden {
  opacity: 0;
  transform: translateY(-50%) translateX(-20px);
  pointer-events: none;
}

.map-scale-bar {
  width: 2px;
  height: 80px;
  background: rgba(100, 100, 100, 0.6);
  border-radius: 1px;
}

.map-scale-text {
  font-size: 12px;
  font-weight: 500;
  color: rgba(80, 80, 80, 0.7);
  white-space: nowrap;
}

/* Адаптив для маленьких экранов */
@media (max-height: 600px) {
  .map-scale-bar {
    height: 60px;
  }
}

/* =============================================
   POINT POPUP - шторка для точки на карте
   ============================================= */

.point-popup {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 50vh;
  overflow: hidden;
}

.point-popup.open {
  transform: translateY(0);
}

.point-popup-grip {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 10px auto 6px;
}

.point-popup-content {
  padding: 0 16px 20px;
}

.point-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.point-popup-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.point-popup-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
}

.point-popup-close:active {
  background: #e5e7eb;
  color: #374151;
}

.point-popup-address {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.point-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.point-popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

.point-popup-btn:active {
  transform: scale(0.98);
}

.point-popup-btn.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

.point-popup-btn.primary:active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.point-popup-btn.secondary {
  background: #f3f4f6;
  color: #374151;
}

.point-popup-btn.secondary:active {
  background: #e5e7eb;
}

/* Overlay для закрытия по клику вне шторки */
.point-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.point-popup-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* =============================================
   ROUTE INFO - информация о маршруте
   ============================================= */

.route-info {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.route-info.open {
  transform: translateY(0);
  opacity: 1;
}

.route-info-content {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.route-info-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.route-info-duration {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.route-info-distance {
  font-size: 14px;
  color: #6b7280;
}

.route-info-close {
  padding: 10px 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.route-info-close:active {
  background: #e5e7eb;
}


/* ============================================================
   ADD TAB REDESIGN - Google Material Style (v145)
   ============================================================ */

/* Tab padding */
#tab-add { padding: 16px; }

/* Единая карточка формы */
.add-form-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  overflow: visible;
}

/* Секции */
.add-section { padding: 16px; }
.add-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.add-section-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.add-section-row { display: flex; align-items: center; justify-content: space-between; }

/* Разделители */
.add-divider { height: 1px; background: rgba(0,0,0,0.06); margin: 0 16px; }

/* === CATEGORY CHIPS === */
.category-chips-scroll {
  margin: 0 -16px; padding: 0 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
}
.category-chips-scroll::-webkit-scrollbar { display: none; }
.category-chips { display: flex; gap: 8px; padding-bottom: 4px; }

.category-chip {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid rgba(0,0,0,0.1);
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.category-chip:active { transform: scale(0.97); }
.category-chip.active { border-color: transparent; color: #fff; transform: scale(1.02); }

/* Category chip colors */
.category-chip[data-k="COMPLAINT"].active { background: var(--cat-complaint); box-shadow: 0 4px 12px -2px rgba(239,68,68,0.4); }
.category-chip[data-k="IDEA"].active { background: var(--cat-idea); box-shadow: 0 4px 12px -2px rgba(245,158,11,0.4); }
.category-chip[data-k="EVENT"].active { background: var(--cat-event); box-shadow: 0 4px 12px -2px rgba(34,197,94,0.4); }
.category-chip[data-k="LOSTFOUND"].active { background: var(--cat-lostfound); box-shadow: 0 4px 12px -2px rgba(14,165,233,0.4); }
.category-chip[data-k="COMMERCE"].active { background: var(--cat-commerce); box-shadow: 0 4px 12px -2px rgba(99,102,241,0.4); }
.category-chip[data-k="SOCIAL"].active { background: var(--cat-social); box-shadow: 0 4px 12px -2px rgba(236,72,153,0.4); }
.category-chip[data-k="ROAD"].active { background: var(--cat-road); box-shadow: 0 4px 12px -2px rgba(234,88,12,0.4); }
.category-chip[data-k="PODSLUSHANO"].active { background: var(--cat-podslushano); box-shadow: 0 4px 12px -2px rgba(26,26,26,0.4); }

/* === TAG TILES === */
#tab-add #add-tags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; }
#tab-add .tag-tile { width: auto; margin: 0; opacity: 0; animation: addTagFadeIn 0.25s ease-out forwards; }
#tab-add .tag-tile:nth-child(1) { animation-delay: 0ms; }
#tab-add .tag-tile:nth-child(2) { animation-delay: 30ms; }
#tab-add .tag-tile:nth-child(3) { animation-delay: 60ms; }
#tab-add .tag-tile:nth-child(4) { animation-delay: 90ms; }
#tab-add .tag-tile:nth-child(5) { animation-delay: 120ms; }
#tab-add .tag-tile:nth-child(6) { animation-delay: 150ms; }
@keyframes addTagFadeIn { from { opacity: 0; transform: translateY(8px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* === INPUTS === */
.add-row { display: flex; gap: 8px; align-items: stretch; }
.add-input {
  flex: 1; padding: 12px 14px;
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: 12px;
  background: rgba(0,0,0,0.02); font-size: 15px; color: #111;
  transition: all 0.2s ease;
}
.add-input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.add-input::placeholder { color: #9ca3af; }

.add-search-btn {
  width: 48px; min-height: 48px;
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: 12px;
  background: rgba(0,0,0,0.02); color: #6b7280;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.add-search-btn:hover { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.15); }
.add-search-btn:active { transform: scale(0.95); }

.add-hint { margin-top: 8px; font-size: 12px; color: #6b7280; }
.add-hint:empty { display: none; }

/* === TEXTAREA === */
.add-textarea {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid rgba(0,0,0,0.1); border-radius: 12px;
  background: rgba(0,0,0,0.02); font-size: 15px; color: #111;
  resize: vertical; min-height: 80px; font-family: inherit;
  transition: all 0.2s ease; box-sizing: border-box;
}
.add-textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.add-textarea::placeholder { color: #9ca3af; }

/* === ANON === */
.add-anon-label { font-size: 14px; color: #374151; }
#tab-add .add-section-row .switch { margin: 0; }

/* === SUBMIT BUTTON === */
.add-submit-btn {
  width: 100%; margin-top: 16px; padding: 14px;
  border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 4px 12px -2px rgba(37,99,235,0.35);
}
.add-submit-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -2px rgba(37,99,235,0.4); }
.add-submit-btn:active { transform: scale(0.98); }

/* Dynamic submit colors */
.add-submit-btn[data-cat="COMPLAINT"] { background: var(--cat-complaint); box-shadow: 0 4px 12px -2px rgba(239,68,68,0.35); }
.add-submit-btn[data-cat="IDEA"] { background: var(--cat-idea); box-shadow: 0 4px 12px -2px rgba(245,158,11,0.35); }
.add-submit-btn[data-cat="EVENT"] { background: var(--cat-event); box-shadow: 0 4px 12px -2px rgba(34,197,94,0.35); }
.add-submit-btn[data-cat="LOSTFOUND"] { background: var(--cat-lostfound); box-shadow: 0 4px 12px -2px rgba(14,165,233,0.35); }
.add-submit-btn[data-cat="COMMERCE"] { background: var(--cat-commerce); box-shadow: 0 4px 12px -2px rgba(99,102,241,0.35); }
.add-submit-btn[data-cat="SOCIAL"] { background: var(--cat-social); box-shadow: 0 4px 12px -2px rgba(236,72,153,0.35); }
.add-submit-btn[data-cat="ROAD"] { background: var(--cat-road); box-shadow: 0 4px 12px -2px rgba(234,88,12,0.35); }
.add-submit-btn[data-cat="PODSLUSHANO"] { background: var(--cat-podslushano); box-shadow: 0 4px 12px -2px rgba(26,26,26,0.35); }

/* === FOOTER HINT === */
.add-footer-hint { margin-top: 12px; font-size: 12px; color: #9ca3af; text-align: center; line-height: 1.5; }

/* Media slots in new card */
#tab-add .add-section .media-slots { margin-top: 12px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .category-chip, .add-submit-btn, .add-input, .add-textarea, #tab-add .tag-tile { transition: none; animation: none; }
}

/* === ADDRESS AUTOCOMPLETE SUGGESTIONS === */
.add-section-addr { position: relative; }

.addr-suggestions {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(12px + 11px + 48px + 4px); /* padding + label + input + gap */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid rgba(0,0,0,0.08);
}

.addr-suggestions.open { display: block; }

.addr-suggestion {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.15s;
}
.addr-suggestion:last-child { border-bottom: none; }
.addr-suggestion:hover, .addr-suggestion:focus { background: rgba(0,0,0,0.04); }
.addr-suggestion:active { background: rgba(0,0,0,0.08); }

.addr-suggestion__main {
  font-size: 14px;
  color: #111;
  line-height: 1.3;
}
.addr-suggestion__sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}

.addr-suggestions--loading {
  padding: 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* === POPUP CONTENT TRANSITION ANIMATIONS === */
/* Apple Slide style - horizontal slide-in */

@keyframes popupSlideIn {
  0% {
    opacity: 0;
    transform: translateX(30px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes popupScaleIn {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Base state for animated elements */
.popup.transitioning .popup-meta,
.popup.transitioning .text,
.popup.transitioning .clamp-toggle,
.popup.transitioning .road-strip,
.popup.transitioning .social-strip,
.popup.transitioning .feed-strip,
.popup.transitioning .popup-block-content,
.popup.transitioning #p-thanks {
  opacity: 0;
}

/* Media preview - separate animation triggered by JS */
.popup-media-preview.media-animate-in,
.popup-block-media.media-animate-in {
  animation: popupSlideIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

/* Animated entrance - Apple staggered delays */
.popup.animate-in .popup-block-content,
.popup.animate-in .popup-meta {
  animation: popupSlideIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0s;
}

.popup.animate-in .text {
  animation: popupSlideIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0.03s;
}

.popup.animate-in #p-thanks {
  animation: popupSlideIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0.05s;
}

.popup.animate-in .clamp-toggle {
  animation: popupSlideIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0.07s;
}

.popup.animate-in .road-strip,
.popup.animate-in .social-strip,
.popup.animate-in .feed-strip {
  animation: popupSlideIn 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0.1s;
}

/* Address marquee smooth transition */
.popup.animate-in .addr-rect {
  animation: popupSlideIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  animation-delay: 0s;
}

/* Skeleton shimmer for loading state */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.popup .preview-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
  min-height: 180px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .popup.animate-in .popup-meta,
  .popup.animate-in .text,
  .popup.animate-in .clamp-toggle,
  .popup.animate-in .road-strip,
  .popup.animate-in .social-strip,
  .popup.animate-in .feed-strip,
  .popup.animate-in .addr-rect,
  .popup.animate-in .popup-block-content,
  .popup.animate-in #p-thanks,
  .popup-media-preview.media-animate-in,
  .popup-block-media.media-animate-in {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* === TAB SWITCH ANIMATION (Simple Crossfade) === */
.tab {
  transition: opacity 0.25s ease;
}

.tab:not(.active) {
  opacity: 0;
  pointer-events: none;
}

.tab.active {
  opacity: 1;
}

.tab.fade-out {
  opacity: 0;
}

.tab.fade-in {
  animation: tabFadeIn 0.3s ease forwards;
}

@keyframes tabFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* Отключаем для reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tab {
    transition: none;
  }
  .tab.fade-in {
    animation: none;
    opacity: 1;
  }
}

/* ================================================
   LEADERBOARD / РЕЙТИНГ СТИЛИ
   ================================================ */

.pp-lb-content {
  padding: 0 !important;
}

/* === ПОДИУМ === */
.pp-lb-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 24px 12px 20px;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
}

.pp-lb-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  flex-shrink: 0;
}

/* Обёртка аватара */
.pp-lb-avatar-wrap {
  position: relative;
  margin-bottom: 8px;
}

.pp-lb-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  background: #e5e7eb;
}

.pp-lb-place.first .pp-lb-avatar {
  width: 72px;
  height: 72px;
  border-width: 4px;
}

/* Имя с обрезкой */
.pp-lb-name {
  width: 100%;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  margin-bottom: 4px;
}

/* XP */
.pp-lb-xp {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 8px;
}

/* Колонна подиума */
.pp-lb-bar {
  width: 56px;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.3);
}

.pp-lb-bar-num {
  color: white;
  font-weight: 800;
  font-size: 18px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Высота и цвет колонн */
.pp-lb-place.first .pp-lb-bar {
  height: 100px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

.pp-lb-place.second .pp-lb-bar {
  height: 75px;
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

.pp-lb-place.third .pp-lb-bar {
  height: 55px;
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
}

/* === СПИСОК === */
.pp-lb-list {
  background: white;
}

.pp-lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.2s;
}

.pp-lb-item.is-me {
  background: rgba(34, 197, 94, 0.08);
}

.pp-lb-rank {
  width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #9ca3af;
  flex-shrink: 0;
}

.pp-lb-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #e5e7eb;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pp-lb-item-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-lb-you {
  color: #22c55e;
  font-weight: 600;
  margin-left: 4px;
}

.pp-lb-item-xp {
  font-size: 14px;
  font-weight: 700;
  color: #f59e0b;
  flex-shrink: 0;
}

/* === ТЕКУЩИЙ ПОЛЬЗОВАТЕЛЬ (вне топ-20) === */
.pp-lb-current-user {
  padding: 16px;
  border-top: 1px dashed #e5e7eb;
  margin-top: 8px;
}

.pp-lb-current-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

/* === ПУСТОЕ СОСТОЯНИЕ === */
.pp-lb-empty {
  padding: 48px 16px;
  text-align: center;
}

.pp-lb-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.pp-lb-empty p {
  color: #9ca3af;
  font-size: 15px;
}

/* === АДАПТИВ === */
@media (max-width: 360px) {
  .pp-lb-place {
    width: 90px;
  }
  
  .pp-lb-avatar {
    width: 48px;
    height: 48px;
  }
  
  .pp-lb-place.first .pp-lb-avatar {
    width: 60px;
    height: 60px;
  }
  
  .pp-lb-bar {
    width: 48px;
  }
  
  .pp-lb-name {
    font-size: 12px;
  }
}
