/* Аэропорты России — тёмный минимализм в духе Apple HIG */

:root {
  --bg: #000;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.095);
  --surface-3: rgba(255, 255, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.98);
  --text-2: rgba(235, 235, 245, 0.62);
  --text-3: rgba(235, 235, 245, 0.34);
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --gray: #98989d;
  --radius: 20px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.4, 1);
  --dur: 420ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  background-image: radial-gradient(120% 44% at 50% 0%, rgba(120, 140, 255, 0.045), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

::selection { background: rgba(48, 209, 88, 0.35); }

:focus-visible {
  outline: 2px solid rgba(48, 209, 88, 0.65);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- шапка ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.68);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 0.5px solid var(--hairline);
}

.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 15px clamp(16px, 4vw, 28px) 13px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px 24px;
  align-items: center;
}

.brand h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  font-size: clamp(19px, 2.4vw, 23px);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand h1 span { color: var(--text-2); font-weight: 600; }

.live {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.8);
  animation: pulse 2.4s var(--ease) infinite;
}
.live--off .live-dot { background: var(--gray); box-shadow: none; animation: none; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.72); opacity: 0.65; }
}

.counters { display: flex; gap: 8px; }
.counter {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 14px;
  background: var(--surface);
  border: 0.5px solid transparent;
  transition: background 220ms var(--ease), transform 220ms var(--spring),
              border-color 220ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.counter:hover { background: var(--surface-2); }
.counter:active { transform: scale(0.95); }
.counter b {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.counter i { font-style: normal; font-size: 12.5px; color: var(--text-2); letter-spacing: -0.01em; }
.counter--closed b { color: var(--red); }
.counter--open b { color: var(--green); }
.counter.is-active { border-color: rgba(255, 255, 255, 0.22); background: var(--surface-2); }

.controls { display: flex; gap: 10px; align-items: center; }

/* поиск */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 12px;
  width: 15px; height: 15px;
  fill: var(--text-3);
  pointer-events: none;
  transition: fill 200ms var(--ease);
}
.search:focus-within svg { fill: var(--text-2); }
.search input {
  width: clamp(170px, 21vw, 240px);
  padding: 9px 32px 9px 34px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: background 220ms var(--ease), box-shadow 220ms var(--ease),
              width 320ms var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus {
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.25);
}
@media (min-width: 901px) {
  .search input:focus { width: clamp(210px, 24vw, 280px); }
}
.search input::-webkit-search-cancel-button { display: none; }
#searchClear {
  position: absolute;
  right: 9px;
  display: flex;
  padding: 2px;
  transition: transform 160ms var(--spring);
}
#searchClear:active { transform: scale(0.85); }
#searchClear svg { position: static; width: 15px; height: 15px; fill: var(--text-3); }
#searchClear:hover svg { fill: var(--text-2); }

/* сегментированный контрол — как в iOS */
.segmented {
  position: relative;
  display: flex;
  padding: 2.5px;
  border-radius: 12px;
  background: var(--surface);
}
.segmented button {
  position: relative;
  z-index: 1;
  padding: 7px 18px;
  font-size: 13.5px;
  font-weight: 590;
  color: var(--text-2);
  border-radius: 10px;
  transition: color 240ms var(--ease), transform 160ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.segmented button:active { transform: scale(0.96); }
.segmented button[aria-selected="true"] { color: var(--text); }
.segmented-thumb {
  position: absolute;
  top: 2.5px; bottom: 2.5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform var(--dur) var(--spring), width var(--dur) var(--spring);
}

/* ---------- основной контент ---------- */

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; }

.view { padding: 24px clamp(16px, 4vw, 28px) 34px; }
.view.is-entering { animation: viewIn 460ms var(--ease); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

/* список */
.group { margin-bottom: 34px; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 2px 13px;
}
.group-head h2 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.group-head .n { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.group-head .dot { width: 8px; height: 8px; align-self: center; animation: none; }
.group-note {
  font-size: 12.5px;
  color: var(--text-3);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}
.cards-rich { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* карточка «недоступен сейчас» — с акцентной кромкой и пилюлей статуса */
.card.card--rich {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 15px 17px 12px 19px;
}
.card--rich::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.card--restricted::before { background: var(--red); box-shadow: 0 0 12px rgba(255, 69, 58, 0.5); }
.card--partial::before { background: var(--yellow); box-shadow: 0 0 12px rgba(255, 214, 10, 0.45); }

.rich-top { display: flex; align-items: center; gap: 9px; }
.rich-city {
  flex: 1;
  min-width: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 17px;
  font-weight: 690;
  letter-spacing: -0.022em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill {
  flex: none;
  padding: 3.5px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 640;
  letter-spacing: -0.005em;
}
.pill--restricted { color: #ff6b60; background: rgba(255, 69, 58, 0.14); }
.pill--partial { color: var(--yellow); background: rgba(255, 214, 10, 0.13); }

.rich-sub {
  display: block;
  margin: 2px 0 0 19px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rich-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 0.5px solid var(--hairline);
}
.rich-ago { font-size: 12.5px; font-weight: 620; letter-spacing: -0.01em; }
.rich-since { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* свёрнутая строка «Закрыты давно» */
.closed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 0.5px solid transparent;
  transition: background 200ms var(--ease), border-color 200ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.closed-row:hover { background: var(--surface-2); border-color: var(--hairline); }
.closed-row .chev {
  flex: none;
  width: 11px; height: 11px;
  color: var(--text-3);
  transition: transform 260ms var(--spring);
}
.closed-row.is-open .chev { transform: rotate(90deg); }
.closed-row b { font-size: 14.5px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; }
.closed-row .badge {
  flex: none;
  min-width: 21px;
  text-align: center;
  padding: 1.5px 6px;
  border-radius: 7px;
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 640;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.closed-note {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.closed-names {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-2);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cards-closed { margin-top: 10px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  min-height: 62px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 0.5px solid transparent;
  transition: background 220ms var(--ease), transform 220ms var(--spring),
              border-color 220ms var(--ease), box-shadow 220ms var(--ease);
  -webkit-tap-highlight-color: transparent;
  animation: cardIn 440ms var(--ease) backwards;
}
.card:hover {
  background: var(--surface-2);
  border-color: var(--hairline);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}
.card:active { transform: scale(0.975); box-shadow: none; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card .dot { flex: none; }
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.dot--open { background: var(--green); box-shadow: 0 0 10px rgba(48, 209, 88, 0.5); }
.dot--restricted {
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 69, 58, 0.65);
  animation: pulse 1.9s var(--ease) infinite;
}
.dot--closed { background: rgba(255, 69, 58, 0.4); }
.dot--partial {
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(255, 214, 10, 0.5);
}

.card-main { flex: 1; min-width: 0; }
.card-city {
  display: block;
  font-weight: 640;
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--text-2);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-side { text-align: right; flex: none; line-height: 1.35; }
.card-status { font-size: 12.5px; font-weight: 620; letter-spacing: -0.005em; }
.card-status--open { color: var(--green); }
.card-status--restricted { color: var(--red); }
.card-status--closed { color: rgba(255, 99, 90, 0.75); }
.card-status--partial { color: var(--yellow); }
.card-time { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.empty {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 15px;
}

/* ---------- карта ---------- */

.view--map { padding-top: 14px; }

.map-wrap {
  position: relative;
  border-radius: 24px;
  background:
    radial-gradient(90% 90% at 50% 8%, rgba(125, 145, 255, 0.05), transparent 60%),
    radial-gradient(120% 130% at 50% 0%, #0b0b0d 0%, #050506 100%);
  border: 0.5px solid var(--hairline);
  overflow: hidden;
  height: min(72dvh, 660px);
  touch-action: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#mapSvg { width: 100%; height: 100%; display: block; cursor: grab; }
#mapSvg.is-panning { cursor: grabbing; }
#mapSvg g.viewport.is-animating { transition: transform 300ms var(--ease); }

.land {
  fill: rgba(255, 255, 255, 0.052);
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.ap { cursor: pointer; transition: opacity 220ms var(--ease); }
.ap circle { transition: r 180ms var(--ease); }
.ap .core { stroke: rgba(0, 0, 0, 0.55); stroke-width: 0.8; vector-effect: non-scaling-stroke; }
.ap .halo { opacity: 0; transition: opacity 200ms var(--ease); }
.ap:hover .halo, .ap.is-hl .halo { opacity: 0.32; }
.ap--restricted .ring, .ap--partial .ring {
  fill: none;
  stroke-width: 1.2;
  animation: ringPulse 2.2s var(--ease) infinite;
  transform-origin: center;
  transform-box: fill-box;
}
.ap--restricted .ring { stroke: var(--red); }
.ap--partial .ring { stroke: var(--yellow); animation-duration: 2.8s; }
@keyframes ringPulse {
  0% { transform: scale(0.6); opacity: 0.85; }
  75% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}
.ap.is-dim { opacity: 0.15; }

.ap-label {
  fill: rgba(255, 255, 255, 0.88);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.8);
  stroke-width: 3px;
  pointer-events: none;
}

.map-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 13px));
  animation: tipIn 200ms var(--spring);
}
@keyframes tipIn {
  from { opacity: 0; transform: translate(-50%, calc(-100% - 8px)) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, calc(-100% - 13px)) scale(1); }
}
.map-tip b { display: block; font-size: 13px; font-weight: 650; letter-spacing: -0.015em; }
.map-tip span { color: var(--text-2); font-size: 11.5px; }

.map-zoom {
  position: absolute;
  right: 13px;
  top: 13px;
  display: flex;
  flex-direction: column;
  border-radius: 13px;
  overflow: hidden;
  background: rgba(28, 28, 30, 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 0.5px solid var(--hairline);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}
.map-zoom button {
  width: 40px; height: 38px;
  font-size: 19px;
  font-weight: 450;
  color: var(--text-2);
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.map-zoom button:hover { background: var(--surface-2); color: var(--text); }
.map-zoom button:active { background: var(--surface-3); }
.map-zoom button:first-child { border-bottom: 0.5px solid var(--hairline); }

.map-legend {
  position: absolute;
  left: 13px;
  bottom: 13px;
  display: flex;
  gap: 13px;
  padding: 8px 14px;
  border-radius: 100px;
  background: rgba(28, 28, 30, 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 0.5px solid var(--hairline);
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: -0.005em;
}
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-legend .dot { width: 7px; height: 7px; animation: none; box-shadow: none; }

/* ---------- карточка аэропорта (sheet) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 340ms var(--ease);
}
.sheet-backdrop.is-open { opacity: 1; }

.sheet {
  position: fixed;
  z-index: 61;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100vw - 32px));
  max-height: min(78dvh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 26px;
  background: rgba(24, 24, 26, 0.88);
  -webkit-backdrop-filter: saturate(170%) blur(30px);
  backdrop-filter: saturate(170%) blur(30px);
  border: 0.5px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
  transform: translate(-50%, -50%) scale(0.93);
  opacity: 0;
  transition: transform 400ms var(--spring), opacity 300ms var(--ease);
}
.sheet.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.sheet.is-dragging { transition: none; }

.sheet-grip { display: none; }

.sheet-close {
  position: absolute;
  top: 15px; right: 15px;
  z-index: 2;
  width: 29px; height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  transition: background 160ms var(--ease), transform 160ms var(--spring);
}
.sheet-close:hover { background: var(--surface-3); }
.sheet-close:active { transform: scale(0.88); }
.sheet-close svg { width: 14px; height: 14px; fill: var(--text-2); }

.sheet-body { padding: 28px 26px 22px; }

.sh-code {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.09em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.sh-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 3px 0 0;
}
.sh-sub { color: var(--text-2); font-size: 14px; margin-top: 1px; letter-spacing: -0.01em; }

.sh-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 20px;
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.sh-status .dot { width: 11px; height: 11px; }
.sh-status-text b { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.sh-status-text span { font-size: 12.5px; color: var(--text-2); }
.sh-status--restricted { background: rgba(255, 69, 58, 0.12); }
.sh-status--restricted b { color: var(--red); }
.sh-status--closed { background: rgba(255, 69, 58, 0.07); }
.sh-status--closed b { color: rgba(255, 105, 97, 0.9); }
.sh-status--open { background: rgba(48, 209, 88, 0.11); }
.sh-status--open b { color: var(--green); }
.sh-status--partial { background: rgba(255, 214, 10, 0.1); }
.sh-status--partial b { color: var(--yellow); }

.sh-note { margin-top: 10px; font-size: 13px; color: var(--text-2); }

.sh-history { margin-top: 22px; }
.sh-history h3 {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.sh-history ul { list-style: none; }
.sh-history li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 2px;
  border-top: 0.5px solid var(--hairline);
  font-size: 13.5px;
  letter-spacing: -0.01em;
}
.sh-history li span:last-child {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  white-space: nowrap;
}
.sh-history .hi--restricted { color: var(--red); }
.sh-history .hi--open { color: var(--green); }
.sh-history .hi--partial { color: var(--yellow); }

.sh-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 0.5px solid var(--hairline);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.55;
}

/* ---------- подвал, бейдж ---------- */

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 28px) calc(22px + env(safe-area-inset-bottom));
  width: 100%;
}
.foot p { font-size: 12px; color: var(--text-3); letter-spacing: -0.005em; }

.demo-badge {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 7px 15px;
  border-radius: 100px;
  background: rgba(255, 159, 10, 0.15);
  border: 0.5px solid rgba(255, 159, 10, 0.3);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* ---------- планшет ---------- */

@media (max-width: 900px) {
  .top-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand counters" "controls controls";
  }
  .brand { grid-area: brand; }
  .counters { grid-area: counters; }
  .controls { grid-area: controls; }
  .search { flex: 1; }
  .search input { width: 100%; }
}

/* ---------- телефон ---------- */

@media (max-width: 600px) {
  body { font-size: 14.5px; }

  .top-inner {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "counters" "controls";
    gap: 11px;
    padding-top: 12px;
    padding-bottom: 11px;
  }
  .brand { display: block; }
  .brand h1 { font-size: 21px; }
  .live { margin-top: 3px; }
  .counters { width: 100%; }
  .counter { flex: 1; justify-content: center; padding: 8px 10px; border-radius: 13px; }
  .counter b { font-size: 19px; }
  .counter i { font-size: 12px; }
  .segmented { flex: none; }
  .segmented button { padding: 7px 14px; }

  .view { padding-top: 18px; }
  .group { margin-bottom: 28px; }

  /* липкие заголовки секций под шапкой */
  .group-head {
    position: sticky;
    top: 148px; /* высота шапки; уточняется из JS переменной */
    top: calc(var(--top-h, 148px));
    z-index: 10;
    margin: 0 -4px 8px;
    padding: 7px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.72);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }
  .group-head h2 { font-size: 18px; }

  /* сгруппированный список как в iOS (работают / закрытые) */
  .cards-open, .cards-closed {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
  }
  .cards-open .card, .cards-closed .card {
    width: 100%;
    border-radius: 0;
    background: transparent;
    border: 0;
    border-bottom: 0.5px solid var(--hairline);
    padding: 13px 15px;
    min-height: 60px;
    animation: none;
  }
  .cards-open .card:last-child, .cards-closed .card:last-child { border-bottom: 0; }
  .card:hover { transform: none; box-shadow: none; }
  .cards-open .card:hover, .cards-closed .card:hover { background: transparent; }
  .card:active { transform: none; background: var(--surface-2); transition-duration: 60ms; }

  /* «недоступны сейчас» — отдельные карточки во всю ширину */
  .cards-rich { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .group-note { display: none; }

  /* строка «Закрыты давно»: имена переносятся на вторую строку */
  .closed-row { flex-wrap: wrap; row-gap: 4px; padding: 12px 14px; }
  .closed-names {
    flex-basis: 100%;
    text-align: left;
    white-space: normal;
    padding-left: 21px;
    line-height: 1.5;
  }

  .map-wrap {
    height: calc(100dvh - var(--top-h, 190px) - 76px);
    min-height: 380px;
    border-radius: 20px;
  }
  .map-legend {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 5px 12px;
    padding: 7px 12px;
    font-size: 11px;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 14px;
  }
  .map-legend span { white-space: nowrap; }
  .map-zoom { display: none; }

  /* карточка становится нижним листом со свайпом */
  .sheet {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-height: 84dvh;
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    transform: translateY(100%);
    transition: transform 440ms var(--spring), opacity 300ms var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sheet.is-open { transform: translateY(0); }
  .sheet-grip {
    display: block;
    position: sticky;
    top: 0;
    width: 40px; height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.24);
    margin: 9px auto 0;
  }
  .sheet-body { padding-top: 16px; }
  .foot p { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
