html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #0b1220; font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; color: #e5e7eb; }
#map { position: absolute; inset: 0; }

#panel { position: absolute; top: 10px; right: 10px; bottom: 64px; width: 320px; z-index: 1000;
  background: rgba(15, 23, 42, .88); border-radius: 10px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.4); transition: transform .25s, visibility .25s; }
#panel.collapsed { transform: translateX(calc(100% + 20px)); visibility: hidden; }
#feedBtn { display: none; position: absolute; top: 10px; right: 10px; z-index: 1001; height: 44px; padding: 0 14px; border-radius: 22px;
  border: 0; font-size: 15px; font-weight: 600; cursor: pointer; color: #fff;
  background: rgba(28, 28, 30, .72); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 0 .5px rgba(255,255,255,.15); }
#panel.collapsed ~ #feedBtn { display: block; }
#feedBtn:active { transform: scale(.95); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #1f2937; }
.panel-head #stats { flex: 1; color: #94a3b8; font-size: 12px; text-align: right; }
.panel-head button { background: none; border: 0; color: #cbd5e1; font-size: 18px; cursor: pointer; min-width: 40px; height: 40px; }
#feed { overflow-y: auto; flex: 1; }
.msg { padding: 7px 10px; border-bottom: 1px solid #111827; cursor: pointer; white-space: pre-line; font-size: 13px; }
.msg:hover { background: #1e293b; }
.msg .t { color: #64748b; font-size: 11px; margin-bottom: 2px; display: flex; justify-content: space-between; }
.msg.fix { border-left: 3px solid #f97316; } .msg.shot { border-left: 3px solid #ef4444; }
.msg.danger { border-left: 3px solid #eab308; } .msg.safety { border-left: 3px solid #f59e0b; }
.msg.clear, .msg.rocket_clear { border-left: 3px solid #22c55e; opacity: .75; }
.msg.rocket { border-left: 3px solid #dc2626; } .msg.news { opacity: .5; }
.msg.fresh { animation: flash 1.5s; }
@keyframes flash { from { background: #334155; } to { background: transparent; } }

#bar { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 44px; z-index: 1000; display: flex; align-items: center;
  gap: 10px; padding: 0 12px; background: rgba(15, 23, 42, .9); border-radius: 10px; }
#bar button, #bar select { background: #1e293b; color: #e5e7eb; border: 1px solid #334155; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
#bar #live.on { background: #7f1d1d; border-color: #ef4444; }
#slider { flex: 1; accent-color: #f97316; }
#clock { font-variant-numeric: tabular-nums; min-width: 120px; text-align: center; }
#bar label { font-size: 12px; color: #cbd5e1; white-space: nowrap; }

#compass { position: absolute; top: 10px; left: 56px; z-index: 1000; width: 110px; text-align: center;
  background: rgba(15, 23, 42, .85); border-radius: 10px; padding: 6px; }
#compass svg { width: 96px; height: 96px; }
#compass .ring { fill: none; stroke: #334155; stroke-width: 2; }
#compass .n { fill: #64748b; font-size: 11px; text-anchor: middle; }
#compassArrow { fill: #f97316; transition: transform .8s; }
#compassArrow.idle { fill: #334155; }
#compassText { font-size: 12px; color: #cbd5e1; }

.drone { transition: opacity .5s; }
.drone svg { filter: drop-shadow(0 0 3px rgba(0,0,0,.9)); }
.drone .badge { position: absolute; top: -6px; left: 26px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 8px; padding: 0 4px; line-height: 14px; }
.leaflet-tooltip.dt { background: rgba(15,23,42,.95); color: #e5e7eb; border: 1px solid #334155; font-size: 12px; white-space: pre-line; }
.leaflet-control-minimap { border: 2px solid #334155 !important; border-radius: 8px; }

#threats { border-bottom: 1px solid #1f2937; padding: 6px 10px; font-size: 13px; }
#threats:empty { display: none; }
#threats .th { display: flex; justify-content: space-between; padding: 3px 0; cursor: pointer; color: #fde047; }
#threats .th.red { color: #f87171; font-weight: 600; }
.threat { display: flex !important; align-items: center; gap: 3px; width: auto !important; }
.threat .tl { background: rgba(15,23,42,.85); color: #fde047; font-size: 11px; font-weight: 700; padding: 1px 4px; border-radius: 4px; white-space: nowrap; }
.threat .tl.red { color: #fca5a5; }

/* взрывы */
.boom { position: relative; width: 100%; height: 100%; pointer-events: auto; }
.boom b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px;
  animation: boomPulse 1.2s ease-in-out infinite; filter: drop-shadow(0 0 6px #f97316); }
.boom.shot b { font-size: 14px; color: #fff; filter: drop-shadow(0 0 4px #fff); }
.boom i { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; margin: -50% 0 0 -50%; border-radius: 50%;
  border: 3px solid #f97316; animation: boomRing 1.8s ease-out infinite; opacity: 0; }
.boom.infra i { border-color: #ef4444; }
.boom.shot i { border: 2px solid #fff; animation-duration: 1.2s; }
.boom i:nth-child(2) { animation-delay: .6s; } .boom i:nth-child(3) { animation-delay: 1.2s; }
@keyframes boomRing { 0% { transform: scale(.2); opacity: .95; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes boomPulse { 0%, 100% { transform: scale(.85); } 50% { transform: scale(1.2); } }
.msg.impact { border-left: 3px solid #dc2626; background: rgba(127,29,29,.25); opacity: 1; }

/* аэропорты */
.apt { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.apt b { width: 20px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; border: 1px solid #111; }
.apt.closed b { background: #b91c1c; animation: aptBlink 1.6s ease-in-out infinite; }
.apt.open b { background: #15803d; }
.apt span { background: rgba(15,23,42,.85); color: #e5e7eb; font-size: 11px; padding: 1px 4px; border-radius: 4px; }
@keyframes aptBlink { 50% { box-shadow: 0 0 0 5px rgba(239,68,68,.35); } }
#airports { border-bottom: 1px solid #1f2937; padding: 6px 10px; font-size: 13px; }
#airports:empty { display: none; }
#airports .ap { display: flex; justify-content: space-between; padding: 3px 0; cursor: pointer; color: #fca5a5; }
.msg.airport { border-left: 3px solid #60a5fa; }

/* ---------- мини-апп: моя точка (стиль Apple) ---------- */
.hidden { display: none !important; }
#meBtn { position: absolute; right: 15px; top: 208px; z-index: 1001; width: 56px; height: 56px; border-radius: 50%;
  border: 0; font-size: 26px; cursor: pointer; color: #fff;
  background: rgba(28, 28, 30, .72); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 0 .5px rgba(255,255,255,.15); }
#meBtn:active { transform: scale(.92); transition: transform .12s; }

:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) { position: absolute; left: 50%; bottom: 68px; transform: translateX(-50%); z-index: 1002;
  width: min(380px, calc(100vw - 24px)); padding: 14px 18px 18px; border-radius: 22px; color: #f5f5f7;
  background: rgba(28, 28, 30, .78); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 16px 48px rgba(0,0,0,.55), inset 0 0 0 .5px rgba(255,255,255,.12);
  font: 15px/1.4 -apple-system, system-ui, "SF Pro Text", "Segoe UI", sans-serif;
  animation: cardUp .35s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes cardUp { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .grab { width: 36px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.3); margin: 0 auto 10px; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) h3 { margin: 0 0 2px; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .sub { color: rgba(235,235,245,.6); font-size: 13px; margin: 2px 0; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .sub.small { font-size: 11px; margin-top: 10px; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .pill { display: block; width: 100%; margin: 12px 0; padding: 12px; border: 0; border-radius: 14px;
  background: #0a84ff; color: #fff; font: 600 16px -apple-system, system-ui, sans-serif; cursor: pointer; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .pill:active { opacity: .75; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .pill.secondary { background: rgba(255,255,255,.12); }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 4px; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) .row b { color: #0a84ff; font-variant-numeric: tabular-nums; }
:is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) input[type=range] { width: 100%; accent-color: #0a84ff; height: 28px; }
#meThreat:not(:empty) { margin-top: 6px; font-size: 14px; color: #fde047; }
#meThreat.red { color: #ff453a; font-weight: 600; }

/* выключатель как в iOS */
.switch { position: relative; width: 51px; height: 31px; display: inline-block; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: rgba(120,120,128,.32); transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3); transition: transform .25s cubic-bezier(.2,.9,.3,1.1); }
.switch input:checked + i { background: #30d158; }
.switch input:checked + i::after { transform: translateX(20px); }

/* маркер «я здесь» — синяя точка с пульсом, как в Картах Apple */
.meDot { position: relative; }
.meDot b { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.meDot i { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: rgba(10,132,255,.45); animation: mePulse 2.4s ease-out infinite; }
@keyframes mePulse { 0% { transform: scale(1); opacity: .8; } 70% { transform: scale(3.4); opacity: 0; } 100% { opacity: 0; } }

#mePickHint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1002;
  padding: 10px 18px; border-radius: 20px; color: #fff; font: 600 14px -apple-system, system-ui, sans-serif;
  background: rgba(10,132,255,.92); box-shadow: 0 8px 24px rgba(0,0,0,.4); white-space: nowrap; }
.picking { cursor: crosshair !important; }

/* телефон / окно Telegram */
@media (max-width: 640px) {
  #panel { width: min(320px, 82vw); }
  #bar { height: auto; flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; gap: 8px; scrollbar-width: none; }
  #clock { min-width: 90px; font-size: 12px; }
  #compass { display: none; }
}

/* ---------- метки очевидцев ---------- */
#repBtn { position: absolute; right: 8px; top: 64px; z-index: 1001; width: 70px; height: 64px;
  border: 0; padding: 0; display: grid; place-items: center; cursor: pointer; background: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); -webkit-tap-highlight-color: transparent; }
#repBtn svg { display: block; }
#repBtn:active { transform: scale(.92); transition: transform .12s; }
#repCard { max-height: calc(var(--tg-viewport-stable-height, 100vh) - 150px); overflow-y: auto; overscroll-behavior: contain; }
.cardX { position: sticky; top: 0; float: right; z-index: 2; width: 36px; height: 36px; margin: -4px -8px -36px 0; border: 0; border-radius: 50%;
  cursor: pointer; color: #f5f5f7; font-size: 16px; line-height: 36px; padding: 0; background: rgba(120,120,128,.36); }
.cardX:active { transform: scale(.9); }
#repCard .warn { background: rgba(255,69,58,.14); border: 1px solid rgba(255,69,58,.45); border-radius: 14px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
#repCard .warn b:first-child { color: #ff6961; font-size: 16px; }
#repCard .warn p { margin: 6px 0; }
#repCard .lbl { margin: 12px 0 6px; font-size: 13px; color: rgba(235,235,245,.6); }
#repCard .seg { display: flex; flex-wrap: wrap; gap: 6px; }
#repCard .seg button { flex: 1 1 auto; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 12px; cursor: pointer;
  color: #f5f5f7; background: rgba(255,255,255,.1); font: 14px -apple-system, system-ui, sans-serif; }
#repCard .seg.dirs button { flex: 1 1 18%; }
#repCard .seg button.on { background: #0a84ff; }
#repCard .chk { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
#repCard .chk input { width: 20px; height: 20px; accent-color: #0a84ff; }
#repCard .pill:disabled { opacity: .4; }
#repMsg.err { color: #ff6961; }
#repMsg.ok { color: #30d158; }
#repWhere { margin-top: 6px; font-size: 14px; }
#repWhere.ok { color: #30d158; font-weight: 600; }
#repWhere.err { color: #ff6961; }

/* свои метки «Я видел» */
.mineDot { position: relative; }
.mineDot b { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; font-size: 15px;
  background: rgba(28,28,30,.85); box-shadow: 0 0 0 2px #ff9f0a, 0 2px 8px rgba(0,0,0,.5); }
.mineDot s { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -27px 0 0 -6px; transform-origin: 6px 27px;
  border: 6px solid transparent; border-bottom: 10px solid #ff9f0a; border-top: 0; }
.minePop .leaflet-popup-content { font: 14px/1.4 -apple-system, system-ui, sans-serif; }
.minePop .mineNote { color: #666; font-size: 12px; }

/* «Написать нам» */
#fbCard .seg { display: flex; gap: 6px; margin: 12px 0 8px; }
#fbCard .seg button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; cursor: pointer; color: #f5f5f7;
  background: rgba(255,255,255,.1); font: 14px -apple-system, system-ui, sans-serif; }
#fbCard .seg button.on { background: #0a84ff; }
#fbText { width: 100%; box-sizing: border-box; resize: vertical; min-height: 110px; padding: 10px 12px; border: 0; border-radius: 12px;
  color: #f5f5f7; background: rgba(255,255,255,.1); font: 16px/1.35 -apple-system, system-ui, sans-serif; }
#fbText:focus { outline: 2px solid #0a84ff; }
#fbMsg.ok { color: #30d158; }
#fbCard .row { gap: 10px; align-items: flex-start; }
#fbCount { white-space: nowrap; }
#fbMsg.err { color: #ff6961; }

/* карточка обозначения на карте (телефон: по нажатию вместо всплывающей подсказки) */
#infoText { white-space: pre-line; font-size: 14px; line-height: 1.45; max-height: 42vh; overflow-y: auto; padding-right: 30px; overscroll-behavior: contain; }
#followBtn { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1001; height: 40px; padding: 0 16px;
  border: 0; border-radius: 20px; cursor: pointer; color: #fff; font: 600 14px -apple-system, system-ui, sans-serif;
  background: rgba(28, 28, 30, .78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4), inset 0 0 0 1px rgba(249,115,22,.7); }
#tgBar { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 1002; width: min(400px, calc(100vw - 20px));
  padding: 10px; border-radius: 16px; background: rgba(28, 28, 30, .94); color: #c9ccd3; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  font: 13px -apple-system, system-ui, sans-serif; }
#tgBar a { display: block; margin-right: 44px; padding: 12px 8px; border-radius: 12px; background: #2a9df4; color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; }
#tgBar div { margin-top: 7px; }
#tgBar .small { margin-top: 3px; font-size: 11px; opacity: .7; }
#tgBar.live a { background: #e0532f; }
#tgBarSub b { color: #fff; }
#tgMini.live { background: #e0532f; animation: tgPulse 1.6s ease-in-out infinite; }
@keyframes tgPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,83,47,.7); } 50% { box-shadow: 0 0 0 12px rgba(224,83,47,0); } }
#tgBarX { position: absolute; right: 8px; top: 10px; width: 40px; height: 42px; border: 0; background: none; color: #c9ccd3; font-size: 18px; cursor: pointer; }
#tgMini { position: absolute; left: 10px; top: 132px; z-index: 1001; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: #2a9df4; font-size: 20px; text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
#followBtn:active { transform: translateX(-50%) scale(.95); }

/* лента и карточки прокручиваются сами, не утягивая страницу (и Telegram) за пальцем */
#feed, :is(#meCard, #repCard, #fbCard, #infoCard, #hearCard) { overscroll-behavior: contain; }
:is(#meCard, #repCard) a { color: #64d2ff; }

#stale { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 1003; width: max-content; max-width: calc(100vw - 24px);
  padding: 9px 14px; border-radius: 10px; background: #b45309; color: #fff; font-weight: 600; font-size: 14px; text-align: center; pointer-events: none; }

#hearBtn { position: absolute; right: 15px; top: 140px; z-index: 1001; width: 56px; height: 56px; border-radius: 50%; border: 2px solid #f97316;
  background: rgba(28,28,30,.85); font-size: 26px; cursor: pointer; }
/* правая колонка кнопок: «Лента» → «Я видел» → «Слышу» → «Моя точка» (шаг 68 px, круглые 56 px по одной оси). Открыта лента на широком экране — колонка встаёт левее неё */
@media (min-width: 641px) {
  #panel:not(.collapsed) ~ #repBtn { right: 338px; top: 6px; }
  #panel:not(.collapsed) ~ #hearBtn { right: 345px; top: 82px; }
  #panel:not(.collapsed) ~ #meBtn { right: 345px; top: 150px; }
}
@media (max-width: 640px) {   /* на телефоне открытая лента закрывает правую часть — кнопки прячем */
  #panel:not(.collapsed) ~ #repBtn, #panel:not(.collapsed) ~ #hearBtn, #panel:not(.collapsed) ~ #meBtn { display: none; }
}
#hearBtn:active { transform: scale(.92); }
#hearDeg { text-align: center; font-size: 24px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
#hearRec { display: block; width: 96px; height: 96px; margin: 8px auto; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: 40px; cursor: pointer; }
#hearRec:disabled { background: #475569; }
#hearRec.on { animation: hearPulse 1s ease-in-out infinite; }
@keyframes hearPulse { 50% { transform: scale(1.06); } }
#hearLevel { height: 6px; margin: 4px 20px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
#hearLevel i { display: block; height: 100%; width: 0; background: #22c55e; }
.hearDot b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(249,115,22,.9); font-size: 16px; border: 2px solid #fff; }

#aboutMap { flex: none; padding: 8px 12px 10px; border-top: 1px solid rgba(255,255,255,.08); color: rgba(235,235,245,.55); font-size: 11px; line-height: 1.4; }
#aboutMap h1 { margin: 0 0 3px; font-size: 12px; font-weight: 600; color: rgba(235,235,245,.75); }
#aboutMap p { margin: 3px 0; }
#aboutMap a { color: #64d2ff; text-decoration: none; }
