.shopao-flat-lay-result-card { position: relative; isolation: isolate; aspect-ratio: var(--shopao-result-ratio, 3 / 4); height: auto !important; }
.shopao-flat-lay-result-card > img { width: 100%; height: 100%; object-fit: contain !important; }
.flat-lay-result-actions { position: absolute; inset: 0; opacity: 0; background: rgb(0 0 0 / 28%); transition: opacity .15s; display: flex; justify-content: center; align-items: center; }
.shopao-flat-lay-result-card:hover .flat-lay-result-actions, .shopao-flat-lay-result-card:focus-within .flat-lay-result-actions { opacity: 1; }
.flat-lay-result-actions button, .shopao-flat-lay-preview button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 4px; cursor: pointer; font: inherit; }
.flat-lay-result-actions button { color: white; background: rgb(0 0 0 / 55%); min-width: 30px; min-height: 32px; padding: 5px; font-size: 12px; }
.flat-lay-result-view button { background: transparent; }
.flat-lay-result-delete { position: absolute; top: 8px; right: 8px; }
.flat-lay-result-tools { position: absolute; bottom: 10px; left: 6px; right: 6px; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.shopao-generation-board[data-workspace-path$="flat-lay"] .shopao-generation-reference img { width: 100%; height: auto; max-height: 150px; object-fit: contain; }
.shopao-flat-lay-preview { position: fixed; border: 0; padding: 0; border-radius: 8px; width: min(1600px, 96vw); height: min(1000px, 90dvh); max-width: none; max-height: none; background: #fff; color: #37383a; font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
.shopao-flat-lay-preview[open] { display: grid; grid-template-columns: 110px minmax(0, 1fr) 210px; }
.shopao-flat-lay-preview::backdrop { background: rgb(0 0 0 / 66%); }
.flat-lay-preview-thumbs { padding: 16px 12px; overflow: auto; border-right: 1px solid #eee; }
.flat-lay-preview-thumbs button { width: 100%; padding: 3px; margin-bottom: 8px; border: 2px solid transparent; background: white; }
.flat-lay-preview-thumbs button[aria-current="true"] { border-color: #7485c3; }
.flat-lay-preview-thumbs img { width: 100%; height: 125px; object-fit: contain; display: block; }
.flat-lay-preview-main { position: relative; min-width: 0; min-height: 0; padding: 24px 20px 16px; background: #f5f5fa; display: flex; flex-direction: column; gap: 20px; }
.flat-lay-preview-stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; min-height: 0; cursor: grab; touch-action: none; }
.flat-lay-preview-stage:active { cursor: grabbing; }
.flat-lay-preview-stage figure { margin: 0; min-width: 0; min-height: 0; position: relative; overflow: hidden; background: #fff; }
.flat-lay-preview-stage figure + figure { border-left: 1px solid #eee; }
.flat-lay-preview-stage figcaption { position: absolute; top: 12px; left: 12px; z-index: 1; background: #edf3ff; color: #657cb2; padding: 6px 14px; border-radius: 4px; }
.flat-lay-preview-stage img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
.flat-lay-preview-source { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.flat-lay-preview-source img { min-height: 0; flex: 1; }
.flat-lay-preview-source p { margin: auto; color: #84868d; }
.flat-lay-preview-zoom { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; border-radius: 4px; padding: 3px; background: rgb(25 25 25 / 75%); color: white; }
.flat-lay-preview-zoom button { min-width: 30px; min-height: 30px; background: transparent; color: white; }
.flat-lay-preview-zoom output { width: 46px; text-align: center; }
.flat-lay-preview-toolbar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; padding: 8px; border-radius: 6px; background: #fff; }
.flat-lay-preview-toolbar button { flex-direction: column; min-width: 62px; min-height: 48px; padding: 5px; background: #fff; color: #404045; font-size: 12px; }
.flat-lay-preview-toolbar button[data-flat-lay-action="download"] { background: #6d81b8; color: white; flex-direction: row; padding: 8px 12px; }
.flat-lay-preview-toolbar button:hover, .shopao-flat-lay-preview button:focus-visible { outline: 2px solid #8a9bcd; outline-offset: -2px; background: #edf1fb; }
.flat-lay-preview-more { position: absolute; bottom: 90px; left: 20px; right: 20px; z-index: 2; padding: 10px; border: 1px solid #dce0e9; border-radius: 6px; background: #fff; box-shadow: 0 6px 20px #0002; display: flex; gap: 8px; flex-wrap: wrap; }
.flat-lay-preview-more[hidden] { display: none; }
.flat-lay-preview-more button { padding: 8px; min-height: 40px; background: #f4f5f8; color: #383a42; }
.flat-lay-preview-info { padding: 30px 16px 16px; overflow: auto; overflow-wrap: anywhere; }
.flat-lay-preview-info h3 { margin: 10px 0 18px; font-size: 15px; font-weight: 600; }
.flat-lay-preview-info dl { display: grid; grid-template-columns: 66px minmax(0, 1fr); margin: 0 0 20px; padding-bottom: 24px; border-bottom: 1px solid #eee; gap: 16px 8px; font-size: 12px; }
.flat-lay-preview-info dt { color: #999; }
.flat-lay-preview-info dd { margin: 0; }
.flat-lay-preview-detail-status { grid-column: 1 / -1; margin-bottom: 8px; font-size: 12px; }
.flat-lay-preview-detail-status button { margin-left: 8px; padding: 4px 8px; background: #edf1fb; color: #404045; }
.flat-lay-preview-reference img { display: block; max-width: 100%; width: 100%; max-height: 240px; object-fit: contain; margin-bottom: 8px; border-radius: 4px; }
.flat-lay-preview-close { position: absolute; top: 6px; right: 6px; }
.flat-lay-preview-close button { width: 30px; height: 30px; color: #42444a; background: white; }
.shopao-flat-lay-preview button:disabled, .flat-lay-result-actions button:disabled { opacity: .5; cursor: wait; }
@media (hover: none) { .flat-lay-result-actions { opacity: 1; background: transparent; } .flat-lay-result-view { background: rgb(0 0 0 / 40%); border-radius: 4px; } }
@media (max-width: 760px) {
  .shopao-generation-board[data-workspace-path$="flat-lay"] { padding: 10px 8px 24px; bottom: 92px; }
  .shopao-generation-board[data-workspace-path$="flat-lay"] .shopao-generation-grid,
  .shopao-generation-board[data-workspace-path$="flat-lay"] .shopao-generation-grid[data-count] {
    grid-template-columns: minmax(0, 1fr); gap: 10px;
  }
  .shopao-generation-board[data-workspace-path$="flat-lay"] .shopao-generation-reference { width: 64px; height: 86px; }
  .shopao-generation-board[data-workspace-path$="flat-lay"] .shopao-generation-card { min-width: 0; min-height: 0; width: 100%; }
  .shopao-flat-lay-preview { width: 100vw; height: calc(100dvh - 8px); border-radius: 4px; }
  .shopao-flat-lay-preview[open] { grid-template-columns: 1fr; grid-template-rows: 66px minmax(0, 1fr) 132px; }
  .flat-lay-preview-thumbs { display: flex; padding: 4px 38px 4px 8px; gap: 5px; border: 0; }
  .flat-lay-preview-thumbs button { width: 44px; flex: none; margin: 0; }
  .flat-lay-preview-thumbs img { height: 48px; }
  .flat-lay-preview-main { padding: 6px; gap: 6px; }
  .flat-lay-preview-stage figcaption { top: 4px; left: 4px; padding: 4px 7px; font-size: 12px; }
  .flat-lay-preview-zoom { gap: 0; bottom: 6px; }
  .flat-lay-preview-zoom button { min-width: 26px; }
  .flat-lay-preview-zoom output { width: 38px; font-size: 12px; }
  .flat-lay-preview-toolbar { gap: 3px; padding: 4px; }
  .flat-lay-preview-toolbar button { min-width: 56px; min-height: 44px; }
  .flat-lay-preview-info { padding: 8px 12px; border-top: 1px solid #eee; display: grid; grid-template-columns: minmax(0, 1fr) 90px; column-gap: 12px; }
  .flat-lay-preview-info > h3 { display: none; }
  .flat-lay-preview-info dl { gap: 6px; margin: 0; padding: 0; border: 0; }
  .flat-lay-preview-reference h3 { margin: 0 0 4px; font-size: 12px; }
  .flat-lay-preview-reference img { max-height: 88px; }
  .flat-lay-preview-more { bottom: 158px; left: 8px; right: 8px; }
}
