/* ============================================================
   RoutenKnoten v0.5.111 – styles-mobile.css
   Unter 480px: einspaltig ohne unnötige weiße Ränder.

   REGEL: Alles was auf dem Handy anders als der Basis-Style
   aussehen soll, steht HIER. Keine Abhängigkeit zu Tablet
   oder Desktop. Änderungen hier wirken sich NUR auf Handys aus.
   ============================================================ */

@media (max-width: 479px) {

  /* ----------------------------------------------------------
     LAYOUT: Ansichten-Höhe
  ---------------------------------------------------------- */

  .view {
    height: 100%;
  }

  .view-map,
  #map {
    height: 100%;
  }


  /* ----------------------------------------------------------
     BOTTOM NAVIGATION: Entfernt
  ---------------------------------------------------------- */

  .bottom-nav {
    display: none !important;
  }


  /* ----------------------------------------------------------
     STARTSEITE
  ---------------------------------------------------------- */

  .sm-start {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 12px calc(24px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    text-align: center;
  }

  .sm-start-card {
    padding: 22px 16px;
    border-radius: 24px;
    margin-bottom: 20px;
  }

  .sm-start-card h1 {
    font-size: 25px;
  }

  .sm-search-wrap {
    width: 100%;
    margin-bottom: 20px;
  }

  .sm-search {
    gap: 8px;
  }

  .sm-search input {
    font-size: 15px;
    padding: 13px 14px;
    min-width: 0;
  }

  .sm-search button {
    flex-shrink: 0;
    min-width: 48px;
    padding: 0 12px;
  }

  .sm-actions {
    flex-direction: column;
    gap: 10px;
  }

  .sm-action {
    font-size: 15px;
    padding: 13px 16px;
    border-radius: 50px !important;
  }

  /* Vorschaubild ausblenden */
  .img-preview {
    display: none !important;
  }


  /* ----------------------------------------------------------
     KARTE: Desktop-Toolbar ausblenden
  ---------------------------------------------------------- */

  .desktop-map-controls {
    display: none !important;
  }


  /* ----------------------------------------------------------
     KARTE: Mobile Toolbar (oben)
     Handy-Modus ab v0.5.111: Nur Hamburger + Modus-Toggle.
     Standort und Laden liegen im Seitenmenü.
  ---------------------------------------------------------- */

  .mobile-map-controls {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    z-index: var(--z-controls);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
  }

  /* Hamburger und Modus-Toggle bleiben klickbar */
  .mobile-map-controls #mobileMenuBtn,
  .mobile-map-controls #mobileModeToggleBtn {
    display: inline-flex;
    pointer-events: auto;
  }

  /* Standort, Laden und Titel werden im Menü gezeigt, nicht in der Toolbar */
  .mobile-map-controls #mobileLocateBtn,
  .mobile-map-controls #mobileLoadAreaBtn,
  .mobile-map-controls .mobile-map-title {
    display: none;
  }

  /* ☰ Hamburger-Button */
  #mobileMenuBtn {
    min-width: 74px;
    height: 54px;
    justify-content: center;
    border: 3px solid #111;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: calc(var(--z-menu) - 800);
  }

  /* Das Hamburger-Symbol sitzt etwas höher durch die Schriftmetrik */
  button#mobileMenuBtn span {
    position: relative;
    top: -12px;
    font-size: 2.4rem;
  }

  /* Modus-Toggle-Button */
  #mobileModeToggleBtn {
    width: 58px;
    min-width: 58px;
    height: 58px;
    justify-content: center;
  }


  /* ----------------------------------------------------------
     KARTE: Mobiles Vollbild-Menü (Overlay)
     Basisregeln liegen in styles.css. Hier nur Handy-Anpassungen.
  ---------------------------------------------------------- */

  .mobile-map-menu {
    z-index: var(--z-menu);
    background: rgba(15, 23, 42, .42);
  }

  .mobile-menu-card {
    padding: calc(18px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
    gap: 12px;
  }

  .mobile-menu-head {
    color: #166534;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 4px;
  }

  .mobile-menu-head button {
    border: 0;
    background: #f1f5f9;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }

  /* Menü-Einträge */
  .mobile-menu-card > button,
  .mobile-menu-card button:not(#mobileMenuCloseBtn) {
    width: 100%;
    border: 0;
    border-radius: 22px;
    padding: 15px 16px;
    text-align: left;
    background: #f8fafc;
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    box-shadow: 0 1px 0 rgba(15, 23, 42, .06);
    cursor: pointer;
  }

  .mobile-menu-card button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .mobile-menu-card button:active {
    background: #e2e8f0;
    transform: scale(0.98);
  }

  .mobile-menu-card .emotji {
    font-size: 1.4rem;
  }


  /* ----------------------------------------------------------
     KARTE: Positions-Badge
  ---------------------------------------------------------- */

  .route-info-badge {
    top: 62px;
    max-width: calc(100vw - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
  }


  /* ----------------------------------------------------------
     ROUTENINFO (untere Box)
  ---------------------------------------------------------- */

  .route-info {
    left: 10px;
    right: 10px;
    bottom: 12px;
    max-width: none;
    display: flex;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 16px;
    overflow: visible;
    z-index: var(--z-route-info);
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
  }

  .route-info-total {
    flex: 0 0 auto;
  }

  .route-info-meta {
    flex: 0 0 auto;
  }

  .route-info-list {
    flex: 1 1 100%;
    width: 100%;
    padding: 7px 8px;
    margin-top: 0;
    white-space: normal;
    pointer-events: auto;
    cursor: pointer;
  }

  /* Schriftgrößen je nach Knoten-Dichte */
  .route-info-list.route-list-density-1 {
    font-size: clamp(1.18rem, 4.8vw, 1.55rem);
  }

  .route-info-list.route-list-density-2 {
    font-size: clamp(1.02rem, 4.0vw, 1.30rem);
  }

  .route-info-list.route-list-density-3 {
    font-size: clamp(0.88rem, 3.4vw, 1.08rem);
  }

  .route-info-list.route-list-density-4 {
    font-size: clamp(0.74rem, 2.9vw, 0.94rem);
  }


  /* ----------------------------------------------------------
     ZOOM-BUTTONS (außerhalb der Routeninfo, rechts unten)
  ---------------------------------------------------------- */

  .route-map-zoom-controls {
    right: 36px;
    bottom: 112px;
    gap: 10px;
    z-index: var(--z-map-zoom);
  }

  .route-map-zoom-controls button,
  #routeMapZoomControls button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    font-size: 2rem;
  }


  /* ----------------------------------------------------------
     KNOTENLISTE (Overlay-Panel)
  ---------------------------------------------------------- */

  .route-nodes-sheet {
    padding: 8px;
    align-items: flex-end;
  }

  .route-nodes-card {
    width: calc(100vw - 20px);
    max-height: 78vh;
  }

  .route-node-row {
    min-height: 78px;
    gap: 8px;
    padding: 8px;
  }

  .route-node-jump {
    flex-basis: 96px;
    width: 96px;
    min-width: 96px;
    height: 62px;
    font-size: 1.95rem;
  }

  .route-node-distance {
    font-size: 1rem;
  }

  .route-node-remove {
    flex-basis: 58px;
    width: 58px;
    min-width: 58px;
    height: 58px;
    font-size: 1.6rem;
  }


  /* ----------------------------------------------------------
     SHEET / DIALOG
  ---------------------------------------------------------- */

  .sheet {
    padding: 18px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .sheet-grid {
    flex-direction: column;
  }

  /* Speichern-Dialog und Kontextmenü: 1-spaltig auf Handy */
  .save-choice-grid {
    grid-template-columns: 1fr;
  }

  .save-choice-grid button {
    min-height: 54px;
  }

  .node-context-grid {
    grid-template-columns: 1fr;
  }

  .app-info-sheet {
    max-height: min(84vh, 820px);
  }

  .info-hero {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .info-hero h3 {
    font-size: 20px;
  }

  .info-hero-icon {
    display: block;
    width: 52px;
    height: 52px;
  }

  .app-info-grid {
    grid-template-columns: 1fr;
  }

  .donation-card img {
    width: min(100%, 220px);
    max-height: 220px;
  }

  .license-note,
  .last-modified {
    font-size: 13px;
  }


  /* ----------------------------------------------------------
     TOAST
     Position: oben zentriert (aus styles.css), hier nur
     Überschreibung falls nötig – aktuell keine Änderung.
  ---------------------------------------------------------- */


  /* ----------------------------------------------------------
     NAVIGATIONS-STATUS
  ---------------------------------------------------------- */

  #navigationStatus {
    left: 12px;
    right: 12px;
    bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 12px);
  }


  /* ----------------------------------------------------------
     MODUS-UMSCHALTER (Rad / Wandern)
  ---------------------------------------------------------- */

  .mode-toggle-wrap {
    margin: 0 auto 6px;
  }

  .mode-toggle-btn,
  .mobile-map-controls .mode-toggle-chip {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .mode-toggle-icon {
    font-size: 23px;
  }

  /* Modus-Toggle im Hamburger-Menü ausblenden (er sitzt in der Toolbar) */
  #mobileModeToggleBtn {
    display: none;
  }

}
