:root {
  --bg: #eef4f8;
  --shell: #f9fcff;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --surface-soft: #f3f8fc;
  --text: #142033;
  --muted: #6b7789;
  --border: rgba(166, 183, 201, 0.42);
  --green: #36b857;
  --green-dark: #16823a;
  --green-soft: rgba(54, 184, 87, 0.2);
  --red: #ea3e3a;
  --red-dark: #bd2725;
  --red-soft: rgba(234, 62, 58, 0.18);
  --blue: #2e8bd8;
  --shadow: 0 22px 64px rgba(48, 74, 104, 0.16);
  --panel-shadow: 0 16px 38px rgba(48, 74, 104, 0.12);
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 0%, rgba(98, 176, 231, 0.22), transparent 32%),
    radial-gradient(circle at 86% 8%, rgba(54, 184, 87, 0.14), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-frame {
  width: min(1240px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 249, 253, 0.96)),
    var(--shell);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-header {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(52px, 8vw, 78px);
  font-weight: 950;
  line-height: 0.9;
  text-align: center;
  text-shadow: 0 10px 26px rgba(48, 74, 104, 0.12);
}

.chrome-button {
  width: 54px;
  height: 54px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(48, 74, 104, 0.1);
}

.menu-button {
  gap: 6px;
}

.menu-button span {
  width: 28px;
  height: 3px;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.info-button {
  justify-self: end;
  font-size: 28px;
  font-weight: 800;
  font-family: Georgia, serif;
}

.intro-card {
  margin-bottom: 20px;
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 12px 30px rgba(48, 74, 104, 0.08);
  text-align: center;
}

.intro-card p {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 2.8vw, 29px);
  font-weight: 520;
  line-height: 1.32;
}

.intro-card p + p {
  margin-top: 6px;
}

.positive-text {
  color: var(--green-dark);
}

.negative-text {
  color: var(--red-dark);
}

.main-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.map-card {
  position: relative;
  min-height: 400px;
  height: clamp(400px, 48vh, 760px);
  overflow: hidden;
  border: 1px solid rgba(150, 170, 190, 0.5);
  border-radius: 26px;
  background: #dfeaf1;
  box-shadow: var(--panel-shadow);
}

.map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map .leaflet-tile {
  filter: saturate(0.86) contrast(0.94) brightness(1.03);
}

/* Critical Leaflet fallback if CDN CSS is delayed or blocked by a local browser policy. */
.leaflet-container {
  position: relative;
  overflow: hidden;
  background: #dce6d4;
  outline: 0;
  touch-action: pan-x pan-y;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-map-pane,
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container {
  transform-origin: 0 0;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
  float: left;
  clear: both;
}

.leaflet-control-zoom {
  margin: 24px 0 0 24px !important;
  overflow: hidden;
  border: 1px solid rgba(125, 145, 166, 0.42) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 12px 28px rgba(48, 74, 104, 0.16);
}

.leaflet-control-zoom a {
  width: 52px !important;
  height: 52px !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, 0.86) !important;
  border-color: rgba(166, 183, 201, 0.42) !important;
  font-size: 34px !important;
  line-height: 48px !important;
}

.locate-button {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 800;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(125, 145, 166, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(48, 74, 104, 0.16);
}

.locate-button span {
  width: 30px;
  height: 30px;
  display: block;
  border: 4px solid var(--text);
  border-radius: 999px;
  position: relative;
}

.locate-button span::before,
.locate-button span::after {
  content: "";
  position: absolute;
  background: var(--text);
}

.locate-button span::before {
  width: 44px;
  height: 4px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.locate-button span::after {
  width: 4px;
  height: 44px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.map-hint {
  position: absolute;
  left: 24px;
  bottom: 24px;
  max-width: calc(100% - 48px);
  z-index: 800;
  padding: 12px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(48, 74, 104, 0.14);
  font-size: 16px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  align-items: stretch;
  gap: 26px;
}

.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(16px);
}

.status-card,
.city-card {
  padding: 24px 28px;
}

.glass-panel h2 {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
  text-transform: uppercase;
}

.status-lines {
  display: grid;
  gap: 0;
}

.status-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid rgba(166, 183, 201, 0.38);
}

.status-line span {
  color: var(--text);
  font-size: 17px;
}

.status-line strong {
  color: var(--green-dark);
  font-size: 24px;
  line-height: 1;
}

.action-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.vo-button {
  min-height: 142px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 0;
  border-radius: 28px;
  color: #ffffff;
  font-size: clamp(34px, 4.6vw, 52px);
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 20px 42px rgba(48, 74, 104, 0.2);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    filter 140ms ease;
}

.vo-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 48px rgba(48, 74, 104, 0.24);
}

.vo-button:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}

.vo-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.vo-up {
  background: linear-gradient(180deg, #65db70, var(--green-dark));
}

.vo-down {
  background: linear-gradient(180deg, #ff5a55, var(--red-dark));
}

.action-help {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

.message {
  min-height: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.35;
  text-align: center;
}

.message.is-error {
  color: var(--red-dark);
}

.message.is-success {
  color: var(--green-dark);
}

.city-list {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(166, 183, 201, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.city-line {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.city-line span {
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
}

.city-line strong {
  font-size: 25px;
  font-weight: 760;
  line-height: 1;
}

.hotspot-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.emoji-panel {
  padding: 22px;
}

.emoji-panel.is-hidden {
  display: none;
}

.emoji-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.emoji-choice {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 18px;
}

.emoji-choice.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46, 139, 216, 0.16);
}

.invite-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 24px;
  align-items: center;
  padding: 26px 28px;
}

.invite-copy h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 23px;
  font-weight: 850;
  text-transform: uppercase;
}

.invite-copy p {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.invite-copy strong {
  color: var(--green-dark);
}

.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 16px;
}

.share-button {
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 20px;
  font-weight: 760;
  box-shadow: 0 14px 30px rgba(48, 74, 104, 0.14);
}

.whatsapp-button {
  background: linear-gradient(180deg, #58d268, #239a40);
}

.telegram-button {
  background: linear-gradient(180deg, #53afe7, #1e79bd);
}

.copy-button {
  background: linear-gradient(180deg, #667386, #344052);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.vo-div-icon {
  background: transparent;
  border: 0;
}

.vo-map-marker {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 0 0 10px rgba(54, 184, 87, 0.14), 0 12px 24px rgba(48, 74, 104, 0.28);
}

.vo-map-marker.up {
  background: var(--green);
  box-shadow: 0 0 0 10px var(--green-soft), 0 12px 24px rgba(48, 74, 104, 0.28);
}

.vo-map-marker.down {
  background: var(--red);
  box-shadow: 0 0 0 10px var(--red-soft), 0 12px 24px rgba(48, 74, 104, 0.28);
}

.leaflet-popup-content {
  margin: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

@media (max-width: 980px) {
  .app-frame {
    width: min(100% - 18px, 760px);
    padding: 16px;
    border-radius: 18px;
  }

  .hero-header {
    grid-template-columns: 46px 1fr 46px;
  }

  .hero-header h1 {
    font-size: clamp(46px, 15vw, 68px);
  }

  .chrome-button {
    width: 46px;
    height: 46px;
  }

  .menu-button span {
    width: 24px;
  }

  .intro-card {
    padding: 16px;
  }

  .intro-card p {
    font-size: 20px;
  }

  .map-card {
    height: 48vh;
    min-height: 360px;
    border-radius: 20px;
  }

  .control-row,
  .invite-panel {
    grid-template-columns: 1fr;
  }

  .action-stack {
    order: -1;
  }

  .vo-button {
    min-height: 108px;
    border-radius: 22px;
  }

  .invite-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-frame {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 12px;
    border-radius: 0;
  }

  .hero-header {
    margin-bottom: 12px;
  }

  .intro-card {
    margin-bottom: 12px;
  }

  .intro-card p {
    font-size: 17px;
  }

  .map-card {
    height: 46vh;
    min-height: 320px;
  }

  .leaflet-control-zoom {
    margin: 14px 0 0 14px !important;
  }

  .leaflet-control-zoom a {
    width: 42px !important;
    height: 42px !important;
    font-size: 28px !important;
    line-height: 39px !important;
  }

  .locate-button {
    top: 14px;
    right: 14px;
    width: 48px;
    height: 48px;
  }

  .locate-button span {
    width: 24px;
    height: 24px;
    border-width: 3px;
  }

  .locate-button span::before {
    width: 34px;
    height: 3px;
  }

  .locate-button span::after {
    width: 3px;
    height: 34px;
  }

  .map-hint {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
    font-size: 13px;
  }

  .control-row {
    gap: 14px;
  }

  .action-buttons {
    gap: 12px;
  }

  .vo-button {
    min-height: 82px;
    gap: 8px;
    font-size: 29px;
    border-radius: 18px;
  }

  .action-help {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 13px;
  }

  .status-card,
  .city-card,
  .invite-panel,
  .emoji-panel {
    padding: 18px;
  }

  .status-line span,
  .invite-copy p {
    font-size: 15px;
  }

  .share-button {
    min-height: 54px;
    font-size: 17px;
  }
}
