  #uiOpts { display: flex; flex-direction: column; gap: 12px; }
  /* Khu kết quả: ảnh hiển thị to theo bề ngang khung, thanh nút một hàng, bấm ảnh để phóng to */
  #imgGrid { grid-template-columns: 1fr; gap: 28px; }
  #imgGrid .imgcard { display: flex; flex-direction: column; width: 100%; max-width: 1400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
  #imgGrid .imgcard.tall { max-width: 460px; }
  .devs { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 2px; } .dev { display: flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; white-space: nowrap; } .dev input { width: auto; }
  /* ---------- Bảng màu gợi ý / tự chọn cho Figma ---------- */
  .palettes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
  .pal { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); font-size: 13px; color: var(--muted); cursor: pointer; }
  .pal:hover { border-color: var(--accent); color: var(--ink); }
  .pal.active { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent) inset; }
  .pal .sw { display: flex; }
  .pal .sw i { width: 14px; height: 14px; border-radius: 50%; display: block; margin-left: -5px; border: 1.5px solid var(--field); }
  .pal .sw i:first-child { margin-left: 0; }
  .pal.none { padding: 6px 12px; }
  .palCustom { display: none; gap: 14px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
  .palCustom.on { display: flex; }
  .palCustom label { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; margin: 0; }
  .palCustom input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
  #imgGrid .imgcard.board { max-width: 1400px; border-color: var(--accent); }
  #imgGrid .imgcard.sq { max-width: 720px; }
  #imgGrid .imgcard img { width: 100%; height: auto; border: 0; border-radius: 12px; background: #fff; cursor: zoom-in; }
  #imgGrid .imgbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
  #imgGrid .imgbar a.ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
  #imgGrid .imgbar button, #imgBtns button { white-space: nowrap; }
  #imgBtns { display: flex; width: 100%; max-width: 1400px; margin: 20px 0 0; }
  #imgBtns[hidden] { display: none; }
  #imgBtns { gap: 10px; align-items: center; }
  #imgBtns .time { display: inline-flex; align-items: center; padding: 11px 16px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); color: var(--ink); font-weight: 600; white-space: nowrap; }
  #histBox > label { display: block; }
  #histBox .convlist, #hList { max-height: none; overflow: visible; }
  #zoomBox { position: fixed; inset: 0; z-index: 90; background: rgba(8,8,14,.92); overflow: auto; padding: 32px; cursor: zoom-out; }
  #zoomBox img { display: block; margin: 0 auto; max-width: none; width: min(100%, var(--zw, 1600px)); height: auto; background: #fff; border-radius: 8px; }
  #zoomBox .zx { position: fixed; top: 16px; right: 20px; padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; cursor: pointer; }
  @media (max-width: 900px) { #zoomBox { padding: 12px; } }

  /* ---------- Bấm chọn & sửa từng thành phần của thiết kế (giống Stitch) ---------- */
  #editStage { position: fixed; inset: 0; z-index: 95; background: rgba(8,8,14,.94); display: flex; flex-direction: column; }
  #editStage .esTop { display: flex; align-items: center; gap: 12px; padding: 14px 20px; flex: none; }
  #editStage .esHint { color: #e8e4e4; font-size: 13.5px; flex: 1; }
  #editStage .esZoom { display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 2px; flex: none; }
  #editStage .esZoom button { background: transparent; color: #fff; border: 0; width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 16px; line-height: 1; }
  #editStage .esZoom button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
  #editStage .esZoomPct { color: #e8e4e4; font-size: 12.5px; width: 42px; text-align: center; flex: none; user-select: none; }
  #editStage .esClose { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; flex: none; }
  #editStage .esWrap { position: relative; flex: 1; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 12px 20px 28px; }
  #editStage .esWrap > svg { background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); transform-origin: top center; transition: transform .12s; margin: auto; }
  #editStage .esHi { position: absolute; display: none; pointer-events: none; border: 2px solid var(--accent); border-radius: 4px; background: color-mix(in srgb, var(--accent) 14%, transparent); z-index: 2; transition: left .06s, top .06s, width .06s, height .06s; }
  #editStage .esPop { position: fixed; z-index: 4; width: 280px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 14px 44px rgba(0,0,0,.45); }
  #editStage .esPopTitle { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
  #editStage .esPopTitle b { color: var(--ink); font-weight: 600; }
  #editStage .esPopInput { width: 100%; min-height: 72px; margin-bottom: 10px; }
  #editStage .esPopBtns { display: flex; justify-content: flex-end; gap: 8px; }
  @media (max-width: 900px) { #editStage .esTop { flex-wrap: wrap; } #editStage .esWrap { padding: 8px 10px 20px; } }
