/* ===== Responsive: Sidebar oben, Viewer darunter ===== */

/* ----- Breakpoints:  ----- */
@media (max-width: 1500px) {
  .type-grid.cols-4-extras {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 1200px) {
  .swatch-row {
    grid-template-columns: repeat(8, 1fr);
  }

  .type-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .type-tile:not(.viewer-buttons *) {
    aspect-ratio: 4 / 3;
  }

  .floating-window {
    display: none !important;
  }

}

@media (max-width: 900px) {

  #btn-export,
  #btn-import {
    display: none;
  }

  .type-tile__label {
    padding: 4px 6px;
  }
}

@media (max-width: 768px) {

  html, body {
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  /* Die neuen Haupt-Container stapeln */
  #container-3D.is-active,
  #container-2D.is-active {
    display: flex !important;
    flex-direction: column !important;
    height: 100dvh;
    width: 100%;
  }

  /* Sidebar/Panel oben */
  #panel-container, #info-container {
    flex: 0 0 auto !important; /* Nicht starr 50%, sondern nach Inhalt */
    width: 100% !important;
    max-height: 50dvh !important; /* Dein gewünschter Wert */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    border-bottom: 1px solid #ddd;
  }

  /* Viewer/SVG unten */
  #viewer-root, #svg-wrapper {
    flex: 1 1 auto !important;
    min-height: 30dvh !important;
    height: auto;
    background: #f8f8f8;
  }

  /* Deine restlichen Styles bleiben erhalten */
  .panel-tab { padding: 2px 4px; min-height: 40px; }
  .panel-tabs { padding: 0px; }

  #gs-logo {
    max-width: 60px;
    top: 60px; /* Damit es nicht mit den Tabs kollidiert */
    right: 10px;
    opacity: 0.4;
  }

  #btn-undo, #btn-redo, #autosave-status, #btn-export, #btn-import {
    display: none;
  }
}

@media (max-width: 350px) {
  .swatch-row {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .type-grid {
    grid-template-columns: 1fr;
  }

  .viewer-buttons {
    margin-left: 5%;
    width: 90%;
  }


  .type-tile:not(.viewer-buttons *) {
    aspect-ratio: 16 / 11;
  }

  #btn-reset-global {
    display: none;
  }
}

/* Touchgeräte: größere Ziele */
@media (hover: none) {

  /* Tooltip-Container */
  .app-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 320px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: rgba(22, 27, 34, .92);
    color: #fff;
    font: 12px/1.3 system-ui, Arial, sans-serif;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
    pointer-events: none;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity .12s ease;
  }

  .app-tooltip.is-visible {
    opacity: 1;
  }
}