@media (min-width: 1024px) {
  html, body {
    height: 100vh;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden !important;
    padding: 0;
    margin: 0;
  }
  body > .container,
  .container.mx-auto.p-4.flex.flex-col.h-screen {
    height: 100vh !important;
    min-height: 0 !important;
    max-height: 100vh !important;
    display: flex;
    flex-direction: column;
  }
  .flex-1.flex.gap-2.min-h-0,
  .flex-1.flex {
    flex: 1 1 0%;
    min-height: 0;
    max-height: 100%;
    height: 100%;
  }
}
@media (max-width: 1023px) {
  /* Stack left/right panes vertically */
  .responsive-stack {
    flex-direction: column !important;
    gap: 1rem !important;
  }
  .responsive-half {
    width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 1rem;
    flex: 1 1 0%;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
  }
  .responsive-stack {
    height: 100%;
    min-height: 0;
  }
  .font-list-popup {
    display: none;
    position: fixed;
    left: 0; right: 0; top: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 50;
    align-items: center;
    justify-content: center;
  }
  .font-list-popup.active {
    display: flex;
  }
  .font-list-popup-content {
    background: #fff;
    border-radius: 0.5rem;
    max-height: 80vh;
    width: 90vw;
    overflow-y: auto;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
    padding: 1rem;
  }
  .font-list-trigger {
    display: block !important;
    border-left: 0 !important;
    border-right: none !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
    margin-right: auto !important;
    margin-left: 0 !important;
    order: -1;
    align-self: flex-start;
  }
  /* Ensure both triggers are first in their flex row on mobile */
  .responsive-half > .flex {
    /*flex-direction: row !important;*/
  }
  .responsive-half > .flex > .font-list-trigger {
    order: -1 !important;
  }
  .responsive-half > .flex > textarea {
    order: 0;
  }
  .responsive-half > .flex > .font-list-inline {
    order: 1;
  }
  .font-list-inline {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .font-list-popup, .font-list-trigger {
    display: none !important;
  }
  .font-list-inline {
    display: flex !important;
  }
}
