@media only screen and (max-width: 850px) {
  :root {
    --header-height: 60px;
    --tabbar-height: 75px;
  }

  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed; /* Verhindert das "Wackeln" der App */
    width: 100%;
    background-color: #f2f2f7;
  }

  /* Der fixierte Header oben */
  .app-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--header-height) + env(safe-area-inset-top));
    background: #fff;
    display: flex;
    align-items: flex-end; /* Text nach unten an den Header-Rand */
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    z-index: 2000;
  }

  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 5px;
  }

  /* Der Scroll-Bereich dazwischen */
  main.app-content {
    position: absolute;
    top: calc(var(--header-height) + env(safe-area-inset-top));
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
  }

  /* Die fixierte Tab-Bar unten */
  .tab-bar {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
    background: transparent;
    display: flex;
    justify-content: space-around;
    align-items: flex-start; /* Symbole oben in der Leiste halten */
    padding-top: 25px;
    border-top: 0px solid #ddd;
    z-index: 5000; /* Ganz wichtig! */
    padding-bottom: env(safe-area-inset-bottom); /* Platz für den Home-Balken beim iPhone */
  }


  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #8e8e93;
    font-size: 0.7rem;
  }
  .tab-item.active { color: #007AFF; }
  .tab-item i { font-size: 1.4rem; margin-bottom: 3px; }

}
