/* ── Visibility helpers ─────────────────────────────────────────── */
.mobile-hidden {
  display: initial !important;
}

.mobile-only {
  display: none !important;
}

.small-screen-only {
  display: none !important;
}

/* ── Desktop (wide > 1024px) ──────────────────────────────────── */
@media screen and (min-width: 1025px) {
  a.button {
    font-size: 28px !important;
    width: 36px;
  }
  a.button.small {
    font-size: 18px !important;
  }

  .ap-speed-inline {
    flex: 0 1 220px;
  }
}

/* ── Tablet / narrow desktop (≤ 1024px) ───────────────────────── */
@media screen and (max-width: 1024px) {
  .small-screen-only {
    display: initial !important;
  }

  header .logo {
    height: 36px;
    max-width: 100px;
    padding: 2px 4px;
  }

  header .semaphore {
    min-width: 36px;
  }

  header h1 {
    font-size: 1.4em;
  }

  /* Buttons in panel: smaller */
  .ap-panel a.button:not(.play) {
    width: 30px;
    height: 32px;
    font-size: 18px !important;
    line-height: 32px !important;
  }

  a.button.small {
    font-size: 14px !important;
  }

  /* Play button in bar */
  .ap-bar .button.play {
    font-size: 24px !important;
  }

  .ap-speed-inline {
    flex: 0 1 160px;
    min-width: 100px;
  }

  header nav .colors label {
    margin: 0;
  }
}

/* ── Mobile (≤ 768px) ─────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  .mobile-only {
    display: initial !important;
  }

  .mobile-hidden {
    display: none !important;
  }

  /* Hide logo and semaphore on mobile */
  header .logo {
    display: none;
  }

  header .semaphore {
    display: none;
  }

  /* Speed inline narrower */
  .ap-speed-inline {
    flex: 0 1 130px;
    min-width: 80px;
  }

  .ap-speed-inline span {
    display: none;
  }

  /* Panel inner stacks vertically */
  .ap-panel-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .ap-panel-inner .sliders-items {
    min-width: 0;
    flex: 1 1 auto;
  }

  .ap-panel-inner .buttons {
    justify-content: center;
    gap: 4px;
    padding: 4px 0;
    margin: 0 !important;
  }

  header.panel-open .ap-panel {
    max-height: 400px;
  }

  header nav .colors {
    flex-direction: row;
    width: 100%;
    justify-content: center;
    gap: 8px;
    height: auto;
  }

  header nav .colors label {
    margin: 4px 0;
  }

  #fileTitle {
    max-width: 100%;
    text-align: center;
  }
}
