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

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

  .header {
    display: none;
  }

  .mobile-header {
    display: block;
  }

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

  #map {
    border-radius: 0;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

  /* Sidebar as full-screen overlay on mobile */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--footer-height); /* keep above footer */
    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;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .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;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .mobile-header h1 {
    font-size: 18px;
  }

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

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

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

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

  .mobile-header h1 {
    font-size: 16px;
  }

  .mobile-header p {
    display: none;
  }

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

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

  .mobile-menu-toggle {
    bottom: calc(10px + var(--footer-height));
    right: 10px;
    width: 50px;
    height: 50px;
  }
}

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

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