/* MIB Audio-to-Tab: compact responsive workspace around the existing engine. */
html,
body {
  background: #090c0e !important;
  color-scheme: dark;
  overflow-x: hidden;
}

body.is-embedded main {
  min-width: 0;
  max-width: none !important;
  background: #090c0e !important;
}

body.is-embedded main > div {
  min-width: 0;
  background-image: none !important;
  box-shadow: none !important;
  border-radius: 8px !important;
}

.at-mobile-selectors {
  display: none;
}

.at-mobile-selectors label {
  color: #9aa6aa;
  font-size: 11px;
  font-weight: 700;
}

.at-mobile-selectors select,
.at-output-switch select {
  min-height: 40px;
  min-width: 0;
  width: 100%;
  border: 1px solid #3a484f;
  border-radius: 5px;
  background: #182024;
  color: #edf1f2;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.at-output-switch {
  display: none;
}

.at-output-panel {
  min-width: 0;
}

.at-output-panel > div {
  min-width: 0;
}

body.is-embedded #sheet-svg {
  min-width: 0 !important;
  width: 100%;
}

body.is-embedded #tab-output {
  min-width: 0;
}

body.is-embedded #fretboard-canvas {
  min-width: 720px !important;
  background-image: none !important;
  box-shadow: none !important;
}

@media (max-width: 720px) {
  body.is-embedded main {
    padding: 9px 7px 18px !important;
    gap: 9px !important;
  }

  body.is-embedded main > div:first-child {
    padding: 10px !important;
  }

  body.is-embedded .at-control-row {
    display: grid !important;
    gap: 9px !important;
    margin-bottom: 9px !important;
    padding-bottom: 9px !important;
  }

  body.is-embedded .at-instrument-strip {
    display: none !important;
  }

  body.is-embedded .at-mobile-selectors {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    order: 1;
  }

  body.is-embedded .at-mobile-selectors > div {
    min-width: 0;
  }

  body.is-embedded .at-action-strip {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px !important;
    width: 100%;
    order: 2;
  }

  body.is-embedded .at-action-strip button {
    min-width: 0;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.is-embedded .at-action-strip #btn-clear-tab,
  body.is-embedded .at-action-strip #btn-copy-tab {
    width: auto;
  }

  body.is-embedded .at-output-switch {
    display: grid;
    gap: 6px;
    padding: 9px 10px;
    border: 1px solid #2a353a;
    border-radius: 8px;
    background: #111719;
  }

  body.is-embedded .at-output-switch label {
    color: #9aa6aa;
    font-size: 11px;
    font-weight: 700;
  }

  body.is-embedded .at-output-panel[hidden] {
    display: none !important;
  }

  body.is-embedded .at-output-panel {
    padding: 11px !important;
  }

  body.is-embedded .at-output-panel h3 {
    max-width: 70%;
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  body.is-embedded .at-output-panel > div:has(> #sheet-svg) {
    min-height: 116px;
  }

  body.is-embedded #song-editor-bar {
    padding: 11px !important;
    gap: 9px !important;
  }

  body.is-embedded #song-editor-bar input,
  body.is-embedded #song-editor-bar select {
    max-width: 100%;
    min-width: 0;
  }

  body.is-embedded #fretboard-canvas {
    min-width: 680px !important;
  }
}

@media (max-width: 420px) {
  body.is-embedded .at-mobile-selectors {
    grid-template-columns: 1fr;
  }

  body.is-embedded .at-action-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.is-embedded #sheet-svg {
    height: 108px;
  }

  /* Keep the live pitch readout inside the narrow viewport. The engine keeps
     its three values; only their presentation becomes a shrinkable grid. */
  body.is-embedded .at-control-row + div > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
    padding-inline: 10px !important;
  }

  body.is-embedded .at-control-row + div > div:last-child > * {
    min-width: 0 !important;
    width: auto !important;
  }

  body.is-embedded .at-control-row + div > div:last-child > .h-8.w-px {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-embedded * {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
