/* Mobile */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
  }

  .main-content {
    padding: 0;
    height: 100vh;
  }

  .header {
    display: none;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(26, 35, 50, 0.98), rgba(26, 35, 50, 0.9));
    backdrop-filter: blur(20px);
    z-index: 1500;
    padding: 0 16px;
    box-sizing: border-box;
  }

  .brand--mobile {
    gap: 10px;
  }

  .brand--mobile .brand__name {
    font-size: 18px;
  }

  .map-container {
    border-radius: 0;
    height: 100vh;
    padding-top: 60px;
  }

  #map {
    border-radius: 0;
  }

  .mobile-menu-toggle,
  .mobile-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(26, 35, 50, 0.85);
    border: 1px solid rgba(226, 226, 226, 0.4);
    border-radius: 8px;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(10px);
  }

  .mobile-menu-toggle {
    display: inline-flex;
    padding: 0 10px;
  }

  .mobile-menu-toggle.is-open {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: rgba(226, 226, 226, 0.5);
  }

  .mobile-info-bar {
    display: block;
  }

  /* Sidebar as full-screen overlay on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    background: rgba(26, 35, 50, 0.98);
    backdrop-filter: blur(20px);
    z-index: 2000;
    transform: translateY(100%);
    opacity: 0;
    padding: 20px;
    padding-top: 80px;
    padding-bottom: 24px; /* room for sidebar footer */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.active {
    transform: translateY(0);
    opacity: 1;
  }

  .control-row {
    flex-direction: column;
  }

  #locationInfoGroup {
    display: none;
  }

  .sidebar .control-group {
    background: rgba(52, 73, 94, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
  }

  .sidebar .control-group h3 {
    font-size: 16px;
    margin-bottom: 16px;
  }

  .nav-button, .language-selector {
    font-size: 16px;
    padding: 16px;
    border-radius: 12px;
    min-height: 52px;
  }

  .format-option {
    font-size: 15px;
    padding: 14px;
    min-height: 48px;
  }

  .info-item {
    padding: 12px 0;
  }

  .info-label {
    font-size: 14px;
  }

  .info-value {
    font-size: 15px;
  }

  /* Close button shown only on mobile */
  .mobile-close {
    display: flex;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(231, 76, 60, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  /* (Old sidebar GPS/Share buttons removed; no mobile overrides needed) */

  /* Up button in map controls */
  .leaflet-control-up {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-top: 5px;
    cursor: pointer;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .brand--mobile .brand__name {
    font-size: 17px;
  }

  .mobile-info-bar {
    bottom: 25px;
    left: 12px;
    right: 12px;
    padding: 10px 14px;
  }

  .mobile-info-bar .info-label {
    font-size: 13px;
  }

  .mobile-info-bar .info-value {
    font-size: 14px;
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-header {
    padding: 8px 15px;
  }

  .brand--mobile .brand__name {
    font-size: 15px;
  }

  .map-container {
    padding-top: 40px;
  }

  .mobile-info-bar {
    bottom: 10px;
    padding: 8px 12px;
  }

  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
  }
}

/* Touch-friendly tweaks */
@media (hover: none) and (pointer: coarse) {
  .nav-button, .language-selector, .format-option {
    min-height: 48px;
  }

  .grid-cell {
    stroke-width: 1;
  }
}

/* Desktop styles */
@media (min-width: 1025px) {
  /* (Old sidebar Share button removed on desktop) */

  /* Add spacing above the back (up) button in desktop controls */
  .leaflet-control-up {
    margin-top: 5px;
  }
}
