.mfs-app,
.mfs-app * {
  box-sizing: border-box;
}

.mfs-app {
  --mfs-blue: #0051de;
  --mfs-orange: #f35600;
  position: fixed !important;
  z-index: 2147483000;
  inset: 0;
  display: block;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 !important;
  padding: clamp(18px, 3vw, 38px);
  border: 0;
  border-radius: 0;
  background: #17191f;
  color: #f6f7fb;
  font: 400 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: left;
  box-shadow: none;
  -webkit-overflow-scrolling: touch;
}

body.mfs-page-only {
  overflow: hidden !important;
}

body.mfs-page-only > :not(.mfs-app):not(#wpadminbar) {
  visibility: hidden !important;
}

body.mfs-page-only.admin-bar #wpadminbar {
  z-index: 2147483001;
}

.admin-bar .mfs-app {
  top: 32px;
  height: calc(100dvh - 32px);
}

.mfs-app [hidden] {
  display: none !important;
}

.mfs-app button,
.mfs-app input {
  font: inherit;
}

.mfs-app button {
  cursor: pointer;
}

.mfs-app button:focus-visible,
.mfs-app a:focus-visible,
.mfs-app input:focus-visible,
.mfs-app .mfs-photo-button:focus-within {
  outline: 3px solid #ff9c62;
  outline-offset: 3px;
}

.mfs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 4vw, 62px);
  max-width: 1120px;
  margin: 0 auto;
}

.mfs-editor,
.mfs-details {
  min-width: 0;
}

.mfs-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  width: 100%;
  border: 1px solid #3c4151;
  border-radius: 18px;
  background: #252833;
  box-shadow: 0 15px 40px rgba(0, 0, 0, .32);
}

.mfs-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  touch-action: pan-y;
  cursor: default;
}

.mfs-stage.is-editing .mfs-canvas {
  touch-action: none;
  cursor: grab;
}

.mfs-stage.is-editing .mfs-canvas:active {
  cursor: grabbing;
}

.mfs-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 160px;
  padding: 13px 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, .36);
  border-radius: 14px;
  background: rgba(18, 20, 27, .75);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  text-align: center;
}

.mfs-placeholder-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0051de;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.mfs-loading {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .85);
  color: #fff;
  font-size: 13px;
}

.mfs-drag-tip {
  margin: 11px 0 15px;
  color: #bdc2d0;
  font-size: 13px;
}

.mfs-photo-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 11px;
  background: var(--mfs-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.mfs-photo-button:hover {
  background: #1764ed;
}

.mfs-photo-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.mfs-edit-controls {
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #3b4050;
  border-radius: 11px;
  background: #242731;
}

.mfs-zoom-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.mfs-zoom-box label,
.mfs-zoom-box output {
  color: #f7f7f9;
  font-size: 13px;
  font-weight: 700;
}

.mfs-zoom-box input {
  width: 100%;
  min-width: 0;
  accent-color: var(--mfs-orange);
}

.mfs-edit-buttons,
.mfs-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mfs-edit-buttons {
  margin-top: 13px;
}

.mfs-edit-buttons button,
.mfs-actions button,
.mfs-save-link {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #485269;
  border-radius: 9px;
  background: #333847;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.mfs-edit-buttons button:hover,
.mfs-actions .mfs-share:hover {
  background: #454b5c;
}

.mfs-actions {
  margin-top: 13px;
}

.mfs-actions .mfs-download,
.mfs-save-link {
  border-color: var(--mfs-orange);
  background: var(--mfs-orange);
  color: #fff;
}

.mfs-actions .mfs-download:hover:not(:disabled),
.mfs-save-link:hover {
  background: #dd4c00;
  color: #fff;
}

.mfs-actions button:disabled {
  opacity: .43;
  cursor: not-allowed;
}

.mfs-status {
  min-height: 21px;
  margin: 10px 0 0;
  color: #c6cbd7;
  font-size: 13px;
}

.mfs-status.is-error {
  color: #ffc1b9;
}

.mfs-result {
  margin-top: 15px;
  padding: 12px;
  border: 1px solid #4b5367;
  border-radius: 10px;
  background: #222632;
}

.mfs-result p {
  margin: 0 0 10px;
  color: #f6f7fb;
  font-size: 13px;
}

.mfs-save-link {
  min-height: 42px;
  margin-bottom: 10px;
}

.mfs-result-image {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 0 auto;
  border-radius: 7px;
}

.mfs-app .mfs-details h3 {
  margin: 5px 0 16px;
  color: #fff;
  font-size: 20px;
  font-weight: 750;
}

.mfs-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 25px;
  border-bottom: 1px solid #424652;
}

.mfs-app .mfs-frame {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 5px;
  border: 2px solid transparent;
  border-radius: 11px;
  background: #262a34;
  color: #e9e9f1;
  text-align: center;
  cursor: pointer;
}

.mfs-app .mfs-frame:hover {
  background: #353c50;
}

.mfs-app .mfs-frame.is-selected {
  border-color: var(--mfs-orange);
  background: #3b302c;
}

.mfs-frame-picture {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  width: 100%;
  border-radius: 7px;
  background-color: #cbcfda;
  background-image: conic-gradient(#e4e5eb 25%, #c3c7d1 0 50%, #e4e5eb 0 75%, #c3c7d1 0);
  background-size: 18px 18px;
}

.mfs-frame-picture img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.mfs-frame-title {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #f5f6fa;
  font-size: 12px;
  line-height: 1.3;
}

.mfs-howto {
  margin-top: 23px;
}

.mfs-howto ol {
  margin: 8px 0 0 20px;
  padding: 0;
  color: #dee0e8;
  font-size: 14px;
}

.mfs-howto li {
  margin-bottom: 8px;
  padding-left: 4px;
}

.mfs-howto p {
  margin: 16px 0 0;
  color: #adb3c1;
  font-size: 12px;
}

@media (max-width: 850px) {
  .mfs-app {
    padding: 16px;
  }

  .mfs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    max-width: 540px;
  }

  .mfs-stage {
    max-width: 540px;
    margin: 0 auto;
  }

  .mfs-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 782px) {
  .admin-bar .mfs-app {
    top: 46px;
    height: calc(100dvh - 46px);
  }
}

@media (max-width: 380px) {
  .mfs-app {
    padding: 12px;
  }

  .mfs-zoom-box {
    grid-template-columns: 1fr auto;
  }

  .mfs-zoom-box input {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .mfs-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
