:root {
  --lm-blue: #17447A;
  --lm-red: #ed1c24;
  --lm-dark: #06386c;
  --lm-muted: #5d7899;
  --marker-size: 12px;
  --panel-width: 380px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--lm-blue);
  font-family: Arial, Helvetica, sans-serif;
}

.network-app {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 24px 44px;
}

.network-title {
  margin: 0 0 28px;
  text-align: center;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.1;
  color: var(--lm-blue);
  font-weight: 800;
  letter-spacing: .2px;
}

.network-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) var(--panel-width);
  gap: 48px;
  align-items: center;
}

.map-zone { width: 100%; }

.map-canvas {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
  user-select: none;
}

.world-map {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
}

.marker-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  line-height: normal;
}

.map-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--marker-size);
  height: var(--marker-size);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.22));
  z-index: 2;
}

.map-marker::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50% 50% 50% 0;
    background: var(--lm-red);
    transform: rotate(-45deg);
    border: 2px solid #ffffffbf;
}

.map-marker::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
}

.map-marker.is-active {
  z-index: 5;
  --marker-size: 21px;
}

.map-marker.is-dragging { cursor: grabbing; }

.info-panel {
  position: relative;
  min-height: 470px;
  border-left: 3px solid var(--lm-blue);
  padding: 48px 0 28px 32px;
  color: var(--lm-blue);
}

.close-panel {
  position: absolute;
  top: 0;
  left: 32px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #222;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.empty-panel {
  color: #7890aa;
  font-size: 18px;
  margin-top: 48px;
}

.panel-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

#locationTitle {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.15;
  color: var(--lm-blue);
  font-weight: 800;
}

#locationSubtitle {
  margin: 0 0 24px;
  font-size: 18px;
  font-weight: 800;
  color: var(--lm-blue);
}

.flag-img {
  width: 46px;
  max-height: 32px;
  object-fit: cover;
  border: 1px solid #e1e6ef;
}

.logo-box {
  min-height: 56px;
  margin-bottom: 24px;
}

.logo-box img {
  display: block;
  max-width: 220px;
  max-height: 72px;
}

.logo-text {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
}
.logo-text span:first-child { color: var(--lm-blue); }
.logo-text span:last-child { color: var(--lm-red); }
.logo-tagline {
  display: block;
  color: var(--lm-blue);
  font-size: 8px;
  letter-spacing: 3px;
  margin-top: 4px;
}

.contact-info p {
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.45;
  color: #003f7a;
}

.contact-info strong { color: #111; font-weight: 500; }
.contact-info a { color: #004f91; text-decoration: none; }
.contact-info a:hover { text-decoration: underline; }

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-start;
  margin-top: 28px;
}

.btn-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid #d4dce8;
  border-radius: 5px;
  color: #111;
  background: #fff;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
}

.btn-link span { color: var(--lm-red); font-size: 24px; line-height: 1; }

.text-link {
  color: var(--lm-blue);
  font-size: 20px;
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover { text-decoration: underline; }

.edit-toolbar {
  margin-top: 14px;
  padding: 12px;
  background: #fff8e8;
  border: 1px solid #ffe0a3;
  border-radius: 8px;
  line-height: 1.4;
  color: #8a5800;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
 display:none !important;
}

.edit-toolbar select,
.edit-toolbar button {
  min-height: 34px;
  border: 1px solid #d6dce6;
  border-radius: 5px;
  background: #fff;
}

.edit-toolbar button { cursor: pointer; font-weight: 700; color: var(--lm-blue); }

body.edit-mode .map-canvas { outline: 1px dashed rgba(237,28,36,.45); outline-offset: 8px; }

.json-output-wrap {
  margin-top: 22px;
  padding: 16px;
  background: #f6f8fb;
  border: 1px solid #dde5ef;
  border-radius: 8px;
}

#jsonOutput {
  width: 100%;
  height: 260px;
  margin-top: 10px;
  font-family: Consolas, Monaco, monospace;
}

@media (max-width: 1024px) {
  .network-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .info-panel {
    min-height: auto;
    border-left: 0;
    border-top: 3px solid var(--lm-blue);
    padding: 48px 0 0;
  }
  .close-panel { left: 0; }
}

@media (max-width: 640px) {
  .network-app { padding: 26px 14px 34px; }
  #locationTitle { font-size: 23px; }
  #locationSubtitle, .contact-info p { font-size: 16px; }
  .map-marker { --marker-size: 10px; }
  .map-marker.is-active { --marker-size: 12px; }
}

/* Location navigation controls */
.location-controls {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
}

.location-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: stretch;
}

.location-button,
.location-arrow {
  border: 1px solid #d9e3f0;
  background: #fff;
  color: var(--lm-blue);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(23, 68, 122, .08);
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}

.location-button {
  min-width: 112px;
  max-width: 170px;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 999px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.15;
  text-align: center;
}

.location-button-main {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.location-button-sub {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  opacity: .78;
}

.location-button:hover,
.location-arrow:hover,
.location-button.is-active {
  background: var(--lm-blue);
  border-color: var(--lm-blue);
  color: #fff;
}

.location-arrow {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 34px;
  line-height: 1;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-panel-backdrop {
  display: none;
}

@media (max-width: 760px) {
  .network-app {
    padding: 24px 14px 34px;
  }

  .network-title {
    margin-bottom: 18px;
    font-size: 28px;
  }

  .network-layout {
    display: block;
  }

  .map-marker {
    pointer-events: none !important;
  }

  body.edit-mode .map-marker {
    pointer-events: auto !important;
  }

  .location-controls {
    grid-template-columns: 38px 1fr 38px;
    gap: 8px;
    margin-top: 16px;
  }

  .location-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .location-button {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 50px;
    padding: 8px 9px;
    border-radius: 12px;
  }

  .location-button-main {
    font-size: 13px;
  }

  .location-button-sub {
    font-size: 10px;
  }

  .location-arrow {
    width: 38px;
    height: 38px;
    font-size: 28px;
  }

  .mobile-panel-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(3, 19, 38, .45);
    z-index: 99998;
  }

  .info-panel {
    position: fixed;
    left: 14px;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    display: none;
    min-height: 0;
    padding: 48px 20px 22px;
    border-left: 0;
    border-top: 4px solid var(--lm-blue);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(0,0,0,.28);
    z-index: 99999;
  }

  .info-panel.is-open {
    display: block;
  }

  .close-panel {
    top: 12px;
    right: 14px;
    left: auto;
  }

  .empty-panel {
    margin-top: 0;
  }

  #locationTitle {
    font-size: 23px;
  }

  #locationSubtitle,
  .contact-info p {
    font-size: 16px;
  }

  .logo-box img {
    max-width: 180px;
  }
}